difftreelog
fix Change hashier for `Sponsoring` storage
in: master
2 files changed
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -295,24 +295,24 @@
for HelpersContractSponsoring<T>
{
fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {
- let (contract, _) = call;
- let mode = <Pallet<T>>::sponsoring_mode(*contract);
+ let (contract_address, _) = call;
+ let mode = <Pallet<T>>::sponsoring_mode(*contract_address);
if mode == SponsoringModeT::Disabled {
return None;
}
- let sponsor = match <Pallet<T>>::get_sponsor(*contract) {
+ let sponsor = match <Pallet<T>>::get_sponsor(*contract_address) {
Some(sponsor) => sponsor,
None => return None,
};
- if mode == SponsoringModeT::Allowlisted && !<Pallet<T>>::allowed(*contract, *who.as_eth()) {
+ if mode == SponsoringModeT::Allowlisted && !<Pallet<T>>::allowed(*contract_address, *who.as_eth()) {
return None;
}
let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
- if let Some(last_tx_block) = <SponsorBasket<T>>::get(contract, who.as_eth()) {
- let limit = <SponsoringRateLimit<T>>::get(contract);
+ if let Some(last_tx_block) = <SponsorBasket<T>>::get(contract_address, who.as_eth()) {
+ let limit = <SponsoringRateLimit<T>>::get(contract_address);
let timeout = last_tx_block + limit;
if block_number < timeout {
@@ -320,7 +320,7 @@
}
}
- <SponsorBasket<T>>::insert(contract, who.as_eth(), block_number);
+ <SponsorBasket<T>>::insert(contract_address, who.as_eth(), block_number);
Some(sponsor)
}
pallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth29 use pallet_evm_coder_substrate::DispatchResult;29 use pallet_evm_coder_substrate::DispatchResult;30 use sp_core::H160;30 use sp_core::H160;31 use pallet_evm::account::CrossAccountId;31 use pallet_evm::account::CrossAccountId;32 use frame_system::pallet_prelude::BlockNumberFor;33 use up_data_structs::SponsorshipState;32 use up_data_structs::SponsorshipState;343335 #[pallet::config]34 #[pallet::config]66 pub(super) type SelfSponsoring<T: Config> =65 pub(super) type SelfSponsoring<T: Config> =67 StorageMap<Hasher = Twox128, Key = H160, Value = bool, QueryKind = ValueQuery>;66 StorageMap<Hasher = Twox128, Key = H160, Value = bool, QueryKind = ValueQuery>;686768 /// Store for contract sponsorship state.69 /// 70 /// * **Key** - contract address.71 /// * **Value** - sponsorship state.69 #[pallet::storage]72 #[pallet::storage]70 pub(super) type Sponsoring<T: Config> = StorageMap<73 pub(super) type Sponsoring<T: Config> = StorageMap<71 Hasher = Twox128,74 Hasher = Twox64Concat,72 Key = H160,75 Key = H160,73 Value = SponsorshipState<T::CrossAccountId>,76 Value = SponsorshipState<T::CrossAccountId>,74 QueryKind = ValueQuery,77 QueryKind = ValueQuery,