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

Commit

Permalink
clippy + 🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Oct 15, 2023
1 parent e173828 commit 7e2070d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 1,429 deletions.
2 changes: 1 addition & 1 deletion bin/reth/src/args/payload_builder_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl PayloadBuilderConfig for PayloadBuilderArgs {
// TODO(clabby): Move to rollupargs
#[cfg(feature = "optimism")]
fn compute_pending_block(&self) -> bool {
true
false
}
}

Expand Down
5 changes: 3 additions & 2 deletions bin/reth/src/cli/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ pub trait RethNodeCommandConfig: fmt::Debug {

// TODO(clabby): Re-add conf option
#[cfg(feature = "optimism")]
let payload_job_config = payload_job_config.compute_pending_block(false);
let payload_job_config =
payload_job_config.compute_pending_block(conf.compute_pending_block());

// The default payload builder is implemented on the unit type.
#[cfg(not(feature = "optimism"))]
Expand All @@ -121,7 +122,7 @@ pub trait RethNodeCommandConfig: fmt::Debug {
#[cfg(feature = "optimism")]
let payload_builder = reth_basic_payload_builder::OptimismPayloadBuilder;

let payload_generator = BasicPayloadJobGenerator::new(
let payload_generator = BasicPayloadJobGenerator::with_builder(
components.provider(),
components.pool(),
components.task_executor(),
Expand Down
18 changes: 17 additions & 1 deletion crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,30 @@ where
Ok(outcome) => {
match outcome {
CanonicalOutcome::AlreadyCanonical { ref header } => {
#[cfg(not(feature = "optimism"))]
debug!(
target: "consensus::engine",
fcu_head_num=?header.number,
current_head_num=?self.blockchain.canonical_tip().number,
"Ignoring beacon update to old head"
);

// TODO(clabby): Update anyways for optimism.
#[cfg(feature = "optimism")]
if self.chain_spec().optimism {
debug!(
target: "consensus::engine",
fcu_head_num=?header.number,
current_head_num=?self.blockchain.canonical_tip().number,
"[Optimism] Allowing beacon reorg to old head"
);
let _ = self.update_head(header.clone());
self.listeners.notify(
BeaconConsensusEngineEvent::CanonicalChainCommitted(
header.clone(),
elapsed,
),
);
}
}
CanonicalOutcome::Committed { ref head } => {
debug!(
Expand Down
5 changes: 2 additions & 3 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,16 @@ pub struct BasicPayloadJobGenerator<Client, Pool, Tasks, Builder = ()> {

// === impl BasicPayloadJobGenerator ===

impl<Client, Pool, Tasks, Builder> BasicPayloadJobGenerator<Client, Pool, Tasks, Builder> {
impl<Client, Pool, Tasks> BasicPayloadJobGenerator<Client, Pool, Tasks> {
/// Creates a new [BasicPayloadJobGenerator] with the given config.
pub fn new(
client: Client,
pool: Pool,
executor: Tasks,
config: BasicPayloadJobGeneratorConfig,
chain_spec: Arc<ChainSpec>,
builder: Builder,
) -> Self {
BasicPayloadJobGenerator::with_builder(client, pool, executor, config, chain_spec, builder)
BasicPayloadJobGenerator::with_builder(client, pool, executor, config, chain_spec, ())
}
}

Expand Down
12 changes: 5 additions & 7 deletions crates/payload/basic/src/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ where
// nonces, so we don't need to touch the DB for those.
let depositor = (is_regolith && sequencer_tx.is_deposit())
.then(|| {
Ok::<_, PayloadBuilderError>(
db.load_cache_account(sequencer_tx.signer())
.map_err(|_| PayloadBuilderError::AccountLoadFailed(sequencer_tx.signer()))?
.clone()
.account
.ok_or(PayloadBuilderError::AccountLoadFailed(sequencer_tx.signer()))?,
)
db.load_cache_account(sequencer_tx.signer())
.map_err(|_| PayloadBuilderError::AccountLoadFailed(sequencer_tx.signer()))?
.clone()
.account
.ok_or(PayloadBuilderError::AccountLoadFailed(sequencer_tx.signer()))
})
.transpose()?;

Expand Down
Loading

0 comments on commit 7e2070d

Please sign in to comment.