@@ -33,7 +33,9 @@ use sov_rollup_interface::node::da::DaService;
3333use sov_rollup_interface:: node:: ledger_api:: IncludeChildren ;
3434use sov_sequencer:: { SequencerKindConfig , StateUpdateNotification } ;
3535use sov_test_modules:: hooks_count:: HooksCount ;
36- use sov_test_utils:: runtime:: genesis:: optimistic:: HighLevelOptimisticGenesisConfig ;
36+ use sov_test_utils:: runtime:: genesis:: optimistic:: {
37+ HighLevelOptimisticGenesisConfig , MinimalOptimisticGenesisConfig ,
38+ } ;
3739use sov_test_utils:: test_rollup:: FullNodeBlueprint ;
3840use sov_test_utils:: test_rollup:: StoragePath ;
3941use sov_test_utils:: test_rollup:: { GenesisSource , RollupBuilder , RollupProverConfig , TestRollup } ;
@@ -3725,6 +3727,74 @@ fn tx_assert_state_root(
37253727 encode_call :: < TestRuntime < TestSpec > > ( key, nonce, & msg)
37263728}
37273729
3730+ #[ tokio:: test( flavor = "multi_thread" ) ]
3731+ #[ should_panic( expected = "DA address mismatch" ) ]
3732+ async fn preferred_sequencer_fails_on_da_address_mismatch ( ) {
3733+ let genesis_config = HighLevelOptimisticGenesisConfig :: generate ( ) ;
3734+ let genesis_params = GenesisParams {
3735+ runtime : <TestRuntime < TestSpec > as Runtime < TestSpec > >:: GenesisConfig :: from_minimal_config (
3736+ genesis_config. into ( ) ,
3737+ ValueSetterConfig {
3738+ admin : sov_modules_api:: Address :: from ( [ 0 ; 28 ] ) ,
3739+ } ,
3740+ ( ) ,
3741+ PaymasterConfig :: default ( ) ,
3742+ ( ) ,
3743+ ( ) ,
3744+ ) ,
3745+ } ;
3746+
3747+ RollupBuilder :: < TestBlueprint > :: new (
3748+ GenesisSource :: CustomParams ( genesis_params) ,
3749+ DEFAULT_BLOCK_PRODUCING_CONFIG ,
3750+ 0 ,
3751+ )
3752+ . set_config ( |conf| {
3753+ conf. sequencer_config = SequencerKindConfig :: Preferred ( Default :: default ( ) ) ;
3754+ } )
3755+ . start ( )
3756+ . await
3757+ . unwrap ( ) ;
3758+ }
3759+
3760+ #[ tokio:: test( flavor = "multi_thread" ) ]
3761+ #[ should_panic( expected = "No preferred sequencer is registered in the sequencer registry" ) ]
3762+ async fn preferred_sequencer_fails_when_no_preferred_sequencer_in_registry ( ) {
3763+ let genesis_config = HighLevelOptimisticGenesisConfig :: generate ( ) ;
3764+ let seq_da_address = HighLevelOptimisticGenesisConfig :: < TestSpec > :: sequencer_da_addr ( ) ;
3765+ let mut minimal: MinimalOptimisticGenesisConfig < TestSpec > = genesis_config. into ( ) ;
3766+ minimal
3767+ . config
3768+ . sequencer_registry
3769+ . sequencer_config
3770+ . is_preferred_sequencer = false ;
3771+ let genesis_params = GenesisParams {
3772+ runtime : <TestRuntime < TestSpec > as Runtime < TestSpec > >:: GenesisConfig :: from_minimal_config (
3773+ minimal,
3774+ ValueSetterConfig {
3775+ admin : sov_modules_api:: Address :: from ( [ 0 ; 28 ] ) ,
3776+ } ,
3777+ ( ) ,
3778+ PaymasterConfig :: default ( ) ,
3779+ ( ) ,
3780+ ( ) ,
3781+ ) ,
3782+ } ;
3783+
3784+ RollupBuilder :: < TestBlueprint > :: new (
3785+ GenesisSource :: CustomParams ( genesis_params) ,
3786+ DEFAULT_BLOCK_PRODUCING_CONFIG ,
3787+ 0 ,
3788+ )
3789+ . set_config ( |conf| {
3790+ conf. sequencer_config = SequencerKindConfig :: Preferred ( Default :: default ( ) ) ;
3791+ } )
3792+ . set_da_config ( |c| c. sender_address = seq_da_address)
3793+ . start ( )
3794+ . await
3795+ . unwrap ( ) ;
3796+ }
3797+
37283798mod tests_with_basic_kernel {
37293799 use sov_modules_stf_blueprint:: GenesisParams ;
37303800 use sov_test_utils:: test_rollup:: { GenesisSource , RollupBuilder } ;
@@ -3745,6 +3815,7 @@ mod tests_with_basic_kernel {
37453815 ) ]
37463816 async fn preferred_sequencer_panics_with_basic_kernel ( ) {
37473817 let genesis_config = HighLevelOptimisticGenesisConfig :: generate ( ) ;
3818+ let seq_da_address = HighLevelOptimisticGenesisConfig :: < TestSpec > :: sequencer_da_addr ( ) ;
37483819 let genesis_params = GenesisParams {
37493820 runtime : GenesisConfig :: from_minimal_config ( genesis_config. into ( ) ) ,
37503821 } ;
@@ -3758,6 +3829,7 @@ mod tests_with_basic_kernel {
37583829 conf. sequencer_config =
37593830 sov_sequencer:: SequencerKindConfig :: Preferred ( Default :: default ( ) ) ;
37603831 } )
3832+ . set_da_config ( |c| c. sender_address = seq_da_address)
37613833 . start ( )
37623834 . await
37633835 . unwrap ( ) ;
0 commit comments