Merge branch 'main' into schouhy/adapt-sequencer-to-bedrock

This commit is contained in:
Sergio Chouhy 2026-01-14 23:27:04 -03:00
commit ae5fe0a2a5
7 changed files with 73 additions and 56 deletions

3
Cargo.lock generated
View File

@ -957,7 +957,6 @@ version = "0.1.0"
dependencies = [
"anyhow",
"common-http-client",
"key-management-system-service",
"reqwest",
]
@ -5175,7 +5174,6 @@ dependencies = [
"storage",
"tempfile",
"tokio",
"zksign",
]
[[package]]
@ -5216,7 +5214,6 @@ dependencies = [
"sequencer_core",
"sequencer_rpc",
"tokio",
"zksign",
]
[[package]]

View File

@ -7,4 +7,3 @@ edition = "2024"
reqwest.workspace = true
anyhow.workspace = true
common-http-client.workspace = true
key-management-system-service.workspace = true

View File

@ -18,9 +18,8 @@ tempfile.workspace = true
chrono.workspace = true
log.workspace = true
bedrock_client.workspace = true
key-management-system-service = { git = "https://github.com/logos-blockchain/logos-blockchain.git" }
nomos-core = { git = "https://github.com/logos-blockchain/logos-blockchain.git" }
zksign = { git = "https://github.com/logos-blockchain/logos-blockchain.git", default-features = false }
key-management-system-service.workspace = true
nomos-core.workspace=true
rand.workspace = true
reqwest.workspace = true
borsh.workspace = true

View File

@ -67,3 +67,12 @@ impl SequencerConfig {
Ok(serde_json::from_reader(reader)?)
}
}
impl SequencerConfig {
pub fn from_path(config_home: &Path) -> Result<SequencerConfig> {
let file = File::open(config_home)?;
let reader = BufReader::new(file);
Ok(serde_json::from_reader(reader)?)
}
}

View File

@ -9,7 +9,6 @@ sequencer_core = { workspace = true, features = ["testnet"] }
sequencer_rpc.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
zksign = { git = "https://github.com/logos-blockchain/logos-blockchain.git", default-features = false }
anyhow.workspace = true
env_logger.workspace = true
log.workspace = true

View File

@ -14,7 +14,7 @@ serde_json.workspace = true
env_logger.workspace = true
log.workspace = true
serde.workspace = true
tokio.workspace = true
tokio = { workspace = true, features = ["macros"] }
clap.workspace = true
base64.workspace = true
bytemuck.workspace = true

View File

@ -10,7 +10,13 @@ use crate::{
#[derive(Subcommand, Debug, Clone)]
pub enum ConfigSubcommand {
/// Getter of config fields
Get { key: String },
Get {
/// Print all config fields
#[arg(short, long)]
all: bool,
/// Config field key to get
key: Option<String>,
},
/// Setter of config fields
Set { key: String, value: String },
/// Prints description of corresponding field
@ -23,58 +29,66 @@ impl WalletSubcommand for ConfigSubcommand {
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
ConfigSubcommand::Get { key } => match key.as_str() {
"all" => {
ConfigSubcommand::Get { all, key } => {
if all {
let config_str =
serde_json::to_string_pretty(&wallet_core.storage.wallet_config)?;
println!("{config_str}");
}
"override_rust_log" => {
if let Some(value) = &wallet_core.storage.wallet_config.override_rust_log {
println!("{value}");
} else {
println!("Not set");
} else if let Some(key) = key {
match key.as_str() {
"override_rust_log" => {
if let Some(value) =
&wallet_core.storage.wallet_config.override_rust_log
{
println!("{value}");
} else {
println!("Not set");
}
}
"sequencer_addr" => {
println!("{}", wallet_core.storage.wallet_config.sequencer_addr);
}
"seq_poll_timeout_millis" => {
println!(
"{}",
wallet_core.storage.wallet_config.seq_poll_timeout_millis
);
}
"seq_tx_poll_max_blocks" => {
println!(
"{}",
wallet_core.storage.wallet_config.seq_tx_poll_max_blocks
);
}
"seq_poll_max_retries" => {
println!("{}", wallet_core.storage.wallet_config.seq_poll_max_retries);
}
"seq_block_poll_max_amount" => {
println!(
"{}",
wallet_core.storage.wallet_config.seq_block_poll_max_amount
);
}
"initial_accounts" => {
println!("{:#?}", wallet_core.storage.wallet_config.initial_accounts);
}
"basic_auth" => {
if let Some(basic_auth) = &wallet_core.storage.wallet_config.basic_auth
{
println!("{basic_auth}");
} else {
println!("Not set");
}
}
_ => {
println!("Unknown field");
}
}
} else {
println!("Please provide a key or use --all flag");
}
"sequencer_addr" => {
println!("{}", wallet_core.storage.wallet_config.sequencer_addr);
}
"seq_poll_timeout_millis" => {
println!(
"{}",
wallet_core.storage.wallet_config.seq_poll_timeout_millis
);
}
"seq_tx_poll_max_blocks" => {
println!(
"{}",
wallet_core.storage.wallet_config.seq_tx_poll_max_blocks
);
}
"seq_poll_max_retries" => {
println!("{}", wallet_core.storage.wallet_config.seq_poll_max_retries);
}
"seq_block_poll_max_amount" => {
println!(
"{}",
wallet_core.storage.wallet_config.seq_block_poll_max_amount
);
}
"initial_accounts" => {
println!("{:#?}", wallet_core.storage.wallet_config.initial_accounts);
}
"basic_auth" => {
if let Some(basic_auth) = &wallet_core.storage.wallet_config.basic_auth {
println!("{basic_auth}");
} else {
println!("Not set");
}
}
_ => {
println!("Unknown field");
}
},
}
ConfigSubcommand::Set { key, value } => {
match key.as_str() {
"override_rust_log" => {