Skip to content

Commit

Permalink
test: extend state transition test
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Apr 29, 2024
1 parent 387a1f1 commit bccadfc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions crates/revm/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,5 +1174,35 @@ mod tests {
.storage(HISTORY_STORAGE_ADDRESS, U256::from(1))
.unwrap()
.is_zero());

// attempt to execute block 2, this should not fail
let header = Header { timestamp: 1, number: 2, ..Header::default() };
executor
.execute_and_verify_receipt(
&BlockWithSenders {
block: Block { header, body: vec![], ommers: vec![], withdrawals: None },
senders: vec![],
},
U256::ZERO,
)
.expect(
"Executing a block with no transactions while Prague is active should not fail",
);

// the block hash of genesis and block 1 should now be in storage, but not block 2
assert!(executor.db_mut().basic(HISTORY_STORAGE_ADDRESS).unwrap().is_some());
assert_ne!(
executor.db_mut().storage(HISTORY_STORAGE_ADDRESS, U256::ZERO).unwrap(),
U256::ZERO
);
assert_ne!(
executor.db_mut().storage(HISTORY_STORAGE_ADDRESS, U256::from(1)).unwrap(),
U256::ZERO
);
assert!(executor
.db_mut()
.storage(HISTORY_STORAGE_ADDRESS, U256::from(2))
.unwrap()
.is_zero());
}
}

0 comments on commit bccadfc

Please sign in to comment.