Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction potentially rejected for the wrong reasons #912

Closed
norswap opened this issue Aug 5, 2021 · 6 comments
Closed

Transaction potentially rejected for the wrong reasons #912

norswap opened this issue Aug 5, 2021 · 6 comments

Comments

@norswap
Copy link

norswap commented Aug 5, 2021

First of all, I know transactions tests are not being maintained, see #906

Nevertheless, I thought I'd report some issue with them, in case someone is interested.

The issue is that some transactions in those tests have a "malleable signature", essentially, a signature s that is higher than the ellipctic curve parameter N divided by 2. This should be rejected after EIP-2 (to avoid replay attacks) and so is only valid on Frontier.

The affected transactions are:

  • TransactionTests/ttData/DataTestNotEnoughGAS.json
  • TransactionTests/ttGasPrice/TransactionWithGasPriceOverflow.json
  • TransactionTests/ttNonce/TransactionWithNonceOverflow.json

All of these are illegal transactions, and so should fail to parse or to be accepted in general.

The problem is that currently, an implementation may reject them (except for Frontier) because the signature is invalid, and not because it validated the thing that was supposed to be tested (e.g. for TransactionWithGasPriceOverflow: that the gas price does not overflow, i.e. is encoded on more than 32 bytes), making these tests much less useful than they should be.

I regenerated the signature on the transactions so that it is EIP-2 compliant.

What I did to work around this was regenerate the signatures on the transactions, here's the nanoeth commit.

I could submit this change as a PR if it's deemed useful. However then I'd need to know how to update the metadata fields. And probably update the filler files too, for consistency?

@winsvega
Copy link
Collaborator

winsvega commented Aug 6, 2021

Hm. Transaction tests currently not supported as there is no legitimate way to generate it.

You can open a PR, we could pretend that it is still being filled from changed fillers.

Ideally there would be a mechanism to provide data from filler to the client and get the result if a transaction is legit. But apparently its much less relevant then the core transition tests.

@norswap
Copy link
Author

norswap commented Aug 7, 2021

Will do the PR then!

I might make such a tool - are you attached to the current JSON format, or could it be changed?
Of course, it wouldn't be useful immediately, since my "client" is itself being implemented and almost assuredly has bugs.

@winsvega
Copy link
Collaborator

winsvega commented Aug 8, 2021

Also the existing ones are verified by aleth constantinople implementation. Are you sure the signature is incorrect?

@norswap
Copy link
Author

norswap commented Aug 12, 2021

To clarify: these are negative tests, meaning that the transaction should be rejected for the tests to pass.

Are you saying that you check the signature (and only the signature) with aleth, and aleth says that all signatures are valid (even on these negative tests)?

I would be very surprised if it's a bug on my side — it would mean I'm parsing the signature values incorrectly. But if that was the case, how come I can verify every other signature, whether I sign it myself or it's signed by someone else?

norswap added a commit to norswap/nanoeth that referenced this issue Aug 23, 2021
norswap added a commit to norswap/tests that referenced this issue Aug 23, 2021
…ure s value > n/2, rather than because of the property being checked (ethereum#912)
@winsvega
Copy link
Collaborator

just checked this file DataTestNotEnoughGASFiller.json and filled DataTestNotEnoughGAS
the test is correct with s/2 requirements, what is the issue?

Those tests clearly say that transaction is expected to be rejected.

@winsvega
Copy link
Collaborator

reworked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants