File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -838,6 +838,13 @@ pub mod pallet {
838
838
payload_location == PayloadLocation :: Itemized ,
839
839
Error :: <T >:: InvalidSetting
840
840
) ;
841
+ // SignatureRequired is only valid for Itemized and Paginated payload locations
842
+ ensure ! (
843
+ !settings. contains( & SchemaSetting :: SignatureRequired ) ||
844
+ payload_location == PayloadLocation :: Itemized ||
845
+ payload_location == PayloadLocation :: Paginated ,
846
+ Error :: <T >:: InvalidSetting
847
+ ) ;
841
848
let schema_name = match optional_schema_name {
842
849
None => None ,
843
850
Some ( name_payload) => {
Original file line number Diff line number Diff line change @@ -756,7 +756,33 @@ fn create_schema_via_governance_v2_with_append_only_setting_and_non_itemized_sho
756
756
) ;
757
757
} )
758
758
}
759
+ #[ test]
760
+ fn create_schema_via_governance_v2_with_signature_required_setting_and_wrong_location_should_fail ( )
761
+ {
762
+ new_test_ext ( ) . execute_with ( || {
763
+ sudo_set_max_schema_size ( ) ;
764
+
765
+ // arrange
766
+ let settings = vec ! [ SchemaSetting :: SignatureRequired ] ;
767
+ let sender: AccountId = test_public ( 1 ) ;
759
768
769
+ for location in vec ! [ PayloadLocation :: OnChain , PayloadLocation :: IPFS ] {
770
+ // act and assert
771
+ assert_noop ! (
772
+ SchemasPallet :: create_schema_via_governance_v2(
773
+ RuntimeOrigin :: from( pallet_collective:: RawOrigin :: Members ( 2 , 3 ) ) ,
774
+ sender. clone( ) ,
775
+ create_bounded_schema_vec( r#"{"name":"John Doe"}"# ) ,
776
+ ModelType :: AvroBinary ,
777
+ location,
778
+ BoundedVec :: try_from( settings. clone( ) ) . unwrap( ) ,
779
+ None ,
780
+ ) ,
781
+ Error :: <Test >:: InvalidSetting
782
+ ) ;
783
+ }
784
+ } )
785
+ }
760
786
/// Test that a request to be a provider, makes the MSA a provider after the council approves it.
761
787
#[ test]
762
788
fn propose_to_create_schema_v2_happy_path ( ) {
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
375
375
spec_name : create_runtime_str ! ( "frequency" ) ,
376
376
impl_name : create_runtime_str ! ( "frequency" ) ,
377
377
authoring_version : 1 ,
378
- spec_version : 111 ,
378
+ spec_version : 112 ,
379
379
impl_version : 0 ,
380
380
apis : apis:: RUNTIME_API_VERSIONS ,
381
381
transaction_version : 1 ,
@@ -389,7 +389,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
389
389
spec_name : create_runtime_str ! ( "frequency-testnet" ) ,
390
390
impl_name : create_runtime_str ! ( "frequency" ) ,
391
391
authoring_version : 1 ,
392
- spec_version : 111 ,
392
+ spec_version : 112 ,
393
393
impl_version : 0 ,
394
394
apis : apis:: RUNTIME_API_VERSIONS ,
395
395
transaction_version : 1 ,
You can’t perform that action at this time.
0 commit comments