File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
anvil/src/eth/backend/mem Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,11 @@ impl Backend {
508508 ( self . spec_id ( ) as u8 ) >= ( SpecId :: LONDON as u8 )
509509 }
510510
511+ /// Returns true for post Merge
512+ pub fn is_eip3675 ( & self ) -> bool {
513+ ( self . spec_id ( ) as u8 ) >= ( SpecId :: MERGE as u8 )
514+ }
515+
511516 /// Returns true for post Berlin
512517 pub fn is_eip2930 ( & self ) -> bool {
513518 ( self . spec_id ( ) as u8 ) >= ( SpecId :: BERLIN as u8 )
@@ -842,7 +847,12 @@ impl Backend {
842847 // update block metadata
843848 storage. best_number = block_number;
844849 storage. best_hash = block_hash;
845- storage. total_difficulty = storage. total_difficulty . saturating_add ( header. difficulty ) ;
850+ // Difficulty is removed and not used after Paris (aka TheMerge). Value is replaced with
851+ // prevrandao. https://github.com/bluealloy/revm/blob/1839b3fce8eaeebb85025576f2519b80615aca1e/crates/interpreter/src/instructions/host_env.rs#L27
852+ if !self . is_eip3675 ( ) {
853+ storage. total_difficulty =
854+ storage. total_difficulty . saturating_add ( header. difficulty ) ;
855+ }
846856
847857 storage. blocks . insert ( block_hash, block) ;
848858 storage. hashes . insert ( block_number, block_hash) ;
You can’t perform that action at this time.
0 commit comments