Ethereum Execution Tests failing only when run inside the guest
Wollac opened this issue · comments
Currently, zeth
is tested against the GeneralStateTests
of ethereum/tests. However, while each of these tests is tested for correct execution on the host, only a handful of them are actually executed on the guest by default.
If you manually run all of them in the guest, some of them will fail due to a SlotNotFound
panic. This happens when the EVM inside the guest tries to access storage slots that are not part of the guest's input.
Steps to reproduce
For example, the following test fails because of this issue: returndatacopy_initial_big_sum.json
. To run this exact test, change the following line
zeth/testing/ef-tests/tests/executor.rs
Line 34 in eed232b
to
#[files("testdata/BlockchainTests/GeneralStateTests/stReturnDataTest/returndatacopy_initial_big_sum.json")]
This returns
[INFO zeth_lib::execution::ethereum] Block no. 1
[INFO zeth_lib::execution::ethereum] EVM spec ID: MERGE
[INFO zeth_lib::execution::ethereum] Timestamp: 1970-01-01 00:16:40 UTC
[INFO zeth_lib::execution::ethereum] Transactions: 1
[INFO zeth_lib::execution::ethereum] Withdrawals: 0
[INFO zeth_lib::execution::ethereum] Fee Recipient: 0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba
[INFO zeth_lib::execution::ethereum] Gas limit: 111669149696
[INFO zeth_lib::execution::ethereum] Base fee per gas: 10
[INFO zeth_lib::execution::ethereum] Extra data: Bytes(0x00)
[DEBUG zeth_lib::execution::ethereum] Tx no. 0 (hash: 0xa46fe628a24d18f063fe6276ef8bca32fa7e68cd93e4b694557cebf82d027936)
[DEBUG zeth_lib::execution::ethereum] Type: 0
[DEBUG zeth_lib::execution::ethereum] Fr: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b
[DEBUG zeth_lib::execution::ethereum] To: 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6
[DEBUG zeth_lib::execution::ethereum] Ok: Halt { reason: OutOfGas(BasicOutOfGas), gas_used: 42949672960 }
[DEBUG zeth_lib::execution::ethereum] State 0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba (is_selfdestructed=false, is_loaded_as_not_existing=false, is_created=false, is_empty=true)
[DEBUG zeth_lib::execution::ethereum] After balance: 0 (Nonce: 0)
[DEBUG zeth_lib::execution::ethereum] State 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b (is_selfdestructed=false, is_loaded_as_not_existing=false, is_created=false, is_empty=false)
[DEBUG zeth_lib::execution::ethereum] After balance: 0 (Nonce: 1)
[INFO zeth_lib::host] The partial state trie consists of 3 nodes
[INFO zeth_lib::host] The partial storage tries consist of 0 nodes
[DEBUG risc0_binfmt::image] root_page_addr: 0x0d6b5800, root_addr: 0x0d6b5ac0
[INFO risc0_zkvm::host::server::session] segment[0]> reads: 340, writes: 53, exit_code: SystemSplit, split_insn: Some(1383200), po2: 21, cycles: 1666168
thread '<unnamed>' panicked at 'Failed to build the resulting block: Error at transaction 0: Database(SlotNotFound(0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6, 0x0_U256))', src/main.rs:29:10
This indicates, that for this artificial case, when revm
is run on the host it does not access storage slot 0x0
of account 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6
. However, when running in the guest, it does.
@dyxushuai Sorry for the late reply. This is a pretty tricky issue, but feel free to check it out!
Will be fixed when revm
is updated to include bluealloy/revm#978
Yes thanks!