@@ -65,7 +65,7 @@ use sequencer::{
65
65
context:: { Consensus , SequencerContext } ,
66
66
network,
67
67
state_signature:: { static_stake_table_commitment, StakeTableCommitmentType , StateSigner } ,
68
- L1Params , NetworkParams , Node ,
68
+ L1Params , NetworkParams , Node , SequencerApiVersion ,
69
69
} ;
70
70
use tide_disco:: { app, method:: ReadState , App , Url } ;
71
71
use vbs:: version:: { StaticVersion , StaticVersionType } ;
@@ -98,7 +98,7 @@ pub fn run_builder_api_service(url: Url, source: ProxyGlobalState<SeqTypes>) {
98
98
app. register_module ( "txn_submit" , private_mempool_api)
99
99
. expect ( "Failed to register the private mempool API" ) ;
100
100
101
- async_spawn ( app. serve ( url, StaticVersion :: < 0 , 1 > :: instance ( ) ) ) ;
101
+ async_spawn ( app. serve ( url, SequencerApiVersion :: instance ( ) ) ) ;
102
102
}
103
103
104
104
#[ cfg( test) ]
@@ -167,13 +167,13 @@ pub mod testing {
167
167
block_contents:: { vid_commitment, BlockHeader , GENESIS_VID_NUM_STORAGE_NODES } ,
168
168
metrics:: NoMetrics ,
169
169
network:: Topic ,
170
- node_implementation:: ConsensusTime ,
170
+ node_implementation:: { ConsensusTime , Versions } ,
171
171
signature_key:: BuilderSignatureKey as _,
172
172
} ,
173
173
ExecutionType , HotShotConfig , PeerConfig , ValidatorConfig ,
174
174
} ;
175
175
use portpicker:: pick_unused_port;
176
- use sequencer:: { state_signature:: StateSignatureMemStorage , testing :: TestConfig } ;
176
+ use sequencer:: { state_signature:: StateSignatureMemStorage , SequencerApiVersion } ;
177
177
use serde:: { Deserialize , Serialize } ;
178
178
use surf_disco:: Client ;
179
179
use vbs:: version:: StaticVersion ;
@@ -345,11 +345,14 @@ pub mod testing {
345
345
}
346
346
}
347
347
348
- pub async fn init_nodes < P : SequencerPersistence , Ver : StaticVersionType + ' static > (
348
+ pub async fn init_nodes < P : SequencerPersistence , V : Versions > (
349
349
& self ,
350
- bind_version : Ver ,
350
+ bind_version : V ,
351
351
options : impl PersistenceOptions < Persistence = P > ,
352
- ) -> Vec < ( Arc < Consensus < network:: Memory , P > > , Option < StateSigner < Ver > > ) > {
352
+ ) -> Vec < (
353
+ Arc < Consensus < network:: Memory , P , V > > ,
354
+ Option < StateSigner < SequencerApiVersion > > ,
355
+ ) > {
353
356
let num_staked_nodes = self . num_staked_nodes ( ) ;
354
357
let mut is_staked = false ;
355
358
let stake_table_commit = static_stake_table_commitment (
@@ -379,15 +382,18 @@ pub mod testing {
379
382
. await
380
383
}
381
384
382
- pub async fn init_node < P : SequencerPersistence , Ver : StaticVersionType + ' static > (
385
+ pub async fn init_node < P : SequencerPersistence , V : Versions > (
383
386
& self ,
384
387
i : usize ,
385
388
is_staked : bool ,
386
389
stake_table_commit : StakeTableCommitmentType ,
387
390
metrics : & dyn Metrics ,
388
- bind_version : Ver ,
391
+ bind_version : V ,
389
392
persistence : P ,
390
- ) -> ( Consensus < network:: Memory , P > , StateSigner < Ver > ) {
393
+ ) -> (
394
+ Consensus < network:: Memory , P , V > ,
395
+ StateSigner < SequencerApiVersion > ,
396
+ ) {
391
397
let mut config = self . config . clone ( ) ;
392
398
393
399
let num_staked_nodes = self . num_staked_nodes ( ) ;
@@ -410,8 +416,8 @@ pub mod testing {
410
416
ChainConfig :: default ( ) ,
411
417
L1Client :: new ( self . anvil . endpoint ( ) . parse ( ) . unwrap ( ) , 1 ) ,
412
418
MockStateCatchup :: default ( ) ,
419
+ V :: Base :: VERSION ,
413
420
)
414
- . with_current_version ( Ver :: VERSION )
415
421
. with_genesis ( ValidatedState :: default ( ) ) ;
416
422
417
423
tracing:: info!( "Before init hotshot" ) ;
@@ -463,14 +469,14 @@ pub mod testing {
463
469
app. register_module ( "hotshot-events" , hotshot_events_api)
464
470
. expect ( "Failed to register hotshot events API" ) ;
465
471
466
- async_spawn ( app. serve ( url, StaticVersion :: < 0 , 1 > :: instance ( ) ) ) ;
472
+ async_spawn ( app. serve ( url, SequencerApiVersion :: instance ( ) ) ) ;
467
473
}
468
474
// enable hotshot event streaming
469
- pub fn enable_hotshot_node_event_streaming < P : SequencerPersistence > (
475
+ pub fn enable_hotshot_node_event_streaming < P : SequencerPersistence , V : Versions > (
470
476
hotshot_events_api_url : Url ,
471
477
known_nodes_with_stake : Vec < PeerConfig < VerKey > > ,
472
478
num_non_staking_nodes : usize ,
473
- hotshot_context_handle : Arc < Consensus < network:: Memory , P > > ,
479
+ hotshot_context_handle : Arc < Consensus < network:: Memory , P , V > > ,
474
480
) {
475
481
// create a event streamer
476
482
let events_streamer = Arc :: new ( RwLock :: new ( EventsStreamer :: new (
@@ -538,10 +544,11 @@ pub mod testing {
538
544
impl NonPermissionedBuilderTestConfig {
539
545
pub const SUBSCRIBED_DA_NODE_ID : usize = 5 ;
540
546
541
- pub async fn init_non_permissioned_builder (
547
+ pub async fn init_non_permissioned_builder < V : Versions > (
542
548
hotshot_events_streaming_api_url : Url ,
543
549
hotshot_builder_api_url : Url ,
544
550
num_nodes : usize ,
551
+ versions : V ,
545
552
) -> Self {
546
553
// generate builder keys
547
554
let seed = [ 201_u8 ; 32 ] ;
@@ -562,14 +569,15 @@ pub mod testing {
562
569
tx_channel_capacity,
563
570
event_channel_capacity,
564
571
node_count,
565
- NodeState :: default ( ) ,
572
+ NodeState :: default ( ) . with_current_version ( V :: Base :: VERSION ) ,
566
573
ValidatedState :: default ( ) ,
567
574
hotshot_events_streaming_api_url,
568
575
hotshot_builder_api_url,
569
576
Duration :: from_millis ( 2000 ) ,
570
577
15 ,
571
578
Duration :: from_millis ( 500 ) ,
572
579
ChainConfig :: default ( ) . base_fee ,
580
+ versions,
573
581
)
574
582
. await
575
583
. unwrap ( ) ;
@@ -581,25 +589,20 @@ pub mod testing {
581
589
}
582
590
}
583
591
584
- pub struct PermissionedBuilderTestConfig <
585
- P : SequencerPersistence ,
586
- Ver : StaticVersionType + ' static ,
587
- > {
588
- pub builder_context : BuilderContext < network:: Memory , P , Ver > ,
592
+ pub struct PermissionedBuilderTestConfig < P : SequencerPersistence , V : Versions > {
593
+ pub builder_context : BuilderContext < network:: Memory , P , V > ,
589
594
pub fee_account : FeeAccount ,
590
595
}
591
596
592
- impl < P : SequencerPersistence , Ver : StaticVersionType + ' static >
593
- PermissionedBuilderTestConfig < P , Ver >
594
- {
597
+ impl < P : SequencerPersistence , V : Versions > PermissionedBuilderTestConfig < P , V > {
595
598
pub async fn init_permissioned_builder (
596
- hotshot_handle : Arc < Consensus < network:: Memory , P > > ,
599
+ hotshot_handle : Arc < Consensus < network:: Memory , P , V > > ,
597
600
node_id : u64 ,
598
- state_signer : Arc < StateSigner < Ver > > ,
601
+ state_signer : Arc < StateSigner < SequencerApiVersion > > ,
599
602
hotshot_builder_api_url : Url ,
600
603
) -> Self {
601
604
// setup the instance state
602
- let node_state = NodeState :: default ( ) ;
605
+ let node_state = NodeState :: default ( ) . with_current_version ( V :: Base :: VERSION ) ;
603
606
604
607
// generate builder keys
605
608
let seed = [ 201_u8 ; 32 ] ;
@@ -784,7 +787,7 @@ pub mod testing {
784
787
mod test {
785
788
use async_std:: stream:: IntoStream ;
786
789
use clap:: builder;
787
- use espresso_types:: { Header , NodeState , Payload , ValidatedState } ;
790
+ use espresso_types:: { Header , MockSequencerVersions , NodeState , Payload , ValidatedState } ;
788
791
use ethers:: providers:: Quorum ;
789
792
use futures:: StreamExt ;
790
793
use hotshot:: types:: EventType :: Decide ;
@@ -811,13 +814,13 @@ mod test {
811
814
async fn test_non_voting_hotshot_node ( ) {
812
815
setup_test ( ) ;
813
816
814
- let ver = StaticVersion :: < 0 , 1 > :: instance ( ) ;
815
-
816
817
let success_height = 5 ;
817
818
// Assign `config` so it isn't dropped early.
818
819
let config = HotShotTestConfig :: default ( ) ;
819
820
tracing:: debug!( "Done with hotshot test config" ) ;
820
- let handles = config. init_nodes ( ver, no_storage:: Options ) . await ;
821
+ let handles = config
822
+ . init_nodes ( MockSequencerVersions :: new ( ) , no_storage:: Options )
823
+ . await ;
821
824
tracing:: debug!( "Done with init nodes" ) ;
822
825
let total_nodes = HotShotTestConfig :: total_nodes ( ) ;
823
826
0 commit comments