Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 0 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ jobs:
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
names:
- binary: commit-boost
publish: commit-boost-cli
- binary: default-pbs
publish: commit-boost-pbs
- binary: signer-module
publish: commit-boost-signer

runs-on: ${{ matrix.os }}
steps:
Expand Down
24 changes: 18 additions & 6 deletions crates/signer/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,22 @@ impl SigningManager {
self.consensus_signers.contains_key(pubkey)
}

pub fn has_proxy_ecdsa(&self, ecdsa_pk: &EcdsaPublicKey) -> bool {
self.proxy_signers.ecdsa_signers.contains_key(ecdsa_pk)
pub fn has_proxy_bls_for_module(&self, bls_pk: &BlsPublicKey, module_id: &ModuleId) -> bool {
match self.proxy_pubkeys_bls.get(module_id) {
Some(keys) => keys.contains(bls_pk),
None => false,
}
}

pub fn has_proxy_bls(&self, bls_pk: &BlsPublicKey) -> bool {
self.proxy_signers.bls_signers.contains_key(bls_pk)
pub fn has_proxy_ecdsa_for_module(
&self,
ecdsa_pk: &EcdsaPublicKey,
module_id: &ModuleId,
) -> bool {
match self.proxy_pubkeys_ecdsa.get(module_id) {
Some(keys) => keys.contains(ecdsa_pk),
None => false,
}
}

pub fn get_delegation_bls(
Expand Down Expand Up @@ -295,7 +305,8 @@ mod tests {
);

assert!(
signing_manager.has_proxy_bls(&signed_delegation.message.proxy),
signing_manager
.has_proxy_bls_for_module(&signed_delegation.message.proxy, &MODULE_ID),
"Newly generated proxy key must be present in the signing manager's registry."
);
}
Expand Down Expand Up @@ -373,7 +384,8 @@ mod tests {
);

assert!(
signing_manager.has_proxy_ecdsa(&signed_delegation.message.proxy),
signing_manager
.has_proxy_ecdsa_for_module(&signed_delegation.message.proxy, &MODULE_ID),
"Newly generated proxy key must be present in the signing manager's registry."
);
}
Expand Down
18 changes: 14 additions & 4 deletions crates/signer/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,21 @@ async fn handle_request_signature(
.sign_consensus(&pubkey, &object_root)
.await
.map(|sig| Json(sig).into_response()),
SignRequest::ProxyBls(SignProxyRequest { pubkey: bls_pk, object_root }) => signing_manager
.sign_proxy_bls(&bls_pk, &object_root)
.await
.map(|sig| Json(sig).into_response()),
SignRequest::ProxyBls(SignProxyRequest { pubkey: bls_pk, object_root }) => {
if !signing_manager.has_proxy_bls_for_module(&bls_pk, &module_id) {
return Err(SignerModuleError::UnknownProxySigner(bls_pk.to_vec()));
}

signing_manager
.sign_proxy_bls(&bls_pk, &object_root)
.await
.map(|sig| Json(sig).into_response())
}
SignRequest::ProxyEcdsa(SignProxyRequest { pubkey: ecdsa_pk, object_root }) => {
if !signing_manager.has_proxy_ecdsa_for_module(&ecdsa_pk, &module_id) {
return Err(SignerModuleError::UnknownProxySigner(ecdsa_pk.to_vec()));
}

signing_manager
.sign_proxy_ecdsa(&ecdsa_pk, &object_root)
.await
Expand Down
Loading