Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
poplexity opened this issue Sep 20, 2024 · 0 comments
Open
2 tasks

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

poplexity opened this issue Sep 20, 2024 · 0 comments
Assignees
Labels

Comments

@poplexity
Copy link
Member

poplexity commented Sep 20, 2024

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 })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants