git.delta.rocks / unique-network / refs/commits / 7e9e8858b433

difftreelog

chore add posibility to define different limits for methods in the future

Grigoriy Simonov2022-09-13parent: #98cf2b1.patch.diff
in: master

2 files changed

modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
263 }263 }
264264
265 fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {265 fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {
266 Ok(<SponsoringFeeLimit<T>>::get(contract_address))266 Ok(<SponsoringFeeLimit<T>>::get(contract_address, 0xffffffff))
267 }267 }
268268
269 /// Is specified user present in contract allow list269 /// Is specified user present in contract allow list
413 }413 }
414 }414 }
415415
416 let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address);416 let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address, 0xffffffff);
417417
418 if call_context.max_fee > sponsored_fee_limit {418 if call_context.max_fee > sponsored_fee_limit {
419 return None;419 return None;
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -121,9 +121,11 @@
 	/// * **Key2** - sponsored user address.
 	/// * **Value** - last sponsored block number.
 	#[pallet::storage]
-	pub(super) type SponsoringFeeLimit<T: Config> = StorageMap<
-		Hasher = Twox128,
-		Key = H160,
+	pub(super) type SponsoringFeeLimit<T: Config> = StorageDoubleMap<
+		Hasher1 = Twox128,
+		Key1 = H160,
+		Hasher2 = Blake2_128Concat,
+		Key2 = u32,
 		Value = U256,
 		QueryKind = ValueQuery,
 		OnEmpty = T::DefaultSponsoringFeeLimit,
@@ -367,7 +369,7 @@
 
 		/// Set maximum for gas limit of transaction
 		pub fn set_sponsoring_fee_limit(contract: H160, fee_limit: U256) {
-			<SponsoringFeeLimit<T>>::insert(contract, fee_limit);
+			<SponsoringFeeLimit<T>>::insert(contract, 0xffffffff, fee_limit);
 		}
 
 		/// Is user added to allowlist, or he is owner of specified contract