Skip to content

Commit

Permalink
rename to bls_lagrange
Browse files Browse the repository at this point in the history
  • Loading branch information
dknopik committed Jan 20, 2025
1 parent b31277f commit d48b45f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 24 deletions.
26 changes: 13 additions & 13 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
members = [
"anchor",
"anchor/client",
"anchor/common/blst_lagrange",
"anchor/common/bls_lagrange",
"anchor/common/qbft",
"anchor/common/ssv_types",
"anchor/common/version",
Expand All @@ -25,7 +25,7 @@ edition = "2021"
# This table has three subsections: first the internal dependencies, then the lighthouse dependencies, then all other.
[workspace.dependencies]
anchor_validator_store = { path = "anchor/validator_store" }
blst_lagrange = { path = "anchor/common/blst_lagrange" }
bls_lagrange = { path = "anchor/common/bls_lagrange" }
client = { path = "anchor/client" }
database = { path = "anchor/database" }
eth = { path = "anchor/eth" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "blst_lagrange"
name = "bls_lagrange"
version = "0.1.0"
edition = "2021"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion anchor/signature_collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = { workspace = true }
authors = ["Sigma Prime <contact@sigmaprime.io>"]

[dependencies]
blst_lagrange = { workspace = true }
bls_lagrange = { workspace = true }
dashmap = { workspace = true }
processor = { workspace = true }
slot_clock = { workspace = true }
Expand Down
16 changes: 9 additions & 7 deletions anchor/signature_collector/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use blst_lagrange::KeyId;
use bls_lagrange::KeyId;
use dashmap::DashMap;
use processor::{DropOnFinish, Senders, WorkItem};
use slot_clock::SlotClock;
Expand Down Expand Up @@ -179,7 +179,7 @@ pub enum CollectionError {
QueueFullError,
CollectionTimeout,
EmptySignature,
RecoverError(blst_lagrange::Error),
RecoverError(bls_lagrange::Error),
}

impl From<TrySendError<WorkItem>> for CollectionError {
Expand All @@ -197,8 +197,8 @@ impl From<RecvError> for CollectionError {
}
}

impl From<blst_lagrange::Error> for CollectionError {
fn from(err: blst_lagrange::Error) -> Self {
impl From<bls_lagrange::Error> for CollectionError {
fn from(err: bls_lagrange::Error) -> Self {
CollectionError::RecoverError(err)
}
}
Expand Down Expand Up @@ -247,7 +247,7 @@ async fn signature_collector(
if signature_share.len() as u64 >= request.threshold {
// TODO move to blocking threadpool?

let signature = match recover_signature(mem::take(&mut signature_share)) {
let signature = match combine_signatures(mem::take(&mut signature_share)) {
Ok(signature) => Arc::new(signature),
Err(err) => {
error!(?err, "Failed to recover signature");
Expand All @@ -265,13 +265,15 @@ async fn signature_collector(
}
}

fn recover_signature(shares: HashMap<OperatorId, Signature>) -> Result<Signature, CollectionError> {
fn combine_signatures(
shares: HashMap<OperatorId, Signature>,
) -> Result<Signature, CollectionError> {
let (ids, signatures): (Vec<_>, Vec<_>) = shares
.into_iter()
.map(|(k, s)| KeyId::try_from(*k).map(|k| (k, s)))
.collect::<Result<Vec<_>, _>>()?
.into_iter()
.unzip();

Ok(blst_lagrange::combine_signatures(&signatures, &ids)?)
Ok(bls_lagrange::combine_signatures(&signatures, &ids)?)
}

0 comments on commit d48b45f

Please sign in to comment.