Skip to content

Commit

Permalink
pd(upgrade): simplify upgrade command
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Sep 11, 2023
1 parent 2e30a6b commit e28e2ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 2 additions & 11 deletions crates/bin/pd/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::clone_on_copy)]
#![recursion_limit = "512"]
use std::time::Duration;
use std::{net::SocketAddr, path::PathBuf};

use console_subscriber::ConsoleLayer;
Expand All @@ -18,13 +17,12 @@ use pd::testnet::{
join::testnet_join,
};
use pd::upgrade::{self, Upgrade};
use penumbra_chain::component::AppHash;
use penumbra_proto::client::v1alpha1::{
oblivious_query_service_server::ObliviousQueryServiceServer,
specific_query_service_server::SpecificQueryServiceServer,
tendermint_proxy_service_server::TendermintProxyServiceServer,
};
use penumbra_storage::{StateDelta, StateRead, Storage};
use penumbra_storage::{StateDelta, Storage};
use penumbra_tendermint_proxy::TendermintProxy;
use penumbra_tower_trace::remote_addr;
use rand::Rng;
Expand Down Expand Up @@ -138,9 +136,6 @@ enum RootCommand {
/// Run a migration on the exported storage state of the full node,
/// and create a genesis file.
Upgrade {
/// The data directory of the full node.
#[clap(long, env = "PENUMBRA_PD_HOME", display_order = 100)]
data_path: PathBuf,
/// The directory containing the exported state.
#[clap(long, display_order = 200)]
export_path: PathBuf,
Expand Down Expand Up @@ -605,11 +600,7 @@ async fn main() -> anyhow::Result<()> {
// - apply checks: root hash, size, etc.
todo!()
}
RootCommand::Upgrade {
// TODO(erwan): overwrite the data dir with the migrated state
data_path: _data_path,
export_path,
} => {
RootCommand::Upgrade { export_path } => {
tracing::info!("upgrading state from {}", export_path.display());
let _ = upgrade::migrate(export_path.clone(), Upgrade::Testnet60)
.await
Expand Down
4 changes: 2 additions & 2 deletions crates/bin/pd/src/upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{path::PathBuf, time::Duration};
use std::path::PathBuf;

use penumbra_chain::{
component::{AppHash, StateReadExt},
genesis::AppState,
};
use penumbra_stake::StateReadExt as _;
use penumbra_storage::{StateDelta, StateRead, StateWrite, Storage};
use penumbra_storage::{StateDelta, StateWrite, Storage};

use crate::testnet::generate::TestnetConfig;

Expand Down

0 comments on commit e28e2ce

Please sign in to comment.