Skip to content

Commit 3c159bf

Browse files
committed
Fix account id lookup in proxy precompile
1 parent 97720eb commit 3c159bf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

runtime/src/precompiles/staking.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ use pallet_evm::{
3131
ExitError, ExitSucceed, PrecompileFailure, PrecompileHandle, PrecompileOutput, PrecompileResult,
3232
};
3333
use sp_core::crypto::Ss58Codec;
34-
use sp_core::U256;
34+
use sp_core::{U256, H256};
3535
use sp_runtime::traits::Dispatchable;
36-
use sp_runtime::traits::{BlakeTwo256, UniqueSaturatedInto};
36+
use sp_runtime::traits::{BlakeTwo256, UniqueSaturatedInto, StaticLookup};
3737
use sp_runtime::AccountId32;
3838

3939
use crate::{
@@ -108,7 +108,8 @@ impl StakingPrecompile {
108108
}
109109

110110
fn add_proxy(handle: &mut impl PrecompileHandle, data: &[u8]) -> PrecompileResult {
111-
let delegate = sp_runtime::MultiAddress::Address32(Self::parse_pub_key(data)?);
111+
let delegate = AccountId32::from(Self::parse_pub_key(data)?);
112+
let delegate = <Runtime as frame_system::Config>::Lookup::unlookup(delegate);
112113
let call = RuntimeCall::Proxy(pallet_proxy::Call::<Runtime>::add_proxy {
113114
delegate,
114115
proxy_type: ProxyType::Staking,
@@ -119,7 +120,8 @@ impl StakingPrecompile {
119120
}
120121

121122
fn remove_proxy(handle: &mut impl PrecompileHandle, data: &[u8]) -> PrecompileResult {
122-
let delegate = sp_runtime::MultiAddress::Address32(Self::parse_pub_key(data)?);
123+
let delegate = AccountId32::from(Self::parse_pub_key(data)?);
124+
let delegate = <Runtime as frame_system::Config>::Lookup::unlookup(delegate);
123125
let call = RuntimeCall::Proxy(pallet_proxy::Call::<Runtime>::remove_proxy {
124126
delegate,
125127
proxy_type: ProxyType::Staking,

0 commit comments

Comments
 (0)