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

Commit ddf16f5

Browse files
committed
feat: activate prague always
1 parent c41ce47 commit ddf16f5

File tree

6 files changed

+35
-3
lines changed

6 files changed

+35
-3
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ tokio = { version = "1.21", default-features = false }
7272
# reth
7373
reth = { git = "https://github.com/paradigmxyz/reth.git", rev = "e4b5325" }
7474
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "e4b5325" }
75+
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", rev = "e4b5325" }
7576
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", rev = "e4b5325" }
7677
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "e4b5325" }
7778
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "e4b5325" }

bin/alphanet/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
//! - `min-debug-logs`: Disables all logs below `debug` level.
2424
//! - `min-trace-logs`: Disables all logs below `trace` level.
2525
26-
use alphanet_node::node::AlphaNetNode;
26+
use alphanet_node::{chainspec::AlphanetChainSpecParser, node::AlphaNetNode};
2727
use clap::Parser;
2828
use reth_node_optimism::args::RollupArgs;
29-
use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
29+
use reth_optimism_cli::Cli;
3030
use reth_optimism_rpc::eth::rpc::SequencerClient;
3131

3232
// We use jemalloc for performance reasons.
@@ -45,7 +45,7 @@ fn main() {
4545
}
4646

4747
if let Err(err) =
48-
Cli::<OpChainSpecParser, RollupArgs>::parse().run(|builder, rollup_args| async move {
48+
Cli::<AlphanetChainSpecParser, RollupArgs>::parse().run(|builder, rollup_args| async move {
4949
let node = builder
5050
.node(AlphaNetNode::new(rollup_args.clone()))
5151
.extend_rpc_modules(move |ctx| {

crates/node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ categories.workspace = true
1212
[dependencies]
1313
alphanet-precompile.workspace = true
1414
reth.workspace = true
15+
reth-cli.workspace = true
1516
reth-node-api.workspace = true
1617
reth-node-optimism.workspace = true
1718
reth-chainspec.workspace = true

crates/node/src/chainspec.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! Alphanet chainspec parsing logic.
2+
3+
use reth::{chainspec::ChainSpec, core::args::utils::parse_custom_chain_spec};
4+
use reth_chainspec::{EthereumHardfork, ForkCondition};
5+
use reth_cli::chainspec::ChainSpecParser;
6+
use std::sync::Arc;
7+
8+
/// Alphanet chain specification parser.
9+
#[derive(Debug, Clone, Default)]
10+
pub struct AlphanetChainSpecParser;
11+
12+
impl ChainSpecParser for AlphanetChainSpecParser {
13+
type ChainSpec = ChainSpec;
14+
15+
const SUPPORTED_CHAINS: &'static [&'static str] = &[];
16+
17+
fn parse(s: &str) -> eyre::Result<Arc<Self::ChainSpec>> {
18+
let mut chainspec = parse_custom_chain_spec(s)?;
19+
20+
// NOTE(onbjerg): This is a temporary workaround until we figure out a better way to
21+
// activate Prague based on a custom fork name. Currently there does not seem to be a good
22+
// way to do it.
23+
chainspec.hardforks.insert(EthereumHardfork::Prague, ForkCondition::Timestamp(0));
24+
25+
Ok(Arc::new(chainspec))
26+
}
27+
}

crates/node/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1616
#![warn(unused_crate_dependencies)]
1717

18+
pub mod chainspec;
1819
pub mod evm;
1920
pub mod node;

0 commit comments

Comments
 (0)