diff --git a/pallets/xvm/src/lib.rs b/pallets/xvm/src/lib.rs index d3c0284b68..1b5de63c64 100644 --- a/pallets/xvm/src/lib.rs +++ b/pallets/xvm/src/lib.rs @@ -47,7 +47,6 @@ use pallet_contracts_primitives::ReturnFlags; use pallet_evm::GasWeightMapping; use parity_scale_codec::Decode; use sp_core::{H160, U256}; -use sp_runtime::traits::StaticLookup; use sp_std::{marker::PhantomData, prelude::*}; use astar_primitives::{ @@ -290,8 +289,7 @@ where let dest = { let error = CallFailure::revert(InvalidTarget, overheads); - let decoded = Decode::decode(&mut target.as_ref()).map_err(|_| error.clone())?; - T::Lookup::lookup(decoded).map_err(|_| error) + Decode::decode(&mut target.as_ref()).map_err(|_| error.clone()) }?; // With overheads, less weight is available. diff --git a/pallets/xvm/src/tests.rs b/pallets/xvm/src/tests.rs index 52794acb9b..09593bd012 100644 --- a/pallets/xvm/src/tests.rs +++ b/pallets/xvm/src/tests.rs @@ -58,7 +58,7 @@ fn calling_into_same_vm_is_not_allowed() { weight_limit: Weight::from_parts(1_000_000, 1_000_000), }; let wasm_vm_id = VmId::Wasm; - let wasm_target = MultiAddress::::Id(ALICE).encode(); + let wasm_target = ALICE.encode(); let wasm_used_weight: Weight = weights::SubstrateWeight::::wasm_call_overheads(); assert_noop!( diff --git a/tests/integration/src/xvm.rs b/tests/integration/src/xvm.rs index 2bca811e5c..08291ce51d 100644 --- a/tests/integration/src/xvm.rs +++ b/tests/integration/src/xvm.rs @@ -231,7 +231,7 @@ fn wasm_payable_call_via_xvm_works() { }, VmId::Wasm, ALICE, - MultiAddress::::Id(wasm_payable_addr.clone()).encode(), + wasm_payable_addr.clone().encode(), // Calling `deposit` hex::decode("0000002a").expect("invalid selector hex"), value, @@ -255,10 +255,10 @@ fn calling_wasm_payable_from_evm_fails_if_caller_contract_balance_below_ed() { RuntimeOrigin::root(), alith(), evm_caller_addr.clone(), - // to: 0x00a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c + // to: 0xa8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c // input: 0x0000002a (deposit) // value: 1000000000 - hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000002100a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"), + hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000003b9aca000000000000000000000000000000000000000000000000000000000000000020a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c00000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"), U256::from(value), 1_000_000, U256::from(DefaultBaseFeePerGas::get()), @@ -295,10 +295,10 @@ fn calling_wasm_payable_from_evm_works() { RuntimeOrigin::root(), alith(), evm_caller_addr.clone(), - // to: 0x00a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c + // to: 0xa8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c // input: 0x0000002a (deposit) // value: 1000000000 - hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000002100a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"), + hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000003b9aca000000000000000000000000000000000000000000000000000000000000000020a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c00000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"), U256::from(value), 1_000_000, U256::from(DefaultBaseFeePerGas::get()), @@ -363,10 +363,10 @@ fn reentrance_not_allowed() { let evm_caller_addr = deploy_evm_contract(CALL_WASM_PAYBLE); let _ = deploy_wasm_contract(WASM_PAYABLE_NAME); - // to: 0x00a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c + // to: 0xa8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c // input: 0x0000002a (deposit) // value: 1000000000 - let call_wasm_payable_input = hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000002100a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"); + let call_wasm_payable_input = hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000003b9aca000000000000000000000000000000000000000000000000000000000000000020a8f69d59df362b69a8d4acdb9001eb3e1b8d067b8fdaa70081aed945bde5c48c00000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"); let input = hex::decode("0000002a") .expect("invalid selector hex") .iter() @@ -522,7 +522,7 @@ fn wasm_call_via_xvm_fails_if_revert() { }, VmId::Wasm, ALICE, - MultiAddress::::Id(wasm_callee_addr.clone()).encode(), + wasm_callee_addr.clone().encode(), input, 0, None, @@ -546,10 +546,10 @@ fn evm_caller_reverts_if_wasm_callee_reverted() { let _ = deploy_wasm_contract(WASM_DUMMY_ERROR_NAME); let evm_caller_addr = deploy_evm_contract(CALL_WASM_PAYBLE); - // to: 0x00a0565d335eb7545deeb25563471219e6f0c9b9bb504a112a5f26fe61237c5a23 + // to: 0xa0565d335eb7545deeb25563471219e6f0c9b9bb504a112a5f26fe61237c5a23 // input: 0x0000002a (do_revert) // value: 0 - let input = hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002100a0565d335eb7545deeb25563471219e6f0c9b9bb504a112a5f26fe61237c5a230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"); + let input = hex::decode("4012b914000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020a0565d335eb7545deeb25563471219e6f0c9b9bb504a112a5f26fe61237c5a2300000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"); let tx = CheckedEthereumTx { target: evm_caller_addr.clone(), input: EthereumTxInput::try_from(input).expect("input too large"), @@ -666,7 +666,7 @@ fn wasm_call_via_xvm_fails_if_storage_deposit_limit_exhausted() { }, VmId::Wasm, ALICE, - MultiAddress::::Id(wasm_callee_addr.clone()).encode(), + wasm_callee_addr.clone().encode(), input, 0, Some(0) @@ -696,7 +696,7 @@ fn wasm_call_via_xvm_call_works_if_sufficient_storage_deposit_limit() { }, VmId::Wasm, ALICE, - MultiAddress::::Id(wasm_callee_addr.clone()).encode(), + wasm_callee_addr.clone().encode(), input, 0, Some(UNIT) @@ -742,11 +742,11 @@ fn calling_wasm_from_evm_works_if_sufficient_storage_deposit_limit() { RuntimeOrigin::root(), alith(), evm_caller_addr.clone(), - // to: 0x000e0ddb5a5f0b99d7be468a3051a94073ec6b1900178316401a52b93415026999 + // to: 0x0e0ddb5a5f0b99d7be468a3051a94073ec6b1900178316401a52b93415026999 // input: 0x0000002a (store) // value: 0 // storage_deposit_limit: 1_000_000_000_000 - hex::decode("2d9338da000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000000000000000000000000000000000000000000021000e0ddb5a5f0b99d7be468a3051a94073ec6b1900178316401a52b934150269990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"), + hex::decode("2d9338da000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e8d4a5100000000000000000000000000000000000000000000000000000000000000000200e0ddb5a5f0b99d7be468a3051a94073ec6b1900178316401a52b9341502699900000000000000000000000000000000000000000000000000000000000000040000002a00000000000000000000000000000000000000000000000000000000").expect("invalid call input hex"), U256::zero(), 1_000_000, U256::from(DefaultBaseFeePerGas::get()),