From b0074496d4f859df43fa55f2fe91414165c09adb Mon Sep 17 00:00:00 2001 From: Deepanshu Hooda Date: Mon, 2 Oct 2023 23:13:38 +0530 Subject: [PATCH] fmt and refactor --- Cargo.lock | 1 + precompiles/xcm/Cargo.toml | 2 +- precompiles/xcm/src/lib.rs | 2 +- primitives/src/xcm/constants.rs | 19 +++++++++++++++++++ primitives/src/xcm/mod.rs | 4 ++-- 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 primitives/src/xcm/constants.rs diff --git a/Cargo.lock b/Cargo.lock index 77c0a75eb8..a882131bbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7481,6 +7481,7 @@ name = "pallet-evm-precompile-xcm" version = "0.9.1" dependencies = [ "assert_matches", + "astar-primitives", "derive_more", "fp-evm", "frame-support", diff --git a/precompiles/xcm/Cargo.toml b/precompiles/xcm/Cargo.toml index 9e792d419b..808015f530 100644 --- a/precompiles/xcm/Cargo.toml +++ b/precompiles/xcm/Cargo.toml @@ -8,12 +8,12 @@ homepage.workspace = true repository.workspace = true [dependencies] +astar-primitives = { workspace = true } log = { workspace = true } num_enum = { workspace = true } pallet-evm-precompile-assets-erc20 = { workspace = true } pallet-xcm = { workspace = true } precompile-utils = { workspace = true } -astar-primitives = { workspace = true } # Substrate frame-support = { workspace = true } diff --git a/precompiles/xcm/src/lib.rs b/precompiles/xcm/src/lib.rs index 05d78bb8fd..a416fda76b 100644 --- a/precompiles/xcm/src/lib.rs +++ b/precompiles/xcm/src/lib.rs @@ -18,13 +18,13 @@ #![cfg_attr(not(feature = "std"), no_std)] +use astar_primitives::xcm::constants::XCM_SIZE_LIMIT; use fp_evm::{PrecompileHandle, PrecompileOutput}; use frame_support::{ dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo}, pallet_prelude::Weight, traits::{ConstU32, Get}, }; -use astar_primitives::xcm::constants::XCM_SIZE_LIMIT; type GetXcmSizeLimit = ConstU32; use pallet_evm::{AddressMapping, Precompile}; diff --git a/primitives/src/xcm/constants.rs b/primitives/src/xcm/constants.rs new file mode 100644 index 0000000000..7e80e6dc54 --- /dev/null +++ b/primitives/src/xcm/constants.rs @@ -0,0 +1,19 @@ +// This file is part of Astar. + +// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later + +// Astar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Astar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Astar. If not, see . + +pub const XCM_SIZE_LIMIT: u32 = 2u32.pow(16); diff --git a/primitives/src/xcm/mod.rs b/primitives/src/xcm/mod.rs index e59e01283b..fed6123939 100644 --- a/primitives/src/xcm/mod.rs +++ b/primitives/src/xcm/mod.rs @@ -30,8 +30,6 @@ //! Please refer to implementation below for more info. //! -#![cfg_attr(not(feature = "std"), no_std)] - use crate::AccountId; use frame_support::{ @@ -54,6 +52,8 @@ use pallet_xc_asset_config::{ExecutionPaymentRate, XcAssetLocation}; #[cfg(test)] mod tests; +pub mod constants; + /// Used to convert between cross-chain asset multilocation and local asset Id. /// /// This implementation relies on `XcAssetConfig` pallet to handle mapping.