Skip to content
Merged
Show file tree
Hide file tree
Changes from 137 commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
6933c85
start fixing imports
zerosnacks Mar 26, 2025
bc48af7
continue fixing imports
zerosnacks Mar 26, 2025
1122da1
continue fixing imports
zerosnacks Mar 26, 2025
85036e8
continue fixing imports
zerosnacks Mar 26, 2025
03083a7
add alloy-evm
zerosnacks Mar 26, 2025
edb2455
fix known good changes
zerosnacks Mar 26, 2025
1c11e70
more known good fixes
zerosnacks Mar 26, 2025
5f4f8e5
more known good fixes
zerosnacks Mar 26, 2025
94d8397
more known good fixes
zerosnacks Mar 26, 2025
8d0e45f
more known good fixes, unclear how OptimismFields should be ported
zerosnacks Mar 26, 2025
bc856c4
start introducing crate::Env
zerosnacks Mar 26, 2025
eccc959
continue introducing crate::Env
zerosnacks Mar 26, 2025
6bf4e91
fix cow types
zerosnacks Mar 27, 2025
c75903a
fix type
zerosnacks Mar 27, 2025
39206bd
add journaledstate types, fix env types
zerosnacks Mar 27, 2025
5208520
fix JournaledState = JournalInner<JournalEntry>
zerosnacks Mar 27, 2025
e3ecba7
fix types
zerosnacks Mar 27, 2025
b3e648e
fix merge type
zerosnacks Mar 27, 2025
d72eb16
add odyssey precompile
zerosnacks Mar 27, 2025
5dbabaf
continue fixing type issues, handler abstraction
zerosnacks Mar 27, 2025
933ea20
start working on create2 handler
zerosnacks Mar 27, 2025
256a414
revert to type instead of struct, investigating handlers
zerosnacks Mar 27, 2025
721845e
comment out accesslistinspector for now, needs to be addressed
zerosnacks Mar 28, 2025
6404dab
fix imports, minor fixes
zerosnacks Mar 28, 2025
cab1d4f
imports, minor fixes, there is no equivalent of AuthorizationList - r…
zerosnacks Mar 28, 2025
0d2dc86
more interpreter type fixes
zerosnacks Mar 28, 2025
e2d0db7
continue type fixes
zerosnacks Mar 28, 2025
bfa11ce
fix inspectorext
zerosnacks Mar 28, 2025
396791e
start porting inspectors
zerosnacks Mar 28, 2025
d347f24
start adding custom evm
zerosnacks Mar 28, 2025
b31257a
continue adding custom FoundryEvm
zerosnacks Mar 28, 2025
81f6c81
impl traits for FoundryEvm
zerosnacks Mar 28, 2025
8946aa3
restructure, move out of utils into evm, precompiles and future handlers
zerosnacks Mar 28, 2025
24a7e83
clean up
zerosnacks Mar 28, 2025
2f671e5
clean up
zerosnacks Mar 28, 2025
dd0a072
improve docs
zerosnacks Mar 28, 2025
f15710c
scaffold handler
zerosnacks Mar 28, 2025
3269e90
evaluate how to add handles
zerosnacks Mar 28, 2025
c42e152
prefer EnvRef over EnvMut
zerosnacks Mar 28, 2025
523a7b6
address feedback of owned env
zerosnacks Mar 28, 2025
28dc375
revert get_or_insert_map workaround
zerosnacks Mar 28, 2025
58a8994
avoid changing types, leave mut where previously, avoid unnecessary mut
zerosnacks Mar 28, 2025
b7e2484
start layout out handler registry connected to evm
zerosnacks Mar 31, 2025
b08e41b
get create2 from frame inputs
zerosnacks Mar 31, 2025
ed210a3
start adding create2 handler
zerosnacks Mar 31, 2025
73141a9
continue create2handler
zerosnacks Mar 31, 2025
242df6b
wrap up create2 handler
zerosnacks Mar 31, 2025
ba5d558
clean up
zerosnacks Mar 31, 2025
9f935a2
continue fixing types
zerosnacks Mar 31, 2025
94c94a7
generalize precompiles
zerosnacks Mar 31, 2025
eff2a0c
clean up
zerosnacks Mar 31, 2025
d6ac47d
tag inline
zerosnacks Apr 1, 2025
0429e63
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks Apr 1, 2025
8534afc
fix imports
zerosnacks Apr 1, 2025
7742e25
start fixing cheatcode types
zerosnacks Apr 1, 2025
df22fcc
use `env` on handler
zerosnacks Apr 1, 2025
3469e1c
clean up
zerosnacks Apr 2, 2025
02ebd02
temp revert
zerosnacks Apr 2, 2025
268e1b7
odyssey precompile was deprecated
zerosnacks Apr 2, 2025
0e2085d
refix cheatcode types
zerosnacks Apr 2, 2025
de3e8f7
merge in master
zerosnacks Apr 2, 2025
f69d141
clean up
zerosnacks Apr 2, 2025
30a6284
still facing issues with borrow-checker, double mut
zerosnacks Apr 2, 2025
eb3142e
open questions around passing around env
zerosnacks Apr 2, 2025
5fb9554
minor fix
zerosnacks Apr 2, 2025
2a4bfa4
for now work around mutability limitations by limited cloning, unclea…
zerosnacks Apr 2, 2025
270dbad
continue fixing types, still issues around cheatcodes, inspector
zerosnacks Apr 2, 2025
12c3b71
merge in master
zerosnacks Apr 8, 2025
6ed3ae7
bump revm
zerosnacks Apr 8, 2025
f0fca47
bump deps
zerosnacks Apr 8, 2025
ed7c35c
minor type fixes
zerosnacks Apr 8, 2025
25440e8
bump foundry-fork-db to handle c-kzg build issue
zerosnacks Apr 8, 2025
464b39e
bump rust version
zerosnacks Apr 8, 2025
7b0279b
utilize Host, ContextTr, JournalTr to avoid double mutable borrows
zerosnacks Apr 9, 2025
0daddb8
temp revert
zerosnacks Apr 10, 2025
2e3107e
merge in master
zerosnacks Apr 10, 2025
cc045f2
temp revert
zerosnacks Apr 10, 2025
926db33
restore handler, improve types
zerosnacks Apr 10, 2025
a25b13b
refactor types
zerosnacks Apr 10, 2025
695f0ff
restore types
zerosnacks Apr 10, 2025
fc5b1ec
restore, clean up
zerosnacks Apr 10, 2025
4f24fb6
continue fixing types
zerosnacks Apr 10, 2025
11146d7
clean up
zerosnacks Apr 11, 2025
44afdd2
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks Apr 11, 2025
9b27ff2
continue fixing types
zerosnacks Apr 11, 2025
ec10771
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks Apr 14, 2025
8957990
revert journal env cloning, still issues around double borrows
zerosnacks Apr 14, 2025
32c7201
fix core types per conversation, use EnvMut<'_>
zerosnacks Apr 15, 2025
db518f3
merge in master
zerosnacks Apr 15, 2025
2db1c84
fix types
zerosnacks Apr 15, 2025
4849341
more progress for foundry-evm
klkvr Apr 15, 2025
9735c08
mutate outcome in place
zerosnacks Apr 16, 2025
756ac40
temp revert exec_create
zerosnacks Apr 16, 2025
efebbf6
some progress with porting with_evm core loop
zerosnacks Apr 16, 2025
c589110
remove redundant types
zerosnacks Apr 16, 2025
61a9338
context -> test_context in Cheatcodes config
zerosnacks Apr 16, 2025
6373a24
construct new handler, wrapping evm context, imports Handler trait
zerosnacks Apr 16, 2025
106cdf4
temporarily comment out exec_create section to unblock
zerosnacks Apr 16, 2025
1eb2ca8
add replacement of EnvWithHandlerCfg
zerosnacks Apr 16, 2025
10cd5bf
minor fixes
zerosnacks Apr 16, 2025
8a908af
continue fixing types
zerosnacks Apr 16, 2025
8968b00
continue fixing types
zerosnacks Apr 16, 2025
c42649f
fix merge conflict
zerosnacks Apr 16, 2025
479b151
continue fixing types
zerosnacks Apr 17, 2025
2f5c2ec
continue fixing types
zerosnacks Apr 17, 2025
27bf832
continue types
zerosnacks Apr 17, 2025
a978d45
fix cached_env
zerosnacks Apr 17, 2025
28c0e9e
remove possibly incorrect handling of CreateOutcome on methods like d…
zerosnacks Apr 17, 2025
ab40c0f
add custom_printer from revm19, porting for compatibility
zerosnacks Apr 17, 2025
2d4f538
cast: fix types
zerosnacks Apr 17, 2025
3d607f3
verify: fix types
zerosnacks Apr 17, 2025
7a6b9c1
forge + script: fix types
zerosnacks Apr 17, 2025
e20d2a6
anvil: start fixing types
zerosnacks Apr 17, 2025
8d06e42
anvil: continue porting types
zerosnacks Apr 17, 2025
b94f25f
anvil: continue porting types
zerosnacks Apr 17, 2025
905b253
anvil: continue porting types
zerosnacks Apr 17, 2025
9fbeb83
anvil: continue porting types, small fix in foundry-evm
zerosnacks Apr 17, 2025
7ecf953
use AnvilEvm
zerosnacks Apr 22, 2025
93543f6
fix merge conflict
zerosnacks Apr 22, 2025
20383c1
stash optimism hardfork specifics for now
zerosnacks Apr 22, 2025
630ffc4
temp mute anvil use in forge
zerosnacks Apr 22, 2025
92f2465
apply apparant fixes, test still failing
zerosnacks Apr 23, 2025
0586f90
clean up
zerosnacks Apr 23, 2025
5843f31
revert to replay
zerosnacks Apr 23, 2025
5005376
apply possible nonce 0/1 fixes, committed to proceed
zerosnacks Apr 24, 2025
c78af12
disable nonce check in local_evm_env
zerosnacks Apr 24, 2025
73f1842
undo is_odyssey remove
zerosnacks Apr 24, 2025
e3d51f3
always spawn evm with handler
zerosnacks Apr 24, 2025
ad855f5
replay() -> inspect_replay()
zerosnacks Apr 25, 2025
b8dfec2
modify macro, comment out anvil related cast tests for the time being
zerosnacks Apr 25, 2025
3624b54
reapply state depth = 1
zerosnacks Apr 25, 2025
e4b3493
something like this?
zerosnacks Apr 25, 2025
058731e
introduce outer block for early return
zerosnacks Apr 25, 2025
25a5ce7
print debugging
zerosnacks Apr 25, 2025
1d28788
clean up
zerosnacks Apr 25, 2025
34face7
merge in master, note no known equivalent of bytecode_address, to do
zerosnacks Apr 25, 2025
ab71127
fix merge
zerosnacks Apr 25, 2025
100f72c
migrate: anvil to revm 21 (#10361)
yash-atreya Apr 29, 2025
4aa7b08
merge in master
zerosnacks Apr 29, 2025
c7d41af
intermediary(`revm bump`): re-enable Anvil tests, remove duplicate `L…
zerosnacks Apr 30, 2025
69c1e57
fix merge conflicts
zerosnacks Apr 30, 2025
0c11f5a
disable nonce checks on forks, enforce setting of tx.nonce on set_nonce
zerosnacks Apr 30, 2025
6ada1ed
fix: use `transact` from alloy-evm (#10417)
yash-atreya Apr 30, 2025
0957ba6
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks May 1, 2025
f70e0b0
Patch revm to fix interpreter panic
grandizzy May 5, 2025
95f0c15
bump revm
klkvr May 5, 2025
00ae885
fix eof test
klkvr May 5, 2025
fe0340a
fix bytecode hash
klkvr May 6, 2025
3145a9a
fix fixture
klkvr May 6, 2025
22c9073
fix fixture
klkvr May 6, 2025
ab95c68
fix fixture
klkvr May 6, 2025
e3c8602
chore: mv EitherEvm to foundry_evm (#10445)
yash-atreya May 6, 2025
645cef6
remove unused JournalTr
zerosnacks May 6, 2025
1908428
restore formatting, avoid diff
zerosnacks May 6, 2025
9e2af65
merge in master, fix merge conflict
zerosnacks May 6, 2025
38ffcf8
remove leftover comment re: optimism support
zerosnacks May 6, 2025
741afe1
fix displays_chained_error test
zerosnacks May 6, 2025
647ba04
fix doc test
zerosnacks May 6, 2025
078d14c
remove optimism todo leftover
zerosnacks May 6, 2025
2165526
avoid direct field assignment, prefer *current.
zerosnacks May 6, 2025
d08fa08
create2 handler register
klkvr May 6, 2025
d8d8b97
fix patch
klkvr May 6, 2025
10cd73d
fix test_broadcast_raw_create2_deployer
klkvr May 7, 2025
52eeac5
fix gas meter test
zerosnacks May 7, 2025
30c93ea
correctly reset env.tx to cached env, cfg and block, ref https://gith…
zerosnacks May 7, 2025
c9449f9
exec_create
klkvr May 7, 2025
4832b10
revert test_GasMeter, assert exact gas used
zerosnacks May 7, 2025
5b47a33
Merge branch 'zerosnacks/revm-bump-2' of github.com:foundry-rs/foundr…
zerosnacks May 7, 2025
2f09b68
fix arbitrum test
klkvr May 7, 2025
e25d45c
doc test fixes
zerosnacks May 7, 2025
d4d1313
fix clippy warnings
zerosnacks May 7, 2025
fd702f5
Merge branch 'zerosnacks/revm-bump-2' of github.com:foundry-rs/foundr…
zerosnacks May 7, 2025
0e28b8a
remove leftover comment
zerosnacks May 7, 2025
95cd68f
fix assert_can_detect_unlinked_target_with_libraries, ref: https://gi…
zerosnacks May 7, 2025
13f3bc1
fix gas metering tests
klkvr May 7, 2025
8ce5c47
restore unintended .wrap_err changes, ref: https://github.com/search?…
zerosnacks May 7, 2025
a682067
fix test_cheats_local_default
klkvr May 7, 2025
e823899
Merge branch 'master' into zerosnacks/revm-bump-2
klkvr May 7, 2025
569fca9
add CC0-1.0 license exception, has been previously approved in Reth: …
zerosnacks May 7, 2025
91bd0a2
usize depth
klkvr May 7, 2025
959a00f
repin foundry-fork-db, this aligns the revm and alloy version back
zerosnacks May 7, 2025
f25ca3f
Merge branch 'zerosnacks/revm-bump-2' of github.com:foundry-rs/foundr…
zerosnacks May 7, 2025
aca65af
fix clippy, after usize depth change
zerosnacks May 7, 2025
9fdd30d
allow foundry-fork-db as git exception
zerosnacks May 7, 2025
0bae474
fix: EitherEvm should work over OpTransaction
yash-atreya May 8, 2025
cfd7292
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks May 8, 2025
5ccf7de
fix fmt
zerosnacks May 8, 2025
4f07ea3
Merge branch 'zerosnacks/revm-bump-2' of github.com:foundry-rs/foundr…
zerosnacks May 8, 2025
5b5fc8c
Env::from_with_spec_id -> Env::new_with_spec_id
zerosnacks May 8, 2025
97470d3
bump clippy msrv to align with foundry.toml
zerosnacks May 8, 2025
593225f
fix merge conflict
zerosnacks May 9, 2025
2d6312d
chore: avoid leaking Anvil specific optimism fields into evm/core (#1…
zerosnacks May 9, 2025
a928abc
fix merge conflict
zerosnacks May 9, 2025
fc6b765
refactor anvil Env and reduce changes in tx processing
klkvr May 11, 2025
c7c1162
Merge branch 'master' into zerosnacks/revm-bump-2
klkvr May 11, 2025
031e060
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks May 12, 2025
4b4da4a
fix: correctly set txtype when setting up TxEnv
klkvr May 12, 2025
2bb2ffd
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks May 13, 2025
fb53456
update last commits from master to be u64 compatible
zerosnacks May 13, 2025
9ea7ff4
Merge branch 'master' into zerosnacks/revm-bump-2
klkvr May 13, 2025
766f60f
fix clippy lint
zerosnacks May 13, 2025
fec95f2
revert clippy changes, make sure lint-foundry uses nightly clippy ver…
zerosnacks May 13, 2025
f8b4c7c
fix merge conflict
zerosnacks May 14, 2025
9a4fb2b
apply tx_type if set, upgrading from legacy to eip2930 if access_list…
zerosnacks May 14, 2025
fcfaa25
restore #[ret] macro that was removed unintendedly
zerosnacks May 14, 2025
5ad9091
replace redundant Env::new_with_spec_id(..) with default
zerosnacks May 14, 2025
d6aa9a0
allow passing is_optimism into Env constructor specific to Anvil
zerosnacks May 14, 2025
78c94f7
extract environment configuration into init.rs to make configuring th…
zerosnacks May 14, 2025
f1acfc4
merge in master, add some tests to make sure immediate_size change ap…
zerosnacks May 15, 2025
21ef359
remove redundant debug derive
zerosnacks May 15, 2025
19a9289
fix merge conflicts stemming from https://github.com/foundry-rs/found…
zerosnacks May 16, 2025
7392f81
Merge branch 'master' into zerosnacks/revm-bump-2
zerosnacks May 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,170 changes: 928 additions & 242 deletions Cargo.lock

Large diffs are not rendered by default.

73 changes: 44 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resolver = "2"
version = "1.1.0"
edition = "2021"
# Remember to update clippy.toml as well
rust-version = "1.83"
rust-version = "1.85"
authors = ["Foundry Contributors"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/foundry-rs/foundry"
Expand Down Expand Up @@ -116,10 +116,17 @@ alloy-sol-types.opt-level = 3
hashbrown.opt-level = 3
foldhash.opt-level = 3
keccak.opt-level = 3
revm.opt-level = 3
revm-primitives.opt-level = 3
revm-interpreter.opt-level = 3
revm-precompile.opt-level = 3
revm-primitives.opt-level = 3
revm.opt-level = 3
revm-database-interface.opt-level = 3
revm-database.opt-level = 3
revm-bytecode.opt-level = 3
revm-state.opt-level = 3
revm-context-interface.opt-level = 3
revm-context.opt-level = 3
revm-inspector.opt-level = 3
ruint.opt-level = 3
sha2.opt-level = 3
sha3.opt-level = 3
Expand Down Expand Up @@ -196,32 +203,32 @@ solar-parse = { version = "=0.1.2", default-features = false }
solar-sema = { version = "=0.1.2", default-features = false }

## revm
revm = { version = "19.4.0", default-features = false }
revm-primitives = { version = "15.1.0", default-features = false }
revm-inspectors = { version = "0.16.0", features = ["serde"] }
revm = { version = "21.0.0", default-features = false }
revm-inspectors = { version = "0.18.1", features = ["serde"] }
op-revm = { version = "3.0.2", default-features = false }

## alloy
alloy-consensus = { version = "0.12.1", default-features = false }
alloy-contract = { version = "0.12.1", default-features = false }
alloy-eips = { version = "0.12.1", default-features = false }
alloy-genesis = { version = "0.12.1", default-features = false }
alloy-json-rpc = { version = "0.12.1", default-features = false }
alloy-network = { version = "0.12.1", default-features = false }
alloy-provider = { version = "0.12.1", default-features = false }
alloy-pubsub = { version = "0.12.1", default-features = false }
alloy-rpc-client = { version = "0.12.1", default-features = false }
alloy-rpc-types = { version = "0.12.1", default-features = true }
alloy-serde = { version = "0.12.1", default-features = false }
alloy-signer = { version = "0.12.1", default-features = false }
alloy-signer-aws = { version = "0.12.1", default-features = false }
alloy-signer-gcp = { version = "0.12.1", default-features = false }
alloy-signer-ledger = { version = "0.12.1", default-features = false }
alloy-signer-local = { version = "0.12.1", default-features = false }
alloy-signer-trezor = { version = "0.12.1", default-features = false }
alloy-transport = { version = "0.12.1", default-features = false }
alloy-transport-http = { version = "0.12.1", default-features = false }
alloy-transport-ipc = { version = "0.12.1", default-features = false }
alloy-transport-ws = { version = "0.12.1", default-features = false }
alloy-consensus = { version = "0.13.0", default-features = false }
alloy-contract = { version = "0.13.0", default-features = false }
alloy-eips = { version = "0.13.0", default-features = false }
alloy-genesis = { version = "0.13.0", default-features = false }
alloy-json-rpc = { version = "0.13.0", default-features = false }
alloy-network = { version = "0.13.0", default-features = false }
alloy-provider = { version = "0.13.0", default-features = false }
alloy-pubsub = { version = "0.13.0", default-features = false }
alloy-rpc-client = { version = "0.13.0", default-features = false }
alloy-rpc-types = { version = "0.13.0", default-features = true }
alloy-serde = { version = "0.13.0", default-features = false }
alloy-signer = { version = "0.13.0", default-features = false }
alloy-signer-aws = { version = "0.13.0", default-features = false }
alloy-signer-gcp = { version = "0.13.0", default-features = false }
alloy-signer-ledger = { version = "0.13.0", default-features = false }
alloy-signer-local = { version = "0.13.0", default-features = false }
alloy-signer-trezor = { version = "0.13.0", default-features = false }
alloy-transport = { version = "0.13.0", default-features = false }
alloy-transport-http = { version = "0.13.0", default-features = false }
alloy-transport-ipc = { version = "0.13.0", default-features = false }
alloy-transport-ws = { version = "0.13.0", default-features = false }

## alloy-core
alloy-dyn-abi = "0.8.22"
Expand All @@ -237,12 +244,13 @@ alloy-sol-macro-input = "0.8.22"
alloy-sol-types = "0.8.22"

alloy-chains = "0.1"
alloy-evm = "0.3.2"
alloy-rlp = "0.3"
alloy-trie = "0.7.0"

## op-alloy
op-alloy-consensus = "0.11.0"
op-alloy-rpc-types = "0.11.0"
op-alloy-consensus = "0.12.0"
op-alloy-rpc-types = "0.12.0"

## cli
anstream = "0.6"
Expand Down Expand Up @@ -351,3 +359,10 @@ path-slash = "0.2"
# alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "7fab7ee" }
# alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "7fab7ee" }
# alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "7fab7ee" }

## revm
# revm = { git = "https://github.com/bluealloy/revm.git", rev = "4266922" }
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors.git", rev = "a625c04" }

## foundry
foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "6144088" }
21 changes: 13 additions & 8 deletions crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ foundry-cli.workspace = true
foundry-common.workspace = true
foundry-config.workspace = true
foundry-evm.workspace = true
foundry-evm-core.workspace = true

# evm support
revm = { workspace = true, features = [
"std",
"serde",
"memory_limit",
"c-kzg",
] }
revm-inspectors.workspace = true
# alloy
alloy-evm.workspace = true
alloy-primitives = { workspace = true, features = ["serde"] }
alloy-consensus = { workspace = true, features = ["k256", "kzg"] }
alloy-contract = { workspace = true, features = ["pubsub"] }
Expand All @@ -61,6 +56,16 @@ alloy-genesis.workspace = true
alloy-trie.workspace = true
op-alloy-consensus = { workspace = true, features = ["serde"] }

# revm
revm = { workspace = true, features = [
"std",
"serde",
"memory_limit",
"c-kzg",
] }
revm-inspectors.workspace = true
op-revm.workspace = true

# axum related
axum.workspace = true
hyper.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/anvil/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ revm = { workspace = true, default-features = false, features = [
"memory_limit",
"c-kzg",
] }
op-revm.workspace = true

alloy-primitives = { workspace = true, features = ["serde", "rlp"] }
alloy-rpc-types = { workspace = true, features = ["anvil", "trace"] }
Expand Down
68 changes: 33 additions & 35 deletions crates/anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ use alloy_serde::{OtherFields, WithOtherFields};
use bytes::BufMut;
use foundry_evm::traces::CallTraceNode;
use op_alloy_consensus::{TxDeposit, DEPOSIT_TX_TYPE_ID};
use revm::{
interpreter::InstructionResult,
primitives::{OptimismFields, TxEnv},
};
use revm::{context::TxEnv, interpreter::InstructionResult};
use serde::{Deserialize, Serialize};
use std::ops::{Deref, Mul};

Expand Down Expand Up @@ -399,15 +396,15 @@ impl PendingTransaction {
let TxLegacy { nonce, gas_price, gas_limit, value, to, input, .. } = tx.tx();
TxEnv {
caller,
transact_to: transact_to(to),
kind: transact_to(to),
data: input.clone(),
chain_id,
nonce: Some(*nonce),
nonce: *nonce,
value: (*value),
gas_price: U256::from(*gas_price),
gas_price: *gas_price,
gas_priority_fee: None,
gas_limit: *gas_limit,
access_list: vec![],
access_list: vec![].into(),
..Default::default()
}
}
Expand All @@ -425,12 +422,12 @@ impl PendingTransaction {
} = tx.tx();
TxEnv {
caller,
transact_to: transact_to(to),
kind: transact_to(to),
data: input.clone(),
chain_id: Some(*chain_id),
nonce: Some(*nonce),
nonce: *nonce,
value: *value,
gas_price: U256::from(*gas_price),
gas_price: *gas_price,
gas_priority_fee: None,
gas_limit: *gas_limit,
access_list: access_list.clone().into(),
Expand All @@ -452,13 +449,13 @@ impl PendingTransaction {
} = tx.tx();
TxEnv {
caller,
transact_to: transact_to(to),
kind: transact_to(to),
data: input.clone(),
chain_id: Some(*chain_id),
nonce: Some(*nonce),
nonce: *nonce,
value: *value,
gas_price: U256::from(*max_fee_per_gas),
gas_priority_fee: Some(U256::from(*max_priority_fee_per_gas)),
gas_price: *max_fee_per_gas,
gas_priority_fee: Some(*max_priority_fee_per_gas),
gas_limit: *gas_limit,
access_list: access_list.clone().into(),
..Default::default()
Expand All @@ -481,14 +478,14 @@ impl PendingTransaction {
} = tx.tx().tx();
TxEnv {
caller,
transact_to: TxKind::Call(*to),
kind: TxKind::Call(*to),
data: input.clone(),
chain_id: Some(*chain_id),
nonce: Some(*nonce),
nonce: *nonce,
value: *value,
gas_price: U256::from(*max_fee_per_gas),
gas_priority_fee: Some(U256::from(*max_priority_fee_per_gas)),
max_fee_per_blob_gas: Some(U256::from(*max_fee_per_blob_gas)),
gas_price: *max_fee_per_gas,
gas_priority_fee: Some(*max_priority_fee_per_gas),
max_fee_per_blob_gas: *max_fee_per_blob_gas,
blob_hashes: blob_versioned_hashes.clone(),
gas_limit: *gas_limit,
access_list: access_list.clone().into(),
Expand All @@ -510,16 +507,16 @@ impl PendingTransaction {
} = tx.tx();
TxEnv {
caller,
transact_to: TxKind::Call(*to),
kind: TxKind::Call(*to),
data: input.clone(),
chain_id: Some(*chain_id),
nonce: Some(*nonce),
nonce: *nonce,
value: *value,
gas_price: U256::from(*max_fee_per_gas),
gas_priority_fee: Some(U256::from(*max_priority_fee_per_gas)),
gas_price: *max_fee_per_gas,
gas_priority_fee: Some(*max_priority_fee_per_gas),
gas_limit: *gas_limit,
access_list: access_list.clone().into(),
authorization_list: Some(authorization_list.clone().into()),
authorization_list: authorization_list.clone(),
..Default::default()
}
}
Expand All @@ -538,21 +535,22 @@ impl PendingTransaction {
} = tx;
TxEnv {
caller,
transact_to: transact_to(kind),
kind: transact_to(kind),
data: input.clone(),
chain_id,
nonce: Some(*nonce),
nonce: *nonce,
value: *value,
gas_price: U256::ZERO,
gas_price: 0,
gas_priority_fee: None,
gas_limit: { *gas_limit },
access_list: vec![],
optimism: OptimismFields {
source_hash: Some(*source_hash),
mint: Some(mint.to::<u128>()),
is_system_transaction: Some(*is_system_tx),
enveloped_tx: None,
},
access_list: vec![].into(),
// TODO: add Optimism support
// optimism: OptimismFields {
// source_hash: Some(*source_hash),
// mint: Some(mint.to::<u128>()),
// is_system_transaction: Some(*is_system_tx),
// enveloped_tx: None,
// },
..Default::default()
}
}
Expand Down
27 changes: 13 additions & 14 deletions crates/anvil/src/cmd.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{
config::{ForkChoice, DEFAULT_MNEMONIC},
eth::{backend::db::SerializableState, pool::transactions::TransactionOrder, EthApi},
hardfork::OptimismHardfork,
AccountGenerator, EthereumHardfork, NodeConfig, CHAIN_ID,
};
use alloy_genesis::Genesis;
Expand Down Expand Up @@ -218,11 +217,11 @@ impl NodeArgs {

let hardfork = match &self.hardfork {
Some(hf) => {
if self.evm.optimism {
Some(OptimismHardfork::from_str(hf)?.into())
} else {
Some(EthereumHardfork::from_str(hf)?.into())
}
// if self.evm.optimism {
// Some(OptimismHardfork::from_str(hf)?.into())
// } else {
Some(EthereumHardfork::from_str(hf)?.into())
// }
}
None => None,
};
Expand Down Expand Up @@ -521,7 +520,7 @@ pub struct AnvilEvmArgs {

/// The block gas limit.
#[arg(long, alias = "block-gas-limit", help_heading = "Environment config")]
pub gas_limit: Option<u128>,
pub gas_limit: Option<u64>,

/// Disable the `call.gas_limit <= block.gas_limit` constraint.
#[arg(
Expand Down Expand Up @@ -834,13 +833,13 @@ mod tests {
assert_eq!(config.hardfork, Some(EthereumHardfork::Berlin.into()));
}

#[test]
fn can_parse_optimism_hardfork() {
let args: NodeArgs =
NodeArgs::parse_from(["anvil", "--optimism", "--hardfork", "Regolith"]);
let config = args.into_node_config().unwrap();
assert_eq!(config.hardfork, Some(OptimismHardfork::Regolith.into()));
}
// #[test]
// fn can_parse_optimism_hardfork() {
// let args: NodeArgs =
// NodeArgs::parse_from(["anvil", "--optimism", "--hardfork", "Regolith"]);
// let config = args.into_node_config().unwrap();
// assert_eq!(config.hardfork, Some(OptimismHardfork::Regolith.into()));
// }

#[test]
fn cant_parse_invalid_hardfork() {
Expand Down
Loading
Loading