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
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -263,7 +263,7 @@
 	}
 
 	fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {
-		Ok(<SponsoringFeeLimit<T>>::get(contract_address))
+		Ok(<SponsoringFeeLimit<T>>::get(contract_address, 0xffffffff))
 	}
 
 	/// Is specified user present in contract allow list
@@ -413,7 +413,7 @@
 			}
 		}
 
-		let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address);
+		let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address, 0xffffffff);
 
 		if call_context.max_fee > sponsored_fee_limit {
 			return None;
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
121 /// * **Key2** - sponsored user address.121 /// * **Key2** - sponsored user address.
122 /// * **Value** - last sponsored block number.122 /// * **Value** - last sponsored block number.
123 #[pallet::storage]123 #[pallet::storage]
124 pub(super) type SponsoringFeeLimit<T: Config> = StorageMap<124 pub(super) type SponsoringFeeLimit<T: Config> = StorageDoubleMap<
125 Hasher = Twox128,125 Hasher1 = Twox128,
126 Key = H160,126 Key1 = H160,
127 Hasher2 = Blake2_128Concat,
128 Key2 = u32,
127 Value = U256,129 Value = U256,
128 QueryKind = ValueQuery,130 QueryKind = ValueQuery,
129 OnEmpty = T::DefaultSponsoringFeeLimit,131 OnEmpty = T::DefaultSponsoringFeeLimit,
367369
368 /// Set maximum for gas limit of transaction370 /// Set maximum for gas limit of transaction
369 pub fn set_sponsoring_fee_limit(contract: H160, fee_limit: U256) {371 pub fn set_sponsoring_fee_limit(contract: H160, fee_limit: U256) {
370 <SponsoringFeeLimit<T>>::insert(contract, fee_limit);372 <SponsoringFeeLimit<T>>::insert(contract, 0xffffffff, fee_limit);
371 }373 }
372374
373 /// Is user added to allowlist, or he is owner of specified contract375 /// Is user added to allowlist, or he is owner of specified contract