1
+ use alloy:: rpc:: types:: beacon:: constants:: BLS_DST_SIG ;
1
2
pub use alloy:: rpc:: types:: beacon:: BlsSignature ;
2
- use alloy:: rpc:: types:: beacon:: { constants:: BLS_DST_SIG , BlsPublicKey as BlsPublicKeyInner } ;
3
3
use blst:: BLST_ERROR ;
4
- use derive_more:: derive:: { Deref , Display , From , Into } ;
5
- use serde:: { Deserialize , Serialize } ;
6
4
use tree_hash:: TreeHash ;
7
- use tree_hash_derive:: TreeHash ;
8
5
9
6
use crate :: {
10
7
error:: BlstErrorWrapper , signature:: sign_commit_boost_root, types:: Chain ,
11
8
utils:: blst_pubkey_to_alloy,
12
9
} ;
13
10
14
11
pub type BlsSecretKey = blst:: min_pk:: SecretKey ;
15
-
16
- // TODO(David):
17
- // This wrapper type is potentially a temporary solution, merely to implement
18
- // `TreeHash`. Remove when progress is made on this issue (https://github.com/sigp/tree_hash/issues/22)
19
- // or refine the boundaries between our wrapper `BlsPublicKey` type
20
- // and alloy's `BlsPublicKey` if we stick with it
21
-
22
- // std traits
23
- #[ derive( Debug , Clone , Copy , Display , PartialEq , Eq , Hash , Default ) ]
24
- // serde, ssz, tree_hash
25
- #[ derive( Serialize , Deserialize , TreeHash ) ]
26
- #[ serde( transparent) ]
27
- // derive_more
28
- #[ derive( Deref , From , Into ) ]
29
- pub struct BlsPublicKey {
30
- inner : BlsPublicKeyInner ,
31
- }
32
-
33
- impl AsRef < [ u8 ] > for BlsPublicKey {
34
- fn as_ref ( & self ) -> & [ u8 ] {
35
- self . as_slice ( )
36
- }
37
- }
38
-
39
- impl TryFrom < & [ u8 ] > for BlsPublicKey {
40
- type Error = core:: array:: TryFromSliceError ;
41
-
42
- fn try_from ( value : & [ u8 ] ) -> Result < Self , Self :: Error > {
43
- Ok ( Self { inner : value. try_into ( ) ? } )
44
- }
45
- }
12
+ pub type BlsPublicKey = alloy:: rpc:: types:: beacon:: BlsPublicKey ;
46
13
47
14
#[ derive( Clone ) ]
48
15
pub enum BlsSigner {
@@ -61,7 +28,7 @@ impl BlsSigner {
61
28
62
29
pub fn pubkey ( & self ) -> BlsPublicKey {
63
30
match self {
64
- BlsSigner :: Local ( secret) => blst_pubkey_to_alloy ( & secret. sk_to_pk ( ) ) . into ( ) ,
31
+ BlsSigner :: Local ( secret) => blst_pubkey_to_alloy ( & secret. sk_to_pk ( ) ) ,
65
32
}
66
33
}
67
34
@@ -97,7 +64,7 @@ pub fn random_secret() -> BlsSecretKey {
97
64
}
98
65
99
66
pub fn verify_bls_signature (
100
- pubkey : & BlsPublicKeyInner ,
67
+ pubkey : & BlsPublicKey ,
101
68
msg : & [ u8 ] ,
102
69
signature : & BlsSignature ,
103
70
) -> Result < ( ) , BlstErrorWrapper > {
0 commit comments