Skip to content

Commit df81431

Browse files
authored
chore: replace ecdsa pubkey with address (#285)
1 parent 07d03fd commit df81431

File tree

15 files changed

+298
-267
lines changed

15 files changed

+298
-267
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ alloy = { version = "0.12", features = [
3636
"ssz",
3737
"getrandom",
3838
"providers",
39+
"signer-local",
3940
] }
4041
ssz_types = "0.10"
4142
ethereum_serde_utils = "0.7.0"
@@ -78,7 +79,6 @@ blsful = "2.5"
7879
tree_hash = "0.9"
7980
tree_hash_derive = "0.9"
8081
eth2_keystore = { git = "https://github.com/sigp/lighthouse", rev = "8d058e4040b765a96aa4968f4167af7571292be2" }
81-
k256 = "0.13"
8282
aes = "0.8"
8383
ctr = "0.9.2"
8484
cipher = "0.4"

api/signer-api.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ paths:
1616
- BearerAuth: []
1717
responses:
1818
"200":
19-
description: "All public keys available to the module: consensus pubkeys (BLS) and proxy pubkeys (BLS and ECDSA)"
19+
description: "All public keys available to the module: consensus pubkeys (BLS) and proxies (BLS pubkeys and ECDSA addresses)"
2020
content:
2121
application/json:
2222
schema:
@@ -32,15 +32,15 @@ paths:
3232
description: Consensus validator pubkey
3333
$ref: "#/components/schemas/BlsPubkey"
3434
proxy_bls:
35-
description: BLS proxy validator pubkeys
35+
description: BLS proxy pubkeys
3636
type: array
3737
items:
3838
$ref: "#/components/schemas/BlsPubkey"
3939
proxy_ecdsa:
40-
description: ECDSA proxy validator pubkeys
40+
description: ECDSA proxy addresses
4141
type: array
4242
items:
43-
$ref: "#/components/schemas/EcdsaPubkey"
43+
$ref: "#/components/schemas/EcdsaAddress"
4444
"500":
4545
description: Internal error
4646
content:
@@ -71,17 +71,23 @@ paths:
7171
application/json:
7272
schema:
7373
type: object
74-
required: [type, pubkey, object_root]
74+
required: [type, object_root]
75+
oneOf:
76+
- required: [pubkey]
77+
- required: [proxy]
7578
properties:
7679
type:
7780
description: Type of the sign request
7881
type: string
7982
enum: [consensus, proxy_bls, proxy_ecdsa]
8083
pubkey:
81-
description: Public key of the validator
84+
description: Public key of the validator for consensus signatures
85+
$ref: "#/components/schemas/BlsPubkey"
86+
proxy:
87+
description: BLS proxy pubkey or ECDSA address for proxy signatures
8288
oneOf:
8389
- $ref: "#/components/schemas/BlsPubkey"
84-
- $ref: "#/components/schemas/EcdsaPubkey"
90+
- $ref: "#/components/schemas/EcdsaAddress"
8591
object_root:
8692
description: The root of the object to be signed
8793
type: string
@@ -97,12 +103,12 @@ paths:
97103
ProxyBls:
98104
value:
99105
type: "proxy_bls"
100-
pubkey: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
106+
proxy: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
101107
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
102108
ProxyEcdsa:
103109
value:
104110
type: "proxy_ecdsa"
105-
pubkey: "0x023b2806b1b1dfa34dd90b01546906cef3e4c8e0fc0cba60480e9eb4d0a0828311"
111+
proxy: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
106112
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
107113
responses:
108114
"200":
@@ -119,7 +125,7 @@ paths:
119125
ProxyBls:
120126
value: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989a3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
121127
ProxyEcdsa:
122-
value: "0xe6a0c0c41a6d4af9794882c18c5280376cbfb7921453612dea02ed8f47b1208455f07931dc12c4b70c4e8ae216db0136000ec2cf17244189f012de356ac46cec"
128+
value: "0x985b495f49d1b96db3bba3f6c5dd1810950317c10d4c2042bd316f338cdbe74359072e209b85e56ac492092d7860063dd096ca31b4e164ef27e3f8d508e656801c"
123129
"404":
124130
description: Unknown value (pubkey, etc.)
125131
content:
@@ -201,10 +207,10 @@ paths:
201207
allOf:
202208
- $ref: "#/components/schemas/BlsPubkey"
203209
proxy:
204-
description: the generated proxy public key
210+
description: the generated proxy identifier (BLS pubkey or ECDSA address)
205211
oneOf:
206212
- $ref: "#/components/schemas/BlsPubkey"
207-
- $ref: "#/components/schemas/EcdsaPubkey"
213+
- $ref: "#/components/schemas/EcdsaAddress"
208214
signature:
209215
description: The signature of the proxy delegation
210216
allOf:
@@ -220,7 +226,7 @@ paths:
220226
value:
221227
message:
222228
delegator: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
223-
proxy: "0x023b2806b1b1dfa34dd90b01546906cef3e4c8e0fc0cba60480e9eb4d0a0828311"
229+
proxy: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
224230
signature: "0xb5b5b71d1701cc45086af3d3d86bf9d3c509442835e5b9f7734923edc9a6c538e743d70613cdef90b7e5b171fbbe6a29075b3f155e4bd66d81ff9dbc3b6d7fa677d169b2ceab727ffa079a31fe1fc0e478752e9da9566a9408e4db24ac6104db"
225231
"404":
226232
description: Unknown value (pubkey, etc.)
@@ -281,11 +287,11 @@ components:
281287
format: hex
282288
pattern: "^0x[a-fA-F0-9]{96}$"
283289
example: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
284-
EcdsaPubkey:
290+
EcdsaAddress:
285291
type: string
286292
format: hex
287-
pattern: "^0x[a-fA-F0-9]{66}$"
288-
example: "0x023b2806b1b1dfa34dd90b01546906cef3e4c8e0fc0cba60480e9eb4d0a0828311"
293+
pattern: "^0x[a-fA-F0-9]{40}$"
294+
example: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
289295
BlsSignature:
290296
type: string
291297
format: hex
@@ -294,5 +300,5 @@ components:
294300
EcdsaSignature:
295301
type: string
296302
format: hex
297-
pattern: "^0x[a-fA-F0-9]{128}$"
298-
example: "0xe6a0c0c41a6d4af9794882c18c5280376cbfb7921453612dea02ed8f47b1208455f07931dc12c4b70c4e8ae216db0136000ec2cf17244189f012de356ac46cec"
303+
pattern: "^0x[a-fA-F0-9]{130}$"
304+
example: "0x985b495f49d1b96db3bba3f6c5dd1810950317c10d4c2042bd316f338cdbe74359072e209b85e56ac492092d7860063dd096ca31b4e164ef27e3f8d508e656801c"

bin/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub mod prelude {
1010
load_pbs_custom_config, LogsSettings, StartCommitModuleConfig, PBS_MODULE_NAME,
1111
},
1212
pbs::{BuilderEvent, BuilderEventClient, OnBuilderApiEvent},
13-
signer::{BlsPublicKey, BlsSignature, EcdsaPublicKey, EcdsaSignature},
13+
signer::{BlsPublicKey, BlsSignature, EcdsaSignature},
1414
types::Chain,
1515
utils::{initialize_tracing_log, utcnow_ms, utcnow_ns, utcnow_sec, utcnow_us},
1616
};

crates/common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ blst.workspace = true
3838
tree_hash.workspace = true
3939
tree_hash_derive.workspace = true
4040
eth2_keystore.workspace = true
41-
k256.workspace = true
4241
aes.workspace = true
4342
ctr.workspace = true
4443
cipher.workspace = true

crates/common/src/commit/client.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::sync::Arc;
22

3-
use alloy::rpc::types::beacon::BlsSignature;
3+
use alloy::{primitives::Address, rpc::types::beacon::BlsSignature};
44
use eyre::WrapErr;
55
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
66
use serde::Deserialize;
@@ -10,12 +10,12 @@ use super::{
1010
constants::{GENERATE_PROXY_KEY_PATH, GET_PUBKEYS_PATH, REQUEST_SIGNATURE_PATH},
1111
error::SignerClientError,
1212
request::{
13-
EncryptionScheme, GenerateProxyRequest, GetPubkeysResponse, PublicKey,
14-
SignConsensusRequest, SignProxyRequest, SignRequest, SignedProxyDelegation,
13+
EncryptionScheme, GenerateProxyRequest, GetPubkeysResponse, ProxyId, SignConsensusRequest,
14+
SignProxyRequest, SignRequest, SignedProxyDelegation,
1515
},
1616
};
1717
use crate::{
18-
signer::{BlsPublicKey, EcdsaPublicKey, EcdsaSignature},
18+
signer::{BlsPublicKey, EcdsaSignature},
1919
DEFAULT_REQUEST_TIMEOUT,
2020
};
2121

@@ -93,7 +93,7 @@ impl SignerClient {
9393

9494
pub async fn request_proxy_signature_ecdsa(
9595
&self,
96-
request: SignProxyRequest<EcdsaPublicKey>,
96+
request: SignProxyRequest<Address>,
9797
) -> Result<EcdsaSignature, SignerClientError> {
9898
self.request_signature(&request.into()).await
9999
}
@@ -110,7 +110,7 @@ impl SignerClient {
110110
request: &GenerateProxyRequest,
111111
) -> Result<SignedProxyDelegation<T>, SignerClientError>
112112
where
113-
T: PublicKey + for<'de> Deserialize<'de>,
113+
T: ProxyId + for<'de> Deserialize<'de>,
114114
{
115115
let url = self.url.join(GENERATE_PROXY_KEY_PATH)?;
116116
let res = self.client.post(url).json(&request).send().await?;
@@ -144,7 +144,7 @@ impl SignerClient {
144144
pub async fn generate_proxy_key_ecdsa(
145145
&self,
146146
consensus_pubkey: BlsPublicKey,
147-
) -> Result<SignedProxyDelegation<EcdsaPublicKey>, SignerClientError> {
147+
) -> Result<SignedProxyDelegation<Address>, SignerClientError> {
148148
let request = GenerateProxyRequest::new(consensus_pubkey, EncryptionScheme::Ecdsa);
149149

150150
let ecdsa_signed_proxy_delegation = self.generate_proxy_key(&request).await?;

0 commit comments

Comments
 (0)