Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Add coinbase codehash test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason Liang committed Sep 13, 2023
1 parent 3575aab commit f8c0ca9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions zkevm-circuits/src/evm_circuit/execution/end_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,32 @@ mod test {
.unwrap(),
);
}

#[test]
fn end_tx_gadget_nonexisting_coinbase() {
// Check that the code hash of the coinbase address is correctly set to be the empty code
// hash when it is created because of receiving the gas fees from the first tx.
test_ok(
TestContext::<2, 2>::new(
None,
account_0_code_account_1_no_code(bytecode! {
COINBASE
EXTCODEHASH
}), /* EXTCODEHASH will return 0 for the first tx and the empty code hash for
* the second tx. */
|mut txs, accs| {
txs[0]
.to(accs[0].address)
.from(accs[1].address)
.value(eth(1));
txs[1]
.to(accs[0].address)
.from(accs[1].address)
.value(eth(1));
},
|block, _| block,
)
.unwrap(),
);
}
}

0 comments on commit f8c0ca9

Please sign in to comment.