Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit fdfc200

Browse files
committed
chore: bump reth
1 parent eb336a8 commit fdfc200

File tree

10 files changed

+933
-823
lines changed

10 files changed

+933
-823
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,32 @@ alloy-signer-local = { version = "0.3", features = ["mnemonic"] }
7070
tokio = { version = "1.21", default-features = false }
7171

7272
# reth
73-
reth = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6", features = [
73+
reth = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb" }
74+
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
7475
"optimism",
7576
] }
76-
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
77-
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
78-
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
79-
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
80-
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
81-
reth-node-optimism = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
82-
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
83-
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
84-
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", rev = "v1.0.6" }
77+
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb" }
78+
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb" }
79+
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb" }
80+
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
81+
"optimism",
82+
] }
83+
reth-node-optimism = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
84+
"optimism",
85+
] }
86+
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
87+
"optimism",
88+
] }
89+
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
90+
"optimism",
91+
] }
92+
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
93+
"optimism",
94+
] }
95+
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb", features = [
96+
"optimism",
97+
] }
98+
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", rev = "c1b5fbb" }
8599

86100
# misc
87101
clap = "4"

bin/alphanet/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ workspace = true
1414
[dependencies]
1515
alphanet-node.workspace = true
1616
tracing.workspace = true
17-
reth.workspace = true
1817
reth-cli-util.workspace = true
1918
reth-node-optimism.workspace = true
19+
reth-optimism-cli.workspace = true
2020
reth-optimism-rpc.workspace = true
2121
clap = { workspace = true, features = ["derive"] }
2222

2323
[target.'cfg(not(windows))'.dependencies]
2424
tikv-jemallocator = { version = "0.5", optional = true }
2525

2626
[features]
27-
default = ["jemalloc", "reth/optimism", "reth-node-optimism/optimism"]
27+
default = ["jemalloc"]
2828

29-
asm-keccak = ["reth/asm-keccak"]
29+
asm-keccak = ["reth-optimism-cli/asm-keccak"]
3030

3131
jemalloc = ["dep:tikv-jemallocator"]
3232
jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling"]

bin/alphanet/src/main.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
2626
use alphanet_node::node::AlphaNetNode;
2727
use clap::Parser;
28-
use reth::cli::Cli;
2928
use reth_node_optimism::args::RollupArgs;
29+
use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
3030
use reth_optimism_rpc::eth::rpc::SequencerClient;
3131

3232
// We use jemalloc for performance reasons.
@@ -44,24 +44,26 @@ fn main() {
4444
std::env::set_var("RUST_BACKTRACE", "1");
4545
}
4646

47-
if let Err(err) = Cli::<RollupArgs>::parse().run(|builder, rollup_args| async move {
48-
let node = builder
49-
.node(AlphaNetNode::new(rollup_args.clone()))
50-
.extend_rpc_modules(move |ctx| {
51-
// register sequencer tx forwarder
52-
if let Some(sequencer_http) = rollup_args.sequencer_http.clone() {
53-
ctx.registry
54-
.eth_api()
55-
.set_sequencer_client(SequencerClient::new(sequencer_http));
56-
}
47+
if let Err(err) =
48+
Cli::<OpChainSpecParser, RollupArgs>::parse().run(|builder, rollup_args| async move {
49+
let node = builder
50+
.node(AlphaNetNode::new(rollup_args.clone()))
51+
.extend_rpc_modules(move |ctx| {
52+
// register sequencer tx forwarder
53+
if let Some(sequencer_http) = rollup_args.sequencer_http.clone() {
54+
ctx.registry
55+
.eth_api()
56+
.set_sequencer_client(SequencerClient::new(sequencer_http));
57+
}
5758

58-
Ok(())
59-
})
60-
.launch()
61-
.await?;
59+
Ok(())
60+
})
61+
.launch()
62+
.await?;
6263

63-
node.wait_for_node_exit().await
64-
}) {
64+
node.wait_for_node_exit().await
65+
})
66+
{
6567
eprintln!("Error: {err:?}");
6668
std::process::exit(1);
6769
}

crates/node/Cargo.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@ categories.workspace = true
1111

1212
[dependencies]
1313
alphanet-precompile.workspace = true
14-
reth.workspace = true
1514
reth-node-api.workspace = true
15+
reth-node-builder.workspace = true
1616
reth-node-optimism.workspace = true
1717
reth-chainspec.workspace = true
18+
reth-primitives.workspace = true
19+
reth-revm.workspace = true
1820

1921
eyre.workspace = true
2022

21-
[features]
22-
default = [
23-
"alphanet-precompile/optimism",
24-
"reth/optimism",
25-
"reth-node-optimism/optimism",
26-
]
27-
2823
[lints]
2924
workspace = true

crates/node/src/evm.rs

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,35 @@
1111
//! precompiles defined by [`alphanet_precompile`].
1212
1313
use alphanet_precompile::secp256r1;
14-
use reth::{
15-
primitives::{
14+
use reth_primitives::{
1615
revm_primitives::{CfgEnvWithHandlerCfg, TxEnv},
1716
transaction::FillTxEnv,
1817
Address, Bytes, Header, TransactionSigned, TxKind, U256,
19-
},
20-
revm::{
18+
};
19+
use reth_revm::{
2120
handler::register::EvmHandler,
2221
inspector_handle_register,
2322
precompile::PrecompileSpecId,
2423
primitives::{AnalysisKind, Env, OptimismFields},
2524
ContextPrecompiles, Database, Evm, EvmBuilder, GetInspector,
26-
},
2725
};
2826
use reth_chainspec::{ChainSpec, EthereumHardfork, Head, OptimismHardfork};
2927
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv};
3028
use std::sync::Arc;
3129

3230
/// Custom EVM configuration
33-
#[derive(Debug, Clone, Copy, Default)]
31+
#[derive(Debug, Clone, Default)]
3432
#[non_exhaustive]
35-
pub struct AlphaNetEvmConfig;
33+
pub struct AlphaNetEvmConfig {
34+
chain_spec: Arc<ChainSpec>,
35+
}
3636

3737
impl AlphaNetEvmConfig {
38+
/// Creates a new AlphaNet EVM configuration with the given chain spec.
39+
pub const fn new(chain_spec: Arc<ChainSpec>) -> Self {
40+
Self { chain_spec }
41+
}
42+
3843
/// Sets the precompiles to the EVM handler
3944
///
4045
/// This will be invoked when the EVM is created via [ConfigureEvm::evm] or
@@ -113,12 +118,11 @@ impl ConfigureEvmEnv for AlphaNetEvmConfig {
113118
fn fill_cfg_env(
114119
&self,
115120
cfg_env: &mut CfgEnvWithHandlerCfg,
116-
chain_spec: &ChainSpec,
117121
header: &Header,
118122
total_difficulty: U256,
119123
) {
120124
let spec_id = revm_spec(
121-
chain_spec,
125+
&self.chain_spec,
122126
&Head {
123127
number: header.number,
124128
timestamp: header.timestamp,
@@ -128,11 +132,11 @@ impl ConfigureEvmEnv for AlphaNetEvmConfig {
128132
},
129133
);
130134

131-
cfg_env.chain_id = chain_spec.chain().id();
135+
cfg_env.chain_id = self.chain_spec.chain().id();
132136
cfg_env.perf_analyse_created_bytecodes = AnalysisKind::Analyse;
133137

134138
cfg_env.handler_cfg.spec_id = spec_id;
135-
cfg_env.handler_cfg.is_optimism = chain_spec.is_optimism();
139+
cfg_env.handler_cfg.is_optimism = self.chain_spec.is_optimism();
136140
}
137141
}
138142

@@ -167,47 +171,47 @@ impl ConfigureEvm for AlphaNetEvmConfig {
167171
}
168172

169173
/// Determine the revm spec ID from the current block and reth chainspec.
170-
fn revm_spec(chain_spec: &ChainSpec, block: &Head) -> reth::revm::primitives::SpecId {
174+
fn revm_spec(chain_spec: &ChainSpec, block: &Head) -> reth_revm::primitives::SpecId {
171175
if chain_spec.fork(EthereumHardfork::Prague).active_at_head(block) {
172-
reth::revm::primitives::PRAGUE_EOF
176+
reth_revm::primitives::PRAGUE_EOF
173177
} else if chain_spec.fork(OptimismHardfork::Granite).active_at_head(block) {
174-
reth::revm::primitives::GRANITE
178+
reth_revm::primitives::GRANITE
175179
} else if chain_spec.fork(OptimismHardfork::Fjord).active_at_head(block) {
176-
reth::revm::primitives::FJORD
180+
reth_revm::primitives::FJORD
177181
} else if chain_spec.fork(OptimismHardfork::Ecotone).active_at_head(block) {
178-
reth::revm::primitives::ECOTONE
182+
reth_revm::primitives::ECOTONE
179183
} else if chain_spec.fork(OptimismHardfork::Canyon).active_at_head(block) {
180-
reth::revm::primitives::CANYON
184+
reth_revm::primitives::CANYON
181185
} else if chain_spec.fork(OptimismHardfork::Regolith).active_at_head(block) {
182-
reth::revm::primitives::REGOLITH
186+
reth_revm::primitives::REGOLITH
183187
} else if chain_spec.fork(OptimismHardfork::Bedrock).active_at_head(block) {
184-
reth::revm::primitives::BEDROCK
188+
reth_revm::primitives::BEDROCK
185189
} else if chain_spec.fork(EthereumHardfork::Prague).active_at_head(block) {
186-
reth::revm::primitives::PRAGUE
190+
reth_revm::primitives::PRAGUE
187191
} else if chain_spec.fork(EthereumHardfork::Cancun).active_at_head(block) {
188-
reth::revm::primitives::CANCUN
192+
reth_revm::primitives::CANCUN
189193
} else if chain_spec.fork(EthereumHardfork::Shanghai).active_at_head(block) {
190-
reth::revm::primitives::SHANGHAI
194+
reth_revm::primitives::SHANGHAI
191195
} else if chain_spec.fork(EthereumHardfork::Paris).active_at_head(block) {
192-
reth::revm::primitives::MERGE
196+
reth_revm::primitives::MERGE
193197
} else if chain_spec.fork(EthereumHardfork::London).active_at_head(block) {
194-
reth::revm::primitives::LONDON
198+
reth_revm::primitives::LONDON
195199
} else if chain_spec.fork(EthereumHardfork::Berlin).active_at_head(block) {
196-
reth::revm::primitives::BERLIN
200+
reth_revm::primitives::BERLIN
197201
} else if chain_spec.fork(EthereumHardfork::Istanbul).active_at_head(block) {
198-
reth::revm::primitives::ISTANBUL
202+
reth_revm::primitives::ISTANBUL
199203
} else if chain_spec.fork(EthereumHardfork::Petersburg).active_at_head(block) {
200-
reth::revm::primitives::PETERSBURG
204+
reth_revm::primitives::PETERSBURG
201205
} else if chain_spec.fork(EthereumHardfork::Byzantium).active_at_head(block) {
202-
reth::revm::primitives::BYZANTIUM
206+
reth_revm::primitives::BYZANTIUM
203207
} else if chain_spec.fork(EthereumHardfork::SpuriousDragon).active_at_head(block) {
204-
reth::revm::primitives::SPURIOUS_DRAGON
208+
reth_revm::primitives::SPURIOUS_DRAGON
205209
} else if chain_spec.fork(EthereumHardfork::Tangerine).active_at_head(block) {
206-
reth::revm::primitives::TANGERINE
210+
reth_revm::primitives::TANGERINE
207211
} else if chain_spec.fork(EthereumHardfork::Homestead).active_at_head(block) {
208-
reth::revm::primitives::HOMESTEAD
212+
reth_revm::primitives::HOMESTEAD
209213
} else if chain_spec.fork(EthereumHardfork::Frontier).active_at_head(block) {
210-
reth::revm::primitives::FRONTIER
214+
reth_revm::primitives::FRONTIER
211215
} else {
212216
panic!(
213217
"invalid hardfork chainspec: expected at least one hardfork, got {:?}",
@@ -219,7 +223,7 @@ fn revm_spec(chain_spec: &ChainSpec, block: &Head) -> reth::revm::primitives::Sp
219223
#[cfg(test)]
220224
mod tests {
221225
use super::*;
222-
use reth::primitives::{
226+
use reth_primitives::{
223227
revm_primitives::{BlockEnv, CfgEnv, SpecId},
224228
ForkCondition, Genesis,
225229
};
@@ -230,17 +234,18 @@ mod tests {
230234
let mut cfg_env = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST);
231235
let mut block_env = BlockEnv::default();
232236
let header = Header::default();
233-
let chain_spec = ChainSpecBuilder::default()
234-
.chain(Chain::optimism_mainnet())
235-
.genesis(Genesis::default())
236-
.with_fork(EthereumHardfork::Frontier, ForkCondition::Block(0))
237-
.build();
237+
let chain_spec = Arc::new(
238+
ChainSpecBuilder::default()
239+
.chain(Chain::optimism_mainnet())
240+
.genesis(Genesis::default())
241+
.with_fork(EthereumHardfork::Frontier, ForkCondition::Block(0))
242+
.build(),
243+
);
238244
let total_difficulty = U256::ZERO;
239245

240-
AlphaNetEvmConfig::default().fill_cfg_and_block_env(
246+
AlphaNetEvmConfig::new(chain_spec.clone()).fill_cfg_and_block_env(
241247
&mut cfg_env,
242248
&mut block_env,
243-
&chain_spec,
244249
&header,
245250
total_difficulty,
246251
);

0 commit comments

Comments
 (0)