@@ -13,9 +13,9 @@ use multisig::{Committee, x25519};
13
13
use sailfish_types:: UNKNOWN_COMMITTEE_ID ;
14
14
use timeboost:: types:: BundleVariant ;
15
15
use timeboost_builder:: CertifierConfig ;
16
- use timeboost_crypto:: prelude:: { DkgDecKey , ThresholdEncKeyCell } ;
16
+ use timeboost_crypto:: prelude:: DkgDecKey ;
17
17
use timeboost_sequencer:: SequencerConfig ;
18
- use timeboost_types:: { ChainConfig , DkgKeyStore } ;
18
+ use timeboost_types:: { ChainConfig , DecryptionKeyCell , KeyStore } ;
19
19
use timeboost_utils:: load_generation:: make_bundle;
20
20
use tokio:: sync:: broadcast;
21
21
use tokio:: time:: { Duration , sleep} ;
@@ -25,7 +25,10 @@ use url::Url;
25
25
fn make_configs < R > (
26
26
size : NonZeroUsize ,
27
27
recover_index : R ,
28
- ) -> ( ThresholdEncKeyCell , Vec < ( SequencerConfig , CertifierConfig ) > )
28
+ ) -> (
29
+ Vec < DecryptionKeyCell > ,
30
+ Vec < ( SequencerConfig , CertifierConfig ) > ,
31
+ )
29
32
where
30
33
R : Into < Option < usize > > ,
31
34
{
77
80
. map ( |( kp, xp, _, _, _, pa, ..) | ( kp. public_key ( ) , xp. public_key ( ) , pa. clone ( ) ) ) ,
78
81
) ;
79
82
80
- let dkg_keystore = DkgKeyStore :: new (
83
+ let key_store = KeyStore :: new (
81
84
committee. clone ( ) ,
82
85
parts
83
86
. iter ( )
@@ -86,23 +89,22 @@ where
86
89
) ;
87
90
88
91
let mut cfgs = Vec :: new ( ) ;
92
+ let mut enc_keys = Vec :: new ( ) ;
89
93
let recover_index = recover_index. into ( ) ;
90
94
91
- let enc_key = ThresholdEncKeyCell :: new ( ) ;
92
-
93
95
for ( i, ( kpair, xpair, dkg_sk, sa, da, pa) ) in parts. into_iter ( ) . enumerate ( ) {
96
+ let enc_key = DecryptionKeyCell :: new ( ) ;
94
97
let conf = SequencerConfig :: builder ( )
95
98
. sign_keypair ( kpair. clone ( ) )
96
99
. dh_keypair ( xpair. clone ( ) )
97
100
. dkg_key ( dkg_sk)
98
- . dkg_keystore ( dkg_keystore. clone ( ) )
99
101
. sailfish_addr ( sa)
100
102
. decrypt_addr ( da)
101
103
. sailfish_committee ( sailfish_committee. clone ( ) )
102
- . decrypt_committee ( decrypt_committee. clone ( ) )
104
+ . decrypt_committee ( ( decrypt_committee. clone ( ) , key_store . clone ( ) ) )
103
105
. recover ( recover_index. map ( |r| r == i) . unwrap_or ( false ) )
104
106
. leash_len ( 100 )
105
- . threshold_enc_key ( enc_key. clone ( ) )
107
+ . threshold_dec_key ( enc_key. clone ( ) )
106
108
. chain_config ( ChainConfig :: new (
107
109
1 ,
108
110
"https://theserversroom.com/ethereum/54cmzzhcj1o/"
@@ -118,16 +120,17 @@ where
118
120
. address ( pa)
119
121
. committee ( produce_committee. clone ( ) )
120
122
. build ( ) ;
123
+ enc_keys. push ( enc_key) ;
121
124
cfgs. push ( ( conf, pcf) ) ;
122
125
}
123
126
124
- ( enc_key , cfgs)
127
+ ( enc_keys , cfgs)
125
128
}
126
129
127
130
/// Generate random bundles at a fixed frequency.
128
- async fn gen_bundles ( enc_key : ThresholdEncKeyCell , tx : broadcast:: Sender < BundleVariant > ) {
131
+ async fn gen_bundles ( enc_key : DecryptionKeyCell , tx : broadcast:: Sender < BundleVariant > ) {
129
132
loop {
130
- let Ok ( b) = make_bundle ( & enc_key) else {
133
+ let Ok ( b) = make_bundle ( enc_key. read ( ) . await . pubkey ( ) ) else {
131
134
warn ! ( "Failed to generate bundle" ) ;
132
135
continue ;
133
136
} ;
0 commit comments