-
Notifications
You must be signed in to change notification settings - Fork 21
Str 1781 impl evm ee #1127
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
base: main
Are you sure you want to change the base?
Str 1781 impl evm ee #1127
Conversation
ce3a83a to
3d10b00
Compare
|
Commit: 8057953 SP1 Execution Results
|
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #1127 +/- ##
==========================================
- Coverage 76.03% 75.78% -0.26%
==========================================
Files 530 544 +14
Lines 44666 45682 +1016
==========================================
+ Hits 33962 34619 +657
- Misses 10704 11063 +359
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 23 files with indirect coverage changes 🚀 New features to boost your workflow:
|
delbonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of work that's being done to manipulate the state in places that aren't quite ideal for it, should find ways to improve this.
7ebeb7e to
b492ad0
Compare
delbonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better, I have some organizational questions though.
b492ad0 to
55b55bc
Compare
5e812df to
7e80db7
Compare
delbonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if that review comment is relevant right now or if we can defer it
make a note of it in any case
Implement ExecutionEnvironment trait for EVM block execution using RSP's sparse state and Reth's execution engine. Core components: - EvmPartialState: Wraps EthereumState with witness data (bytecodes, ancestor_headers) - EvmWriteBatch: Wraps HashedPostState for state diffs - EvmBlock types: Header, Body, and complete Block with TransactionSigned - EvmExecutionEnvironment: Full ExecutionEnvironment trait implementation Trait methods: - execute_block_body: Execute block and compute state changes - complete_header: Combine intrinsics with computed commitments - verify_outputs_against_header: Validate state root and logs bloom - merge_write_into_state: Apply HashedPostState to EthereumState Refs: STR-1781
Add test_with_witness_params that validates full execution flow: - Loads real witness data from reference implementation - Tests execute_block_body with actual block data - Validates complete_header and verify_outputs_against_header Refs: STR-1781
Refs: STR-1781
- Add utility functions (build_and_recover_block, accumulate_logs_bloom, etc.) - Update module structure to expose utils module
- Implement Codec for EvmHeader, EvmBlockBody, EvmBlock, EvmPartialState, EvmWriteBatch - Add encoding helpers (encode_rlp_with_length, encode_bytes_with_length) for consistency - Reorganize types into module with comprehensive test suite
…sion - Move EVM config creation to constructor for cleaner code structure - Extract witness database preparation into EvmPartialState for better encapsulation - Implement conversion logic for withdrawal intents to bridge messages
- Updated types - Updated codec impl to work with this change - refactored header chain validation logic - other minor nits
- ChainSpec: use Arc::clone instead of dereferencing (2x per block) - EthEvmConfig: pass by reference instead of cloning - Headers: use seal_ref_slow() to avoid cloning N+1 headers - BundleState/receipts/requests: take ownership instead of cloning (3x per block) - Block construction: remove redundant header clone
- Move accumulate_logs_bloom to alpen-reth-evm - Simplify compute_hashed_post_state - Refactor withdrawal intent message conversion - Use .clone() style instead of Arc::clone
- Move use statement to top of file in check_header_matches_body - Use impl_type_flat_struct macro for EvmBlock codec - Rename withdrawal_intents to extract_withdrawal_intents - Add panic documentation to extract_withdrawal_intents
- Serialize pre-computed hashes for headers and bytecodes to avoid rehashing inside zkVM - Add lazy hash caching in WitnessDB for addresses and storage keys - Implement custom DatabaseRef for WitnessDB with zero-copy references TODO: remove bincode serialization for EthereumState
Remove `complete_header` from `ExecutionEnvironment` and move to new `BlockAssembler` trait. Proof path only verifies blocks, doesn't build them. Block assembly still needed for test infrastructure. - Remove `complete_header` from `ExecutionEnvironment` trait - Add `BlockAssembler` trait for block assembly operations - Implement for EVM and Simple execution environments
- Validate deposits from BlockInputs against block withdrawals field - Add conversion helpers for SubjectId to Address and satoshis to gwei
…lementations - Remove bincode dependency, replace with rlp crate - Implement deterministic encoding for EthereumState using RLP and sorted iteration - Implement deterministic encoding for HashedPostState with sorted HashMap entries - Add custom codec functions in codec_shims module for external types
6bdd7b9 to
00a9395
Compare
crates/evm-ee/src/execution.rs
Outdated
| // Encode withdrawal intent data: descriptor bytes + txid | ||
| let mut msg_data = Vec::new(); | ||
| msg_data.extend_from_slice(&intent.destination.to_bytes()); | ||
| msg_data.extend_from_slice(&intent.withdrawal_txid.0); | ||
|
|
||
| let bridge_gateway_account = AccountId::from(BRIDGE_GATEWAY_ACCOUNT); | ||
|
|
||
| // Create message to bridge gateway with withdrawal amount and intent data | ||
| let payload = MsgPayload::new(BitcoinAmount::from_sat(intent.amt), msg_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this message data to construct the message.
| } | ||
| } | ||
|
|
||
| impl Codec for EvmPartialState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should have fuzzing/proptesting on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delbonis I have created a ticket for it to unblock other tasks as proptesting it with EthereumState became a bit complicated.
Description
It is a work heavily based on
strata-proofimpl-evm-ee-stf/src/executor.rs::process_block()and used tons of help from Claude understanding the traits, process_block() function, evm data types, .... and to generate code.Thanks!
Type of Change
Notes to Reviewers
Checklist
in the body of this PR.
Related Issues
STR-1781