Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flat storage] adding debug tool for flat storage #8531

Merged
merged 12 commits into from
Feb 22, 2023
73 changes: 73 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion neard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ near-cold-store-tool = { path = "../tools/cold-store", package = "cold-store-too
near-config-utils = { path = "../utils/config" }
near-crypto = { path = "../core/crypto" }
near-dyn-configs = { path = "../core/dyn-configs" }
near-flat-storage = { path = "../tools/flat-storage" }
near-jsonrpc-primitives = { path = "../chain/jsonrpc-primitives" }
near-mirror = { path = "../tools/mirror" }
near-network = { path = "../chain/network" }
Expand Down Expand Up @@ -64,12 +65,13 @@ delay_detector = ["nearcore/delay_detector"]
rosetta_rpc = ["nearcore/rosetta_rpc"]
json_rpc = ["nearcore/json_rpc"]
protocol_feature_fix_staking_threshold = ["nearcore/protocol_feature_fix_staking_threshold"]
protocol_feature_flat_state = ["nearcore/protocol_feature_flat_state"]
protocol_feature_flat_state = ["nearcore/protocol_feature_flat_state", "near-flat-storage/protocol_feature_flat_state"]

nightly = [
"nightly_protocol",
"nearcore/nightly",
"near-state-viewer/nightly",
"protocol_feature_flat_state",
]
nightly_protocol = ["nearcore/nightly_protocol"]

Expand Down
10 changes: 10 additions & 0 deletions neard/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use near_chain_configs::GenesisValidationMode;
use near_client::ConfigUpdater;
use near_cold_store_tool::ColdStoreCommand;
use near_dyn_configs::{UpdateableConfigLoader, UpdateableConfigLoaderError, UpdateableConfigs};
#[cfg(feature = "protocol_feature_flat_state")]
use near_flat_storage::commands::FlatStorageCommand;
use near_jsonrpc_primitives::types::light_client::RpcLightClientExecutionProofResponse;
use near_mirror::MirrorCommand;
use near_network::tcp;
Expand Down Expand Up @@ -116,6 +118,10 @@ impl NeardCmd {
NeardSubCommand::StateParts(cmd) => {
cmd.run()?;
}
#[cfg(feature = "protocol_feature_flat_state")]
NeardSubCommand::FlatStorage(cmd) => {
cmd.run(&home_dir)?;
}
NeardSubCommand::ValidateConfig(cmd) => {
cmd.run(&home_dir)?;
}
Expand Down Expand Up @@ -229,6 +235,10 @@ pub(super) enum NeardSubCommand {
/// Connects to a NEAR node and sends state parts requests after the handshake is completed.
StateParts(StatePartsCommand),

#[cfg(feature = "protocol_feature_flat_state")]
/// Flat storage related tooling.
FlatStorage(FlatStorageCommand),

/// validate config files including genesis.json and config.json
ValidateConfig(ValidateConfigCommand),
}
Expand Down
29 changes: 29 additions & 0 deletions tools/flat-storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "near-flat-storage"
version = "0.0.0"
authors.workspace = true
publish = false
edition.workspace = true

[dependencies]
anyhow.workspace = true
borsh.workspace = true
clap.workspace = true
rayon.workspace = true

tqdm = "0.4.4"

near-chain = { path = "../../chain/chain" }
near-chain-configs = { path = "../../core/chain-configs" }

near-epoch-manager = { path = "../../chain/epoch-manager" }
near-primitives = { path = "../../core/primitives" }
near-store = { path = "../../core/store" }
nearcore = { path = "../../nearcore" }

[features]
protocol_feature_flat_state = [
"nearcore/protocol_feature_flat_state",
"near-chain/protocol_feature_flat_state",
"near-store/protocol_feature_flat_state",
]
1 change: 1 addition & 0 deletions tools/flat-storage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set of tools for debugging and experimenting with flat storage.
Loading