-
Notifications
You must be signed in to change notification settings - Fork 198
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
Fix eth_getTransactionCount behavior for unknown acccounts #227
Conversation
@AlexRamRam this looks like a really simple change to bring our EVM shim closer-in-line with how things are expected to work, but the code change isn't (at least to my eye) particularly self-explanatory. Is there a simple test that can be added to ensure we don't accidentally undo this behavior in the future, or a script you can provide which would give an easy route to a t-ACK? |
Running the one line code mentioned in the main comment in hardhat (connected to the opencbdc network) currently generates an "Internal error". With this change the returned value is the starting nonce. Please let me know if this is not clear. |
I understand that the change solves a problem you were running into; I mean, it's not clear from the diff itself why the change (which adds an In particular, adding this would seem to make any account for which the The second request is separate: we specifically want reviewers to be able to test changes before they get merged (either by vetting a test case added to the test suite, or by running through steps to reproduce). Should I plan to test this by running a hardhat environment connected to a parsec/evm network and executing the command above? Is there a test that could be easily added to the test suite to avoid regression and simplify testing instead? |
If indeed the “starting account nonce” should always be |
A good definition of an account nonce and its relationship to transaction count is here: At the moment, PArSEC's transaction count starts at 1 (should really be 0) and hence the default transaction count for a new account is 1 just as the default balance for a new account is 0. There is an existing comment: Great idea to add the unit test - will do this. Please let me know if this addresses your question. |
Adding a unit test will definitely make a t-ACK easier, thank you! And your clarification (that this is a “nonce” per-transaction-per-account) definitely answered my main question. 👍 |
11d9bbe
to
4220e05
Compare
Return starting account nonce for unknown accounts instead of error Signed-off-by: Alexander Jung <104335080+AlexRamRam@users.noreply.github.com>
4220e05
to
ab7dda5
Compare
Test added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple change to ensure that newly-created accounts have their transaction-count set to 1
, and a test to avoid accidental regressions. Looks great!
Signed-off-by: Alexander Jung <104335080+AlexRamRam@users.noreply.github.com>
Signed-off-by: Alexander Jung <104335080+AlexRamRam@users.noreply.github.com>
Return starting account nonce for unknown accounts instead of error
i.e. In Hardhat, the following should return the starting account nonce:
await ethers.provider.getTransactionCount(ethers.HDNodeWallet.createRandom().address)