Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7978ad0
Feat: Adding message_types.rs
ch4r10t33r Aug 31, 2025
dcf8b61
feat: parallelise key generation
ch4r10t33r Aug 31, 2025
6771ad2
feat: amended generate_keys function to create multiple keys based on…
ch4r10t33r Aug 31, 2025
9021822
fix: resolved udeps error
ch4r10t33r Aug 31, 2025
c3712de
feat: Added struct definitions for post quantum keystore
ch4r10t33r Sep 1, 2025
259be58
feat: Saving to QsKeystore
ch4r10t33r Sep 1, 2025
2737548
feat: Added passphrase parameter to account_manager command
ch4r10t33r Sep 2, 2025
d18c60c
Merge branch 'master' into account_manager
ch4r10t33r Sep 14, 2025
cdbaba7
fix: review comments
ch4r10t33r Sep 14, 2025
4ba922c
fix: fixed cargo fmt issue
ch4r10t33r Sep 14, 2025
1731b6d
fix: removed ascii art
ch4r10t33r Sep 17, 2025
dc65161
fix: fixed review comments
ch4r10t33r Sep 17, 2025
193b96c
Merge branch 'master' into account_manager
ch4r10t33r Sep 17, 2025
424a8ff
Fix: addressed review comments.
ch4r10t33r Sep 17, 2025
9660a93
Fix: review comment fixes
ch4r10t33r Sep 17, 2025
949091e
fix: linting errors
ch4r10t33r Sep 17, 2025
75a18f1
Fix: Update bin/ream/src/main.rs
ch4r10t33r Sep 17, 2025
5f4321b
Fix: Update crates/common/account_manager/src/keystore.rs
ch4r10t33r Sep 17, 2025
638959f
Fix: Update crates/common/account_manager/src/keystore.rs
ch4r10t33r Sep 17, 2025
4aa6fe9
Fix: review comment fixes
ch4r10t33r Sep 17, 2025
54b3a14
Merge branch 'account_manager' of https://github.com/ch4r10t33r/ream …
ch4r10t33r Sep 17, 2025
861c390
fix: fixed issues with build and removed redundant code
ch4r10t33r Sep 17, 2025
d43a7b4
Fix: review comment fixes
ch4r10t33r Sep 17, 2025
f12db7b
fix: Update bin/ream/src/cli/account_manager.rs
ch4r10t33r Sep 17, 2025
6da008b
Fix: Update bin/ream/src/cli/account_manager.rs
ch4r10t33r Sep 17, 2025
9ef714f
fix: Update crates/common/account_manager/src/lib.rs
ch4r10t33r Sep 17, 2025
7c03e53
Fix: Update crates/common/account_manager/src/message_types.rs
ch4r10t33r Sep 17, 2025
bfe8f5e
Fix: updated code to address comments
ch4r10t33r Sep 17, 2025
4c07a12
fix: review comment fixes
ch4r10t33r Sep 17, 2025
2269d17
fix: Removed parallel processing.
ch4r10t33r Sep 19, 2025
a2e260d
Fix: Removed rayon from Cargo.toml
ch4r10t33r Sep 19, 2025
7c307b9
Fix: addressed review comments
ch4r10t33r Sep 19, 2025
3f513b7
fix: renamed functions
ch4r10t33r Sep 19, 2025
eb82dd9
fix: changed the default keystore path
ch4r10t33r Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ testing/ef-tests/mainnet/*

# DS_Store: Desktop Services Store
.DS_Store

# keystore
.keystore
57 changes: 51 additions & 6 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ alloy-rpc-types-beacon = "1.0.8"
alloy-rpc-types-eth = "1.0.7"
anyhow = "1.0"
async-trait = "0.1.86"
bip32 = "0.5.3"
bip39 = "2.2.0"
clap = "4"
delay_map = "0.4.1"
directories = { version = "6.0.0" }
Expand All @@ -86,6 +86,7 @@ eventsource-client = "0.15.0"
futures = "0.3"
hashbrown = "0.15.3"
hashsig = { git = "https://github.com/b-wagn/hash-sig", rev = "287517a763edba7e518b0c1ee5beb868f26f1f66" }
hex = "0.4"
itertools = "0.14"
jsonwebtoken = "9.3.1"
kzg = { git = "https://github.com/grandinetech/rust-kzg" }
Expand Down
2 changes: 2 additions & 0 deletions bin/ream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ path = "src/main.rs"
[dependencies]
alloy-primitives.workspace = true
anyhow.workspace = true
bip39.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
discv5.workspace = true
hashbrown.workspace = true
libp2p-identity.workspace = true
prometheus_exporter.workspace = true
rand.workspace = true
rand_chacha.workspace = true
serde_json.workspace = true
tokio.workspace = true
tracing = { workspace = true, features = ["log"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
38 changes: 29 additions & 9 deletions bin/ream/src/cli/account_manager.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use anyhow::ensure;
use bip39::Mnemonic;
use clap::Parser;
use tracing::info;

const MIN_CHUNK_SIZE: u64 = 4;
const MIN_LIFETIME: u64 = 18;
const DEFAULT_ACTIVATION_EPOCH: usize = 0;
const DEFAULT_NUM_ACTIVE_EPOCHS: usize = 1 << 18;
const MIN_CHUNK_SIZE: u32 = 4;
const MIN_LIFETIME: u32 = 18;
const DEFAULT_ACTIVATION_EPOCH: u32 = 0;
const DEFAULT_NUM_ACTIVE_EPOCHS: u32 = 1 << 18;

#[derive(Debug, Parser)]
pub struct AccountManagerConfig {
Expand All @@ -14,23 +16,31 @@ pub struct AccountManagerConfig {

/// Account lifetime in 2 ** lifetime slots
#[arg(short, long, default_value_t = 18)]
pub lifetime: u64,
pub lifetime: u32,

/// Chunk size for messages
#[arg(short, long, default_value_t = 5)]
pub chunk_size: u64,
pub chunk_size: u32,

/// Seed phrase for key generation
#[arg(short, long)]
pub seed_phrase: Option<String>,

/// Optional BIP39 passphrase used with the seed phrase
#[arg(long)]
pub passphrase: Option<String>,

/// Activation epoch for the validator
#[arg(long, default_value_t = DEFAULT_ACTIVATION_EPOCH)]
pub activation_epoch: usize,
pub activation_epoch: u32,

/// Number of active epochs
#[arg(long, default_value_t = DEFAULT_NUM_ACTIVE_EPOCHS)]
pub num_active_epochs: usize,
pub num_active_epochs: u32,

/// Path for keystore directory (relative to data-dir if not absolute)
#[arg(long)]
pub keystore_path: Option<String>,
}

impl Default for AccountManagerConfig {
Expand All @@ -40,8 +50,10 @@ impl Default for AccountManagerConfig {
lifetime: 18,
chunk_size: 5,
seed_phrase: None,
passphrase: None,
activation_epoch: DEFAULT_ACTIVATION_EPOCH,
num_active_epochs: DEFAULT_NUM_ACTIVE_EPOCHS,
keystore_path: None,
}
}
}
Expand All @@ -60,14 +72,22 @@ impl AccountManagerConfig {
self.lifetime >= MIN_LIFETIME,
"Lifetime must be at least {MIN_LIFETIME}"
);

Ok(())
}

pub fn get_seed_phrase(&self) -> String {
if let Some(phrase) = &self.seed_phrase {
phrase.clone()
} else {
"default_seed_phrase".to_string()
// Generate a new BIP39 mnemonic with 24 words (256 bits of entropy)
let entropy: [u8; 32] = rand::random();
let mnemonic = Mnemonic::from_entropy(&entropy).expect("Failed to generate mnemonic");
let phrase = mnemonic.words().collect::<Vec<_>>().join(" ");
info!("{}", "=".repeat(89));
info!("Generated new seed phrase (KEEP SAFE): {phrase}");
info!("{}", "=".repeat(89));
phrase
}
}
}
Loading