@@ -34,36 +34,8 @@ macro_rules! identify_chain {
3434 $generic_code: expr $( , ) *
3535 ) => {
3636 match $chain {
37- Chain :: Polkadot => {
38- #[ cfg( feature = "polkadot-native" ) ]
39- {
40- use polkadot_runtime as runtime;
41-
42- let call = $generic_code;
43-
44- Ok ( polkadot_sign_call( call, $nonce, $current_block, $period, $genesis, $signer) )
45- }
46-
47- #[ cfg( not( feature = "polkadot-native" ) ) ]
48- {
49- Err ( "`polkadot-native` feature not enabled" )
50- }
51- } ,
52- Chain :: Kusama => {
53- #[ cfg( feature = "kusama-native" ) ]
54- {
55- use kusama_runtime as runtime;
56-
57- let call = $generic_code;
58-
59- Ok ( kusama_sign_call( call, $nonce, $current_block, $period, $genesis, $signer) )
60- }
61-
62- #[ cfg( not( feature = "kusama-native" ) ) ]
63- {
64- Err ( "`kusama-native` feature not enabled" )
65- }
66- } ,
37+ Chain :: Polkadot => Err ( "Polkadot runtimes are currently not supported" ) ,
38+ Chain :: Kusama => Err ( "Kusama runtimes are currently not supported" ) ,
6739 Chain :: Rococo => {
6840 #[ cfg( feature = "rococo-native" ) ]
6941 {
@@ -91,16 +63,18 @@ macro_rules! identify_chain {
9163
9264 #[ cfg( not( feature = "westend-native" ) ) ]
9365 {
94- let _ = $nonce;
95- let _ = $current_block;
96- let _ = $period;
97- let _ = $genesis;
98- let _ = $signer;
99-
10066 Err ( "`westend-native` feature not enabled" )
10167 }
10268 } ,
103- Chain :: Unknown => Err ( "Unknown chain" ) ,
69+ Chain :: Unknown => {
70+ let _ = $nonce;
71+ let _ = $current_block;
72+ let _ = $period;
73+ let _ = $genesis;
74+ let _ = $signer;
75+
76+ Err ( "Unknown chain" )
77+ } ,
10478 }
10579 } ;
10680}
@@ -130,10 +104,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
130104 }
131105
132106 fn build ( & self , nonce : u32 ) -> std:: result:: Result < OpaqueExtrinsic , & ' static str > {
133- let period = polkadot_runtime_common:: BlockHashCount :: get ( )
134- . checked_next_power_of_two ( )
135- . map ( |c| c / 2 )
136- . unwrap_or ( 2 ) as u64 ;
107+ let period = 128 ;
137108 let genesis = self . client . usage_info ( ) . chain . best_hash ;
138109 let signer = Sr25519Keyring :: Bob . pair ( ) ;
139110 let current_block = 0 ;
@@ -181,10 +152,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
181152
182153 fn build ( & self , nonce : u32 ) -> std:: result:: Result < OpaqueExtrinsic , & ' static str > {
183154 let signer = Sr25519Keyring :: Bob . pair ( ) ;
184- let period = polkadot_runtime_common:: BlockHashCount :: get ( )
185- . checked_next_power_of_two ( )
186- . map ( |c| c / 2 )
187- . unwrap_or ( 2 ) as u64 ;
155+ let period = 128 ;
188156 let genesis = self . client . usage_info ( ) . chain . best_hash ;
189157 let current_block = 0 ;
190158 let _dest = self . dest . clone ( ) ;
@@ -206,60 +174,6 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
206174 }
207175}
208176
209- #[ cfg( feature = "polkadot-native" ) ]
210- fn polkadot_sign_call (
211- call : polkadot_runtime:: RuntimeCall ,
212- nonce : u32 ,
213- current_block : u64 ,
214- period : u64 ,
215- genesis : sp_core:: H256 ,
216- acc : sp_core:: sr25519:: Pair ,
217- ) -> OpaqueExtrinsic {
218- use codec:: Encode ;
219- use polkadot_runtime as runtime;
220- use sp_core:: Pair ;
221-
222- let extra: runtime:: SignedExtra = (
223- frame_system:: CheckNonZeroSender :: < runtime:: Runtime > :: new ( ) ,
224- frame_system:: CheckSpecVersion :: < runtime:: Runtime > :: new ( ) ,
225- frame_system:: CheckTxVersion :: < runtime:: Runtime > :: new ( ) ,
226- frame_system:: CheckGenesis :: < runtime:: Runtime > :: new ( ) ,
227- frame_system:: CheckMortality :: < runtime:: Runtime > :: from ( sp_runtime:: generic:: Era :: mortal (
228- period,
229- current_block,
230- ) ) ,
231- frame_system:: CheckNonce :: < runtime:: Runtime > :: from ( nonce) ,
232- frame_system:: CheckWeight :: < runtime:: Runtime > :: new ( ) ,
233- pallet_transaction_payment:: ChargeTransactionPayment :: < runtime:: Runtime > :: from ( 0 ) ,
234- polkadot_runtime_common:: claims:: PrevalidateAttests :: < runtime:: Runtime > :: new ( ) ,
235- ) ;
236-
237- let payload = runtime:: SignedPayload :: from_raw (
238- call. clone ( ) ,
239- extra. clone ( ) ,
240- (
241- ( ) ,
242- runtime:: VERSION . spec_version ,
243- runtime:: VERSION . transaction_version ,
244- genesis,
245- genesis,
246- ( ) ,
247- ( ) ,
248- ( ) ,
249- ( ) ,
250- ) ,
251- ) ;
252-
253- let signature = payload. using_encoded ( |p| acc. sign ( p) ) ;
254- runtime:: UncheckedExtrinsic :: new_signed (
255- call,
256- sp_runtime:: AccountId32 :: from ( acc. public ( ) ) . into ( ) ,
257- polkadot_core_primitives:: Signature :: Sr25519 ( signature. clone ( ) ) ,
258- extra,
259- )
260- . into ( )
261- }
262-
263177#[ cfg( feature = "westend-native" ) ]
264178fn westend_sign_call (
265179 call : westend_runtime:: RuntimeCall ,
@@ -312,58 +226,6 @@ fn westend_sign_call(
312226 . into ( )
313227}
314228
315- #[ cfg( feature = "kusama-native" ) ]
316- fn kusama_sign_call (
317- call : kusama_runtime:: RuntimeCall ,
318- nonce : u32 ,
319- current_block : u64 ,
320- period : u64 ,
321- genesis : sp_core:: H256 ,
322- acc : sp_core:: sr25519:: Pair ,
323- ) -> OpaqueExtrinsic {
324- use codec:: Encode ;
325- use kusama_runtime as runtime;
326- use sp_core:: Pair ;
327-
328- let extra: runtime:: SignedExtra = (
329- frame_system:: CheckNonZeroSender :: < runtime:: Runtime > :: new ( ) ,
330- frame_system:: CheckSpecVersion :: < runtime:: Runtime > :: new ( ) ,
331- frame_system:: CheckTxVersion :: < runtime:: Runtime > :: new ( ) ,
332- frame_system:: CheckGenesis :: < runtime:: Runtime > :: new ( ) ,
333- frame_system:: CheckMortality :: < runtime:: Runtime > :: from ( sp_runtime:: generic:: Era :: mortal (
334- period,
335- current_block,
336- ) ) ,
337- frame_system:: CheckNonce :: < runtime:: Runtime > :: from ( nonce) ,
338- frame_system:: CheckWeight :: < runtime:: Runtime > :: new ( ) ,
339- pallet_transaction_payment:: ChargeTransactionPayment :: < runtime:: Runtime > :: from ( 0 ) ,
340- ) ;
341-
342- let payload = runtime:: SignedPayload :: from_raw (
343- call. clone ( ) ,
344- extra. clone ( ) ,
345- (
346- ( ) ,
347- runtime:: VERSION . spec_version ,
348- runtime:: VERSION . transaction_version ,
349- genesis,
350- genesis,
351- ( ) ,
352- ( ) ,
353- ( ) ,
354- ) ,
355- ) ;
356-
357- let signature = payload. using_encoded ( |p| acc. sign ( p) ) ;
358- runtime:: UncheckedExtrinsic :: new_signed (
359- call,
360- sp_runtime:: AccountId32 :: from ( acc. public ( ) ) . into ( ) ,
361- polkadot_core_primitives:: Signature :: Sr25519 ( signature. clone ( ) ) ,
362- extra,
363- )
364- . into ( )
365- }
366-
367229#[ cfg( feature = "rococo-native" ) ]
368230fn rococo_sign_call (
369231 call : rococo_runtime:: RuntimeCall ,
0 commit comments