@@ -48,14 +48,18 @@ impl Keychain {
4848 }
4949}
5050
51- // Currently the traits for legacy and current match, so only one implementation needed.
5251impl legacy_aleph_bft:: Index for Keychain {
5352 fn index ( & self ) -> legacy_aleph_bft:: NodeIndex {
5453 Keychain :: index ( self ) . into ( )
5554 }
5655}
5756
58- // Currently the traits for legacy and current match, so only one implementation needed.
57+ impl current_aleph_bft:: Index for Keychain {
58+ fn index ( & self ) -> current_aleph_bft:: NodeIndex {
59+ Keychain :: index ( self ) . into ( )
60+ }
61+ }
62+
5963impl legacy_aleph_bft:: Keychain for Keychain {
6064 type Signature = Signature ;
6165
@@ -72,7 +76,22 @@ impl legacy_aleph_bft::Keychain for Keychain {
7276 }
7377}
7478
75- // Currently the traits for legacy and current match, so only one implementation needed.
79+ impl current_aleph_bft:: Keychain for Keychain {
80+ type Signature = Signature ;
81+
82+ fn node_count ( & self ) -> current_aleph_bft:: NodeCount {
83+ Keychain :: node_count ( self ) . into ( )
84+ }
85+
86+ fn sign ( & self , msg : & [ u8 ] ) -> Signature {
87+ Keychain :: sign ( self , msg)
88+ }
89+
90+ fn verify ( & self , msg : & [ u8 ] , sgn : & Signature , index : current_aleph_bft:: NodeIndex ) -> bool {
91+ Keychain :: verify ( self , msg, sgn, index)
92+ }
93+ }
94+
7695impl legacy_aleph_bft:: MultiKeychain for Keychain {
7796 // Using `SignatureSet` is slow, but Substrate has not yet implemented aggregation.
7897 // We probably should do this for them at some point.
@@ -96,3 +115,27 @@ impl legacy_aleph_bft::MultiKeychain for Keychain {
96115 Keychain :: is_complete ( self , msg, partial)
97116 }
98117}
118+
119+ impl current_aleph_bft:: MultiKeychain for Keychain {
120+ // Using `SignatureSet` is slow, but Substrate has not yet implemented aggregation.
121+ // We probably should do this for them at some point.
122+ type PartialMultisignature = SignatureSet < Signature > ;
123+
124+ fn bootstrap_multi (
125+ & self ,
126+ signature : & Signature ,
127+ index : current_aleph_bft:: NodeIndex ,
128+ ) -> Self :: PartialMultisignature {
129+ current_aleph_bft:: PartialMultisignature :: add_signature (
130+ SignatureSet ( aleph_bft_crypto:: SignatureSet :: with_size (
131+ aleph_bft_crypto:: Keychain :: node_count ( self ) ,
132+ ) ) ,
133+ signature,
134+ index,
135+ )
136+ }
137+
138+ fn is_complete ( & self , msg : & [ u8 ] , partial : & Self :: PartialMultisignature ) -> bool {
139+ Keychain :: is_complete ( self , msg, partial)
140+ }
141+ }
0 commit comments