MCPcopy Create free account
hub / github.com/base/base / execute

Method execute

crates/execution/cli/src/commands/base_proofs/unwind.rs:51–92  ·  view source on GitHub ↗

Execute [`UnwindCommand`].

(
        self,
        runtime: reth_tasks::Runtime,
    )

Source from the content-addressed store, hash-verified

49impl<C: ChainSpecParser<ChainSpec = BaseChainSpec>> UnwindCommand<C> {
50 /// Execute [`UnwindCommand`].
51 pub async fn execute<N: CliNodeTypes<ChainSpec = C::ChainSpec, Primitives = BasePrimitives>>(
52 self,
53 runtime: reth_tasks::Runtime,
54 ) -> eyre::Result<()> {
55 let Self { env, storage_path, proofs_history_db, proofs_history_rocksdb, target } = self;
56
57 info!(target: "reth::cli", version = %version_metadata().short_version, "reth starting");
58 info!(
59 target: "reth::cli",
60 path = ?storage_path,
61 backend = ?proofs_history_db,
62 "Unwinding Base proofs storage"
63 );
64 proofs_history_db.ensure_storage_path_matches(&storage_path)?;
65
66 // Initialize the environment with read-only access
67 let Environment { provider_factory, .. } = env.init::<N>(AccessRights::RO, runtime)?;
68
69 match proofs_history_db {
70 ProofsHistoryDbBackend::Rocksdb => {
71 let storage: BaseProofsStorage<Arc<RocksdbProofsStorage>> = Arc::new(
72 RocksdbProofsStorage::new_with_options(
73 &storage_path,
74 proofs_history_rocksdb.storage_options()?,
75 )
76 .map_err(|e| eyre::eyre!("Failed to create RocksdbProofsStorage: {e}"))?,
77 )
78 .into();
79 Self::unwind_storage(target, &provider_factory, storage)?;
80 }
81 ProofsHistoryDbBackend::Mdbx => {
82 let storage: BaseProofsStorage<Arc<MdbxProofsStorage>> = Arc::new(
83 MdbxProofsStorage::new(&storage_path)
84 .map_err(|e| eyre::eyre!("Failed to create MdbxProofsStorage: {e}"))?,
85 )
86 .into();
87 Self::unwind_storage(target, &provider_factory, storage)?;
88 }
89 }
90
91 Ok(())
92 }
93
94 fn unwind_storage<S, P>(
95 target: u64,

Callers

nothing calls this directly

Calls 2

storage_optionsMethod · 0.80

Tested by

no test coverage detected