@@ -250,6 +250,7 @@ enum TestScenario {
250250 ContractVersionExistance ,
251251 ) ,
252252 VmCasperV2ByPackageHash ,
253+ VmCasperV2MissingSeedValue ,
253254}
254255
255256impl TestScenario {
@@ -305,7 +306,8 @@ impl TestScenario {
305306 | TestScenario :: RedelegateExceedingMaximumDelegation
306307 | TestScenario :: DelegateExceedingMaximumDelegation
307308 | TestScenario :: VmCasperV2ByPackageHash
308- | TestScenario :: V1ByPackage ( ..) => Source :: Client ,
309+ | TestScenario :: V1ByPackage ( ..)
310+ | TestScenario :: VmCasperV2MissingSeedValue => Source :: Client ,
309311 }
310312 }
311313
@@ -860,6 +862,20 @@ impl TestScenario {
860862 . unwrap ( ) ;
861863 Transaction :: from ( txn)
862864 }
865+ TestScenario :: VmCasperV2MissingSeedValue => {
866+ let transaction_runtime = TransactionRuntimeParams :: VmCasperV2 {
867+ transferred_value : 3_000_000_000u64 ,
868+ seed : None ,
869+ } ;
870+ let module_bytes = Bytes :: from ( vec ! [ 1 ] ) ;
871+ let txn =
872+ TransactionV1Builder :: new_session ( true , module_bytes, transaction_runtime)
873+ . with_chain_name ( "casper-example" )
874+ . with_secret_key ( & secret_key)
875+ . build ( )
876+ . unwrap ( ) ;
877+ Transaction :: from ( txn)
878+ }
863879 }
864880 }
865881
@@ -937,6 +953,7 @@ impl TestScenario {
937953 HashOrName :: Name => true ,
938954 }
939955 } ,
956+ TestScenario :: VmCasperV2MissingSeedValue => false ,
940957 }
941958 }
942959
@@ -961,7 +978,10 @@ impl TestScenario {
961978 }
962979
963980 fn is_v2_casper_vm ( & self ) -> bool {
964- matches ! ( self , TestScenario :: VmCasperV2ByPackageHash )
981+ matches ! (
982+ self ,
983+ TestScenario :: VmCasperV2ByPackageHash | TestScenario :: VmCasperV2MissingSeedValue
984+ )
965985 }
966986}
967987
@@ -1692,6 +1712,14 @@ async fn run_transaction_acceptor_without_timeout(
16921712 ..
16931713 } )
16941714 ) ,
1715+ TestScenario :: VmCasperV2MissingSeedValue => {
1716+ matches ! (
1717+ event,
1718+ Event :: TransactionAcceptorAnnouncement (
1719+ TransactionAcceptorAnnouncement :: InvalidTransaction { .. }
1720+ )
1721+ )
1722+ }
16951723 TestScenario :: V1ByPackage (
16961724 hash_or_name,
16971725 entity_version,
@@ -3063,3 +3091,17 @@ async fn should_succeed_when_asking_for_active_exact_version() {
30633091 . await ;
30643092 assert ! ( result. is_ok( ) )
30653093}
3094+
3095+ #[ tokio:: test]
3096+ async fn should_reject_vm2_installs_without_seed_value ( ) {
3097+ let result = run_transaction_acceptor ( TestScenario :: VmCasperV2MissingSeedValue ) . await ;
3098+ assert ! (
3099+ matches!(
3100+ result,
3101+ Err ( super :: Error :: InvalidTransaction ( InvalidTransaction :: V1 (
3102+ InvalidTransactionV1 :: MissingSeed
3103+ ) ) )
3104+ ) ,
3105+ "{result:?}"
3106+ ) ;
3107+ }
0 commit comments