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

fix: correctly apply genesis #8431

Merged
merged 2 commits into from
Jul 12, 2024
Merged

fix: correctly apply genesis #8431

merged 2 commits into from
Jul 12, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Jul 12, 2024

Motivation

Closes #4173

Caching genesis accounts state is not really correct because we might reset fork to a forked block where account nonce is lower than the one we cached and inserted during reset. This would cause eth_getTransactionCount to return nonce lower than the one actually stored in the db

Solution

This PR removes caching of genesis accounts state, which makes anvil_reset a bit slower

Another approach could be to instead serve overriden data over getTransactionCound/getBalance etc, but I don't think that it's great to mess with the actual forked state

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah very nice

we can live with the overhead on reset

pending conflicts

@klkvr klkvr force-pushed the klkvr/fix-apply-genesis branch from a073eb2 to 7b409fa Compare July 12, 2024 18:09
@klkvr klkvr merged commit 547e975 into master Jul 12, 2024
20 checks passed
@klkvr klkvr deleted the klkvr/fix-apply-genesis branch July 12, 2024 18:22
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

Successfully merging this pull request may close these issues.

Nonce too low for eth_sendRawTransaction on forked chain
3 participants