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
8 changes: 4 additions & 4 deletions crates/common/src/signer/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ fn store_erc2335_key<T: ProxyId>(
secrets_path: &Path,
scheme: EncryptionScheme,
) -> eyre::Result<()> {
let proxy_pubkey = delegation.message.proxy;
let proxy_delegation = delegation.message.proxy;

let password_bytes: [u8; 32] = rand::rng().random();
let password = hex::encode(password_bytes);
Expand All @@ -436,7 +436,7 @@ fn store_erc2335_key<T: ProxyId>(
.join(&module_id.0)
.join(scheme.to_string());
std::fs::create_dir_all(&pass_path)?;
let pass_path = pass_path.join(proxy_pubkey.to_string());
let pass_path = pass_path.join(proxy_delegation.to_string());
let mut pass_file = std::fs::File::create(&pass_path)?;
pass_file.write_all(password.as_bytes())?;

Expand All @@ -445,7 +445,7 @@ fn store_erc2335_key<T: ProxyId>(
.join(&module_id.0)
.join(scheme.to_string());
std::fs::create_dir_all(&sig_path)?;
let sig_path = sig_path.join(format!("{}.sig", proxy_pubkey));
let sig_path = sig_path.join(format!("{}.sig", proxy_delegation));

let mut sig_file = std::fs::File::create(sig_path)?;
sig_file.write_all(delegation.signature.to_string().as_bytes())?;
Expand Down Expand Up @@ -489,7 +489,7 @@ fn store_erc2335_key<T: ProxyId>(
.join(&module_id.0)
.join(scheme.to_string());
std::fs::create_dir_all(&json_path)?;
let json_path = json_path.join(format!("{}.json", proxy_pubkey));
let json_path = json_path.join(format!("{}.json", proxy_delegation));
let mut json_file = std::fs::File::create(&json_path)?;
json_file.write_all(serde_json::to_string(&keystore)?.as_bytes())?;

Expand Down
8 changes: 4 additions & 4 deletions crates/signer/src/manager/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ impl LocalSigningManager {
store.store_proxy_ecdsa(&module_id, &proxy)?;
}

let proxy_pubkey = proxy.address();
let proxy_address = proxy.address();
self.proxy_signers.ecdsa_signers.insert(proxy.address(), proxy);
self.proxy_addresses_ecdsa.entry(module_id).or_default().push(proxy_pubkey);
self.proxy_addresses_ecdsa.entry(module_id).or_default().push(proxy_address);

Ok(())
}
Expand Down Expand Up @@ -111,9 +111,9 @@ impl LocalSigningManager {
delegator: BlsPublicKey,
) -> Result<SignedProxyDelegationEcdsa, SignerModuleError> {
let signer = EcdsaSigner::new_random();
let proxy_pubkey = signer.address();
let proxy_address = signer.address();

let message = ProxyDelegationEcdsa { delegator, proxy: proxy_pubkey };
let message = ProxyDelegationEcdsa { delegator, proxy: proxy_address };
let signature = self.sign_consensus(&delegator, &message.tree_hash_root().0).await?;
let delegation = SignedProxyDelegationEcdsa { signature, message };
let proxy_signer = EcdsaProxySigner { signer, delegation };
Expand Down
7 changes: 5 additions & 2 deletions docs/docs/developing/commit-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,21 @@ let proxy_pubkey = proxy_delegation.message.proxy;

// or ECDSA proxy
let proxy_delegation = self.config.signer_client.generate_proxy_key_ecdsa(pubkey).await?;
let proxy_pubkey = proxy_delegation.message.proxy;
let proxy_address = proxy_delegation.message.proxy;
```

Where `pubkey` is the validator (consensus) public key for which a proxy is to be generated.

Then you can use the generated proxy key to request a signature:
```rust
// if `proxy_pubkey` is a BLS proxy
let datagram = Datagram { data: 1 };
let request = SignProxyRequest::builder(proxy_pubkey).with_msg(&datagram);
// if `proxy_pubkey` is a BLS proxy
let signature = config.signer_client.request_proxy_signature_bls(&request).await.unwrap();

// or for ECDSA proxy
let datagram = Datagram { data: 1 };
let request = SignProxyRequest::builder(proxy_address).with_msg(&datagram);
let signature = config.signer_client.request_proxy_signature_ecdsa(&request).await.unwrap();
```

Expand Down
Loading