Skip to content

Commit 214959a

Browse files
authored
backport: Database manipulation tool to release 0.2.0 (#955)
* strata-dbtool outline with command stubs * implementation of get-client-state-update with println for output * implement get-l1-summary and get-l1-manifest commands * implement get-checkpoints-summary, get-checkpoint and get-epoch-summary * implement get-l2-summary and get-l2-block still l2 commands * move block id parsing and validation to utils * implement get-chainstate and revert-chainstate * implement get-syncinfo * implement get-sync-events-summary and get-sync-event * output formatting to support json and porcelain * add README * add functional tests
1 parent 84addaf commit 214959a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+4391
-105
lines changed

Cargo.lock

Lines changed: 29 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ members = [
4343
"bin/datatool",
4444
"bin/alpen-cli",
4545
"bin/strata-client",
46+
"bin/strata-dbtool",
4647
"bin/alpen-reth",
4748
"bin/strata-sequencer-client",
4849
"bin/prover-client",
@@ -58,6 +59,7 @@ default-members = [
5859
"bin/prover-client",
5960
"bin/alpen-reth",
6061
"bin/strata-client",
62+
"bin/strata-dbtool",
6163
"bin/strata-sequencer-client",
6264
"crates/util/python-utils",
6365
]
@@ -73,6 +75,7 @@ alpen-reth-primitives = { path = "crates/reth/primitives" }
7375
alpen-reth-rpc = { path = "crates/reth/rpc" }
7476
strata-btcio = { path = "crates/btcio" }
7577
strata-chaintsn = { path = "crates/chaintsn" }
78+
strata-cli-common = { path = "crates/strata-cli-common" }
7679
strata-common = { path = "crates/common" }
7780
strata-config = { path = "crates/config" }
7881
strata-consensus-logic = { path = "crates/consensus-logic" }
@@ -195,7 +198,7 @@ borsh = { version = "1.5.0", features = ["derive"] }
195198
bytes = "1.6.0"
196199
cfg-if = "1.0.0"
197200
chrono = "0.4.38"
198-
clap = "4"
201+
clap = { version = "4.5.39", default-features = false, features = ["derive"] }
199202
deadpool = "0.12.1"
200203
digest = "0.10"
201204
ethnum = "1.5.0"

bin/alpen-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name = "alpen"
88
path = "src/main.rs"
99

1010
[dependencies]
11+
strata-cli-common.workspace = true
1112
strata-primitives.workspace = true
1213

1314
aes-gcm-siv = "0.11.1"

bin/alpen-cli/src/cmd/backup.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use argh::FromArgs;
22
use bip39::Language;
3+
use strata_cli_common::errors::DisplayedError;
34

4-
use crate::{errors::DisplayedError, seed::Seed};
5+
use crate::seed::Seed;
56

67
#[derive(FromArgs, PartialEq, Debug)]
78
#[argh(subcommand, name = "backup")]

bin/alpen-cli/src/cmd/balance.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@ use alloy::{
44
};
55
use argh::FromArgs;
66
use bdk_wallet::bitcoin::Amount;
7+
use strata_cli_common::errors::{DisplayableError, DisplayedError};
78

89
use crate::{
9-
alpen::AlpenWallet,
10-
constants::SATS_TO_WEI,
11-
errors::{DisplayableError, DisplayedError},
12-
net_type::NetworkType,
13-
seed::Seed,
14-
settings::Settings,
15-
signet::SignetWallet,
10+
alpen::AlpenWallet, constants::SATS_TO_WEI, net_type::NetworkType, seed::Seed,
11+
settings::Settings, signet::SignetWallet,
1612
};
1713

1814
/// Prints the wallet's current balance(s)

bin/alpen-cli/src/cmd/change_pwd.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use argh::FromArgs;
22
use rand_core::OsRng;
3+
use strata_cli_common::errors::{DisplayableError, DisplayedError};
34

4-
use crate::{
5-
errors::{DisplayableError, DisplayedError},
6-
seed::{password::Password, EncryptedSeedPersister, Seed},
7-
};
5+
use crate::seed::{password::Password, EncryptedSeedPersister, Seed};
86

97
/// Changes the seed's encryption password
108
#[derive(FromArgs, PartialEq, Debug)]

bin/alpen-cli/src/cmd/debug.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
use argh::FromArgs;
2+
use strata_cli_common::errors::{DisplayableError, DisplayedError};
23

3-
use crate::{
4-
errors::{DisplayableError, DisplayedError},
5-
recovery::DescriptorRecovery,
6-
seed::Seed,
7-
settings::Settings,
8-
};
4+
use crate::{recovery::DescriptorRecovery, seed::Seed, settings::Settings};
95

106
/// Various debug utilities
117
#[derive(FromArgs, PartialEq, Debug)]

bin/alpen-cli/src/cmd/deposit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ use colored::Colorize;
1515
use indicatif::ProgressBar;
1616
use rand_core::OsRng;
1717
use shrex::encode;
18+
use strata_cli_common::errors::{DisplayableError, DisplayedError};
1819
use strata_primitives::crypto::even_kp;
1920

2021
use crate::{
2122
alpen::AlpenWallet,
2223
constants::SIGNET_BLOCK_TIME,
23-
errors::{DisplayableError, DisplayedError},
2424
link::{OnchainObject, PrettyPrint},
2525
recovery::DescriptorRecovery,
2626
seed::Seed,

bin/alpen-cli/src/cmd/drain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use bdk_wallet::{
1111
error::CreateTxError,
1212
};
1313
use colored::Colorize;
14+
use strata_cli_common::errors::{DisplayableError, DisplayedError};
1415

1516
use crate::{
1617
alpen::AlpenWallet,
1718
constants::SATS_TO_WEI,
18-
errors::{DisplayableError, DisplayedError},
1919
link::{OnchainObject, PrettyPrint},
2020
seed::Seed,
2121
settings::Settings,

bin/alpen-cli/src/cmd/faucet.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ use reqwest::{StatusCode, Url};
88
use serde::{Deserialize, Serialize};
99
use sha2::{Digest, Sha256};
1010
use shrex::{encode, Hex};
11+
use strata_cli_common::errors::{DisplayableError, DisplayedError};
1112

1213
use crate::{
13-
alpen::AlpenWallet,
14-
errors::{DisplayableError, DisplayedError},
15-
net_type::NetworkType,
16-
seed::Seed,
17-
settings::Settings,
18-
signet::SignetWallet,
14+
alpen::AlpenWallet, net_type::NetworkType, seed::Seed, settings::Settings, signet::SignetWallet,
1915
};
2016

2117
/// Requests BTC from the faucet

0 commit comments

Comments
 (0)