Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #136 from anton-rs/merklefruit/rm-optimism-chain-s…
Browse files Browse the repository at this point in the history
…pec-field

chore(primitives): remove optimism field in ChainSpec
  • Loading branch information
refcell authored Oct 31, 2023
2 parents b752b9e + 497b96e commit 773d566
Show file tree
Hide file tree
Showing 22 changed files with 154 additions and 181 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions bin/reth/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ mod tests {
genesis_hash: None,
paris_block_and_final_difficulty: None,
deposit_contract: None,
#[cfg(feature = "optimism")]
optimism: false,
..Default::default()
});

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
// client from performing the derivation pipeline from genesis, and instead
// starts syncing from the current tip in the DB.
#[cfg(feature = "optimism")]
if self.chain.optimism && !self.rollup.enable_genesis_walkback {
if self.chain.is_optimism() && !self.rollup.enable_genesis_walkback {
let client = _rpc_server_handles.auth.http_client();
reth_rpc_api::EngineApiClient::fork_choice_updated_v2(
&client,
Expand Down
16 changes: 8 additions & 8 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ where
// On Optimism, the proposers are allowed to reorg their own chain at will.
cfg_if::cfg_if! {
if #[cfg(feature = "optimism")] {
if self.chain_spec().optimism {
if self.chain_spec().is_optimism() {
debug!(
target: "consensus::engine",
fcu_head_num=?header.number,
Expand Down Expand Up @@ -1647,7 +1647,7 @@ where
if reached_max_block {
// Terminate the sync early if it's reached the maximum user
// configured block.
return Some(Ok(()));
return Some(Ok(()))
}

if let ControlFlow::Unwind { bad_block, .. } = ctrl {
Expand Down Expand Up @@ -1843,7 +1843,7 @@ where
},
)? {
this.on_hook_result(result)?;
continue;
continue
}

// Process one incoming message from the CL. We don't drain the messages right away,
Expand Down Expand Up @@ -1878,12 +1878,12 @@ where
this.listeners.push_listener(tx);
}
}
continue;
continue
}

// Both running hook with db write access and engine messages are pending,
// proceed to other polls
break;
break
}

// process sync events if any
Expand All @@ -1894,7 +1894,7 @@ where
}
// this could have taken a while, so we start the next cycle to handle any new
// engine messages
continue 'main;
continue 'main
}
Poll::Pending => {
// no more sync events to process
Expand All @@ -1919,7 +1919,7 @@ where

// ensure we're polling until pending while also checking for new engine
// messages before polling the next hook
continue 'main;
continue 'main
}
}

Expand Down Expand Up @@ -2037,7 +2037,7 @@ mod tests {
result,
Err(BeaconConsensusEngineError::Pipeline(n)) if matches!(*n.as_ref(), PipelineError::Stage(StageError::ChannelClosed))
);
break;
break
}
Err(TryRecvError::Empty) => {
let _ = env
Expand Down
3 changes: 3 additions & 0 deletions crates/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ reth-primitives.workspace = true
reth-interfaces.workspace = true
reth-provider.workspace = true

# misc
cfg-if = "1.0.0"

[dev-dependencies]
reth-interfaces = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
Expand Down
Loading

0 comments on commit 773d566

Please sign in to comment.