@@ -139,21 +139,17 @@ mod benchmarks {
139139 use k256:: ecdsa:: SigningKey ;
140140 use sp_core:: keccak_256;
141141
142- // Generate a signing key
143142 let signing_key = SigningKey :: from_slice ( & keccak_256 ( & [ 0u8 ; 32 ] ) )
144143 . expect ( "valid key" ) ;
145144
146- // Create target address
147145 let target_address = H160 :: from_low_u64_be ( 1 ) ;
148146
149- // Create unsigned authorization
150147 let unsigned_auth = AuthorizationListEntry {
151148 chain_id : U256 :: from ( T :: ChainId :: get ( ) ) ,
152149 address : target_address,
153150 nonce : U256 :: zero ( ) ,
154151 } ;
155152
156- // Sign the authorization
157153 let mut message = Vec :: new ( ) ;
158154 message. push ( eip7702:: EIP7702_MAGIC ) ;
159155 message. extend_from_slice ( & crate :: evm:: rlp:: encode ( & unsigned_auth) ) ;
@@ -187,23 +183,19 @@ mod benchmarks {
187183 #[ benchmark( pov_mode = Measured ) ]
188184 fn apply_delegations_existing ( a : Linear < 1 , 16 > ) -> Result < ( ) , BenchmarkError > {
189185 use crate :: evm:: eip7702;
190- use frame_support:: traits:: fungible:: Mutate ;
191186
192187 let mut authorities = alloc:: collections:: BTreeMap :: new ( ) ;
193188
194- // Create existing accounts with balance
195189 for i in 0 ..a {
196190 let authority = H160 :: from_low_u64_be ( i as u64 + 1 ) ;
197191 let target = H160 :: from_low_u64_be ( ( i + 100 ) as u64 ) ;
198-
199- // Fund the account so it exists in frame_system
192+
200193 let authority_id = T :: AddressMapper :: to_account_id ( & authority) ;
201- let _ = T :: Currency :: set_balance ( & authority_id, 1_000_000u32 . into ( ) ) ;
202-
203- // Verify the account now exists in frame_system
194+ frame_system:: Pallet :: < T > :: inc_account_nonce ( & authority_id) ;
195+
204196 assert ! ( frame_system:: Account :: <T >:: contains_key( & authority_id) ,
205- "Account should exist after setting balance " ) ;
206-
197+ "Account should exist after incrementing nonce " ) ;
198+
207199 authorities. insert ( authority, target) ;
208200 }
209201
@@ -223,15 +215,13 @@ mod benchmarks {
223215
224216 let mut authorities = alloc:: collections:: BTreeMap :: new ( ) ;
225217
226- // Create authority addresses that don't exist in frame_system
227218 for i in 0 ..a {
228219 let authority = H160 :: from_low_u64_be ( ( i + 1000 ) as u64 ) ;
229220 let target = H160 :: from_low_u64_be ( ( i + 2000 ) as u64 ) ;
230-
231- // Verify the account doesn't exist
221+
232222 let authority_id = T :: AddressMapper :: to_account_id ( & authority) ;
233223 assert ! ( !frame_system:: Account :: <T >:: contains_key( & authority_id) ) ;
234-
224+
235225 authorities. insert ( authority, target) ;
236226 }
237227
0 commit comments