Skip to content

Commit 7890062

Browse files
authored
feat: Euclid with enable_eip7702 (#27)
* feat: modify handler for Euclid * feat: add custom journal and context * test: journal `load_account_delegated` * doc: document `validation_initial_tx_gas` changes * fix: lints * test: fix no-std * feat: add deref + JournalExt implementations * feat: add revm feature enable eip7702 * chore: update branch name
1 parent ccf29ef commit 7890062

File tree

6 files changed

+211
-53
lines changed

6 files changed

+211
-53
lines changed

Cargo.lock

Lines changed: 16 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ license = "MIT OR Apache-2.0"
66

77
[dependencies]
88
# revm
9-
revm = { version = "22.0.0", default-features = false }
10-
revm-primitives = { version = "18.0.0", default-features = false }
11-
revm-inspector = { version = "3.0.0", default-features = false }
9+
revm = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth", default-features = false, features = ["secp256r1", "enable_eip7702"] }
10+
revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth", default-features = false }
11+
revm-inspector = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth", default-features = false }
1212

1313
# misc
1414
auto_impl = "1.2.0"

src/builder.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,29 @@ pub trait DefaultScrollContext {
5656

5757
impl DefaultScrollContext for ScrollContext<EmptyDB> {
5858
fn scroll() -> ScrollContext<EmptyDB> {
59+
let spec = ScrollSpecId::default();
60+
let mut cfg = CfgEnv::new_with_spec(spec);
61+
cfg.enable_eip7702 = spec >= ScrollSpecId::EUCLID;
62+
5963
Context::mainnet()
6064
.with_tx(ScrollTransaction::default())
61-
.with_cfg(CfgEnv::new_with_spec(ScrollSpecId::default()))
65+
.with_cfg(cfg)
6266
.with_chain(L1BlockInfo::default())
6367
}
6468
}
6569

70+
/// Activates EIP-7702 if necessary for the context.
71+
pub trait MaybeWithEip7702 {
72+
/// Activates EIP-7702 if necessary.
73+
fn maybe_with_eip_7702(self) -> Self;
74+
}
75+
76+
impl<DB: Database> MaybeWithEip7702 for ScrollContext<DB> {
77+
fn maybe_with_eip_7702(mut self) -> Self {
78+
self.cfg.enable_eip7702 = self.cfg.spec >= ScrollSpecId::EUCLID;
79+
self
80+
}
81+
}
82+
6683
pub type ScrollContext<DB> =
6784
Context<BlockEnv, ScrollTransaction<TxEnv>, CfgEnv<ScrollSpecId>, DB, Journal<DB>, L1BlockInfo>;

0 commit comments

Comments
 (0)