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

feat(levm): implement EIP7702 - Set EOA account code #1672

Merged
merged 96 commits into from
Jan 23, 2025
Merged

Conversation

fborello-lambda
Copy link
Contributor

@fborello-lambda fborello-lambda commented Jan 9, 2025

Motivation

LEVM needs to support EIP7702 transactions.

Description

Implement the approach described in the Behavior section of the EIP7702 document, and take the ethereum/execution_specs implementation as reference to support the "written" spec with actual code.

To run the ef-tests for EIP7702:

cd crates/vm/levm
make clean-evm-ef-tests download-evm-ef-tests
make run-evm-ef-tests flags="--tests set_code_txs" 
make run-evm-ef-tests flags="--tests gas" 

Closes #1642

@fborello-lambda fborello-lambda added the levm Lambda EVM implementation label Jan 9, 2025
@fborello-lambda fborello-lambda self-assigned this Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

| File                                                                              | Lines | Diff |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/cmd/ef_tests/levm/runner/levm_runner.rs           | 392   | +2   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/cmd/ethrex/ethrex.rs                              | 353   | -1   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/blockchain/fork_choice.rs                  | 178   | -1   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/discv4.rs                   | 905   | -11  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/kademlia.rs                 | 469   | -18  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/net.rs                      | 934   | -204 |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/rlpx/connection.rs          | 546   | -5   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/types.rs                    | 147   | -82  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/rpc/engine/fork_choice.rs       | 278   | -4   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/rpc/eth/client.rs               | 27    | -1   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/storage/store/engines/api.rs               | 159   | -2   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/storage/store/engines/in_memory.rs         | 373   | -8   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/storage/store/engines/libmdbx.rs           | 722   | -9   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/storage/store/engines/redb.rs              | 670   | -13  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/storage/store/engines/utils.rs             | 32    | -2   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/storage/store/storage.rs                   | 1152  | -8   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/db.rs                                   | 97    | +7   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/constants.rs                   | 49    | +14  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/db/mod.rs                      | 62    | +4   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/errors.rs                      | 247   | +2   |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/opcode_handlers/environment.rs | 340   | +11  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/opcode_handlers/system.rs      | 619   | +37  |
+-----------------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/levm/src/vm.rs                          | 1271  | +226 |
+-----------------------------------------------------------------------------------+-------+------+

Total lines added: +303
Total lines removed: 369
Total lines changed: 672

@fborello-lambda fborello-lambda force-pushed the levm/eip7702 branch 2 times, most recently from 88c1330 to 56cff3a Compare January 9, 2025 18:09
Copy link

github-actions bot commented Jan 9, 2025

Benchmark Results Comparison

PR Results

Benchmark Results: Factorial

Command Mean [s] Min [s] Max [s] Relative
revm_factorial 7.852 ± 1.246 7.066 9.677 1.00
levm_factorial 26.547 ± 0.268 26.030 26.807 3.38 ± 0.54

Benchmark Results: Fibonacci

Command Mean [s] Min [s] Max [s] Relative
revm_fibonacci 7.464 ± 1.130 6.815 10.128 1.00
levm_fibonacci 25.137 ± 1.511 24.003 29.038 3.37 ± 0.55

Main Results

Benchmark Results: Factorial

Command Mean [s] Min [s] Max [s] Relative
revm_factorial 7.284 ± 0.912 6.964 9.879 1.00
levm_factorial 26.487 ± 0.217 26.101 26.637 3.64 ± 0.46

Benchmark Results: Fibonacci

Command Mean [s] Min [s] Max [s] Relative
revm_fibonacci 7.787 ± 0.102 7.706 7.965 1.00
levm_fibonacci 23.994 ± 0.151 23.774 24.189 3.08 ± 0.04

crates/vm/levm/src/vm.rs Outdated Show resolved Hide resolved
crates/vm/levm/src/vm.rs Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Jan 22, 2025

crates/vm/levm/src/vm.rs Outdated Show resolved Hide resolved
@lambdaclass lambdaclass deleted a comment from github-actions bot Jan 23, 2025
@lambdaclass lambdaclass deleted a comment from github-actions bot Jan 23, 2025
Copy link

Summary: 6265/6475 (96.76%)

Prague: 2163/2373 (91.15%)
Cancun: 3579/3579 (100.00%)
Shanghai: 221/221 (100.00%)
Merge: 62/62 (100.00%)
London: 39/39 (100.00%)
Berlin: 35/35 (100.00%)
Istanbul: 34/34 (100.00%)
Constantinople: 66/66 (100.00%)
Byzantium: 33/33 (100.00%)
Homestead: 17/17 (100.00%)
Frontier: 16/16 (100.00%)

@fborello-lambda fborello-lambda added this pull request to the merge queue Jan 23, 2025
Merged via the queue into main with commit 062eea8 Jan 23, 2025
25 checks passed
@fborello-lambda fborello-lambda deleted the levm/eip7702 branch January 23, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
levm Lambda EVM implementation pectra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LEVM: Add support for the EIP-7702
3 participants