@@ -33,9 +33,18 @@ pub mod pallet {
3333
3434 #[ pallet:: trait_]
3535 pub trait Trait : frame_system:: Trait {
36+ /// Some comment
37+ /// Some comment
3638 #[ pallet:: const_]
3739 type MyGetParam : Get < u32 > ;
40+
41+ /// Some comment
42+ /// Some comment
43+ #[ pallet:: const_]
44+ type MyGetParam2 : Get < u32 > ;
45+
3846 type Balance : Parameter + Default ;
47+
3948 type Event : From < Event < Self > > + IsType < <Self as frame_system:: Trait >:: Event > ;
4049 }
4150
@@ -68,7 +77,7 @@ pub mod pallet {
6877 impl < T : Trait > Call for Module < T > where T :: Balance : From < u64 > {
6978 /// Doc comment put in metadata
7079 #[ pallet:: weight( Weight :: from( * _foo) ) ]
71- fn foo ( origin : OriginFor < T > , #[ pallet:: compact] _foo : u32 ) -> DispatchResultWithPostInfo {
80+ fn foo ( origin : OriginFor < T > , #[ pallet:: compact] _foo : u32 , _bar : u32 ) -> DispatchResultWithPostInfo {
7281 T :: Balance :: from ( 3u64 ) ; // Test for where clause
7382 let _ = origin;
7483 Self :: deposit_event ( Event :: Something ( 3 ) ) ;
@@ -174,6 +183,7 @@ pub mod pallet {
174183
175184frame_support:: parameter_types!(
176185 pub const MyGetParam : u32 = 10 ;
186+ pub const MyGetParam2 : u32 = 11 ;
177187 pub const BlockHashCount : u32 = 250 ;
178188 pub const MaximumBlockWeight : frame_support:: weights:: Weight = 1024 ;
179189 pub const MaximumBlockLength : u32 = 2 * 1024 ;
@@ -210,6 +220,7 @@ impl frame_system::Trait for Runtime {
210220impl pallet:: Trait for Runtime {
211221 type Event = Event ;
212222 type MyGetParam = MyGetParam ;
223+ type MyGetParam2 = MyGetParam2 ;
213224 type Balance = u64 ;
214225}
215226
@@ -230,7 +241,7 @@ frame_support::construct_runtime!(
230241
231242#[ test]
232243fn call_expand ( ) {
233- let call_foo = pallet:: Call :: < Runtime > :: foo ( 3 ) ;
244+ let call_foo = pallet:: Call :: < Runtime > :: foo ( 3 , 0 ) ;
234245 assert_eq ! (
235246 call_foo. get_dispatch_info( ) ,
236247 DispatchInfo {
@@ -275,7 +286,7 @@ fn instance_expand() {
275286fn module_expand_deposit_event ( ) {
276287 TestExternalities :: default ( ) . execute_with ( || {
277288 frame_system:: Module :: < Runtime > :: set_block_number ( 1 ) ;
278- pallet:: Call :: < Runtime > :: foo ( 3 ) . dispatch_bypass_filter ( None . into ( ) ) . unwrap ( ) ;
289+ pallet:: Call :: < Runtime > :: foo ( 3 , 0 ) . dispatch_bypass_filter ( None . into ( ) ) . unwrap ( ) ;
279290 assert_eq ! (
280291 frame_system:: Module :: <Runtime >:: events( ) [ 0 ] . event,
281292 Event :: pallet( pallet:: Event :: Something ( 3 ) ) ,
@@ -432,6 +443,10 @@ fn metadata() {
432443 FunctionArgumentMetadata {
433444 name: DecodeDifferent :: Decoded ( "_foo" . to_string( ) ) ,
434445 ty: DecodeDifferent :: Decoded ( "Compact<u32>" . to_string( ) ) ,
446+ } ,
447+ FunctionArgumentMetadata {
448+ name: DecodeDifferent :: Decoded ( "_bar" . to_string( ) ) ,
449+ ty: DecodeDifferent :: Decoded ( "u32" . to_string( ) ) ,
435450 }
436451 ] ) ,
437452 documentation: DecodeDifferent :: Decoded ( vec![
@@ -477,7 +492,19 @@ fn metadata() {
477492 name: DecodeDifferent :: Decoded ( "MyGetParam" . to_string( ) ) ,
478493 ty: DecodeDifferent :: Decoded ( "u32" . to_string( ) ) ,
479494 value: DecodeDifferent :: Decoded ( vec![ 10 , 0 , 0 , 0 ] ) ,
480- documentation: DecodeDifferent :: Decoded ( vec![ ] ) ,
495+ documentation: DecodeDifferent :: Decoded ( vec![
496+ " Some comment" . to_string( ) ,
497+ " Some comment" . to_string( ) ,
498+ ] ) ,
499+ } ,
500+ ModuleConstantMetadata {
501+ name: DecodeDifferent :: Decoded ( "MyGetParam2" . to_string( ) ) ,
502+ ty: DecodeDifferent :: Decoded ( "u32" . to_string( ) ) ,
503+ value: DecodeDifferent :: Decoded ( vec![ 11 , 0 , 0 , 0 ] ) ,
504+ documentation: DecodeDifferent :: Decoded ( vec![
505+ " Some comment" . to_string( ) ,
506+ " Some comment" . to_string( ) ,
507+ ] ) ,
481508 } ,
482509 ] ) ,
483510 errors : DecodeDifferent :: Decoded ( vec ! [
0 commit comments