mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor(stages): previous_stage -> target in ExecInput (#3030)
This commit is contained in:
@ -111,7 +111,7 @@ impl Command {
|
||||
.execute(
|
||||
&mut tx,
|
||||
ExecInput {
|
||||
previous_stage: Some((StageId::SenderRecovery, block)),
|
||||
target: Some(block),
|
||||
checkpoint: block.checked_sub(1).map(StageCheckpoint::new),
|
||||
},
|
||||
)
|
||||
@ -123,7 +123,7 @@ impl Command {
|
||||
.execute(
|
||||
&mut tx,
|
||||
ExecInput {
|
||||
previous_stage: Some((StageId::Execution, block)),
|
||||
target: Some(block),
|
||||
checkpoint: progress.map(StageCheckpoint::new),
|
||||
},
|
||||
)
|
||||
@ -137,7 +137,7 @@ impl Command {
|
||||
.execute(
|
||||
&mut tx,
|
||||
ExecInput {
|
||||
previous_stage: Some((StageId::AccountHashing, block)),
|
||||
target: Some(block),
|
||||
checkpoint: progress.map(StageCheckpoint::new),
|
||||
},
|
||||
)
|
||||
@ -149,7 +149,7 @@ impl Command {
|
||||
.execute(
|
||||
&mut tx,
|
||||
ExecInput {
|
||||
previous_stage: Some((StageId::StorageHashing, block)),
|
||||
target: Some(block),
|
||||
checkpoint: progress.map(StageCheckpoint::new),
|
||||
},
|
||||
)
|
||||
@ -166,10 +166,7 @@ impl Command {
|
||||
.walk_range(..)?
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
let clean_input = ExecInput {
|
||||
previous_stage: Some((StageId::StorageHashing, block)),
|
||||
checkpoint: None,
|
||||
};
|
||||
let clean_input = ExecInput { target: Some(block), checkpoint: None };
|
||||
loop {
|
||||
let clean_result = merkle_stage.execute(&mut tx, clean_input).await;
|
||||
assert!(clean_result.is_ok(), "Clean state root calculation failed");
|
||||
|
||||
@ -4,10 +4,7 @@ use eyre::Result;
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, table::TableImporter, tables, transaction::DbTx,
|
||||
};
|
||||
use reth_primitives::{
|
||||
stage::{StageCheckpoint, StageId},
|
||||
MAINNET,
|
||||
};
|
||||
use reth_primitives::{stage::StageCheckpoint, MAINNET};
|
||||
use reth_provider::Transaction;
|
||||
use reth_stages::{stages::ExecutionStage, Stage, UnwindInput};
|
||||
use std::{ops::DerefMut, path::PathBuf, sync::Arc};
|
||||
@ -139,7 +136,7 @@ async fn dry_run(
|
||||
.execute(
|
||||
&mut tx,
|
||||
reth_stages::ExecInput {
|
||||
previous_stage: Some((StageId::Other("Another"), to)),
|
||||
target: Some(to),
|
||||
checkpoint: Some(StageCheckpoint::new(from)),
|
||||
},
|
||||
)
|
||||
|
||||
@ -2,10 +2,7 @@ use super::setup;
|
||||
use crate::utils::DbTool;
|
||||
use eyre::Result;
|
||||
use reth_db::{database::Database, table::TableImporter, tables};
|
||||
use reth_primitives::{
|
||||
stage::{StageCheckpoint, StageId},
|
||||
BlockNumber,
|
||||
};
|
||||
use reth_primitives::{stage::StageCheckpoint, BlockNumber};
|
||||
use reth_provider::Transaction;
|
||||
use reth_stages::{stages::AccountHashingStage, Stage, UnwindInput};
|
||||
use std::{ops::DerefMut, path::PathBuf};
|
||||
@ -83,7 +80,7 @@ async fn dry_run(
|
||||
.execute(
|
||||
&mut tx,
|
||||
reth_stages::ExecInput {
|
||||
previous_stage: Some((StageId::Other("Another"), to)),
|
||||
target: Some(to),
|
||||
checkpoint: Some(StageCheckpoint::new(from)),
|
||||
},
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@ use super::setup;
|
||||
use crate::utils::DbTool;
|
||||
use eyre::Result;
|
||||
use reth_db::{database::Database, table::TableImporter, tables};
|
||||
use reth_primitives::stage::{StageCheckpoint, StageId};
|
||||
use reth_primitives::stage::StageCheckpoint;
|
||||
use reth_provider::Transaction;
|
||||
use reth_stages::{stages::StorageHashingStage, Stage, UnwindInput};
|
||||
use std::{ops::DerefMut, path::PathBuf};
|
||||
@ -77,7 +77,7 @@ async fn dry_run(
|
||||
.execute(
|
||||
&mut tx,
|
||||
reth_stages::ExecInput {
|
||||
previous_stage: Some((StageId::Other("Another"), to)),
|
||||
target: Some(to),
|
||||
checkpoint: Some(StageCheckpoint::new(from)),
|
||||
},
|
||||
)
|
||||
|
||||
@ -2,10 +2,7 @@ use super::setup;
|
||||
use crate::utils::DbTool;
|
||||
use eyre::Result;
|
||||
use reth_db::{database::Database, table::TableImporter, tables};
|
||||
use reth_primitives::{
|
||||
stage::{StageCheckpoint, StageId},
|
||||
BlockNumber, MAINNET,
|
||||
};
|
||||
use reth_primitives::{stage::StageCheckpoint, BlockNumber, MAINNET};
|
||||
use reth_provider::Transaction;
|
||||
use reth_stages::{
|
||||
stages::{
|
||||
@ -57,10 +54,8 @@ async fn unwind_and_copy<DB: Database>(
|
||||
checkpoint: StageCheckpoint::new(tip_block_number),
|
||||
bad_block: None,
|
||||
};
|
||||
let execute_input = reth_stages::ExecInput {
|
||||
previous_stage: Some((StageId::Other("Another"), to)),
|
||||
checkpoint: Some(StageCheckpoint::new(from)),
|
||||
};
|
||||
let execute_input =
|
||||
reth_stages::ExecInput { target: Some(to), checkpoint: Some(StageCheckpoint::new(from)) };
|
||||
|
||||
// Unwind hashes all the way to FROM
|
||||
StorageHashingStage::default().unwind(&mut unwind_tx, unwind).await.unwrap();
|
||||
@ -128,7 +123,7 @@ async fn dry_run(
|
||||
.execute(
|
||||
&mut tx,
|
||||
reth_stages::ExecInput {
|
||||
previous_stage: Some((StageId::Other("Another"), to)),
|
||||
target: Some(to),
|
||||
checkpoint: Some(StageCheckpoint::new(from)),
|
||||
},
|
||||
)
|
||||
|
||||
@ -11,7 +11,7 @@ use clap::Parser;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_config::Config;
|
||||
use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
|
||||
use reth_primitives::{stage::StageId, ChainSpec};
|
||||
use reth_primitives::ChainSpec;
|
||||
use reth_provider::{providers::get_stage_checkpoint, ShareableDatabase, Transaction};
|
||||
use reth_staged_sync::utils::init::init_db;
|
||||
use reth_stages::{
|
||||
@ -232,7 +232,7 @@ impl Command {
|
||||
}
|
||||
|
||||
let mut input = ExecInput {
|
||||
previous_stage: Some((StageId::Other("No Previous Stage"), self.to)),
|
||||
target: Some(self.to),
|
||||
checkpoint: Some(checkpoint.with_block_number(self.from)),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user