-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add check for post merge and don't add difficulty #5236
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
Conversation
anvil/src/eth/backend/mem/mod.rs
Outdated
| // Difficulty is removed and not used after Paris (aka TheMerge). Value is replaced with prevrandao. | ||
| // https://github.com/bluealloy/revm/blob/1839b3fce8eaeebb85025576f2519b80615aca1e/crates/interpreter/src/instructions/host_env.rs#L27 | ||
| if self.is_eip3675() { |
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.
oh yeah, this makes sense.
nice find.
we can simplify this by only using the else branch, we don't need to update the ttd if eip3675
I think it's even debatable if we should increase ttd at all if me mining a block
however this is the first time that this has been raised so I'm ok with increasing it pre merge
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.
sounds good! just made the requested change
Evalir
left a comment
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.
very nice catch. With the changes applied this lgtm!
|
btw, just needs |
|
just pushed fmt changes |
Motivation
Post merge TD is set to prevrandao. Anvil was adding prevrandao to fork difficulty causing overflows
Relevant dependency in REVM https://github.com/bluealloy/revm/blob/1839b3fce8eaeebb85025576f2519b80615aca1e/crates/interpreter/src/instructions/host_env.rs#L27
Solution
Check for post merge and don't add difficulty