From 819c7f8e17f794a6d7fcd763643fa52f5ff1333a Mon Sep 17 00:00:00 2001 From: Shaun Wang Date: Wed, 26 Jul 2023 17:30:52 +1200 Subject: [PATCH] Clean up. --- Cargo.lock | 1 - pallets/xvm/src/lib.rs | 11 ++++++----- precompiles/xvm/Cargo.toml | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7e28f03a1..41d2040ba5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7302,7 +7302,6 @@ dependencies = [ "log", "num_enum", "pallet-balances", - "pallet-contracts", "pallet-evm", "pallet-timestamp", "parity-scale-codec", diff --git a/pallets/xvm/src/lib.rs b/pallets/xvm/src/lib.rs index 04d578c5b9..789d5b4821 100644 --- a/pallets/xvm/src/lib.rs +++ b/pallets/xvm/src/lib.rs @@ -31,7 +31,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use frame_support::{pallet_prelude::*, traits::ConstU32, BoundedVec}; +use frame_support::{ensure, pallet_prelude::*, traits::ConstU32, BoundedVec}; use pallet_evm::GasWeightMapping; use parity_scale_codec::Decode; use sp_core::U256; @@ -90,12 +90,13 @@ impl Pallet { input: Vec, skip_execution: bool, ) -> XvmCallResult { - if context.source_vm_id == vm_id { - return Err(CallErrorWithWeight { + ensure!( + context.source_vm_id != vm_id, + CallErrorWithWeight { error: CallError::SameVmCallNotAllowed, used_weight: PLACEHOLDER_WEIGHT, - }); - } + } + ); match context.source_vm_id { VmId::Evm => Pallet::::evm_call(context, source, target, input, skip_execution), diff --git a/precompiles/xvm/Cargo.toml b/precompiles/xvm/Cargo.toml index e88c0d5b38..397a412373 100644 --- a/precompiles/xvm/Cargo.toml +++ b/precompiles/xvm/Cargo.toml @@ -37,7 +37,6 @@ serde = { workspace = true } precompile-utils = { workspace = true, features = ["testing"] } pallet-balances = { workspace = true, features = ["std"] } -pallet-contracts = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true } sp-runtime = { workspace = true }