From 38cd818ad0f6d344a6595d2d5ac2082281be8105 Mon Sep 17 00:00:00 2001 From: icodezjb Date: Tue, 16 Dec 2025 23:35:46 +0800 Subject: [PATCH 1/8] Add evm rent burn and estimate and update runtime version --- Cargo.lock | 72 ++++++++++++++++++-------- Cargo.toml | 2 +- runtime/chainx/Cargo.toml | 5 ++ runtime/chainx/src/lib.rs | 10 +++- runtime/chainx/src/precompiles.rs | 3 +- runtime/chainx/src/withdraw.rs | 86 ++++++++++++++++++++++++------- runtime/dev/Cargo.toml | 5 ++ runtime/dev/src/lib.rs | 10 +++- runtime/dev/src/precompiles.rs | 3 +- runtime/dev/src/withdraw.rs | 86 ++++++++++++++++++++++++------- 10 files changed, 218 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8e483d7c..00bb683e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -787,7 +787,7 @@ dependencies = [ [[package]] name = "chainx" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-cli", ] @@ -942,6 +942,7 @@ dependencies = [ "chainx-primitives", "chainx-runtime-common", "fp-evm", + "fp-rent", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -969,6 +970,7 @@ dependencies = [ "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", + "pallet-evm-rent", "pallet-grandpa", "pallet-identity", "pallet-im-online", @@ -1573,6 +1575,7 @@ dependencies = [ "chainx-primitives", "chainx-runtime-common", "fp-evm", + "fp-rent", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -1600,6 +1603,7 @@ dependencies = [ "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", + "pallet-evm-rent", "pallet-grandpa", "pallet-identity", "pallet-im-online", @@ -2064,7 +2068,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "async-trait", "fc-db", @@ -2083,7 +2087,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -2097,7 +2101,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fc-db", "fp-consensus", @@ -2114,7 +2118,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "ethereum", "ethereum-types", @@ -2156,7 +2160,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "ethereum", "ethereum-types", @@ -2263,7 +2267,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "ethereum", "parity-scale-codec", @@ -2275,7 +2279,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "evm", "parity-scale-codec", @@ -2284,10 +2288,18 @@ dependencies = [ "sp-std", ] +[[package]] +name = "fp-rent" +version = "2.0.0-dev" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +dependencies = [ + "sp-core", +] + [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "ethereum", "ethereum-types", @@ -2304,7 +2316,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "ethereum", "frame-support", @@ -2320,7 +2332,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "parity-scale-codec", ] @@ -5296,7 +5308,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "frame-support", "frame-system", @@ -5378,13 +5390,14 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "ethereum", "ethereum-types", "evm", "fp-consensus", "fp-evm", + "fp-rent", "fp-rpc", "fp-self-contained", "fp-storage", @@ -5407,10 +5420,11 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "evm", "fp-evm", + "fp-rent", "frame-benchmarking", "frame-support", "frame-system", @@ -5433,7 +5447,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-evm", ] @@ -5441,7 +5455,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-evm", "sp-core", @@ -5451,7 +5465,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-evm", "frame-support", @@ -5461,7 +5475,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-evm", "num", @@ -5470,7 +5484,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-evm", "tiny-keccak", @@ -5479,13 +5493,29 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f42dbeb4013f239c07f99add4bd14b5cbe79eb58" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" dependencies = [ "fp-evm", "ripemd", "sp-io", ] +[[package]] +name = "pallet-evm-rent" +version = "1.0.0" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +dependencies = [ + "fp-rent", + "frame-support", + "frame-system", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", +] + [[package]] name = "pallet-grandpa" version = "4.0.0-dev" @@ -9432,7 +9462,7 @@ dependencies = [ "chrono", "lazy_static", "matchers", - "parking_lot 0.11.2", + "parking_lot 0.10.2", "regex", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index ba8f78883..e449efbd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" description = "Fully Decentralized Interchain Crypto Asset Management on Polkadot" diff --git a/runtime/chainx/Cargo.toml b/runtime/chainx/Cargo.toml index 858e2c1a2..e80ea3a01 100644 --- a/runtime/chainx/Cargo.toml +++ b/runtime/chainx/Cargo.toml @@ -102,6 +102,8 @@ xpallet-btc-ledger-runtime-api = { path = "../../xpallets/btc-ledger/rpc/runtime pallet-evm = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false, features = ["chainx-adaptor"] } pallet-ethereum = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } pallet-base-fee = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } +pallet-evm-rent = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } + xpallet-ethereum-chain-id = { path = "../../xpallets/ethereum-chain-id", default-features = false } xpallet-assets-bridge = { path = "../../xpallets/assets-bridge", default-features = false } @@ -116,6 +118,7 @@ pallet-evm-precompile-blake2 = { git = "https://github.com/chainx-org/frontier", # ETH API fp-rpc = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } fp-self-contained = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } +fp-rent = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } [build-dependencies] substrate-wasm-builder = { git = "https://github.com/chainx-org/substrate", branch = "polkadot-v0.9.18-fix2" } @@ -206,11 +209,13 @@ std = [ "pallet-evm/std", "pallet-ethereum/std", "pallet-base-fee/std", + "pallet-evm-rent/std", "xpallet-ethereum-chain-id/std", "xpallet-assets-bridge/std", "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", + "fp-rent/std", ] runtime-benchmarks = [ "hex-literal", diff --git a/runtime/chainx/src/lib.rs b/runtime/chainx/src/lib.rs index c91a6d12b..2458f46a2 100644 --- a/runtime/chainx/src/lib.rs +++ b/runtime/chainx/src/lib.rs @@ -125,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("chainx"), impl_name: create_runtime_str!("chainx-net"), authoring_version: 1, - spec_version: 35, + spec_version: 36, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 8, @@ -1159,6 +1159,7 @@ impl pallet_evm::Config for Runtime { type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter; type BlockGasLimit = BlockGasLimit; type FindAuthor = (); + type EvmRentCalculator = EvmRent; type WeightInfo = pallet_evm::weights::SubstrateWeight; } @@ -1203,6 +1204,12 @@ impl xpallet_assets_bridge::Config for Runtime { type ClaimBond = ClaimBond; } +impl pallet_evm_rent::Config for Runtime { + type Event = Event; + type CouncilOrigin = + pallet_collective::EnsureProportionAtLeast; +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -1281,6 +1288,7 @@ construct_runtime!( XAssetsBridge: xpallet_assets_bridge::{Pallet, Call, Storage, Config, Event} = 45, XBtcLedger: xpallet_btc_ledger::{Pallet, Call, Storage, Config, Event} = 46, + EvmRent: pallet_evm_rent::{Pallet, Call, Storage, Event} = 47, } ); diff --git a/runtime/chainx/src/precompiles.rs b/runtime/chainx/src/precompiles.rs index 7f6c291c1..60aea941e 100644 --- a/runtime/chainx/src/precompiles.rs +++ b/runtime/chainx/src/precompiles.rs @@ -40,7 +40,8 @@ impl PrecompileSet for ChainXPrecompiles where R: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, Dispatch: Precompile, { fn execute( diff --git a/runtime/chainx/src/withdraw.rs b/runtime/chainx/src/withdraw.rs index faf21fdec..302f52c49 100644 --- a/runtime/chainx/src/withdraw.rs +++ b/runtime/chainx/src/withdraw.rs @@ -1,10 +1,9 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use codec::{Decode, Encode}; use core::marker::PhantomData; use fp_evm::{ Context, ExitRevert, ExitSucceed, PrecompileFailure, PrecompileOutput, PrecompileResult, }; +use fp_rent::EvmRentCalculator; use frame_support::log; use pallet_evm::{AddressMapping, Precompile}; use sp_core::{hexdisplay::HexDisplay, H160, U256}; @@ -14,10 +13,18 @@ use sp_std::vec; const MIN_BTC_TRANSFER_VALUE: u128 = 10_000_000_000; const BASE_GAS_COST: u64 = 100_000; +#[derive(Clone, Debug, Eq, PartialEq)] +enum ReturnType { + WithdrawBTC, + WithdrawPCX, + EstimateRent(u128, u64), +} + pub struct Withdraw< T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, > { _marker: PhantomData, } @@ -25,10 +32,11 @@ pub struct Withdraw< impl< T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, > Withdraw { - fn process(caller: &H160, input: &[u8]) -> Result<(), PrecompileFailure> { + fn process(caller: &H160, input: &[u8]) -> Result { match input.first() { // Withdraw BTC Some(&0) if input.len() >= 67 && input.len() <= 95 => { @@ -43,7 +51,7 @@ impl< log::debug!(target: "evm-withdraw", "btc: success"); - Ok(()) + Ok(ReturnType::WithdrawBTC) } // Withdraw PCX Some(&1) if input.len() == 65 => { @@ -58,7 +66,21 @@ impl< log::debug!(target: "evm-withdraw", "pcx: success"); - Ok(()) + Ok(ReturnType::WithdrawPCX) + } + // EstimateRent + Some(&2) if input.len() == 20 => { + // input = (flag, 1 byte) + evm_account(20 bytes) + + log::debug!(target: "evm-withdraw", "estimateRent: call"); + let (rent_balance, days) = + Self::process_estimate_rent(&input[1..]).map_err(|err| { + log::warn!(target: "evm-withdraw", "estimateRent: err = {:?}", err); + err + })?; + log::debug!(target: "evm-withdraw", "estimateRent: success"); + + Ok(ReturnType::EstimateRent(rent_balance, days)) } _ => { log::warn!(target: "evm-withdraw", "invalid input: {:?}", input); @@ -207,13 +229,23 @@ impl< Ok(()) } + + fn process_estimate_rent(input: &[u8]) -> Result<(u128, u64), PrecompileFailure> { + let evm_account = H160::from_slice(&input[0..20]); + + let (rent_balance, days) = + as EvmRentCalculator>::estimate_rent(evm_account); + + Ok((rent_balance, days)) + } } impl Precompile for Withdraw where T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, T::AccountId: Decode, { fn execute( @@ -224,17 +256,33 @@ where ) -> PrecompileResult { log::debug!(target: "evm-withdraw", "caller: {:?}", context.caller); - Self::process(&context.caller, input).map(|_| { - // Refer: https://github.com/rust-ethereum/ethabi/blob/master/ethabi/src/encoder.rs#L144 - let mut out = vec![0u8; 32]; - out[31] = 1u8; - - Ok(PrecompileOutput { - exit_status: ExitSucceed::Returned, - cost: BASE_GAS_COST, - output: out.to_vec(), - logs: Default::default(), - }) + Self::process(&context.caller, input).map(|r| { + match r { + ReturnType::WithdrawBTC | ReturnType::WithdrawPCX => { + // Refer: https://github.com/rust-ethereum/ethabi/blob/master/ethabi/src/encoder.rs#L144 + let mut out = vec![0u8; 32]; + out[31] = 1u8; + + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + cost: BASE_GAS_COST, + output: out.to_vec(), + logs: Default::default(), + }) + } + ReturnType::EstimateRent(rent_balance, days) => { + let mut padded = [0u8; 64]; + padded[16..32].copy_from_slice(rent_balance.to_be_bytes().as_slice()); + padded[56..64].copy_from_slice(days.to_be_bytes().as_slice()); + + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + cost: BASE_GAS_COST, + output: padded.to_vec(), + logs: Default::default(), + }) + } + } })? } } diff --git a/runtime/dev/Cargo.toml b/runtime/dev/Cargo.toml index 927b317ec..6ccba0395 100644 --- a/runtime/dev/Cargo.toml +++ b/runtime/dev/Cargo.toml @@ -103,6 +103,8 @@ xpallet-btc-ledger-runtime-api = { path = "../../xpallets/btc-ledger/rpc/runtime pallet-evm = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false, features = ["chainx-adaptor"] } pallet-ethereum = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } pallet-base-fee = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } +pallet-evm-rent = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } + xpallet-ethereum-chain-id = { path = "../../xpallets/ethereum-chain-id", default-features = false } xpallet-assets-bridge = { path = "../../xpallets/assets-bridge", default-features = false } @@ -117,6 +119,7 @@ pallet-evm-precompile-blake2 = { git = "https://github.com/chainx-org/frontier", # ETH API fp-rpc = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } fp-self-contained = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } +fp-rent = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } [build-dependencies] substrate-wasm-builder = { git = "https://github.com/chainx-org/substrate", branch = "polkadot-v0.9.18-fix2" } @@ -208,11 +211,13 @@ std = [ "pallet-evm/std", "pallet-ethereum/std", "pallet-base-fee/std", + "pallet-evm-rent/std", "xpallet-ethereum-chain-id/std", "xpallet-assets-bridge/std", "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", + "fp-rent/std", ] runtime-benchmarks = [ "hex-literal", diff --git a/runtime/dev/src/lib.rs b/runtime/dev/src/lib.rs index 6dee1ad1a..21a1613d1 100644 --- a/runtime/dev/src/lib.rs +++ b/runtime/dev/src/lib.rs @@ -125,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("chainx"), impl_name: create_runtime_str!("chainx-dev"), authoring_version: 1, - spec_version: 34, + spec_version: 36, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 7, @@ -1163,6 +1163,7 @@ impl pallet_evm::Config for Runtime { type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter; type BlockGasLimit = BlockGasLimit; type FindAuthor = (); + type EvmRentCalculator = EvmRent; type WeightInfo = pallet_evm::weights::SubstrateWeight; } @@ -1207,6 +1208,12 @@ impl xpallet_assets_bridge::Config for Runtime { type ClaimBond = ClaimBond; } +impl pallet_evm_rent::Config for Runtime { + type Event = Event; + type CouncilOrigin = + pallet_collective::EnsureProportionAtLeast; +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -1288,6 +1295,7 @@ construct_runtime!( XAssetsBridge: xpallet_assets_bridge::{Pallet, Call, Storage, Config, Event} = 45, XBtcLedger: xpallet_btc_ledger::{Pallet, Call, Storage, Config, Event} = 46, + EvmRent: pallet_evm_rent::{Pallet, Call, Storage, Event} = 47, } ); diff --git a/runtime/dev/src/precompiles.rs b/runtime/dev/src/precompiles.rs index 7f6c291c1..60aea941e 100644 --- a/runtime/dev/src/precompiles.rs +++ b/runtime/dev/src/precompiles.rs @@ -40,7 +40,8 @@ impl PrecompileSet for ChainXPrecompiles where R: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, Dispatch: Precompile, { fn execute( diff --git a/runtime/dev/src/withdraw.rs b/runtime/dev/src/withdraw.rs index faf21fdec..302f52c49 100644 --- a/runtime/dev/src/withdraw.rs +++ b/runtime/dev/src/withdraw.rs @@ -1,10 +1,9 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use codec::{Decode, Encode}; use core::marker::PhantomData; use fp_evm::{ Context, ExitRevert, ExitSucceed, PrecompileFailure, PrecompileOutput, PrecompileResult, }; +use fp_rent::EvmRentCalculator; use frame_support::log; use pallet_evm::{AddressMapping, Precompile}; use sp_core::{hexdisplay::HexDisplay, H160, U256}; @@ -14,10 +13,18 @@ use sp_std::vec; const MIN_BTC_TRANSFER_VALUE: u128 = 10_000_000_000; const BASE_GAS_COST: u64 = 100_000; +#[derive(Clone, Debug, Eq, PartialEq)] +enum ReturnType { + WithdrawBTC, + WithdrawPCX, + EstimateRent(u128, u64), +} + pub struct Withdraw< T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, > { _marker: PhantomData, } @@ -25,10 +32,11 @@ pub struct Withdraw< impl< T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, > Withdraw { - fn process(caller: &H160, input: &[u8]) -> Result<(), PrecompileFailure> { + fn process(caller: &H160, input: &[u8]) -> Result { match input.first() { // Withdraw BTC Some(&0) if input.len() >= 67 && input.len() <= 95 => { @@ -43,7 +51,7 @@ impl< log::debug!(target: "evm-withdraw", "btc: success"); - Ok(()) + Ok(ReturnType::WithdrawBTC) } // Withdraw PCX Some(&1) if input.len() == 65 => { @@ -58,7 +66,21 @@ impl< log::debug!(target: "evm-withdraw", "pcx: success"); - Ok(()) + Ok(ReturnType::WithdrawPCX) + } + // EstimateRent + Some(&2) if input.len() == 20 => { + // input = (flag, 1 byte) + evm_account(20 bytes) + + log::debug!(target: "evm-withdraw", "estimateRent: call"); + let (rent_balance, days) = + Self::process_estimate_rent(&input[1..]).map_err(|err| { + log::warn!(target: "evm-withdraw", "estimateRent: err = {:?}", err); + err + })?; + log::debug!(target: "evm-withdraw", "estimateRent: success"); + + Ok(ReturnType::EstimateRent(rent_balance, days)) } _ => { log::warn!(target: "evm-withdraw", "invalid input: {:?}", input); @@ -207,13 +229,23 @@ impl< Ok(()) } + + fn process_estimate_rent(input: &[u8]) -> Result<(u128, u64), PrecompileFailure> { + let evm_account = H160::from_slice(&input[0..20]); + + let (rent_balance, days) = + as EvmRentCalculator>::estimate_rent(evm_account); + + Ok((rent_balance, days)) + } } impl Precompile for Withdraw where T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, T::AccountId: Decode, { fn execute( @@ -224,17 +256,33 @@ where ) -> PrecompileResult { log::debug!(target: "evm-withdraw", "caller: {:?}", context.caller); - Self::process(&context.caller, input).map(|_| { - // Refer: https://github.com/rust-ethereum/ethabi/blob/master/ethabi/src/encoder.rs#L144 - let mut out = vec![0u8; 32]; - out[31] = 1u8; - - Ok(PrecompileOutput { - exit_status: ExitSucceed::Returned, - cost: BASE_GAS_COST, - output: out.to_vec(), - logs: Default::default(), - }) + Self::process(&context.caller, input).map(|r| { + match r { + ReturnType::WithdrawBTC | ReturnType::WithdrawPCX => { + // Refer: https://github.com/rust-ethereum/ethabi/blob/master/ethabi/src/encoder.rs#L144 + let mut out = vec![0u8; 32]; + out[31] = 1u8; + + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + cost: BASE_GAS_COST, + output: out.to_vec(), + logs: Default::default(), + }) + } + ReturnType::EstimateRent(rent_balance, days) => { + let mut padded = [0u8; 64]; + padded[16..32].copy_from_slice(rent_balance.to_be_bytes().as_slice()); + padded[56..64].copy_from_slice(days.to_be_bytes().as_slice()); + + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + cost: BASE_GAS_COST, + output: padded.to_vec(), + logs: Default::default(), + }) + } + } })? } } From 903f955b41501f09be7c09fafa6c184384d1e2ba Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 00:05:02 +0800 Subject: [PATCH 2/8] Fix chainx-malan runtime --- Cargo.lock | 2 + runtime/chainx/src/lib.rs | 17 ------- runtime/dev/src/lib.rs | 17 ------- runtime/malan/Cargo.toml | 5 ++ runtime/malan/src/lib.rs | 10 +++- runtime/malan/src/precompiles.rs | 3 +- runtime/malan/src/withdraw.rs | 84 +++++++++++++++++++++++++------- 7 files changed, 85 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 00bb683e2..124f8985f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4565,6 +4565,7 @@ dependencies = [ "chainx-primitives", "chainx-runtime-common", "fp-evm", + "fp-rent", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -4592,6 +4593,7 @@ dependencies = [ "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", + "pallet-evm-rent", "pallet-grandpa", "pallet-identity", "pallet-im-online", diff --git a/runtime/chainx/src/lib.rs b/runtime/chainx/src/lib.rs index 2458f46a2..0e3e666a7 100644 --- a/runtime/chainx/src/lib.rs +++ b/runtime/chainx/src/lib.rs @@ -1330,25 +1330,8 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - AssetsBridgeMigration, >; -pub struct AssetsBridgeMigration; -impl OnRuntimeUpgrade for AssetsBridgeMigration { - fn on_runtime_upgrade() -> Weight { - use frame_support::storage::migration; - - frame_support::log::info!("🔍️ AssetsBridgeMigration start"); - - // Remove the storage value `HotAccount` from pallet `XAssetsBridge` - migration::remove_storage_prefix(b"XAssetsBridge", b"HotAccount", b""); - - frame_support::log::info!("🚀 AssetsBridgeMigration end"); - - ::DbWeight::get().writes(1) - } -} - pub struct TransactionConverter; impl fp_rpc::ConvertTransaction for TransactionConverter { fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic { diff --git a/runtime/dev/src/lib.rs b/runtime/dev/src/lib.rs index 21a1613d1..e19626002 100644 --- a/runtime/dev/src/lib.rs +++ b/runtime/dev/src/lib.rs @@ -1337,25 +1337,8 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - AssetsBridgeMigration, >; -pub struct AssetsBridgeMigration; -impl OnRuntimeUpgrade for AssetsBridgeMigration { - fn on_runtime_upgrade() -> Weight { - use frame_support::storage::migration; - - frame_support::log::info!("🔍️ AssetsBridgeMigration start"); - - // Remove the storage value `HotAccount` from pallet `XAssetsBridge` - migration::remove_storage_prefix(b"XAssetsBridge", b"HotAccount", b""); - - frame_support::log::info!("🚀 AssetsBridgeMigration end"); - - ::DbWeight::get().writes(1) - } -} - pub struct TransactionConverter; impl fp_rpc::ConvertTransaction for TransactionConverter { fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic { diff --git a/runtime/malan/Cargo.toml b/runtime/malan/Cargo.toml index 561357808..151bb6d12 100644 --- a/runtime/malan/Cargo.toml +++ b/runtime/malan/Cargo.toml @@ -103,6 +103,8 @@ xpallet-btc-ledger-runtime-api = { path = "../../xpallets/btc-ledger/rpc/runtime pallet-evm = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false, features = ["chainx-adaptor"] } pallet-ethereum = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } pallet-base-fee = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } +pallet-evm-rent = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } + xpallet-ethereum-chain-id = { path = "../../xpallets/ethereum-chain-id", default-features = false } xpallet-assets-bridge = { path = "../../xpallets/assets-bridge", default-features = false } @@ -117,6 +119,7 @@ pallet-evm-precompile-blake2 = { git = "https://github.com/chainx-org/frontier", # ETH API fp-rpc = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } fp-self-contained = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } +fp-rent = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc-fix2", default-features = false } [build-dependencies] substrate-wasm-builder = { git = "https://github.com/chainx-org/substrate", branch = "polkadot-v0.9.18-fix2" } @@ -208,11 +211,13 @@ std = [ "pallet-evm/std", "pallet-ethereum/std", "pallet-base-fee/std", + "pallet-evm-rent/std", "xpallet-ethereum-chain-id/std", "xpallet-assets-bridge/std", "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", + "fp-rent/std", ] runtime-benchmarks = [ "hex-literal", diff --git a/runtime/malan/src/lib.rs b/runtime/malan/src/lib.rs index fab6576f1..9bdd39f9c 100644 --- a/runtime/malan/src/lib.rs +++ b/runtime/malan/src/lib.rs @@ -125,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("chainx"), impl_name: create_runtime_str!("chainx-malan"), authoring_version: 1, - spec_version: 34, + spec_version: 36, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 7, @@ -1163,6 +1163,7 @@ impl pallet_evm::Config for Runtime { type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter; type BlockGasLimit = BlockGasLimit; type FindAuthor = (); + type EvmRentCalculator = EvmRent; type WeightInfo = pallet_evm::weights::SubstrateWeight; } @@ -1207,6 +1208,12 @@ impl xpallet_assets_bridge::Config for Runtime { type ClaimBond = ClaimBond; } +impl pallet_evm_rent::Config for Runtime { + type Event = Event; + type CouncilOrigin = + pallet_collective::EnsureProportionAtLeast; +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -1288,6 +1295,7 @@ construct_runtime!( XAssetsBridge: xpallet_assets_bridge::{Pallet, Call, Storage, Config, Event} = 45, XBtcLedger: xpallet_btc_ledger::{Pallet, Call, Storage, Config, Event} = 46, + EvmRent: pallet_evm_rent::{Pallet, Call, Storage, Event} = 47, } ); diff --git a/runtime/malan/src/precompiles.rs b/runtime/malan/src/precompiles.rs index 7f6c291c1..60aea941e 100644 --- a/runtime/malan/src/precompiles.rs +++ b/runtime/malan/src/precompiles.rs @@ -40,7 +40,8 @@ impl PrecompileSet for ChainXPrecompiles where R: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, Dispatch: Precompile, { fn execute( diff --git a/runtime/malan/src/withdraw.rs b/runtime/malan/src/withdraw.rs index faf21fdec..3ed5979c1 100644 --- a/runtime/malan/src/withdraw.rs +++ b/runtime/malan/src/withdraw.rs @@ -5,6 +5,7 @@ use core::marker::PhantomData; use fp_evm::{ Context, ExitRevert, ExitSucceed, PrecompileFailure, PrecompileOutput, PrecompileResult, }; +use fp_rent::EvmRentCalculator; use frame_support::log; use pallet_evm::{AddressMapping, Precompile}; use sp_core::{hexdisplay::HexDisplay, H160, U256}; @@ -14,10 +15,18 @@ use sp_std::vec; const MIN_BTC_TRANSFER_VALUE: u128 = 10_000_000_000; const BASE_GAS_COST: u64 = 100_000; +#[derive(Clone, Debug, Eq, PartialEq)] +enum ReturnType { + WithdrawBTC, + WithdrawPCX, + EstimateRent(u128, u64), +} + pub struct Withdraw< T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, > { _marker: PhantomData, } @@ -25,10 +34,11 @@ pub struct Withdraw< impl< T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, > Withdraw { - fn process(caller: &H160, input: &[u8]) -> Result<(), PrecompileFailure> { + fn process(caller: &H160, input: &[u8]) -> Result { match input.first() { // Withdraw BTC Some(&0) if input.len() >= 67 && input.len() <= 95 => { @@ -43,7 +53,7 @@ impl< log::debug!(target: "evm-withdraw", "btc: success"); - Ok(()) + Ok(ReturnType::WithdrawBTC) } // Withdraw PCX Some(&1) if input.len() == 65 => { @@ -58,7 +68,21 @@ impl< log::debug!(target: "evm-withdraw", "pcx: success"); - Ok(()) + Ok(ReturnType::WithdrawPCX) + } + // EstimateRent + Some(&2) if input.len() == 20 => { + // input = (flag, 1 byte) + evm_account(20 bytes) + + log::debug!(target: "evm-withdraw", "estimateRent: call"); + let (rent_balance, days) = + Self::process_estimate_rent(&input[1..]).map_err(|err| { + log::warn!(target: "evm-withdraw", "estimateRent: err = {:?}", err); + err + })?; + log::debug!(target: "evm-withdraw", "estimateRent: success"); + + Ok(ReturnType::EstimateRent(rent_balance, days)) } _ => { log::warn!(target: "evm-withdraw", "invalid input: {:?}", input); @@ -207,13 +231,23 @@ impl< Ok(()) } + + fn process_estimate_rent(input: &[u8]) -> Result<(u128, u64), PrecompileFailure> { + let evm_account = H160::from_slice(&input[0..20]); + + let (rent_balance, days) = + as EvmRentCalculator>::estimate_rent(evm_account); + + Ok((rent_balance, days)) + } } impl Precompile for Withdraw where T: xpallet_assets_bridge::Config + xpallet_gateway_common::Config - + xpallet_gateway_records::Config, + + xpallet_gateway_records::Config + + pallet_evm_rent::Config, T::AccountId: Decode, { fn execute( @@ -224,17 +258,33 @@ where ) -> PrecompileResult { log::debug!(target: "evm-withdraw", "caller: {:?}", context.caller); - Self::process(&context.caller, input).map(|_| { - // Refer: https://github.com/rust-ethereum/ethabi/blob/master/ethabi/src/encoder.rs#L144 - let mut out = vec![0u8; 32]; - out[31] = 1u8; - - Ok(PrecompileOutput { - exit_status: ExitSucceed::Returned, - cost: BASE_GAS_COST, - output: out.to_vec(), - logs: Default::default(), - }) + Self::process(&context.caller, input).map(|r| { + match r { + ReturnType::WithdrawBTC | ReturnType::WithdrawPCX => { + // Refer: https://github.com/rust-ethereum/ethabi/blob/master/ethabi/src/encoder.rs#L144 + let mut out = vec![0u8; 32]; + out[31] = 1u8; + + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + cost: BASE_GAS_COST, + output: out.to_vec(), + logs: Default::default(), + }) + } + ReturnType::EstimateRent(rent_balance, days) => { + let mut padded = [0u8; 64]; + padded[16..32].copy_from_slice(rent_balance.to_be_bytes().as_slice()); + padded[56..64].copy_from_slice(days.to_be_bytes().as_slice()); + + Ok(PrecompileOutput { + exit_status: ExitSucceed::Returned, + cost: BASE_GAS_COST, + output: padded.to_vec(), + logs: Default::default(), + }) + } + } })? } } From 5bcfc17f914524c62b43a6d277e9bc903c881283 Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 00:07:22 +0800 Subject: [PATCH 3/8] Bump chainx version to 5.2.4 --- Cargo.lock | 102 +++++++++--------- cli/Cargo.toml | 2 +- client/rpc/finality/Cargo.toml | 2 +- executor/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- primitives/assets-registrar/Cargo.toml | 2 +- primitives/gateway/bitcoin/Cargo.toml | 2 +- primitives/gateway/common/Cargo.toml | 2 +- primitives/genesis-builder/Cargo.toml | 2 +- primitives/io/Cargo.toml | 2 +- primitives/mining/common/Cargo.toml | 2 +- primitives/mining/staking/Cargo.toml | 2 +- primitives/protocol/Cargo.toml | 2 +- primitives/rpc/Cargo.toml | 2 +- primitives/runtime/Cargo.toml | 2 +- rpc/Cargo.toml | 2 +- runtime/chainx/Cargo.toml | 2 +- runtime/dev/Cargo.toml | 2 +- runtime/malan/Cargo.toml | 2 +- service/Cargo.toml | 2 +- xpallets/assets-bridge/Cargo.toml | 2 +- xpallets/assets-registrar/Cargo.toml | 2 +- xpallets/assets/Cargo.toml | 2 +- xpallets/assets/rpc/Cargo.toml | 2 +- xpallets/assets/rpc/runtime-api/Cargo.toml | 2 +- xpallets/btc-ledger/Cargo.toml | 2 +- xpallets/btc-ledger/rpc/Cargo.toml | 2 +- .../btc-ledger/rpc/runtime-api/Cargo.toml | 2 +- xpallets/dex/spot/Cargo.toml | 2 +- xpallets/dex/spot/rpc/Cargo.toml | 2 +- xpallets/dex/spot/rpc/runtime-api/Cargo.toml | 2 +- xpallets/gateway/bitcoin/Cargo.toml | 2 +- xpallets/gateway/bitcoin/rpc/Cargo.toml | 2 +- .../bitcoin/rpc/runtime-api/Cargo.toml | 2 +- xpallets/gateway/common/Cargo.toml | 2 +- xpallets/gateway/common/rpc/Cargo.toml | 2 +- .../gateway/common/rpc/runtime-api/Cargo.toml | 2 +- xpallets/gateway/records/Cargo.toml | 2 +- xpallets/gateway/records/rpc/Cargo.toml | 2 +- .../records/rpc/runtime-api/Cargo.toml | 2 +- xpallets/genesis-builder/Cargo.toml | 2 +- xpallets/mining/asset/Cargo.toml | 2 +- xpallets/mining/asset/rpc/Cargo.toml | 2 +- .../mining/asset/rpc/runtime-api/Cargo.toml | 2 +- xpallets/mining/staking/Cargo.toml | 2 +- xpallets/mining/staking/rpc/Cargo.toml | 2 +- .../mining/staking/rpc/runtime-api/Cargo.toml | 2 +- xpallets/support/Cargo.toml | 2 +- xpallets/system/Cargo.toml | 2 +- xpallets/transaction-fee/Cargo.toml | 2 +- xpallets/transaction-fee/rpc/Cargo.toml | 2 +- .../rpc/runtime-api/Cargo.toml | 2 +- 52 files changed, 102 insertions(+), 102 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 124f8985f..eba207dda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,7 +401,7 @@ dependencies = [ [[package]] name = "bevm-finality-rpc" -version = "5.2.2" +version = "5.2.4" dependencies = [ "fc-db", "fc-rpc", @@ -794,7 +794,7 @@ dependencies = [ [[package]] name = "chainx-cli" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-executor", "chainx-primitives", @@ -850,7 +850,7 @@ dependencies = [ [[package]] name = "chainx-executor" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-runtime", "dev-runtime", @@ -862,7 +862,7 @@ dependencies = [ [[package]] name = "chainx-primitives" -version = "5.2.3" +version = "5.2.4" dependencies = [ "frame-system", "parity-scale-codec", @@ -876,7 +876,7 @@ dependencies = [ [[package]] name = "chainx-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "bevm-finality-rpc", "chainx-primitives", @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "chainx-runtime" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "chainx-runtime-common", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "chainx-service" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-executor", "chainx-primitives", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "dev-runtime" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "chainx-runtime-common", @@ -4560,7 +4560,7 @@ dependencies = [ [[package]] name = "malan-runtime" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "chainx-runtime-common", @@ -10319,7 +10319,7 @@ dependencies = [ [[package]] name = "xp-assets-registrar" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "impl-trait-for-tuples", @@ -10332,7 +10332,7 @@ dependencies = [ [[package]] name = "xp-gateway-bitcoin" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "frame-support", @@ -10349,7 +10349,7 @@ dependencies = [ [[package]] name = "xp-gateway-common" -version = "5.2.3" +version = "5.2.4" dependencies = [ "bs58 0.3.1", "frame-support", @@ -10362,7 +10362,7 @@ dependencies = [ [[package]] name = "xp-genesis-builder" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "serde", @@ -10371,7 +10371,7 @@ dependencies = [ [[package]] name = "xp-io" -version = "5.2.3" +version = "5.2.4" dependencies = [ "hex", "parity-scale-codec", @@ -10382,7 +10382,7 @@ dependencies = [ [[package]] name = "xp-mining-common" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "sp-arithmetic", @@ -10391,7 +10391,7 @@ dependencies = [ [[package]] name = "xp-mining-staking" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "sp-runtime", @@ -10401,7 +10401,7 @@ dependencies = [ [[package]] name = "xp-protocol" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "parity-scale-codec", @@ -10412,7 +10412,7 @@ dependencies = [ [[package]] name = "xp-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "hex", "jsonrpc-core", @@ -10422,7 +10422,7 @@ dependencies = [ [[package]] name = "xp-runtime" -version = "5.2.3" +version = "5.2.4" dependencies = [ "fp-rpc", "hex", @@ -10437,7 +10437,7 @@ dependencies = [ [[package]] name = "xpallet-assets" -version = "5.2.3" +version = "5.2.4" dependencies = [ "bitflags", "chainx-primitives", @@ -10460,7 +10460,7 @@ dependencies = [ [[package]] name = "xpallet-assets-bridge" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "ethabi", @@ -10483,7 +10483,7 @@ dependencies = [ [[package]] name = "xpallet-assets-registrar" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "frame-benchmarking", @@ -10505,7 +10505,7 @@ dependencies = [ [[package]] name = "xpallet-assets-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -10520,7 +10520,7 @@ dependencies = [ [[package]] name = "xpallet-assets-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "parity-scale-codec", @@ -10531,7 +10531,7 @@ dependencies = [ [[package]] name = "xpallet-btc-ledger" -version = "5.2.3" +version = "5.2.4" dependencies = [ "frame-benchmarking", "frame-support", @@ -10546,7 +10546,7 @@ dependencies = [ [[package]] name = "xpallet-btc-ledger-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -10561,7 +10561,7 @@ dependencies = [ [[package]] name = "xpallet-btc-ledger-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "parity-scale-codec", "sp-api", @@ -10570,7 +10570,7 @@ dependencies = [ [[package]] name = "xpallet-dex-spot" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "env_logger 0.7.1", @@ -10594,7 +10594,7 @@ dependencies = [ [[package]] name = "xpallet-dex-spot-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -10610,7 +10610,7 @@ dependencies = [ [[package]] name = "xpallet-dex-spot-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "parity-scale-codec", "sp-api", @@ -10631,7 +10631,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-bitcoin" -version = "5.2.3" +version = "5.2.4" dependencies = [ "bs58 0.3.1", "chainx-primitives", @@ -10670,7 +10670,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-bitcoin-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "hex", "jsonrpc-core", @@ -10687,7 +10687,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-bitcoin-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "parity-scale-codec", @@ -10701,7 +10701,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-common" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "frame-benchmarking", @@ -10739,7 +10739,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-common-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "hex", "jsonrpc-core", @@ -10756,7 +10756,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-common-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "parity-scale-codec", @@ -10772,7 +10772,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-records" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "frame-benchmarking", @@ -10795,7 +10795,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-records-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -10811,7 +10811,7 @@ dependencies = [ [[package]] name = "xpallet-gateway-records-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "parity-scale-codec", @@ -10823,7 +10823,7 @@ dependencies = [ [[package]] name = "xpallet-genesis-builder" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "frame-support", @@ -10844,7 +10844,7 @@ dependencies = [ [[package]] name = "xpallet-mining-asset" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "env_logger 0.7.1", @@ -10873,7 +10873,7 @@ dependencies = [ [[package]] name = "xpallet-mining-asset-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -10888,7 +10888,7 @@ dependencies = [ [[package]] name = "xpallet-mining-asset-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "parity-scale-codec", @@ -10899,7 +10899,7 @@ dependencies = [ [[package]] name = "xpallet-mining-staking" -version = "5.2.3" +version = "5.2.4" dependencies = [ "chainx-primitives", "frame-benchmarking", @@ -10929,7 +10929,7 @@ dependencies = [ [[package]] name = "xpallet-mining-staking-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -10944,7 +10944,7 @@ dependencies = [ [[package]] name = "xpallet-mining-staking-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "parity-scale-codec", "sp-api", @@ -10954,7 +10954,7 @@ dependencies = [ [[package]] name = "xpallet-support" -version = "5.2.3" +version = "5.2.4" dependencies = [ "hex", "sp-std", @@ -10962,7 +10962,7 @@ dependencies = [ [[package]] name = "xpallet-system" -version = "5.2.3" +version = "5.2.4" dependencies = [ "frame-support", "frame-system", @@ -10976,7 +10976,7 @@ dependencies = [ [[package]] name = "xpallet-transaction-fee" -version = "5.2.3" +version = "5.2.4" dependencies = [ "frame-support", "frame-system", @@ -10990,7 +10990,7 @@ dependencies = [ [[package]] name = "xpallet-transaction-fee-rpc" -version = "5.2.3" +version = "5.2.4" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -11008,7 +11008,7 @@ dependencies = [ [[package]] name = "xpallet-transaction-fee-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" dependencies = [ "parity-scale-codec", "sp-api", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index edc671c01..c60d7812f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx-cli" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] description = "Implementation of protocol https://chainx.org in Rust based on the Substrate framework." edition = "2021" diff --git a/client/rpc/finality/Cargo.toml b/client/rpc/finality/Cargo.toml index 59e964987..e5d827ca9 100644 --- a/client/rpc/finality/Cargo.toml +++ b/client/rpc/finality/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevm-finality-rpc" description = "An experimental RPC to check for block and transaction finality in the bevm chain" -version = "5.2.2" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/executor/Cargo.toml b/executor/Cargo.toml index 0bfe0ed7d..76a13a26d 100644 --- a/executor/Cargo.toml +++ b/executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx-executor" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 5b6aa2679..89b9cd5a1 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx-primitives" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/assets-registrar/Cargo.toml b/primitives/assets-registrar/Cargo.toml index 31753157d..8d36b1a30 100644 --- a/primitives/assets-registrar/Cargo.toml +++ b/primitives/assets-registrar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-assets-registrar" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/gateway/bitcoin/Cargo.toml b/primitives/gateway/bitcoin/Cargo.toml index 8ef4a30c0..0528ff635 100644 --- a/primitives/gateway/bitcoin/Cargo.toml +++ b/primitives/gateway/bitcoin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-gateway-bitcoin" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/gateway/common/Cargo.toml b/primitives/gateway/common/Cargo.toml index c2e922bc8..fe8cc0c4c 100644 --- a/primitives/gateway/common/Cargo.toml +++ b/primitives/gateway/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-gateway-common" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/genesis-builder/Cargo.toml b/primitives/genesis-builder/Cargo.toml index 2e22f9441..3e6e1e762 100644 --- a/primitives/genesis-builder/Cargo.toml +++ b/primitives/genesis-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-genesis-builder" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/io/Cargo.toml b/primitives/io/Cargo.toml index 2864e89a8..876c4f819 100644 --- a/primitives/io/Cargo.toml +++ b/primitives/io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-io" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/mining/common/Cargo.toml b/primitives/mining/common/Cargo.toml index c64db3a49..90e85e020 100644 --- a/primitives/mining/common/Cargo.toml +++ b/primitives/mining/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-mining-common" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/mining/staking/Cargo.toml b/primitives/mining/staking/Cargo.toml index 97b73437f..5db5702b2 100644 --- a/primitives/mining/staking/Cargo.toml +++ b/primitives/mining/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-mining-staking" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/protocol/Cargo.toml b/primitives/protocol/Cargo.toml index 2e8b96220..f97a9b758 100644 --- a/primitives/protocol/Cargo.toml +++ b/primitives/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-protocol" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/rpc/Cargo.toml b/primitives/rpc/Cargo.toml index f34fe6766..6ed90dff9 100644 --- a/primitives/rpc/Cargo.toml +++ b/primitives/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index b2cef59f4..7d4cecbed 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xp-runtime" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 5f33e8d8b..ad14ef9f6 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/runtime/chainx/Cargo.toml b/runtime/chainx/Cargo.toml index e80ea3a01..3d38f3c8d 100644 --- a/runtime/chainx/Cargo.toml +++ b/runtime/chainx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx-runtime" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/runtime/dev/Cargo.toml b/runtime/dev/Cargo.toml index 6ccba0395..6c31ce343 100644 --- a/runtime/dev/Cargo.toml +++ b/runtime/dev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dev-runtime" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/runtime/malan/Cargo.toml b/runtime/malan/Cargo.toml index 151bb6d12..0feaa68c5 100644 --- a/runtime/malan/Cargo.toml +++ b/runtime/malan/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "malan-runtime" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/service/Cargo.toml b/service/Cargo.toml index 27753facf..4495afed6 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chainx-service" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/assets-bridge/Cargo.toml b/xpallets/assets-bridge/Cargo.toml index efb04d790..f36ea3f2d 100644 --- a/xpallets/assets-bridge/Cargo.toml +++ b/xpallets/assets-bridge/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-assets-bridge" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/assets-registrar/Cargo.toml b/xpallets/assets-registrar/Cargo.toml index b75e39295..602cd8a74 100644 --- a/xpallets/assets-registrar/Cargo.toml +++ b/xpallets/assets-registrar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-assets-registrar" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/assets/Cargo.toml b/xpallets/assets/Cargo.toml index c70345f9a..7b84a7644 100644 --- a/xpallets/assets/Cargo.toml +++ b/xpallets/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-assets" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/assets/rpc/Cargo.toml b/xpallets/assets/rpc/Cargo.toml index bdcec6cf9..e265ef87c 100644 --- a/xpallets/assets/rpc/Cargo.toml +++ b/xpallets/assets/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-assets-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/assets/rpc/runtime-api/Cargo.toml b/xpallets/assets/rpc/runtime-api/Cargo.toml index 1d46373df..c8958b054 100644 --- a/xpallets/assets/rpc/runtime-api/Cargo.toml +++ b/xpallets/assets/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-assets-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/btc-ledger/Cargo.toml b/xpallets/btc-ledger/Cargo.toml index 45215b1f8..b8f452fcd 100644 --- a/xpallets/btc-ledger/Cargo.toml +++ b/xpallets/btc-ledger/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-btc-ledger" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/btc-ledger/rpc/Cargo.toml b/xpallets/btc-ledger/rpc/Cargo.toml index 3a4dece56..d25f77a4f 100644 --- a/xpallets/btc-ledger/rpc/Cargo.toml +++ b/xpallets/btc-ledger/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-btc-ledger-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/btc-ledger/rpc/runtime-api/Cargo.toml b/xpallets/btc-ledger/rpc/runtime-api/Cargo.toml index 83686ce33..2c3c188f4 100644 --- a/xpallets/btc-ledger/rpc/runtime-api/Cargo.toml +++ b/xpallets/btc-ledger/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-btc-ledger-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/dex/spot/Cargo.toml b/xpallets/dex/spot/Cargo.toml index 3d7336078..6f76a1fcf 100644 --- a/xpallets/dex/spot/Cargo.toml +++ b/xpallets/dex/spot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-dex-spot" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/dex/spot/rpc/Cargo.toml b/xpallets/dex/spot/rpc/Cargo.toml index 4039ff6ca..3492d3424 100644 --- a/xpallets/dex/spot/rpc/Cargo.toml +++ b/xpallets/dex/spot/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-dex-spot-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/dex/spot/rpc/runtime-api/Cargo.toml b/xpallets/dex/spot/rpc/runtime-api/Cargo.toml index 61a1247d5..20c2071b7 100644 --- a/xpallets/dex/spot/rpc/runtime-api/Cargo.toml +++ b/xpallets/dex/spot/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-dex-spot-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/bitcoin/Cargo.toml b/xpallets/gateway/bitcoin/Cargo.toml index 1965d8df0..e782e2be6 100644 --- a/xpallets/gateway/bitcoin/Cargo.toml +++ b/xpallets/gateway/bitcoin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-bitcoin" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/bitcoin/rpc/Cargo.toml b/xpallets/gateway/bitcoin/rpc/Cargo.toml index 66496a26f..e3123c84e 100644 --- a/xpallets/gateway/bitcoin/rpc/Cargo.toml +++ b/xpallets/gateway/bitcoin/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-bitcoin-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/bitcoin/rpc/runtime-api/Cargo.toml b/xpallets/gateway/bitcoin/rpc/runtime-api/Cargo.toml index a79fc77a3..c7882c6cc 100644 --- a/xpallets/gateway/bitcoin/rpc/runtime-api/Cargo.toml +++ b/xpallets/gateway/bitcoin/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-bitcoin-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/common/Cargo.toml b/xpallets/gateway/common/Cargo.toml index b28e3a9b2..64d472aaa 100644 --- a/xpallets/gateway/common/Cargo.toml +++ b/xpallets/gateway/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-common" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/common/rpc/Cargo.toml b/xpallets/gateway/common/rpc/Cargo.toml index 7c9224727..73f4819ba 100644 --- a/xpallets/gateway/common/rpc/Cargo.toml +++ b/xpallets/gateway/common/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-common-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/common/rpc/runtime-api/Cargo.toml b/xpallets/gateway/common/rpc/runtime-api/Cargo.toml index b39e6e6f3..f3f0e8839 100644 --- a/xpallets/gateway/common/rpc/runtime-api/Cargo.toml +++ b/xpallets/gateway/common/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-common-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/records/Cargo.toml b/xpallets/gateway/records/Cargo.toml index be84a1e28..187f6bc68 100644 --- a/xpallets/gateway/records/Cargo.toml +++ b/xpallets/gateway/records/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-records" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/records/rpc/Cargo.toml b/xpallets/gateway/records/rpc/Cargo.toml index 8704627d0..45909d34f 100644 --- a/xpallets/gateway/records/rpc/Cargo.toml +++ b/xpallets/gateway/records/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-records-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/gateway/records/rpc/runtime-api/Cargo.toml b/xpallets/gateway/records/rpc/runtime-api/Cargo.toml index 32ef8e782..93b416186 100644 --- a/xpallets/gateway/records/rpc/runtime-api/Cargo.toml +++ b/xpallets/gateway/records/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-gateway-records-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/genesis-builder/Cargo.toml b/xpallets/genesis-builder/Cargo.toml index 33e8cdc66..059939d5e 100644 --- a/xpallets/genesis-builder/Cargo.toml +++ b/xpallets/genesis-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-genesis-builder" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/mining/asset/Cargo.toml b/xpallets/mining/asset/Cargo.toml index bc0614f0a..d9ea5cc86 100644 --- a/xpallets/mining/asset/Cargo.toml +++ b/xpallets/mining/asset/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-mining-asset" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/mining/asset/rpc/Cargo.toml b/xpallets/mining/asset/rpc/Cargo.toml index a96f8f42e..f196a9491 100644 --- a/xpallets/mining/asset/rpc/Cargo.toml +++ b/xpallets/mining/asset/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-mining-asset-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/mining/asset/rpc/runtime-api/Cargo.toml b/xpallets/mining/asset/rpc/runtime-api/Cargo.toml index 8f1f0930d..79abad9d4 100644 --- a/xpallets/mining/asset/rpc/runtime-api/Cargo.toml +++ b/xpallets/mining/asset/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-mining-asset-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/mining/staking/Cargo.toml b/xpallets/mining/staking/Cargo.toml index 8724cffbb..0cce949c3 100644 --- a/xpallets/mining/staking/Cargo.toml +++ b/xpallets/mining/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-mining-staking" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/mining/staking/rpc/Cargo.toml b/xpallets/mining/staking/rpc/Cargo.toml index 1c45203de..e1da014e1 100644 --- a/xpallets/mining/staking/rpc/Cargo.toml +++ b/xpallets/mining/staking/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-mining-staking-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/mining/staking/rpc/runtime-api/Cargo.toml b/xpallets/mining/staking/rpc/runtime-api/Cargo.toml index e1eeed9a7..6b2b3faef 100644 --- a/xpallets/mining/staking/rpc/runtime-api/Cargo.toml +++ b/xpallets/mining/staking/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-mining-staking-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/support/Cargo.toml b/xpallets/support/Cargo.toml index 10efe0076..36abb9bf2 100644 --- a/xpallets/support/Cargo.toml +++ b/xpallets/support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-support" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/system/Cargo.toml b/xpallets/system/Cargo.toml index 0ed4c8744..021cf02f4 100644 --- a/xpallets/system/Cargo.toml +++ b/xpallets/system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-system" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/transaction-fee/Cargo.toml b/xpallets/transaction-fee/Cargo.toml index 0f278a835..223333a91 100644 --- a/xpallets/transaction-fee/Cargo.toml +++ b/xpallets/transaction-fee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-transaction-fee" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/transaction-fee/rpc/Cargo.toml b/xpallets/transaction-fee/rpc/Cargo.toml index 98a235351..a89c29055 100644 --- a/xpallets/transaction-fee/rpc/Cargo.toml +++ b/xpallets/transaction-fee/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-transaction-fee-rpc" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" diff --git a/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml b/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml index a607ef2e3..c87557776 100644 --- a/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml +++ b/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xpallet-transaction-fee-rpc-runtime-api" -version = "5.2.3" +version = "5.2.4" authors = ["The ChainX Authors"] edition = "2021" From 19ee9016c4f0dd395367cc8fe475987b9e8053a5 Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 00:31:29 +0800 Subject: [PATCH 4/8] Update DesiredRunnersUp from 0 to 3 in runtime configuration --- runtime/chainx/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/chainx/src/lib.rs b/runtime/chainx/src/lib.rs index 0e3e666a7..2439abfb5 100644 --- a/runtime/chainx/src/lib.rs +++ b/runtime/chainx/src/lib.rs @@ -688,7 +688,7 @@ parameter_types! { pub const VotingBond: Balance = DOLLARS; pub const TermDuration: BlockNumber = DAYS; pub const DesiredMembers: u32 = 6; - pub const DesiredRunnersUp: u32 = 0; + pub const DesiredRunnersUp: u32 = 3; pub const ElectionsPhragmenPalletId: LockIdentifier = *b"pcx/phre"; } From a3d3e1d0f5c7f2de963a9b8e23a660d543f8b18d Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 10:11:09 +0800 Subject: [PATCH 5/8] Add EvmRentCalculator type to mock configurations --- xpallets/assets-bridge/src/mock.rs | 1 + xpallets/gateway/bitcoin/src/mock.rs | 1 + xpallets/gateway/common/src/mock.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/xpallets/assets-bridge/src/mock.rs b/xpallets/assets-bridge/src/mock.rs index 68713d8af..88b9f75d7 100644 --- a/xpallets/assets-bridge/src/mock.rs +++ b/xpallets/assets-bridge/src/mock.rs @@ -137,6 +137,7 @@ impl pallet_evm::Config for Test { type OnChargeTransaction = (); type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; type FindAuthor = (); + type EvmRentCalculator = (); type WeightInfo = (); } diff --git a/xpallets/gateway/bitcoin/src/mock.rs b/xpallets/gateway/bitcoin/src/mock.rs index 31dbe7a86..7883d9115 100644 --- a/xpallets/gateway/bitcoin/src/mock.rs +++ b/xpallets/gateway/bitcoin/src/mock.rs @@ -272,6 +272,7 @@ impl pallet_evm::Config for Test { type OnChargeTransaction = (); type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; type FindAuthor = (); + type EvmRentCalculator = (); type WeightInfo = (); } diff --git a/xpallets/gateway/common/src/mock.rs b/xpallets/gateway/common/src/mock.rs index 89b5db626..f8a4aad61 100644 --- a/xpallets/gateway/common/src/mock.rs +++ b/xpallets/gateway/common/src/mock.rs @@ -258,6 +258,7 @@ impl pallet_evm::Config for Test { type OnChargeTransaction = (); type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; type FindAuthor = (); + type EvmRentCalculator = (); type WeightInfo = (); } From 807c25df715b18762032722008b4ce0011328f5c Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 10:53:28 +0800 Subject: [PATCH 6/8] Fix input length check for EstimateRent in withdraw modules --- runtime/chainx/src/withdraw.rs | 2 +- runtime/dev/src/withdraw.rs | 2 +- runtime/malan/src/withdraw.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/chainx/src/withdraw.rs b/runtime/chainx/src/withdraw.rs index 302f52c49..4970a65b1 100644 --- a/runtime/chainx/src/withdraw.rs +++ b/runtime/chainx/src/withdraw.rs @@ -69,7 +69,7 @@ impl< Ok(ReturnType::WithdrawPCX) } // EstimateRent - Some(&2) if input.len() == 20 => { + Some(&2) if input.len() == 21 => { // input = (flag, 1 byte) + evm_account(20 bytes) log::debug!(target: "evm-withdraw", "estimateRent: call"); diff --git a/runtime/dev/src/withdraw.rs b/runtime/dev/src/withdraw.rs index 302f52c49..4970a65b1 100644 --- a/runtime/dev/src/withdraw.rs +++ b/runtime/dev/src/withdraw.rs @@ -69,7 +69,7 @@ impl< Ok(ReturnType::WithdrawPCX) } // EstimateRent - Some(&2) if input.len() == 20 => { + Some(&2) if input.len() == 21 => { // input = (flag, 1 byte) + evm_account(20 bytes) log::debug!(target: "evm-withdraw", "estimateRent: call"); diff --git a/runtime/malan/src/withdraw.rs b/runtime/malan/src/withdraw.rs index 3ed5979c1..dcace9328 100644 --- a/runtime/malan/src/withdraw.rs +++ b/runtime/malan/src/withdraw.rs @@ -71,7 +71,7 @@ impl< Ok(ReturnType::WithdrawPCX) } // EstimateRent - Some(&2) if input.len() == 20 => { + Some(&2) if input.len() == 21 => { // input = (flag, 1 byte) + evm_account(20 bytes) log::debug!(target: "evm-withdraw", "estimateRent: call"); From b08cfdbd9198117c78f6f494a0c352d4e5fd13d8 Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 12:58:32 +0800 Subject: [PATCH 7/8] Update frontier dependencies to commit 3925a4d2 --- Cargo.lock | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eba207dda..b8484b5a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2068,7 +2068,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "async-trait", "fc-db", @@ -2087,7 +2087,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -2101,7 +2101,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fc-db", "fp-consensus", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "ethereum", "ethereum-types", @@ -2160,7 +2160,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "ethereum", "ethereum-types", @@ -2267,7 +2267,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "ethereum", "parity-scale-codec", @@ -2279,7 +2279,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "evm", "parity-scale-codec", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "fp-rent" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "sp-core", ] @@ -2299,7 +2299,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "ethereum", "ethereum-types", @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "ethereum", "frame-support", @@ -2332,7 +2332,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "parity-scale-codec", ] @@ -5310,7 +5310,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "frame-support", "frame-system", @@ -5392,7 +5392,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "ethereum", "ethereum-types", @@ -5422,7 +5422,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "evm", "fp-evm", @@ -5449,7 +5449,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-evm", ] @@ -5457,7 +5457,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-evm", "sp-core", @@ -5467,7 +5467,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-evm", "frame-support", @@ -5477,7 +5477,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-evm", "num", @@ -5486,7 +5486,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-evm", "tiny-keccak", @@ -5495,7 +5495,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-evm", "ripemd", @@ -5505,7 +5505,7 @@ dependencies = [ [[package]] name = "pallet-evm-rent" version = "1.0.0" -source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#f5d233e838625c233bf2bdd6434f1d1d026eb1b9" +source = "git+https://github.com/chainx-org/frontier?branch=polkadot-v0.9.18-btc-fix2#3925a4d27bb30310212c86d2ced940b789cbc406" dependencies = [ "fp-rent", "frame-support", From 3a7381acfa9ddebae6327163b2cf9a23920a8c46 Mon Sep 17 00:00:00 2001 From: icodezjb Date: Wed, 17 Dec 2025 13:10:36 +0800 Subject: [PATCH 8/8] Add rent settings query functionality to withdraw precompile --- runtime/chainx/src/withdraw.rs | 30 +++++++++++++++++++++++++++--- runtime/dev/src/withdraw.rs | 30 +++++++++++++++++++++++++++--- runtime/malan/src/withdraw.rs | 32 +++++++++++++++++++++++++++----- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/runtime/chainx/src/withdraw.rs b/runtime/chainx/src/withdraw.rs index 4970a65b1..df202059a 100644 --- a/runtime/chainx/src/withdraw.rs +++ b/runtime/chainx/src/withdraw.rs @@ -18,6 +18,7 @@ enum ReturnType { WithdrawBTC, WithdrawPCX, EstimateRent(u128, u64), + RentSettings(u128, u64), } pub struct Withdraw< @@ -82,6 +83,21 @@ impl< Ok(ReturnType::EstimateRent(rent_balance, days)) } + + // Get Rent Settings + Some(&3) if input.len() == 1 => { + // input = (flag, 1 byte) + + log::debug!(target: "evm-withdraw", "rentSettings: call"); + let (daily_rent, active_timestamp) = + Self::process_rent_settings().map_err(|err| { + log::warn!(target: "evm-withdraw", "rentSettings: err = {:?}", err); + err + })?; + log::debug!(target: "evm-withdraw", "rentSettings: success"); + + Ok(ReturnType::RentSettings(daily_rent, active_timestamp)) + } _ => { log::warn!(target: "evm-withdraw", "invalid input: {:?}", input); @@ -238,6 +254,13 @@ impl< Ok((rent_balance, days)) } + + fn process_rent_settings() -> Result<(u128, u64), PrecompileFailure> { + let daily_rent: u128 = pallet_evm_rent::Pallet::::daily_rent(); + let active_timestamp: u64 = pallet_evm_rent::Pallet::::active_timestamp(); + + Ok((daily_rent, active_timestamp)) + } } impl Precompile for Withdraw @@ -270,10 +293,11 @@ where logs: Default::default(), }) } - ReturnType::EstimateRent(rent_balance, days) => { + ReturnType::EstimateRent(balance, time) + | ReturnType::RentSettings(balance, time) => { let mut padded = [0u8; 64]; - padded[16..32].copy_from_slice(rent_balance.to_be_bytes().as_slice()); - padded[56..64].copy_from_slice(days.to_be_bytes().as_slice()); + padded[16..32].copy_from_slice(balance.to_be_bytes().as_slice()); + padded[56..64].copy_from_slice(time.to_be_bytes().as_slice()); Ok(PrecompileOutput { exit_status: ExitSucceed::Returned, diff --git a/runtime/dev/src/withdraw.rs b/runtime/dev/src/withdraw.rs index 4970a65b1..df202059a 100644 --- a/runtime/dev/src/withdraw.rs +++ b/runtime/dev/src/withdraw.rs @@ -18,6 +18,7 @@ enum ReturnType { WithdrawBTC, WithdrawPCX, EstimateRent(u128, u64), + RentSettings(u128, u64), } pub struct Withdraw< @@ -82,6 +83,21 @@ impl< Ok(ReturnType::EstimateRent(rent_balance, days)) } + + // Get Rent Settings + Some(&3) if input.len() == 1 => { + // input = (flag, 1 byte) + + log::debug!(target: "evm-withdraw", "rentSettings: call"); + let (daily_rent, active_timestamp) = + Self::process_rent_settings().map_err(|err| { + log::warn!(target: "evm-withdraw", "rentSettings: err = {:?}", err); + err + })?; + log::debug!(target: "evm-withdraw", "rentSettings: success"); + + Ok(ReturnType::RentSettings(daily_rent, active_timestamp)) + } _ => { log::warn!(target: "evm-withdraw", "invalid input: {:?}", input); @@ -238,6 +254,13 @@ impl< Ok((rent_balance, days)) } + + fn process_rent_settings() -> Result<(u128, u64), PrecompileFailure> { + let daily_rent: u128 = pallet_evm_rent::Pallet::::daily_rent(); + let active_timestamp: u64 = pallet_evm_rent::Pallet::::active_timestamp(); + + Ok((daily_rent, active_timestamp)) + } } impl Precompile for Withdraw @@ -270,10 +293,11 @@ where logs: Default::default(), }) } - ReturnType::EstimateRent(rent_balance, days) => { + ReturnType::EstimateRent(balance, time) + | ReturnType::RentSettings(balance, time) => { let mut padded = [0u8; 64]; - padded[16..32].copy_from_slice(rent_balance.to_be_bytes().as_slice()); - padded[56..64].copy_from_slice(days.to_be_bytes().as_slice()); + padded[16..32].copy_from_slice(balance.to_be_bytes().as_slice()); + padded[56..64].copy_from_slice(time.to_be_bytes().as_slice()); Ok(PrecompileOutput { exit_status: ExitSucceed::Returned, diff --git a/runtime/malan/src/withdraw.rs b/runtime/malan/src/withdraw.rs index dcace9328..df202059a 100644 --- a/runtime/malan/src/withdraw.rs +++ b/runtime/malan/src/withdraw.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use codec::{Decode, Encode}; use core::marker::PhantomData; use fp_evm::{ @@ -20,6 +18,7 @@ enum ReturnType { WithdrawBTC, WithdrawPCX, EstimateRent(u128, u64), + RentSettings(u128, u64), } pub struct Withdraw< @@ -84,6 +83,21 @@ impl< Ok(ReturnType::EstimateRent(rent_balance, days)) } + + // Get Rent Settings + Some(&3) if input.len() == 1 => { + // input = (flag, 1 byte) + + log::debug!(target: "evm-withdraw", "rentSettings: call"); + let (daily_rent, active_timestamp) = + Self::process_rent_settings().map_err(|err| { + log::warn!(target: "evm-withdraw", "rentSettings: err = {:?}", err); + err + })?; + log::debug!(target: "evm-withdraw", "rentSettings: success"); + + Ok(ReturnType::RentSettings(daily_rent, active_timestamp)) + } _ => { log::warn!(target: "evm-withdraw", "invalid input: {:?}", input); @@ -240,6 +254,13 @@ impl< Ok((rent_balance, days)) } + + fn process_rent_settings() -> Result<(u128, u64), PrecompileFailure> { + let daily_rent: u128 = pallet_evm_rent::Pallet::::daily_rent(); + let active_timestamp: u64 = pallet_evm_rent::Pallet::::active_timestamp(); + + Ok((daily_rent, active_timestamp)) + } } impl Precompile for Withdraw @@ -272,10 +293,11 @@ where logs: Default::default(), }) } - ReturnType::EstimateRent(rent_balance, days) => { + ReturnType::EstimateRent(balance, time) + | ReturnType::RentSettings(balance, time) => { let mut padded = [0u8; 64]; - padded[16..32].copy_from_slice(rent_balance.to_be_bytes().as_slice()); - padded[56..64].copy_from_slice(days.to_be_bytes().as_slice()); + padded[16..32].copy_from_slice(balance.to_be_bytes().as_slice()); + padded[56..64].copy_from_slice(time.to_be_bytes().as_slice()); Ok(PrecompileOutput { exit_status: ExitSucceed::Returned,