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

Add test for the codehash of the coinbase account. #1511

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -510,4 +510,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(),
);
}
}