Skip to content

Commit 8c91ab5

Browse files
chore: merge main (feat: add bootnode.rs #262)
Manually merges changes from main branch commit e41e6d9: - Add crates/p2p/src/bootnode.rs and crates/p2p/src/relay.rs - Add crates/p2p/examples/bootnode.rs - Update p2p peer.rs: add Default for MutablePeer, addr_infos_from_p2p_addrs - Update p2p gater.rs: remove Arc wrapper from relay peers - Update p2p utils.rs: add multi_addrs_via_relay helper - Update p2p lib.rs: export bootnode and relay modules - Update p2p Cargo.toml: add backon, reqwest, url deps - Fix crypto share indexing: use 1-indexed keys throughout - Remove MathError enum, replace with direct DivisionByZero variant - Fix cluster test_cluster.rs: use 1-indexed share lookup - Fix app obolapi: add FailedToConvertShareIndexToU8/MathOverflow errors - Add app/src/utils.rs with archive helpers - Add core/src/parasigdb/memory.rs - Update Cargo.toml and Cargo.lock with flate2, tar deps - Update relay_server example: simplify TCP addr, add docblock Co-authored-by: Bohdan Ohorodnii <varex83@users.noreply.github.com>
1 parent a41f417 commit 8c91ab5

21 files changed

Lines changed: 2429 additions & 58 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ testcontainers = "0.26"
8989
test-case = "3.3"
9090
tree_hash = "0.12"
9191
tree_hash_derive = "0.12"
92+
tar = "0.4"
93+
flate2 = "1.1"
9294
wiremock = "0.6"
9395

9496
# Crates in the workspace

crates/app/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ serde_json.workspace = true
2828
hex.workspace = true
2929
k256.workspace = true
3030
bon.workspace = true
31+
flate2.workspace = true
32+
tar.workspace = true
33+
tempfile.workspace = true
3134
pluto-cluster.workspace = true
3235
pluto-k1util.workspace = true
3336
pluto-crypto.workspace = true
@@ -36,8 +39,8 @@ pluto-crypto.workspace = true
3639
pluto-build-proto.workspace = true
3740

3841
[dev-dependencies]
39-
tempfile.workspace = true
4042
wiremock.workspace = true
43+
test-case.workspace = true
4144

4245
[lints]
4346
workspace = true

crates/app/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ pub mod eth2wrap;
2727

2828
/// Private key locking service.
2929
pub mod privkeylock;
30+
31+
/// Utility helpers for archiving, extracting, and comparing files/directories.
32+
pub mod utils;

crates/app/src/obolapi/error.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ pub enum Error {
5959
#[error("signature string has invalid size: {0}")]
6060
InvalidSignatureSize(usize),
6161

62+
/// Failed to convert share index to u8.
63+
#[error("failed to convert share index to u8: {0}")]
64+
FailedToConvertShareIndexToU8(#[from] std::num::TryFromIntError),
65+
66+
/// Math overflow error.
67+
#[error("math overflow error")]
68+
MathOverflow,
69+
6270
/// Epoch parsing error.
6371
#[error("epoch parsing error: {0}")]
6472
EpochParse(#[from] std::num::ParseIntError),

crates/app/src/obolapi/exit.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,12 @@ impl Client {
346346
let mut sig = [0u8; 96];
347347
sig.copy_from_slice(&sig_bytes);
348348

349-
// `BlstImpl::threshold_aggregate` shifts the index to 1-based internally
349+
// Convert 0-indexed array position to 1-indexed share ID (API stores signatures
350+
// at array position share_id-1, e.g., share 1 at position 0)
350351
let share_idx = u8::try_from(sig_idx)
351-
.map_err(|_| Error::InvalidSignatureSize(sig_idx.saturating_add(1)))?;
352+
.map_err(Error::FailedToConvertShareIndexToU8)?
353+
.checked_add(1)
354+
.ok_or(Error::MathOverflow)?;
352355
raw_signatures.insert(share_idx, sig);
353356
}
354357

0 commit comments

Comments
 (0)