bluealloy / revm

Rust implementation of the Ethereum Virtual Machine.
https://bluealloy.github.io/revm/
MIT License
1.65k stars 555 forks source link

Failing state test: `CreateTransactionHighNonce.json` #150

Closed sveitser closed 2 years ago

sveitser commented 2 years ago

I looks like a recently added test with maximum nonce https://github.com/ethereum/tests/blob/develop/GeneralStateTests/stCreateTest/CreateTransactionHighNonce.json fails.

Failed CI run: https://github.com/bluealloy/revm/runs/7381837438?check_suite_focus=true#step:6:277

To reproduce locally

git clone https://github.com/ethereum/tests ethtests
cargo run --release -p revme -- statetest ethtests/GeneralStateTests
Start running tests on: "ethtests/GeneralStateTests"
██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░ 2428/2604
ROOTS mismath:
state_root:0x2fb5804c5079bae761a87f44bc870b2c8675b72980d98c99acd2e451cb84aa94:0x83c22c7e0679ef049d0f7c0d799c5181f567bee3b446b68a8d1bdd9e65a30bc1
logs_root:0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347:0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
CREATE CALL: caller:0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b, scheme:Create, value:0, init_code:"60016000f3", gas:36932
depth:1, PC:0, gas:0x9044(36932), OPCODE: "PUSH1"(96)  refund:0x0(0) Stack:[], Data:
depth:1, PC:2, gas:0x9041(36929), OPCODE: "PUSH1"(96)  refund:0x0(0) Stack:[1], Data:
depth:1, PC:4, gas:0x903e(36926), OPCODE: "RETURN"(243)  refund:0x0(0) Stack:[1, 0], Data:
"ethtests/GeneralStateTests/stCreateTest/CreateTransactionHighNonce.json" UNIT_TEST:CreateTransactionHighNonce

fail reson: Continue "ethtests/GeneralStateTests/stCreateTest/CreateTransactionHighNonce.json" UNIT_TEST:CreateTransactionHighNonce
 gas:53277

Applied state:CacheDB { accounts: {0x0000000000000000000000000000000000000001: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000002: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000003: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000004: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000005: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000006: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000007: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000008: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x0000000000000000000000000000000000000009: DbAccount { info: AccountInfo { balance: 0, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }, 0x5bed6800e21afd96396b466f25acaeb8d3ab33fe: DbAccount { info: AccountInfo { balance: 0, nonce: 1, code_hash: 0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a, code: Some(b"\0") }, account_state: EVMStorageCleared, storage: {} }, 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b: DbAccount { info: AccountInfo { balance: 99999999467230, nonce: 0, code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, code: Some(b"") }, account_state: EVMTouched, storage: {} }}, contracts: {0x0000000000000000000000000000000000000000000000000000000000000000: b"", 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470: b""}, logs: [], block_hashes: {}, db: EmptyDB }

Stateroot: 0x83c22c7e0679ef049d0f7c0d799c5181f567bee3b446b68a8d1bdd9e65a30bc1

Test[2561] named:
"ethtests/GeneralStateTests/stCreateTest/CreateTransactionHighNonce.json" failed:  Test:LONDON:0, Root missmatched, Expected: 0x2fb5804c5079bae761a87f44bc870b2c8675b72980d98c99acd2e451cb84aa94 got:0x83c22c7e0679ef049d0f7c0d799c5181f567bee3b446b68a8d1bdd9e65a30bc1
████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████░░░░ 2559/2604
Error: Statetest(RootMissmatch { spec_id: LONDON, id: 0, got: 0x83c22c7e0679ef049d0f7c0d799c5181f567bee3b446b68a8d1bdd9e65a30bc1, expect: 0x2fb5804c5079bae761a87f44bc870b2c8675b72980d98c99acd2e451cb84aa94 })
rakita commented 2 years ago

Yeah i have seen this, I am not alarmed as the name suggests CreateTransactionHighNonce it is probably some test for u64 overflow that is not realistic to happen in the wild.

Thank you for reporting!

rakita commented 2 years ago

High nonce is now handled properly, still need to parse exception in test harness but revm is properly handing this case