Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
062ba69
prepared container types for signature aggregation (devnet 2)
JuliusMieliauskas Dec 18, 2025
4c53527
minor cleanups
JuliusMieliauskas Dec 19, 2025
f1f955a
added tests, fixed some types
JuliusMieliauskas Dec 23, 2025
ed67aaf
fixed environment selection by adding a minimal crate `env-config`. A…
JuliusMieliauskas Dec 29, 2025
d72a350
Merge pull request #32 from grandinetech/signature-aggregation
nsannn Jan 11, 2026
99029a7
Attestations changes based on leanSpec #234 commit: removed to_plain(…
nsannn Jan 11, 2026
671715d
Refactor: remove redundant constants from config, implement ChainConf…
LiudasBaronas1 Jan 11, 2026
544b4cf
Merge branch 'devnet-2' of https://github.com/grandinetech/lean into …
LiudasBaronas1 Jan 11, 2026
ab48bc1
fix: use env-config/devnetč in devnet2 feature flags
nsannn Jan 12, 2026
2842fe4
Added lean-multisig dependency for signature aggregation
nsannn Jan 12, 2026
72e22b2
Added MultisigAggregatedSignature struct with helper methods
nsannn Jan 12, 2026
3c71a58
add verify_aggregated_payload method to MultisigAggregatedSignature
nsannn Jan 12, 2026
192ff6e
Fix: moved proposer signature verification outside attestation loop
nsannn Jan 12, 2026
eac81dd
Changes to cfg, made devnet1/devnet2 features mutually exclusive to a…
nsannn Jan 13, 2026
f891e2a
Added store infrastructure for signature aggregation.
nsannn Jan 13, 2026
9fbbf34
rename to PublicKey and use constant for key size
Dariusspr Jan 14, 2026
830a70c
hide key size
Dariusspr Jan 14, 2026
572d545
format code
Dariusspr Jan 14, 2026
4531d81
Merge remote-tracking branch 'origin/main' into devnet-2
Dariusspr Jan 14, 2026
12f2def
Implemented fixed-point attestation collection and signature aggregation
nsannn Jan 18, 2026
da32620
added AggregatedSignatureProof type for signature aggregation
nsannn Jan 18, 2026
ceb4407
Removed feature flags and devnet1 code
nsannn Jan 18, 2026
a3b16a3
Implemented requested changes mentioned in the PR #37
nsannn Jan 18, 2026
53e6e0a
Changed tests to match devnet2 implementation
nsannn Jan 18, 2026
c865383
Pulled latest changes from devnet-2 branch and solved merge conflicts
nsannn Jan 18, 2026
be1836c
Applied cargo fmt formatting
nsannn Jan 18, 2026
43a95e7
- added wrapper classes for public key and signature
JuliusMieliauskas Jan 22, 2026
9b453ba
Changes based on PR #50 comments
nsannn Jan 22, 2026
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
1,730 changes: 1,202 additions & 528 deletions lean_client/Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions lean_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
snap = "1.1"
ssz = { git = "https://github.com/grandinetech/grandine", package = "ssz", branch = "develop" }
ssz-derive = { git = "https://github.com/grandinetech/grandine", package = "ssz_derive", branch = "develop" }
ssz_derive = { git = "https://github.com/grandinetech/grandine", package = "ssz_derive", branch = "develop" }
ssz-types = "0.3.0"
tokio = { version = "1.0", features = ["full"] }
tree-hash = "0.4.0"
typenum = "1.19"
sha2 = "0.10"
rand = "0.9"

[workspace.dev-dependencies]
rstest = "0.18.2"
Expand All @@ -52,8 +53,9 @@ version = "0.1.0"
edition = "2021"

[features]
default = ["xmss-signing"]
default = ["xmss-signing", "containers/xmss-verify"]
xmss-signing = ["validator/xmss-signing"]
xmss-verify = ["containers/xmss-verify"]

[dependencies]
chain = { path = "./chain" }
Expand Down
26 changes: 26 additions & 0 deletions lean_client/ENVIRONMENT_SELECTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
### To select which devnet you want to compile

#### Option A
- Change the default features in root `Cargo.toml`:
```toml
[features]
default = ["devnet1", "<...other features>"] # Change to "devnet2" if needed
devnet1 = [...]
devnet2 = [...]
```

#### Option B
- Use the `--no-default-features` flag and specify the desired devnet feature when building or running the project:
```bash
cargo build --no-default-features --features devnet1 # Change to devnet2
```


### Running tests for a specific devnet

From root directory, use the following command:
```bash
cargo test -p <crate_name> --no-default-features --features devnet1 # Change to devnet2
```

Use `<crate_name>` to specify the crate you want to test.
67 changes: 22 additions & 45 deletions lean_client/chain/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,27 @@ pub struct BasisPoint(pub u64);

impl BasisPoint {
pub const MAX: u64 = 10_000;

pub const fn new(value: u64) -> Option<Self> {
if value <= Self::MAX {
Some(BasisPoint(value))
} else {
None
}
}

#[inline]
pub fn get(&self) -> u64 {
self.0
}
}

pub const INTERVALS_PER_SLOT: u64 = 4;
pub const SLOT_DURATION_MS: u64 = 4_000;
pub const SECONDS_PER_SLOT: u64 = SLOT_DURATION_MS / 1_000;
pub const SECONDS_PER_INTERVAL: u64 = SECONDS_PER_SLOT / INTERVALS_PER_SLOT;
pub const JUSTIFICATION_LOOKBACK_SLOTS: u64 = 3;

pub const PROPOSER_REORG_CUTOFF_BPS: BasisPoint = match BasisPoint::new(2_500) {
Some(x) => x,
None => panic!(),
};
pub const VOTE_DUE_BPS: BasisPoint = match BasisPoint::new(5_000) {
Some(x) => x,
None => panic!(),
};
pub const FAST_CONFIRM_DUE_BPS: BasisPoint = match BasisPoint::new(7_500) {
Some(x) => x,
None => panic!(),
};
pub const VIEW_FREEZE_CUTOFF_BPS: BasisPoint = match BasisPoint::new(7_500) {
Some(x) => x,
None => panic!(),
};

pub const HISTORICAL_ROOTS_LIMIT: u64 = 1u64 << 18;
pub const VALIDATOR_REGISTRY_LIMIT: u64 = 1u64 << 12;

#[derive(Clone, Debug)]
pub struct ChainConfig {
pub intervals_per_slot: u64,
pub slot_duration_ms: u64,
pub second_per_slot: u64,
pub seconds_per_interval: u64,
pub justification_lookback_slots: u64,
pub proposer_reorg_cutoff_bps: BasisPoint,
pub vote_due_bps: BasisPoint,
Expand All @@ -55,25 +33,24 @@ pub struct ChainConfig {
pub validator_registry_limit: u64,
}

pub const DEVNET_CONFIG: ChainConfig = ChainConfig {
slot_duration_ms: SLOT_DURATION_MS,
second_per_slot: SECONDS_PER_SLOT,
justification_lookback_slots: JUSTIFICATION_LOOKBACK_SLOTS,
proposer_reorg_cutoff_bps: PROPOSER_REORG_CUTOFF_BPS,
vote_due_bps: VOTE_DUE_BPS,
fast_confirm_due_bps: FAST_CONFIRM_DUE_BPS,
view_freeze_cutoff_bps: VIEW_FREEZE_CUTOFF_BPS,
historical_roots_limit: HISTORICAL_ROOTS_LIMIT,
validator_registry_limit: VALIDATOR_REGISTRY_LIMIT,
};
impl ChainConfig {
pub fn devnet() -> Self {
let slot_duration_ms = 4_000;
let seconds_per_slot = slot_duration_ms / 1_000;
let intervals_per_slot = 4;

#[cfg(test)]
mod tests {
use super::*;
#[test]
fn time_math_is_consistent() {
assert_eq!(SLOT_DURATION_MS, 4_000);
assert_eq!(SECONDS_PER_SLOT, 4);
assert_eq!(SECONDS_PER_INTERVAL, 1);
Self {
slot_duration_ms,
second_per_slot: seconds_per_slot,
intervals_per_slot,
seconds_per_interval: seconds_per_slot / intervals_per_slot,
justification_lookback_slots: 3,
proposer_reorg_cutoff_bps: BasisPoint::new(2_500).expect("Valid BPS"),
vote_due_bps: BasisPoint::new(5_000).expect("Valid BPS"),
fast_confirm_due_bps: BasisPoint::new(7_500).expect("Valid BPS"),
view_freeze_cutoff_bps: BasisPoint::new(7_500).expect("Valid BPS"),
historical_roots_limit: 1u64 << 18,
validator_registry_limit: 1u64 << 12,
}
}
}
3 changes: 2 additions & 1 deletion lean_client/chain/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod config;
mod config;
pub use config::ChainConfig;
15 changes: 10 additions & 5 deletions lean_client/containers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ version = "0.1.0"
edition = "2021"

[features]
xmss-verify = ["leansig"]
xmss-verify = []
default = []

[lib]
name = "containers"
path = "src/lib.rs"

[dependencies]
ssz = { git = "https://github.com/grandinetech/grandine", package = "ssz", branch = "develop" }
ssz_derive = { git = "https://github.com/grandinetech/grandine", package = "ssz_derive", branch = "develop" }
env-config = { path = "../env-config", default-features = false }
ssz = { workspace = true }
serde = { workspace = true }
ssz_derive = { workspace = true }
typenum = "1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
hex = "0.4.3"
sha2 = "0.10"
leansig = { git = "https://github.com/leanEthereum/leanSig", branch = "main", optional = true }
leansig = { git = "https://github.com/leanEthereum/leanSig", branch = "main" }
lean-multisig = { git = "https://github.com/leanEthereum/leanMultisig", branch = "main" }
anyhow = "1.0.100"
alloy-primitives = "1.5.2"

[dev-dependencies]
rstest = "0.18"
Expand Down
Loading