Skip to content

Write the state from the TelosEVM state diffs to reth state #52

@poplexity

Description

@poplexity

Irrelevant of if there is a difference or the state diffs are the same, we should replace the reth state with the state we get from the TelosEVM state diffs.

  • Write state changes for both account and account_state tables
  • Write receipt values

The state diffs comparison and apply should be followed in this order:

  1. There should be an intra block state that holds the state of the block state during the execution. the reth/revm should be able to execute the transactions by itself in order to generate its own state diffs (already implemented by paradigm)
    evm.db_mut().commit(state);
  2. At the end of execution of the block, the comparison happens between tevm vs. revm (already implemented)
    // Perform state diff comparision
  3. All of the intra block state should be thrown away. In order to do that, it may need to create a snapshot at the start of the block and always revert at the end. (need to be implemented)
  4. The state diffs generated by the revm are high-level and they carry a lot more data in a complex struct such as HashMap<Address,Account> or HashMap<Address,AccountTransition> and they contain much more info like the previous info, the status of the account, etc. But at the end, they are written to the database in a simple form likely to the Telos tables. The Telos EVM state diffs (account/accountstate) should be written to the database in low-level scope (balance/nonce/code for account and key/value for accountstate). After throwing away the intra block state, the telos state diffs should be written to the database and make sure that the diffs are indexed properly for historical calls (need to be implemented)
  5. The receipts from revm should be overridden by Telos receipts (need to be implemented)
    Ok(EthExecuteOutput { receipts, requests, gas_used: cumulative_gas_used })

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions