risechain / pevm

Blazingly fast Parallel EVM
MIT License
217 stars 41 forks source link

chore(`pevm`): Post-processing lazy evaluation: assert that the evaluated nonce matches the transaction's #355

Closed EdwardJES closed 1 month ago

EdwardJES commented 1 month ago

This PR addresses https://github.com/risechain/pevm/issues/310

EdwardJES commented 1 month ago

Hey @hai-rise, I've tried to have a crack at this one. And I'm not sure if I've identified a bug or not (thinking possibly yes as the other MemoryValue::Basic checks pass).

The mainnet_blocks_from_disk is failing. I'd love to try and debug this more to better understand the stack, but I may need some pointers if that's okay 🙏 .

Just for my understanding of what's going on here: this is essentially validating the incarnation (tx) that resulted in the particular state mutation of an account, which is encoded in the write_history. Where the write_history holds all particular state updates for a given memory location from the resulting incarnations?

Here is the particular tx_env where this check fails:

TX TxEnv {
    caller: 0xa9cefd4474086c52f15abc0e604284440768da57,
    gas_limit: 23100,
    gas_price: 54641531805,
    transact_to: Call(
        0xcff0b829fd9bd7a58ca8d62eef8105506f859592,
    ),
    value: 500000000000000,
    data: 0x,
    nonce: Some(
        18,
    ),
    chain_id: Some(
        1,
    ),
    access_list: [],
    gas_priority_fee: Some(
        3358468195,
    ),
    blob_hashes: [],
    max_fee_per_blob_gas: None,
    authorization_list: None,
}

Tyvm.

EdwardJES commented 1 month ago

Thank you for the feedback @hai-rise. That makes sense. Was way off the mark with that bug... Thank you for the learning here.