Skip to content

Commit 6c9df79

Browse files
authored
CBST2-14: Rename proxy_pubkey for ECDSA proxies (#319)
1 parent 221f8c9 commit 6c9df79

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

crates/common/src/signer/store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn store_erc2335_key<T: ProxyId>(
426426
secrets_path: &Path,
427427
scheme: EncryptionScheme,
428428
) -> eyre::Result<()> {
429-
let proxy_pubkey = delegation.message.proxy;
429+
let proxy_delegation = delegation.message.proxy;
430430

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

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

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

crates/signer/src/manager/local.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ impl LocalSigningManager {
7979
store.store_proxy_ecdsa(&module_id, &proxy)?;
8080
}
8181

82-
let proxy_pubkey = proxy.address();
82+
let proxy_address = proxy.address();
8383
self.proxy_signers.ecdsa_signers.insert(proxy.address(), proxy);
84-
self.proxy_addresses_ecdsa.entry(module_id).or_default().push(proxy_pubkey);
84+
self.proxy_addresses_ecdsa.entry(module_id).or_default().push(proxy_address);
8585

8686
Ok(())
8787
}
@@ -111,9 +111,9 @@ impl LocalSigningManager {
111111
delegator: BlsPublicKey,
112112
) -> Result<SignedProxyDelegationEcdsa, SignerModuleError> {
113113
let signer = EcdsaSigner::new_random();
114-
let proxy_pubkey = signer.address();
114+
let proxy_address = signer.address();
115115

116-
let message = ProxyDelegationEcdsa { delegator, proxy: proxy_pubkey };
116+
let message = ProxyDelegationEcdsa { delegator, proxy: proxy_address };
117117
let signature = self.sign_consensus(&delegator, &message.tree_hash_root().0).await?;
118118
let delegation = SignedProxyDelegationEcdsa { signature, message };
119119
let proxy_signer = EcdsaProxySigner { signer, delegation };

docs/docs/developing/commit-module.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,21 @@ let proxy_pubkey = proxy_delegation.message.proxy;
8888

8989
// or ECDSA proxy
9090
let proxy_delegation = self.config.signer_client.generate_proxy_key_ecdsa(pubkey).await?;
91-
let proxy_pubkey = proxy_delegation.message.proxy;
91+
let proxy_address = proxy_delegation.message.proxy;
9292
```
9393

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

9696
Then you can use the generated proxy key to request a signature:
9797
```rust
98+
// if `proxy_pubkey` is a BLS proxy
9899
let datagram = Datagram { data: 1 };
99100
let request = SignProxyRequest::builder(proxy_pubkey).with_msg(&datagram);
100-
// if `proxy_pubkey` is a BLS proxy
101101
let signature = config.signer_client.request_proxy_signature_bls(&request).await.unwrap();
102+
102103
// or for ECDSA proxy
104+
let datagram = Datagram { data: 1 };
105+
let request = SignProxyRequest::builder(proxy_address).with_msg(&datagram);
103106
let signature = config.signer_client.request_proxy_signature_ecdsa(&request).await.unwrap();
104107
```
105108

0 commit comments

Comments
 (0)