difftreelog
chore add posibility to define different limits for methods in the future
in: master
2 files changed
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth263 }263 }264264265 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 }268268269 /// Is specified user present in contract allow list269 /// Is specified user present in contract allow list413 }413 }414 }414 }415415416 let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address);416 let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address, 0xffffffff);417417418 if call_context.max_fee > sponsored_fee_limit {418 if call_context.max_fee > sponsored_fee_limit {419 return None;419 return None;pallets/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