From e2e6f958d50deaafe8312f385d81f06a2848cc11 Mon Sep 17 00:00:00 2001 From: Igor Papandinas <26460174+ipapandinas@users.noreply.github.com> Date: Fri, 22 May 2026 17:56:52 +0100 Subject: [PATCH 1/6] remove: pallet_unified_accounts --- Cargo.lock | 91 --- Cargo.toml | 6 - .../types/unified-accounts/Cargo.toml | 30 - .../types/unified-accounts/src/lib.rs | 48 -- chain-extensions/unified-accounts/Cargo.toml | 49 -- chain-extensions/unified-accounts/src/lib.rs | 85 -- pallets/unified-accounts/Cargo.toml | 87 --- pallets/unified-accounts/src/benchmarking.rs | 162 ---- pallets/unified-accounts/src/lib.rs | 413 ---------- pallets/unified-accounts/src/mock.rs | 198 ----- pallets/unified-accounts/src/tests.rs | 399 ---------- pallets/unified-accounts/src/weights.rs | 210 ----- precompiles/unified-accounts/Cargo.toml | 68 -- .../unified-accounts/UnifiedAccounts.sol | 28 - precompiles/unified-accounts/src/lib.rs | 70 -- precompiles/unified-accounts/src/mock.rs | 243 ------ precompiles/unified-accounts/src/tests.rs | 130 ---- runtime/shibuya/Cargo.toml | 8 - runtime/shibuya/src/chain_extensions.rs | 32 - runtime/shibuya/src/lib.rs | 38 +- runtime/shibuya/src/precompiles.rs | 9 +- tests/ink-contracts/au_ce_getters.json | 723 ------------------ tests/ink-contracts/au_ce_getters.wasm | Bin 19694 -> 0 bytes tests/integration/Cargo.toml | 6 - tests/integration/src/lib.rs | 3 - tests/integration/src/setup.rs | 64 +- tests/integration/src/unified_accounts.rs | 121 --- 27 files changed, 16 insertions(+), 3305 deletions(-) delete mode 100644 chain-extensions/types/unified-accounts/Cargo.toml delete mode 100644 chain-extensions/types/unified-accounts/src/lib.rs delete mode 100644 chain-extensions/unified-accounts/Cargo.toml delete mode 100644 chain-extensions/unified-accounts/src/lib.rs delete mode 100644 pallets/unified-accounts/Cargo.toml delete mode 100644 pallets/unified-accounts/src/benchmarking.rs delete mode 100644 pallets/unified-accounts/src/lib.rs delete mode 100644 pallets/unified-accounts/src/mock.rs delete mode 100644 pallets/unified-accounts/src/tests.rs delete mode 100644 pallets/unified-accounts/src/weights.rs delete mode 100644 precompiles/unified-accounts/Cargo.toml delete mode 100644 precompiles/unified-accounts/UnifiedAccounts.sol delete mode 100644 precompiles/unified-accounts/src/lib.rs delete mode 100644 precompiles/unified-accounts/src/mock.rs delete mode 100644 precompiles/unified-accounts/src/tests.rs delete mode 100644 runtime/shibuya/src/chain_extensions.rs delete mode 100644 tests/ink-contracts/au_ce_getters.json delete mode 100644 tests/ink-contracts/au_ce_getters.wasm delete mode 100644 tests/integration/src/unified_accounts.rs diff --git a/Cargo.lock b/Cargo.lock index 8c1daf875a..8288eff380 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6645,7 +6645,6 @@ dependencies = [ "frame-support", "frame-system", "hex", - "libsecp256k1", "moonbeam-rpc-primitives-debug", "pallet-assets", "pallet-aura", @@ -6669,7 +6668,6 @@ dependencies = [ "pallet-session", "pallet-timestamp", "pallet-tx-pause", - "pallet-unified-accounts", "pallet-utility", "pallet-xcm", "parity-scale-codec", @@ -6686,7 +6684,6 @@ dependencies = [ "sp-trie", "staging-xcm", "staging-xcm-executor", - "unified-accounts-chain-extension-types", "xcm-runtime-apis", ] @@ -9317,26 +9314,6 @@ dependencies = [ "sp-runtime", ] -[[package]] -name = "pallet-chain-extension-unified-accounts" -version = "0.1.0" -dependencies = [ - "astar-primitives", - "frame-support", - "frame-system", - "log", - "num-traits", - "pallet-contracts", - "pallet-evm", - "pallet-unified-accounts", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std", - "unified-accounts-chain-extension-types", -] - [[package]] name = "pallet-child-bounties" version = "40.0.0" @@ -9915,35 +9892,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-evm-precompile-unified-accounts" -version = "0.1.0" -dependencies = [ - "astar-primitives", - "derive_more 0.99.20", - "ethers", - "fp-evm", - "frame-support", - "frame-system", - "hex", - "hex-literal", - "libsecp256k1", - "log", - "num_enum 0.5.11", - "pallet-balances", - "pallet-evm", - "pallet-timestamp", - "pallet-unified-accounts", - "parity-scale-codec", - "precompile-utils", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-evm-precompile-xcm" version = "0.11.0" @@ -10796,31 +10744,6 @@ dependencies = [ "scale-info", ] -[[package]] -name = "pallet-unified-accounts" -version = "0.1.0" -dependencies = [ - "astar-primitives", - "ethers", - "frame-benchmarking", - "frame-support", - "frame-system", - "hex", - "libsecp256k1", - "log", - "pallet-balances", - "pallet-ethereum", - "pallet-evm", - "pallet-timestamp", - "parity-scale-codec", - "precompile-utils", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-utility" version = "41.0.0" @@ -15879,7 +15802,6 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", - "pallet-chain-extension-unified-accounts", "pallet-collator-selection 4.0.0", "pallet-collective", "pallet-collective-proxy", @@ -15903,7 +15825,6 @@ dependencies = [ "pallet-evm-precompile-simple", "pallet-evm-precompile-sr25519", "pallet-evm-precompile-substrate-ecdsa", - "pallet-evm-precompile-unified-accounts", "pallet-evm-precompile-xcm", "pallet-identity", "pallet-inflation", @@ -15923,7 +15844,6 @@ dependencies = [ "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury 37.0.0", "pallet-tx-pause", - "pallet-unified-accounts", "pallet-utility", "pallet-vesting", "pallet-xc-asset-config", @@ -18732,17 +18652,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" -[[package]] -name = "unified-accounts-chain-extension-types" -version = "0.1.0" -dependencies = [ - "num_enum 0.5.11", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", -] - [[package]] name = "universal-hash" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 1993f74cb1..5e3c1dc576 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,6 @@ members = [ "pallets/*", "precompiles/*", "primitives", - "chain-extensions/unified-accounts", - "chain-extensions/types/*", "vendor/evm-tracing", "vendor/primitives/debug", "vendor/primitives/evm-tracing-events", @@ -318,7 +316,6 @@ pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features pallet-ethereum-checked = { path = "./pallets/ethereum-checked", default-features = false } pallet-inflation = { path = "./pallets/inflation", default-features = false } pallet-dynamic-evm-base-fee = { path = "./pallets/dynamic-evm-base-fee", default-features = false } -pallet-unified-accounts = { path = "./pallets/unified-accounts", default-features = false } astar-xcm-benchmarks = { path = "./pallets/astar-xcm-benchmarks", default-features = false } pallet-collective-proxy = { path = "./pallets/collective-proxy", default-features = false } vesting-mbm = { path = "./pallets/vesting-mbm", default-features = false } @@ -335,12 +332,9 @@ pallet-evm-precompile-sr25519 = { path = "./precompiles/sr25519", default-featur pallet-evm-precompile-substrate-ecdsa = { path = "./precompiles/substrate-ecdsa", default-features = false } pallet-evm-precompile-xcm = { path = "./precompiles/xcm", default-features = false } pallet-evm-precompile-dapp-staking = { path = "./precompiles/dapp-staking", default-features = false } -pallet-evm-precompile-unified-accounts = { path = "./precompiles/unified-accounts", default-features = false } pallet-evm-precompile-dispatch-lockdrop = { path = "./precompiles/dispatch-lockdrop", default-features = false } -pallet-chain-extension-unified-accounts = { path = "./chain-extensions/unified-accounts", default-features = false } -unified-accounts-chain-extension-types = { path = "./chain-extensions/types/unified-accounts", default-features = false } shibuya-runtime = { path = "./runtime/shibuya", default-features = false } shiden-runtime = { path = "./runtime/shiden", default-features = false } diff --git a/chain-extensions/types/unified-accounts/Cargo.toml b/chain-extensions/types/unified-accounts/Cargo.toml deleted file mode 100644 index 351b2f03a0..0000000000 --- a/chain-extensions/types/unified-accounts/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "unified-accounts-chain-extension-types" -version = "0.1.0" -description = "Types definitions for contracts using Unified Accounts chain-extension." -authors.workspace = true -edition.workspace = true -homepage.workspace = true -repository.workspace = true - -[lints] -workspace = true - -[dependencies] -num_enum = { workspace = true } -parity-scale-codec = { workspace = true } -scale-info = { workspace = true } - -#substarte -sp-core = { workspace = true } -sp-runtime = { workspace = true } - -[features] -default = ["std"] -std = [ - "num_enum/std", - "parity-scale-codec/std", - "scale-info/std", - "sp-core/std", - "sp-runtime/std", -] diff --git a/chain-extensions/types/unified-accounts/src/lib.rs b/chain-extensions/types/unified-accounts/src/lib.rs deleted file mode 100644 index 7ee82eb9dc..0000000000 --- a/chain-extensions/types/unified-accounts/src/lib.rs +++ /dev/null @@ -1,48 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg_attr(not(feature = "std"), no_std)] - -use num_enum::{IntoPrimitive, TryFromPrimitive}; -use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; - -#[repr(u16)] -#[derive(TryFromPrimitive, IntoPrimitive, Decode, Encode)] -pub enum Command { - /// Get the mapped Evm address if any - GetEvmAddress = 0, - /// Get the mapped Evm address if any otheriwse default associated Evm address - GetEvmAddressOrDefault = 1, - /// Get the mapped Native address if any - GetNativeAddress = 2, - /// Get the mapped Native address if any otheriwse default associated Native address - GetNativeAddressOrDefault = 3, -} - -#[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen)] -#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] -pub enum UnifiedAddress { - /// The address fetched from the mappings and the account - /// is unified - #[codec(index = 0)] - Mapped(T), - /// The default address associated with account as there - /// is no mapping found and accounts are not unified - #[codec(index = 1)] - Default(T), -} diff --git a/chain-extensions/unified-accounts/Cargo.toml b/chain-extensions/unified-accounts/Cargo.toml deleted file mode 100644 index 7cdba58e85..0000000000 --- a/chain-extensions/unified-accounts/Cargo.toml +++ /dev/null @@ -1,49 +0,0 @@ -[package] -name = "pallet-chain-extension-unified-accounts" -version = "0.1.0" -description = "Chain extension for AU" -authors.workspace = true -edition.workspace = true -homepage.workspace = true -repository.workspace = true - -[lints] -workspace = true - -[dependencies] -frame-support = { workspace = true } -frame-system = { workspace = true } -log = { workspace = true } -num-traits = { workspace = true } -pallet-contracts = { workspace = true } -pallet-evm = { workspace = true } -parity-scale-codec = { workspace = true } -scale-info = { workspace = true } -sp-core = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -# Astar -astar-primitives = { workspace = true } -pallet-unified-accounts = { workspace = true } -unified-accounts-chain-extension-types = { workspace = true } - -[features] -default = ["std"] -std = [ - "parity-scale-codec/std", - "frame-support/std", - "frame-system/std", - "num-traits/std", - "pallet-contracts/std", - "pallet-evm/std", - "scale-info/std", - "sp-std/std", - "sp-core/std", - "sp-runtime/std", - # Astar - "astar-primitives/std", - "pallet-unified-accounts/std", - "unified-accounts-chain-extension-types/std", - "log/std", -] diff --git a/chain-extensions/unified-accounts/src/lib.rs b/chain-extensions/unified-accounts/src/lib.rs deleted file mode 100644 index 56c8037535..0000000000 --- a/chain-extensions/unified-accounts/src/lib.rs +++ /dev/null @@ -1,85 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg_attr(not(feature = "std"), no_std)] - -use astar_primitives::evm::{EvmAddress, UnifiedAddressMapper}; -use core::marker::PhantomData; -use sp_runtime::DispatchError; - -use frame_support::DefaultNoBound; -use pallet_contracts::chain_extension::{ - ChainExtension, Environment, Ext, InitState, Result as DispatchResult, RetVal, -}; -use pallet_unified_accounts::WeightInfo; -use parity_scale_codec::Encode; -pub use unified_accounts_chain_extension_types::Command::{self, *}; - -type UAWeight = ::WeightInfo; - -#[derive(DefaultNoBound)] -pub struct UnifiedAccountsExtension(PhantomData<(T, UA)>); - -impl ChainExtension for UnifiedAccountsExtension -where - T: pallet_contracts::Config + pallet_unified_accounts::Config, - UA: UnifiedAddressMapper, -{ - fn call(&mut self, env: Environment) -> DispatchResult - where - E: Ext, - { - let mut env = env.buf_in_buf_out(); - match env.func_id().try_into().map_err(|_| { - DispatchError::Other("Unsupported func id in Unified Accounts Chain Extension") - })? { - GetEvmAddress => { - let account_id: T::AccountId = env.read_as()?; - // charge weight - env.charge_weight(UAWeight::::to_h160())?; - // write to buffer - UA::to_h160(&account_id).using_encoded(|r| env.write(r, false, None))?; - } - GetEvmAddressOrDefault => { - let account_id: T::AccountId = env.read_as()?; - // charge weight - env.charge_weight(UAWeight::::to_h160_or_default())?; - - // write to buffer - UA::to_h160_or_default(&account_id).using_encoded(|r| env.write(r, false, None))?; - } - GetNativeAddress => { - let evm_address: EvmAddress = env.read_as()?; - // charge weight - env.charge_weight(UAWeight::::to_account_id())?; - // write to buffer - UA::to_account_id(&evm_address).using_encoded(|r| env.write(r, false, None))?; - } - GetNativeAddressOrDefault => { - let evm_address: EvmAddress = env.read_as()?; - // charge weight - env.charge_weight(UAWeight::::to_account_id_or_default())?; - - // write to buffer - UA::to_account_id_or_default(&evm_address) - .using_encoded(|r| env.write(r, false, None))?; - } - }; - Ok(RetVal::Converging(0)) - } -} diff --git a/pallets/unified-accounts/Cargo.toml b/pallets/unified-accounts/Cargo.toml deleted file mode 100644 index 3cf6e706e8..0000000000 --- a/pallets/unified-accounts/Cargo.toml +++ /dev/null @@ -1,87 +0,0 @@ -[package] -name = "pallet-unified-accounts" -version = "0.1.0" -description = "Pallet for mapping VM accounts with native accounts" -authors.workspace = true -edition.workspace = true -homepage.workspace = true -repository.workspace = true - -[lints] -workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -libsecp256k1 = { workspace = true, optional = true, features = ["hmac", "static-context"] } -log = { workspace = true } -parity-scale-codec = { workspace = true } -scale-info = { workspace = true } - -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-core = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -# Benchmarks -frame-benchmarking = { workspace = true, optional = true } - -precompile-utils = { workspace = true } - -# frontier -pallet-evm = { workspace = true } - -# Astar -astar-primitives = { workspace = true } - -[dev-dependencies] -ethers = { workspace = true } -hex = { workspace = true } -pallet-balances = { workspace = true } -pallet-ethereum = { workspace = true } -pallet-evm = { workspace = true } -pallet-timestamp = { workspace = true } - -[features] -default = ["std"] -std = [ - "hex/std", - "log/std", - "libsecp256k1", - "libsecp256k1/std", - "parity-scale-codec/std", - "scale-info/std", - "sp-std/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", - "frame-support/std", - "frame-system/std", - "astar-primitives/std", - "precompile-utils/std", - "pallet-evm/std", - "pallet-balances/std", - "pallet-timestamp/std", - "pallet-ethereum/std", - "frame-benchmarking?/std", -] -runtime-benchmarks = [ - "libsecp256k1/hmac", - "frame-benchmarking", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "astar-primitives/runtime-benchmarks", - "pallet-ethereum/runtime-benchmarks", - "pallet-evm/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", -] -try-runtime = [ - "frame-support/try-runtime", - "pallet-evm/try-runtime", - "astar-primitives/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", -] diff --git a/pallets/unified-accounts/src/benchmarking.rs b/pallets/unified-accounts/src/benchmarking.rs deleted file mode 100644 index 0ca8845f17..0000000000 --- a/pallets/unified-accounts/src/benchmarking.rs +++ /dev/null @@ -1,162 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg(feature = "runtime-benchmarks")] - -use super::*; -use frame_benchmarking::v2::*; -use frame_support::assert_ok; -use frame_system::RawOrigin; -use sp_std::prelude::*; - -/// Assert that the last event equals the provided one. -fn assert_last_event(generic_event: crate::Event) { - frame_system::Pallet::::assert_last_event(generic_event.into()); -} - -#[benchmarks] -mod benchmarks { - use super::*; - - #[benchmark] - fn claim_evm_address() { - let caller: T::AccountId = whitelisted_caller(); - let eth_secret_key = libsecp256k1::SecretKey::parse(&keccak_256(b"Alice")).unwrap(); - let evm_address = Pallet::::eth_address(ð_secret_key); - let signature = Pallet::::eth_sign_prehash( - &Pallet::::build_signing_payload(&caller), - ð_secret_key, - ) - .into(); - - assert_ok!(T::Currency::mint_into( - &caller, - T::AccountMappingStorageFee::get() - )); - let caller_clone = caller.clone(); - - #[extrinsic_call] - _(RawOrigin::Signed(caller), evm_address, signature); - - assert_last_event::( - Event::::AccountClaimed { - account_id: caller_clone, - evm_address, - } - .into(), - ); - } - - #[benchmark] - fn claim_default_evm_address() { - let caller: T::AccountId = whitelisted_caller(); - let evm_address = T::DefaultMappings::to_default_h160(&caller); - - assert_ok!(T::Currency::mint_into( - &caller, - T::AccountMappingStorageFee::get() - )); - - #[extrinsic_call] - _(RawOrigin::Signed(caller.clone())); - - assert_last_event::( - Event::::AccountClaimed { - account_id: caller, - evm_address, - } - .into(), - ); - } - - #[benchmark] - fn to_account_id() { - let caller: T::AccountId = whitelisted_caller(); - let evm_address = T::DefaultMappings::to_default_h160(&caller.clone()); - assert_ok!(T::Currency::mint_into( - &caller, - T::AccountMappingStorageFee::get() - )); - // claim mapping - assert_ok!(Pallet::::claim_default_evm_address( - RawOrigin::Signed(caller.clone()).into() - )); - - #[block] - { - let _ = as UnifiedAddressMapper>::to_account_id(&evm_address); - } - } - - #[benchmark] - fn to_account_id_or_default() { - let caller: T::AccountId = whitelisted_caller(); - let evm_address = T::DefaultMappings::to_default_h160(&caller.clone()); - assert_ok!(T::Currency::mint_into( - &caller, - T::AccountMappingStorageFee::get() - )); - // claim mapping - assert_ok!(Pallet::::claim_default_evm_address( - RawOrigin::Signed(caller.clone()).into() - )); - - #[block] - { - let _ = as UnifiedAddressMapper>::to_account_id_or_default( - &evm_address, - ); - } - } - - #[benchmark] - fn to_h160() { - let caller: T::AccountId = whitelisted_caller(); - assert_ok!(T::Currency::mint_into( - &caller, - T::AccountMappingStorageFee::get() - )); - // claim mapping - assert_ok!(Pallet::::claim_default_evm_address( - RawOrigin::Signed(caller.clone()).into() - )); - - #[block] - { - let _ = as UnifiedAddressMapper>::to_h160(&caller); - } - } - - #[benchmark] - fn to_h160_or_default() { - let caller: T::AccountId = whitelisted_caller(); - assert_ok!(T::Currency::mint_into( - &caller, - T::AccountMappingStorageFee::get() - )); - // claim mapping - assert_ok!(Pallet::::claim_default_evm_address( - RawOrigin::Signed(caller.clone()).into() - )); - - #[block] - { - let _ = as UnifiedAddressMapper>::to_h160_or_default(&caller); - } - } -} diff --git a/pallets/unified-accounts/src/lib.rs b/pallets/unified-accounts/src/lib.rs deleted file mode 100644 index 08939fc20d..0000000000 --- a/pallets/unified-accounts/src/lib.rs +++ /dev/null @@ -1,413 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -//! # Pallet Unified Account -//! -//! A simple module for managing mappings (both ways) between different -//! address schemes, inspired from Acala's evm-accounts pallet -//! https://github.com/AcalaNetwork/Acala/tree/master/modules/evm-accounts -//! -//! - [`Config`] -//! - [`Call`] -//! -//! ## Overview -//! -//! The Unified Accounts module provide functionality for native account holders to -//! connect their evm address to have a unified experience across the different VMs. -//! - Connect evm address you control -//! - Connect default evm address -//! -//! ## Interface -//! -//! * `claim_evm_address`: Creates the double mappings for the provided evm address with caller -//! account id given that no prior mapping exists for both and signature provided is valid. -//! * `claim_default_evm_address`: Creates the double mapping with default evm address given that -//! no prior mapping exists. -//! -//! ## Storage Fee -//! User is also charged a storage fee [`AccountMappingStorageFee`](`crate::Config::AccountMappingStorageFee`) -//! before mappings are created to prevent storage abuse. -//! -//! WARNINGS: -//! * This pallet only handles transfer of native balance only, for the rest of native assets -//! hold by evm address like XC20, DAppStaking unclaimed rewards, etc should be transferred -//! manually beforehand by user himself otherwise FUNDS WILL BE LOST FOREVER. -//! * Once mapping is created it cannot be changed. -//! -//! ## Traits -//! -//! * `UnifiedAddressMapper`: Interface to access pallet's mappings with defaults -//! -//! ## Implementations -//! -//! * [`StaticLookup`](sp_runtime::traits::StaticLookup): Lookup implementations for accepting H160 -//! * [`AddressMapping`](pallet_evm::AddressMapping): Wrapper over `UnifiedAddressMapper` for evm address mapping -//! to account id. -//! * `KillAccountMapping`: [`OnKilledAccount`](frame_support::traits::OnKilledAccount) implementation to remove -//! the mappings from storage after account is reaped. - -#![cfg_attr(not(feature = "std"), no_std)] - -use astar_primitives::{ - evm::{EvmAddress, UnifiedAddressMapper}, - Balance, -}; -use frame_support::{ - pallet_prelude::*, - traits::{ - fungible::{Inspect as FungibleInspect, Mutate as FungibleMutate}, - tokens::{Fortitude::*, Precision::*, Preservation::*}, - OnKilledAccount, - }, -}; -use frame_system::{ensure_signed, pallet_prelude::*}; -use pallet_evm::AddressMapping; -use precompile_utils::keccak256; -use sp_core::{H160, H256, U256}; -use sp_io::hashing::keccak_256; -use sp_runtime::{ - traits::{LookupError, StaticLookup, Zero}, - MultiAddress, -}; -use sp_std::marker::PhantomData; - -pub use pallet::*; - -pub mod weights; -pub use weights::WeightInfo; - -#[cfg(feature = "runtime-benchmarks")] -mod benchmarking; -mod mock; -mod tests; - -/// ECDSA Signature type, with last bit for recovering address -type EvmSignature = [u8; 65]; - -#[frame_support::pallet] -pub mod pallet { - use super::*; - - #[pallet::pallet] - pub struct Pallet(PhantomData); - - #[pallet::config] - pub trait Config: frame_system::Config { - /// The Currency for managing evm address assets - type Currency: FungibleMutate; - /// Default address conversion - type DefaultMappings: UnifiedAddressMapper; - /// EVM chain id - #[pallet::constant] - type ChainId: Get; - /// The amount of currency needed for mappings to be added. - /// Two storage items with values sizes, sizeof(AccountId) and sizeof(H160) - /// respectively - #[pallet::constant] - type AccountMappingStorageFee: Get; - /// Weight information for the extrinsics in this module - type WeightInfo: WeightInfo; - } - - #[pallet::error] - pub enum Error { - /// AccountId or EvmAddress already mapped - AlreadyMapped, - /// The signature is malformed - UnexpectedSignatureFormat, - /// The signature verification failed due to mismatch evm address - InvalidSignature, - /// Funds unavailable to claim account - FundsUnavailable, - } - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - /// Evm Address claimed. - /// Double Mapping b/w native and evm address created - AccountClaimed { - account_id: T::AccountId, - evm_address: EvmAddress, - }, - } - - /// Native accounts for evm address - /// EvmToNative: EvmAddress => Option - #[pallet::storage] - pub type EvmToNative = - StorageMap<_, Blake2_128Concat, EvmAddress, T::AccountId, OptionQuery>; - - /// Evm addresses for native accounts - /// NativeToEvm: AccountId => Option - #[pallet::storage] - pub type NativeToEvm = - StorageMap<_, Blake2_128Concat, T::AccountId, EvmAddress, OptionQuery>; - - #[pallet::call] - impl Pallet { - /// Claim account mapping between Substrate account and Evm address. - /// Ensure no prior mapping exists for evm address. - /// - /// - `evm_address`: The evm address to bind to the caller's account - /// - `signature`: A signature generated by the address to prove ownership - /// - /// WARNING: - /// - This extrinsic only handles transfer of native balance, if your EVM - /// address contains any other native assets like XC20, DAppStaking unclaimed rewards, - /// etc you need to transfer them before hand, otherwise FUNDS WILL BE LOST FOREVER. - /// - Once connected user cannot change their mapping EVER. - #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::claim_evm_address())] - pub fn claim_evm_address( - origin: OriginFor, - evm_address: EvmAddress, - signature: EvmSignature, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - // make sure no prior mapping exists - ensure!( - !NativeToEvm::::contains_key(&who), - Error::::AlreadyMapped - ); - ensure!( - !EvmToNative::::contains_key(evm_address), - Error::::AlreadyMapped - ); - - // recover evm address from signature - let address = Self::verify_signature(&who, &signature) - .ok_or(Error::::UnexpectedSignatureFormat)?; - - ensure!(evm_address == address, Error::::InvalidSignature); - - // charge the storage fee - Self::charge_storage_fee(&who)?; - - // Check if the default account id already exists for this evm address - let default_account_id = T::DefaultMappings::to_default_account_id(&evm_address); - if frame_system::Pallet::::account_exists(&default_account_id) { - // Transfer all the free native balance from old account id to the newly - // since this `default_account_id` will no longer be connected to evm address - // and users cannot access it. - // For the reset of the assets types (like XC20, etc) that should be handled by UI. - T::Currency::transfer( - &default_account_id, - &who, - T::Currency::reducible_balance(&default_account_id, Expendable, Polite), - Expendable, - )?; - } - - // create double mappings for the pair - EvmToNative::::insert(&evm_address, &who); - NativeToEvm::::insert(&who, &evm_address); - - Self::deposit_event(Event::AccountClaimed { - account_id: who, - evm_address, - }); - Ok(()) - } - - /// Claim default evm address for given account id - /// Ensure no prior mapping exists for the account - /// - /// WARNINGS: Once connected user cannot change their mapping EVER. - #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::claim_default_evm_address())] - pub fn claim_default_evm_address(origin: OriginFor) -> DispatchResult { - let who = ensure_signed(origin)?; - // claim default evm address - let _ = Self::do_claim_default_evm_address(who)?; - Ok(()) - } - } -} - -impl Pallet { - /// Claim the default evm address - fn do_claim_default_evm_address(account_id: T::AccountId) -> Result { - ensure!( - !NativeToEvm::::contains_key(&account_id), - Error::::AlreadyMapped - ); - // get the default evm address - let evm_address = T::DefaultMappings::to_default_h160(&account_id); - // make sure default address is not already mapped, this should not - // happen but for sanity check. - ensure!( - !EvmToNative::::contains_key(&evm_address), - Error::::AlreadyMapped - ); - - Self::charge_storage_fee(&account_id)?; - - // create double mappings for the pair with default evm address - EvmToNative::::insert(&evm_address, &account_id); - NativeToEvm::::insert(&account_id, &evm_address); - - Self::deposit_event(Event::AccountClaimed { - account_id, - evm_address, - }); - Ok(evm_address) - } - - /// Charge the (exact) storage fee (politely) from the user and burn it - /// while preserving the account from being reaped. - fn charge_storage_fee(who: &T::AccountId) -> Result { - let balance = T::Currency::reducible_balance(who, Preserve, Polite); - let fee = T::AccountMappingStorageFee::get(); - ensure!(balance >= fee, Error::::FundsUnavailable); - T::Currency::burn_from( - who, - T::AccountMappingStorageFee::get(), - Preserve, - Exact, - Polite, - ) - } -} - -/// EIP-712 compatible signature scheme for verifying ownership of EVM Address -/// https://eips.ethereum.org/EIPS/eip-712 -/// -/// Raw Data = Domain Separator + Type Hash + keccak256(AccountId) -impl Pallet { - pub fn build_signing_payload(who: &T::AccountId) -> [u8; 32] { - let domain_separator = Self::build_domain_separator(); - let args_hash = Self::build_args_hash(who); - - let mut payload = b"\x19\x01".to_vec(); - payload.extend_from_slice(&domain_separator); - payload.extend_from_slice(&args_hash); - keccak_256(&payload) - } - - pub fn verify_signature(who: &T::AccountId, sig: &EvmSignature) -> Option { - let payload_hash = Self::build_signing_payload(who); - - sp_io::crypto::secp256k1_ecdsa_recover(sig, &payload_hash) - .map(|pubkey| H160::from(H256::from_slice(&keccak_256(&pubkey)))) - .ok() - } - - fn build_domain_separator() -> [u8; 32] { - let mut domain = - keccak256!("EIP712Domain(string name,string version,uint256 chainId,bytes32 salt)") - .to_vec(); - domain.extend_from_slice(&keccak256!("Astar EVM Claim")); // name - domain.extend_from_slice(&keccak256!("1")); // version - domain.extend_from_slice(&U256::from(T::ChainId::get()).to_big_endian()); // chain id - domain.extend_from_slice( - frame_system::Pallet::::block_hash(BlockNumberFor::::zero()).as_ref(), - ); // genesis block hash - keccak_256(domain.as_slice()) - } - - fn build_args_hash(account: &T::AccountId) -> [u8; 32] { - let mut args_hash = keccak256!("Claim(bytes substrateAddress)").to_vec(); - args_hash.extend_from_slice(&keccak_256(&account.encode())); - keccak_256(args_hash.as_slice()) - } -} - -#[cfg(any(feature = "std", feature = "runtime-benchmarks"))] -impl Pallet { - /// Sign the given prehash with provided eth private key - pub fn eth_sign_prehash(prehash: &[u8; 32], secret: &libsecp256k1::SecretKey) -> [u8; 65] { - let (sig, recovery_id) = libsecp256k1::sign(&libsecp256k1::Message::parse(prehash), secret); - let mut r = [0u8; 65]; - r[0..64].copy_from_slice(&sig.serialize()[..]); - r[64] = recovery_id.serialize(); - r - } - - /// Get the eth address for given eth private key - pub fn eth_address(secret: &libsecp256k1::SecretKey) -> EvmAddress { - EvmAddress::from_slice( - &sp_io::hashing::keccak_256( - &libsecp256k1::PublicKey::from_secret_key(secret).serialize()[1..65], - )[12..], - ) - } -} - -/// UnifiedAddressMapper implementation using pallet's mapping -/// and default address scheme from pallet's config -impl UnifiedAddressMapper for Pallet { - fn to_account_id(evm_address: &EvmAddress) -> Option { - EvmToNative::::get(evm_address) - } - - fn to_default_account_id(evm_address: &EvmAddress) -> T::AccountId { - T::DefaultMappings::to_default_account_id(evm_address) - } - - fn to_h160(account_id: &T::AccountId) -> Option { - NativeToEvm::::get(account_id) - } - - fn to_default_h160(account_id: &T::AccountId) -> EvmAddress { - T::DefaultMappings::to_default_h160(account_id) - } -} - -/// AddressMapping wrapper implementation -impl AddressMapping for Pallet { - fn into_account_id(evm_address: H160) -> T::AccountId { - >::to_account_id_or_default(&evm_address) - .into_address() - } -} - -/// OnKilledAccount hooks implementation for removing storage mapping -/// for killed accounts -pub struct KillAccountMapping(PhantomData); -impl OnKilledAccount for KillAccountMapping { - fn on_killed_account(who: &T::AccountId) { - // remove mappings of account reaped - if let Some(evm_addr) = NativeToEvm::::take(who) { - EvmToNative::::remove(evm_addr); - NativeToEvm::::remove(who); - } - } -} - -/// A lookup implementation returning the `AccountId` from `MultiAddress::Address20` (EVM Address). -impl StaticLookup for Pallet { - type Source = MultiAddress; - type Target = T::AccountId; - - fn lookup(a: Self::Source) -> Result { - match a { - MultiAddress::Address20(i) => Ok( - >::to_account_id_or_default( - &EvmAddress::from_slice(&i), - ) - .into_address(), - ), - _ => Err(LookupError), - } - } - - fn unlookup(a: Self::Target) -> Self::Source { - MultiAddress::Id(a) - } -} diff --git a/pallets/unified-accounts/src/mock.rs b/pallets/unified-accounts/src/mock.rs deleted file mode 100644 index 3b9b9dcbfc..0000000000 --- a/pallets/unified-accounts/src/mock.rs +++ /dev/null @@ -1,198 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg(test)] - -use super::*; -use crate as pallet_unified_accounts; -use astar_primitives::evm::HashedDefaultMappings; -use frame_support::{ - construct_runtime, derive_impl, parameter_types, - traits::{ConstU64, FindAuthor}, - weights::Weight, -}; -use pallet_ethereum::PostLogContent; -use pallet_evm::FeeCalculator; -use sp_core::{keccak_256, H160, U256}; -use sp_io::TestExternalities; -use sp_runtime::{ - traits::{AccountIdLookup, BlakeTwo256}, - AccountId32, BuildStorage, ConsensusEngineId, -}; - -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0)); - pub const ExistentialDeposit: u128 = 100; -} - -#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] -impl frame_system::Config for TestRuntime { - type Block = Block; - type AccountId = AccountId; - type Lookup = (AccountIdLookup, UnifiedAccounts); - type AccountData = pallet_balances::AccountData; - type OnKilledAccount = KillAccountMapping; -} - -#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] -impl pallet_balances::Config for TestRuntime { - type Balance = Balance; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; -} - -#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)] -impl pallet_timestamp::Config for TestRuntime { - type MinimumPeriod = ConstU64<3>; -} - -pub struct MockFeeCalculator; -impl FeeCalculator for MockFeeCalculator { - fn min_gas_price() -> (U256, Weight) { - (U256::one(), Weight::zero()) - } -} - -pub struct MockFindAuthor; -impl FindAuthor for MockFindAuthor { - fn find_author<'a, I>(_digests: I) -> Option - where - I: 'a + IntoIterator, - { - Some(H160::from_low_u64_be(1)) - } -} - -parameter_types! { - pub WeightPerGas: Weight = Weight::from_parts(1, 0); - pub const BlockGasLimit: U256 = U256::MAX; - pub ChainId: u64 = 1024; -} - -impl pallet_evm::Config for TestRuntime { - type FeeCalculator = MockFeeCalculator; - type GasWeightMapping = pallet_evm::FixedGasWeightMapping; - type WeightPerGas = WeightPerGas; - type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; - type CallOrigin = pallet_evm::EnsureAddressRoot; - type WithdrawOrigin = pallet_evm::EnsureAddressTruncated; - type AddressMapping = UnifiedAccounts; - type Currency = Balances; - type Runner = pallet_evm::runner::stack::Runner; - type PrecompilesType = (); - type PrecompilesValue = (); - type ChainId = ChainId; - type OnChargeTransaction = (); - type BlockGasLimit = BlockGasLimit; - type OnCreate = (); - type FindAuthor = MockFindAuthor; - type Timestamp = Timestamp; - type WeightInfo = pallet_evm::weights::SubstrateWeight; - type GasLimitPovSizeRatio = ConstU64<4>; - type AccountProvider = pallet_evm::FrameSystemAccountProvider; - type GasLimitStorageGrowthRatio = ConstU64<0>; - type CreateOriginFilter = (); - type CreateInnerOriginFilter = (); -} - -parameter_types! { - pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; -} - -impl pallet_ethereum::Config for TestRuntime { - type StateRoot = - pallet_ethereum::IntermediateStateRoot<::Version>; - type PostLogContent = PostBlockAndTxnHashes; - type ExtraDataLength = ConstU32<30>; -} - -parameter_types! { - pub const AccountMappingStorageFee: u128 = 100_000_000; -} - -impl pallet_unified_accounts::Config for TestRuntime { - type Currency = Balances; - type DefaultMappings = HashedDefaultMappings; - type ChainId = ChainId; - type AccountMappingStorageFee = AccountMappingStorageFee; - type WeightInfo = (); -} - -pub(crate) type AccountId = AccountId32; -pub(crate) type Balance = u128; - -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); -pub const BOB: AccountId32 = AccountId32::new([1u8; 32]); -pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]); - -pub fn alice_secret() -> libsecp256k1::SecretKey { - libsecp256k1::SecretKey::parse(&keccak_256(b"Alice")).unwrap() -} - -pub fn bob_secret() -> libsecp256k1::SecretKey { - libsecp256k1::SecretKey::parse(&keccak_256(b"Bob")).unwrap() -} - -type Block = frame_system::mocking::MockBlock; - -construct_runtime!( - pub struct TestRuntime { - System: frame_system, - Timestamp: pallet_timestamp, - Balances: pallet_balances, - Evm: pallet_evm, - Ethereum: pallet_ethereum, - UnifiedAccounts: pallet_unified_accounts, - } -); - -pub struct ExtBuilder { - balances: Vec<(AccountId, Balance)>, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { - balances: vec![ - (ALICE, 1_000_000_000_000), - (BOB, 1_000_000_000_000), - (CHARLIE, 1_000_000_000_000), - ], - } - } -} - -impl ExtBuilder { - pub fn build(self) -> TestExternalities { - let mut t = frame_system::GenesisConfig::::default() - .build_storage() - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: self.balances, - ..Default::default() - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = TestExternalities::from(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} diff --git a/pallets/unified-accounts/src/tests.rs b/pallets/unified-accounts/src/tests.rs deleted file mode 100644 index 42ee3bfe27..0000000000 --- a/pallets/unified-accounts/src/tests.rs +++ /dev/null @@ -1,399 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg(test)] - -use super::*; -use frame_support::{assert_noop, assert_ok}; -use mock::*; - -use ethers::{ - contract::{Eip712, EthAbiType}, - core::types::{transaction::eip712::Eip712, Bytes}, -}; -use parity_scale_codec::Encode; -use sp_runtime::{traits::StaticLookup, AccountId32, MultiAddress}; - -/// EIP712 Payload struct -#[derive(Eip712, EthAbiType, Clone)] -#[eip712( - name = "Astar EVM Claim", - version = "1", - chain_id = 1024, - // mock genisis hash - raw_salt = "0x4545454545454545454545454545454545454545454545454545454545454545" - )] -struct Claim { - substrate_address: Bytes, -} - -/// Build the signature payload for given native account and eth private key -fn get_evm_signature(who: &AccountId32, secret: &libsecp256k1::SecretKey) -> [u8; 65] { - // sign the payload - UnifiedAccounts::eth_sign_prehash( - &Claim { - substrate_address: who.encode().into(), - } - .encode_eip712() - .unwrap(), - secret, - ) -} - -/// Create the mappings for the accounts -fn connect_accounts(who: &AccountId32, secret: &libsecp256k1::SecretKey) { - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(who.clone()), - UnifiedAccounts::eth_address(secret), - get_evm_signature(who, secret) - )); -} - -#[test] -fn eip712_signature_verify_works() { - ExtBuilder::default().build().execute_with(|| { - let claim = Claim { - substrate_address: ALICE.encode().into(), - }; - - let claim_hash = UnifiedAccounts::build_signing_payload(&ALICE); - // assert signing payload is correct - assert_eq!( - claim.encode_eip712().unwrap(), - claim_hash, - "signing payload should match" - ); - - // sign the payload - let sig = UnifiedAccounts::eth_sign_prehash(&claim_hash, &alice_secret()); - assert_eq!( - Some(UnifiedAccounts::eth_address(&alice_secret())), - UnifiedAccounts::verify_signature(&ALICE, &sig), - "signature verification should work" - ); - }); -} - -#[test] -fn static_lookup_works() { - ExtBuilder::default().build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - let bob_eth = UnifiedAccounts::eth_address(&bob_secret()); - let bob_default_account_id = - >::to_default_account_id(&bob_eth); - - // create mappings for alice - connect_accounts(&ALICE, &alice_secret()); - - // mapping should work if available - assert_eq!( - ::lookup(MultiAddress::Address20(alice_eth.into())) - .unwrap(), - ALICE - ); - - // should use default if not mapping - assert_eq!( - ::lookup(MultiAddress::Address20(bob_eth.into())) - .unwrap(), - bob_default_account_id - ); - }); -} - -#[test] -fn on_killed_account_hook() { - ExtBuilder::default().build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - - // create the mappings - connect_accounts(&ALICE, &alice_secret()); - - // kill alice by transfering everything to bob - Balances::set_balance(&ALICE, 0); - - // check killed account events - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::System(frame_system::Event::KilledAccount { account }) if account == &ALICE - ))); - - // make sure mapping is removed - assert_eq!(NativeToEvm::::get(ALICE), None); - assert_eq!(EvmToNative::::get(alice_eth), None); - }); -} - -#[test] -fn account_claim_should_work() { - ExtBuilder::default().build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - // default ss58 account associated with eth address - let alice_eth_old_account = - ::DefaultMappings::to_default_account_id(&alice_eth); - let signature = get_evm_signature(&ALICE, &alice_secret()); - - // transfer some funds to alice_eth (H160) - assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(BOB), - alice_eth_old_account.clone().into(), - 1001 - )); - - // claim the account - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth, - signature - )); - - // check if all of balances is transfered to new account (ALICE) from - // old account (alice_eth_old_account) - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::System(frame_system::Event::KilledAccount { account }) - if account == &alice_eth_old_account - ))); - - // check if storage fee is charged and burned - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) - if who == &ALICE && amount == &AccountMappingStorageFee::get() - ))); - - // check for claim account event - System::assert_last_event(RuntimeEvent::UnifiedAccounts( - crate::Event::AccountClaimed { - account_id: ALICE.clone(), - evm_address: alice_eth.clone(), - }, - )); - - // make sure mappings are in place - assert_eq!(EvmToNative::::get(alice_eth).unwrap(), ALICE); - assert_eq!(NativeToEvm::::get(ALICE).unwrap(), alice_eth) - }); -} - -#[test] -fn account_default_claim_works() { - ExtBuilder::default().build().execute_with(|| { - let alice_default_evm = ::DefaultMappings::to_default_h160(&ALICE); - - // claim default account - assert_ok!(UnifiedAccounts::claim_default_evm_address( - RuntimeOrigin::signed(ALICE) - )); - System::assert_last_event(RuntimeEvent::UnifiedAccounts( - crate::Event::AccountClaimed { - account_id: ALICE.clone(), - evm_address: alice_default_evm.clone(), - }, - )); - - // check if storage fee is charged and burned - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) - if who == &ALICE && amount == &AccountMappingStorageFee::get() - ))); - - // check UnifiedAddressMapper's mapping works - assert_eq!( - >::to_h160(&ALICE), - Some(alice_default_evm) - ); - assert_eq!( - >::to_account_id(&alice_default_evm), - Some(ALICE) - ); - - // should not allow to claim afterwards - assert_noop!( - UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - UnifiedAccounts::eth_address(&alice_secret()), - get_evm_signature(&ALICE, &alice_secret()) - ), - Error::::AlreadyMapped - ); - }); -} - -#[test] -fn account_default_claim_should_not_work_if_collision() { - ExtBuilder::default().build().execute_with(|| { - let bob_default_h160 = >::to_default_h160(&BOB); - - // create mapping of alice native with bob's default address - // in real world possibilty of this happening is minuscule - EvmToNative::::insert(&bob_default_h160, &ALICE); - NativeToEvm::::insert(&ALICE, &bob_default_h160); - - // bob try claiming default h160 address, it should fail since alice already - // has mapping in place with it. - assert_noop!( - UnifiedAccounts::claim_default_evm_address(RuntimeOrigin::signed(BOB)), - Error::::AlreadyMapped - ); - - // check mappings are consistent - assert_eq!( - >::to_h160(&ALICE), - Some(bob_default_h160) - ); - assert_eq!( - >::to_account_id(&bob_default_h160), - Some(ALICE) - ); - }); -} - -#[test] -fn replay_attack_should_not_be_possible() { - ExtBuilder::default().build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - let alice_signature = get_evm_signature(&ALICE, &alice_secret()); - - // alice claim her eth address first - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth, - alice_signature - )); - - // bob intercepted alice signature and tries to perform - // replay attack to claim alice eth address as his own, - // this should fail. - assert_noop!( - UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(BOB), - alice_eth, - alice_signature - ), - Error::::AlreadyMapped - ); - }); -} - -#[test] -fn frontrun_attack_should_not_be_possible() { - ExtBuilder::default().build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - let alice_signature = get_evm_signature(&ALICE, &alice_secret()); - - // bob intercepted alice signature and tries to perform - // frontrun attack to claim alice eth address as his own - // this should fail with InvalidSignature. - assert_noop!( - UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(BOB), - alice_eth, - alice_signature - ), - Error::::InvalidSignature - ); - - // alice can claim her eth address - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth, - alice_signature - )); - }); -} - -#[test] -fn connecting_mapped_accounts_should_not_work() { - ExtBuilder::default().build().execute_with(|| { - // connect ALICE accounts - connect_accounts(&ALICE, &alice_secret()); - - // AccountId already mapped - // ALICE attempts to connect another evm address - assert_noop!( - UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - UnifiedAccounts::eth_address(&bob_secret()), - get_evm_signature(&BOB, &bob_secret()) - ), - Error::::AlreadyMapped - ); - - // eth address already mapped - // BOB attempts to connect alice_eth that is already mapped - assert_noop!( - UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(BOB), - UnifiedAccounts::eth_address(&alice_secret()), - get_evm_signature(&ALICE, &alice_secret()) - ), - Error::::AlreadyMapped - ); - }); -} - -#[test] -fn charging_storage_fee_should_not_reap_account() { - ExtBuilder::default().build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - let alice_signature = get_evm_signature(&ALICE, &alice_secret()); - - // set alice balance just enough to claim accounts without being reaped - Balances::set_balance( - &ALICE, - ExistentialDeposit::get() + AccountMappingStorageFee::get(), - ); - - // - // With sufficent funds, claim should succeed - // - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth, - alice_signature - )); - // check for claimed event - System::assert_last_event(RuntimeEvent::UnifiedAccounts( - crate::Event::AccountClaimed { - account_id: ALICE.clone(), - evm_address: alice_eth, - }, - )); - - // confirm the balance, should be equal to ED - assert_eq!(Balances::total_balance(&ALICE), ExistentialDeposit::get()); - - // clear mappings - EvmToNative::::remove(alice_eth); - NativeToEvm::::remove(ALICE); - - // - // When funds are less than required, should fail with funds unavailable - // - assert_noop!( - UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth, - alice_signature - ), - Error::::FundsUnavailable - ); - }); -} diff --git a/pallets/unified-accounts/src/weights.rs b/pallets/unified-accounts/src/weights.rs deleted file mode 100644 index cc4bea93a5..0000000000 --- a/pallets/unified-accounts/src/weights.rs +++ /dev/null @@ -1,210 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -//! Autogenerated weights for pallet_unified_accounts -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-10-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `devserver-01`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/astar-collator -// benchmark -// pallet -// --chain=shibuya-dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_unified_accounts -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./benchmark-results/shibuya-dev/unified_accounts_weights.rs -// --template=./scripts/templates/weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; - -/// Weight functions needed for pallet_unified_accounts. -pub trait WeightInfo { - fn claim_evm_address() -> Weight; - fn claim_default_evm_address() -> Weight; - fn to_account_id() -> Weight; - fn to_account_id_or_default() -> Weight; - fn to_h160() -> Weight; - fn to_h160_or_default() -> Weight; -} - -/// Weights for pallet_unified_accounts using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:1) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts EvmToNative (r:1 w:1) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// Storage: EVMChainId ChainId (r:1 w:0) - /// Proof: EVMChainId ChainId (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) - /// Storage: System BlockHash (r:1 w:0) - /// Proof: System BlockHash (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn claim_evm_address() -> Weight { - // Proof Size summary in bytes: - // Measured: `256` - // Estimated: `3593` - // Minimum execution time: 91_231_000 picoseconds. - Weight::from_parts(91_688_000, 3593) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:1) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts EvmToNative (r:1 w:1) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn claim_default_evm_address() -> Weight { - // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `3533` - // Minimum execution time: 40_749_000 picoseconds. - Weight::from_parts(41_411_000, 3533) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: UnifiedAccounts EvmToNative (r:1 w:0) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_account_id() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_478_000 picoseconds. - Weight::from_parts(5_661_000, 3533) - .saturating_add(T::DbWeight::get().reads(1_u64)) - } - /// Storage: UnifiedAccounts EvmToNative (r:1 w:0) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_account_id_or_default() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_515_000 picoseconds. - Weight::from_parts(5_700_000, 3533) - .saturating_add(T::DbWeight::get().reads(1_u64)) - } - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_h160() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_626_000 picoseconds. - Weight::from_parts(5_827_000, 3533) - .saturating_add(T::DbWeight::get().reads(1_u64)) - } - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_h160_or_default() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_578_000 picoseconds. - Weight::from_parts(5_719_000, 3533) - .saturating_add(T::DbWeight::get().reads(1_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:1) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts EvmToNative (r:1 w:1) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// Storage: EVMChainId ChainId (r:1 w:0) - /// Proof: EVMChainId ChainId (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) - /// Storage: System BlockHash (r:1 w:0) - /// Proof: System BlockHash (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn claim_evm_address() -> Weight { - // Proof Size summary in bytes: - // Measured: `256` - // Estimated: `3593` - // Minimum execution time: 91_231_000 picoseconds. - Weight::from_parts(91_688_000, 3593) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:1) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - /// Storage: UnifiedAccounts EvmToNative (r:1 w:1) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn claim_default_evm_address() -> Weight { - // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `3533` - // Minimum execution time: 40_749_000 picoseconds. - Weight::from_parts(41_411_000, 3533) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: UnifiedAccounts EvmToNative (r:1 w:0) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_account_id() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_478_000 picoseconds. - Weight::from_parts(5_661_000, 3533) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - } - /// Storage: UnifiedAccounts EvmToNative (r:1 w:0) - /// Proof: UnifiedAccounts EvmToNative (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_account_id_or_default() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_515_000 picoseconds. - Weight::from_parts(5_700_000, 3533) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - } - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_h160() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_626_000 picoseconds. - Weight::from_parts(5_827_000, 3533) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - } - /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0) - /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) - fn to_h160_or_default() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `3533` - // Minimum execution time: 5_578_000 picoseconds. - Weight::from_parts(5_719_000, 3533) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - } -} diff --git a/precompiles/unified-accounts/Cargo.toml b/precompiles/unified-accounts/Cargo.toml deleted file mode 100644 index 9589e69164..0000000000 --- a/precompiles/unified-accounts/Cargo.toml +++ /dev/null @@ -1,68 +0,0 @@ -[package] -name = "pallet-evm-precompile-unified-accounts" -description = "Evm Precompile for AU" -version = "0.1.0" -authors.workspace = true -edition.workspace = true -homepage.workspace = true -repository.workspace = true - -[lints] -workspace = true - -[dependencies] -hex = { workspace = true } -log = { workspace = true } -num_enum = { workspace = true } -precompile-utils = { workspace = true } - -# Substrate -frame-support = { workspace = true } -frame-system = { workspace = true } -parity-scale-codec = { workspace = true, features = ["max-encoded-len"] } -sp-core = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -# Frontier -fp-evm = { workspace = true } -pallet-evm = { workspace = true } -pallet-unified-accounts = { workspace = true } - -# Astar -astar-primitives = { workspace = true } - -[dev-dependencies] -derive_more = { workspace = true } -hex-literal = { workspace = true } -scale-info = { workspace = true } -serde = { workspace = true } - -precompile-utils = { workspace = true, features = ["testing"] } - -ethers = { workspace = true } -libsecp256k1 = { workspace = true, features = ["hmac", "static-context"] } -pallet-balances = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true } -sp-runtime = { workspace = true } - -[features] -default = ["std"] -std = [ - "parity-scale-codec/std", - "pallet-unified-accounts/std", - "fp-evm/std", - "frame-support/std", - "frame-system/std", - "pallet-evm/std", - "precompile-utils/std", - "sp-core/std", - "sp-std/std", - "sp-io/std", - "sp-runtime/std", - "astar-primitives/std", - "hex/std", - "log/std", - "num_enum/std", -] diff --git a/precompiles/unified-accounts/UnifiedAccounts.sol b/precompiles/unified-accounts/UnifiedAccounts.sol deleted file mode 100644 index 9569af44e3..0000000000 --- a/precompiles/unified-accounts/UnifiedAccounts.sol +++ /dev/null @@ -1,28 +0,0 @@ -pragma solidity ^0.8.0; - -/** - * @title UA interface. - */ - -/// Interface to the precompiled contract -/// Predeployed at the address 0x0000000000000000000000000000000000005006 -/// For better understanding check the source code: -/// repo: https://github.com/AstarNetwork/astar -/// code: pallets/unified-accounts/src/lib.rs -interface UnifiedAccounts { - /// Gets the evm address associated with given account id. If no mapping exists, - /// then return the default account id. - /// @param accountId: The account id for which you want the evm address for. - /// @return (mapped_address, true) if there is a mapping found otherwise (default_address, false) - function get_evm_address_or_default( - bytes32 accountId - ) external view returns (address, bool); - - /// Gets the account id associated with given evm address. If no mapping exists, - /// then return the default evm address. - /// @param evmAddress: The evm address for which you want the account id for. - /// @return (mapped_account, true) if there is a mapping found otherwise (default_account, false) - function get_native_address_or_default( - address evmAddress - ) external view returns (bytes32, bool); -} diff --git a/precompiles/unified-accounts/src/lib.rs b/precompiles/unified-accounts/src/lib.rs deleted file mode 100644 index 3fa2f2a6f6..0000000000 --- a/precompiles/unified-accounts/src/lib.rs +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg_attr(not(feature = "std"), no_std)] - -use astar_primitives::evm::{UnifiedAddress, UnifiedAddressMapper}; -use core::marker::PhantomData; -use fp_evm::PrecompileHandle; -use frame_support::traits::IsType; -use precompile_utils::prelude::*; -use sp_core::{crypto::AccountId32, H256}; - -#[cfg(test)] -mod mock; -#[cfg(test)] -mod tests; - -/// A precompile that expose AU related functions. -pub struct UnifiedAccountsPrecompile(PhantomData<(T, UA)>); - -#[precompile_utils::precompile] -impl UnifiedAccountsPrecompile -where - R: pallet_evm::Config + pallet_unified_accounts::Config, - ::AccountId: IsType, - UA: UnifiedAddressMapper, -{ - #[precompile::public("get_evm_address_or_default(bytes32)")] - #[precompile::view] - fn get_evm_address_or_default( - _: &mut impl PrecompileHandle, - account_id: H256, - ) -> EvmResult<(Address, bool)> { - let account_id = AccountId32::new(account_id.into()).into(); - - let output: (Address, bool) = match UA::to_h160_or_default(&account_id) { - UnifiedAddress::Mapped(address) => (address.into(), true), - UnifiedAddress::Default(address) => (address.into(), false), - }; - Ok(output) - } - - #[precompile::public("get_native_address_or_default(address)")] - #[precompile::view] - fn get_native_address_or_default( - _: &mut impl PrecompileHandle, - evm_address: Address, - ) -> EvmResult<(H256, bool)> { - let output: (H256, bool) = match UA::to_account_id_or_default(&evm_address.into()) { - UnifiedAddress::Mapped(account_id) => (H256::from(account_id.into().as_ref()), true), - UnifiedAddress::Default(account_id) => (H256::from(account_id.into().as_ref()), false), - }; - Ok(output) - } -} diff --git a/precompiles/unified-accounts/src/mock.rs b/precompiles/unified-accounts/src/mock.rs deleted file mode 100644 index dfe14e9673..0000000000 --- a/precompiles/unified-accounts/src/mock.rs +++ /dev/null @@ -1,243 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -use super::*; - -use fp_evm::{IsPrecompileResult, Precompile}; -use frame_support::{ - construct_runtime, derive_impl, parameter_types, traits::ConstU64, weights::Weight, -}; -pub use pallet_evm::{EnsureAddressNever, EnsureAddressRoot, PrecompileResult, PrecompileSet}; -use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; -use scale_info::TypeInfo; -use serde::{Deserialize, Serialize}; -use sp_core::{keccak_256, H160}; -use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, - AccountId32, BuildStorage, -}; - -use ethers::{ - contract::{Eip712, EthAbiType}, - core::types::transaction::eip712::Eip712, -}; - -use astar_primitives::evm::HashedDefaultMappings; -pub type AccountId = AccountId32; -pub type Balance = u128; -pub type Block = frame_system::mocking::MockBlock; - -pub const PRECOMPILE_ADDRESS: H160 = H160::repeat_byte(0x7B); - -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); - -pub fn alice_secret() -> libsecp256k1::SecretKey { - libsecp256k1::SecretKey::parse(&keccak_256(b"Alice")).unwrap() -} -/// EIP712 Payload struct -#[derive(Eip712, EthAbiType, Clone)] -#[eip712( - name = "Astar EVM Claim", - version = "1", - chain_id = 1024, - // mock genisis hash - raw_salt = "0x4545454545454545454545454545454545454545454545454545454545454545" - )] -struct Claim { - substrate_address: ethers::core::types::Bytes, -} - -/// Build the signature payload for given native account and eth private key -pub fn get_evm_signature(who: &AccountId32, secret: &libsecp256k1::SecretKey) -> [u8; 65] { - // sign the payload - UnifiedAccounts::eth_sign_prehash( - &Claim { - substrate_address: who.encode().into(), - } - .encode_eip712() - .unwrap(), - secret, - ) -} - -#[derive( - Eq, - PartialEq, - Ord, - PartialOrd, - Clone, - Encode, - Decode, - Debug, - MaxEncodedLen, - Serialize, - Deserialize, - derive_more::Display, - TypeInfo, -)] -pub enum TestAccount { - Viktor, - Precompile, -} -impl Default for TestAccount { - fn default() -> Self { - Self::Viktor - } -} -impl From for H160 { - fn from(value: TestAccount) -> H160 { - match value { - TestAccount::Viktor => H160::repeat_byte(0xAA), - TestAccount::Precompile => PRECOMPILE_ADDRESS, - } - } -} - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0)); -} - -#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] -impl frame_system::Config for TestRuntime { - type Block = Block; - type AccountId = AccountId32; - type Lookup = IdentityLookup; - type AccountData = pallet_balances::AccountData; -} -#[derive(Debug, Clone, Copy)] -pub struct TestPrecompileSet(PhantomData); - -impl PrecompileSet for TestPrecompileSet -where - R: pallet_evm::Config, - UnifiedAccountsPrecompile>: Precompile, -{ - fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { - match handle.code_address() { - a if a == PRECOMPILE_ADDRESS => Some(UnifiedAccountsPrecompile::< - R, - pallet_unified_accounts::Pallet, - >::execute(handle)), - _ => None, - } - } - - fn is_precompile(&self, address: H160, _gas: u64) -> IsPrecompileResult { - IsPrecompileResult::Answer { - is_precompile: address == PRECOMPILE_ADDRESS, - extra_cost: 0, - } - } -} - -parameter_types! { - pub const ExistentialDeposit: u128 = 1; -} - -#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] -impl pallet_balances::Config for TestRuntime { - type Balance = Balance; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; -} - -parameter_types! { - pub const MinimumPeriod: u64 = 5; -} - -#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)] -impl pallet_timestamp::Config for TestRuntime { - type MinimumPeriod = MinimumPeriod; -} - -parameter_types! { - pub const PrecompilesValue: TestPrecompileSet = - TestPrecompileSet(PhantomData); - pub WeightPerGas: Weight = Weight::from_parts(1, 0); -} - -pub type PrecompileCall = UnifiedAccountsPrecompileCall; - -impl pallet_evm::Config for TestRuntime { - type FeeCalculator = (); - type GasWeightMapping = pallet_evm::FixedGasWeightMapping; - type WeightPerGas = WeightPerGas; - type CallOrigin = EnsureAddressRoot; - type WithdrawOrigin = EnsureAddressNever; - type AddressMapping = UnifiedAccounts; - type Currency = Balances; - type Runner = pallet_evm::runner::stack::Runner; - type PrecompilesType = TestPrecompileSet; - type PrecompilesValue = PrecompilesValue; - type Timestamp = Timestamp; - type ChainId = ChainId; - type OnChargeTransaction = (); - type BlockGasLimit = (); - type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; - type FindAuthor = (); - type OnCreate = (); - type WeightInfo = (); - type GasLimitPovSizeRatio = ConstU64<4>; - type AccountProvider = pallet_evm::FrameSystemAccountProvider; - type GasLimitStorageGrowthRatio = ConstU64<0>; - type CreateOriginFilter = (); - type CreateInnerOriginFilter = (); -} - -parameter_types! { - // 2 storage items with value size 20 and 32 - pub const AccountMappingStorageFee: u128 = 0; - pub ChainId: u64 = 1024; -} - -impl pallet_unified_accounts::Config for TestRuntime { - type Currency = Balances; - type DefaultMappings = HashedDefaultMappings; - type ChainId = ChainId; - type AccountMappingStorageFee = AccountMappingStorageFee; - type WeightInfo = pallet_unified_accounts::weights::SubstrateWeight; -} - -// Configure a mock runtime to test the pallet. -construct_runtime!( - pub enum TestRuntime - { - System: frame_system, - Evm: pallet_evm, - UnifiedAccounts: pallet_unified_accounts, - Balances : pallet_balances, - Timestamp: pallet_timestamp, - } -); - -#[derive(Default)] -pub(crate) struct ExtBuilder; - -impl ExtBuilder { - pub(crate) fn build(self) -> sp_io::TestExternalities { - let t = frame_system::GenesisConfig::::default() - .build_storage() - .expect("Frame system builds valid default genesis config"); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} diff --git a/precompiles/unified-accounts/src/tests.rs b/precompiles/unified-accounts/src/tests.rs deleted file mode 100644 index 8eaa8d69bd..0000000000 --- a/precompiles/unified-accounts/src/tests.rs +++ /dev/null @@ -1,130 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -use crate::mock::*; -use crate::*; - -use frame_support::assert_ok; -use precompile_utils::testing::*; - -fn precompiles() -> TestPrecompileSet { - PrecompilesValue::get() -} - -#[test] -fn test_get_evm_address() { - // Case 1 : Address Not Mapped - ExtBuilder.build().execute_with(|| { - let alice_default_evm = - ::DefaultMappings::to_default_h160( - &ALICE, - ); - - let res: (Address, bool) = (alice_default_evm.into(), false); - precompiles() - .prepare_test( - TestAccount::Viktor, - PRECOMPILE_ADDRESS, - PrecompileCall::get_evm_address_or_default { - account_id: H256::zero(), // Alice's Address - }, - ) - .expect_no_logs() - .execute_returns(res); - }); - - // Case 2 : Address Mapped - ExtBuilder.build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - let signature = get_evm_signature(&ALICE, &alice_secret()); - - // claim the account - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth, - signature - )); - - let res: (Address, bool) = (alice_eth.into(), true); - precompiles() - .prepare_test( - TestAccount::Viktor, - PRECOMPILE_ADDRESS, - PrecompileCall::get_evm_address_or_default { - account_id: H256::zero(), // Alice's Address - }, - ) - .expect_no_logs() - .execute_returns(res); - }); -} - -#[test] -fn test_get_native_address() { - // Case 1: not mapped native address (default address) - ExtBuilder.build().execute_with(|| { - let alice_eth = UnifiedAccounts::eth_address(&alice_secret()); - let alice_eth_address: Address = alice_eth.into(); - - // default ss58 account associated with eth address - let alice_eth_old_account = - ::DefaultMappings::to_default_account_id( - &alice_eth, - ); - - // for let binding - let alice_eth_old_account_converted: &[u8; 32] = alice_eth_old_account.as_ref(); - let res: (H256, bool) = (alice_eth_old_account_converted.into(), false); - precompiles() - .prepare_test( - TestAccount::Viktor, - PRECOMPILE_ADDRESS, - PrecompileCall::get_native_address_or_default { evm_address: alice_eth_address } - ) - .expect_no_logs() - .execute_returns(res); - }); - - // Case 2 : mapped address - ExtBuilder.build().execute_with(|| { - // claiming address - let alice_eth: Address = UnifiedAccounts::eth_address(&alice_secret()).into(); - let signature = get_evm_signature(&ALICE, &alice_secret()); - - // claim the account - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(ALICE), - alice_eth.into(), - signature - )); - - let alice_converted: &[u8; 32] = ALICE.as_ref(); - - let res: (H256, bool) = (alice_converted.into(), true); - precompiles() - .prepare_test( - TestAccount::Viktor, - PRECOMPILE_ADDRESS, - PrecompileCall::get_native_address_or_default { - evm_address: alice_eth, - }, - ) - .expect_no_logs() - .execute_returns(res); - }); -} diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index be037758e6..4bd8b27851 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -112,7 +112,6 @@ orml-xtokens = { workspace = true } # Astar pallets astar-primitives = { workspace = true } astar-xcm-benchmarks = { workspace = true, optional = true } -pallet-chain-extension-unified-accounts = { workspace = true } pallet-collator-selection = { workspace = true } pallet-collective-proxy = { workspace = true } pallet-dapp-staking = { workspace = true } @@ -123,10 +122,8 @@ pallet-evm-precompile-dapp-staking = { workspace = true } pallet-evm-precompile-dispatch-lockdrop = { workspace = true } pallet-evm-precompile-sr25519 = { workspace = true } pallet-evm-precompile-substrate-ecdsa = { workspace = true } -pallet-evm-precompile-unified-accounts = { workspace = true } pallet-evm-precompile-xcm = { workspace = true } pallet-inflation = { workspace = true } -pallet-unified-accounts = { workspace = true } pallet-xc-asset-config = { workspace = true } pallet-xcm = { workspace = true } pallet-xcm-benchmarks = { workspace = true, optional = true } @@ -186,7 +183,6 @@ std = [ "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", - "pallet-chain-extension-unified-accounts/std", "pallet-collator-selection/std", "pallet-collective-proxy/std", "pallet-collective/std", @@ -209,7 +205,6 @@ std = [ "pallet-evm-precompile-simple/std", "pallet-evm-precompile-sr25519/std", "pallet-evm-precompile-substrate-ecdsa/std", - "pallet-evm-precompile-unified-accounts/std", "pallet-evm-precompile-xcm/std", "pallet-evm/std", "pallet-identity/std", @@ -230,7 +225,6 @@ std = [ "pallet-transaction-payment/std", "pallet-treasury/std", "pallet-tx-pause/std", - "pallet-unified-accounts/std", "pallet-utility/std", "pallet-vesting/std", "pallet-xc-asset-config/std", @@ -311,7 +305,6 @@ runtime-benchmarks = [ "pallet-transaction-payment/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-tx-pause/runtime-benchmarks", - "pallet-unified-accounts/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", "pallet-xc-asset-config/runtime-benchmarks", @@ -373,7 +366,6 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-tx-pause/try-runtime", - "pallet-unified-accounts/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", "pallet-xc-asset-config/try-runtime", diff --git a/runtime/shibuya/src/chain_extensions.rs b/runtime/shibuya/src/chain_extensions.rs deleted file mode 100644 index 610b376988..0000000000 --- a/runtime/shibuya/src/chain_extensions.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -use super::{Runtime, UnifiedAccounts}; - -/// Registered WASM contracts chain extensions. -pub use pallet_chain_extension_unified_accounts::UnifiedAccountsExtension; -use pallet_contracts::chain_extension::RegisteredChainExtension; - -// Following impls defines chain extension IDs. - -impl RegisteredChainExtension for UnifiedAccountsExtension { - const ID: u16 = 03; -} - -pub type ShibuyaChainExtensions = - UnifiedAccountsExtension; diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index e5672dbdc1..6e8f6b7208 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -119,7 +119,6 @@ pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -mod chain_extensions; pub mod genesis_config; mod precompiles; pub mod xcm_config; @@ -132,8 +131,6 @@ pub type ShibuyaAssetLocationIdConverter = AssetLocationIdConverter; -use chain_extensions::ShibuyaChainExtensions; - /// Constant values used within the runtime. pub const MICROSBY: Balance = 1_000_000_000_000; pub const MILLISBY: Balance = 1_000 * MICROSBY; @@ -307,7 +304,7 @@ impl frame_system::Config for Runtime { /// The aggregated dispatch type that is available for extrinsics. type RuntimeCall = RuntimeCall; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = (AccountIdLookup, UnifiedAccounts); + type Lookup = AccountIdLookup; /// The nonce type for storing how many extrinsics an account has signed. type Nonce = Nonce; /// The type for blocks. @@ -330,7 +327,7 @@ impl frame_system::Config for Runtime { type PalletInfo = PalletInfo; type AccountData = pallet_balances::AccountData; type OnNewAccount = (); - type OnKilledAccount = pallet_unified_accounts::KillAccountMapping; + type OnKilledAccount = (); type DbWeight = RocksDbWeight; type BaseCallFilter = BaseCallFilter; type SystemWeightInfo = frame_system::weights::SubstrateWeight; @@ -776,7 +773,7 @@ impl pallet_contracts::Config for Runtime { type CallStack = [pallet_contracts::Frame; 5]; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_contracts::weights::SubstrateWeight; - type ChainExtension = ShibuyaChainExtensions; + type ChainExtension = (); type Schedule = Schedule; type AddressGenerator = pallet_contracts::DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; @@ -921,7 +918,7 @@ impl pallet_ethereum_checked::Config for Runtime { type ReservedXcmpWeight = ReservedXcmpWeight; type InvalidEvmTransactionError = pallet_ethereum::InvalidTransactionWrapper; type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; - type AddressMapper = UnifiedAccounts; + type AddressMapper = HashedDefaultMappings; type XcmTransactOrigin = pallet_ethereum_checked::EnsureXcmEthereumTx; type WeightInfo = pallet_ethereum_checked::weights::SubstrateWeight; } @@ -973,7 +970,7 @@ impl pallet_evm::Config for Runtime { type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; type CallOrigin = pallet_evm::EnsureAddressRoot; type WithdrawOrigin = pallet_evm::EnsureAddressTruncated; - type AddressMapping = UnifiedAccounts; + type AddressMapping = pallet_evm::HashedAddressMapping; type Currency = Balances; type Runner = pallet_evm::runner::stack::Runner; type PrecompilesType = Precompiles; @@ -1204,19 +1201,6 @@ impl pallet_message_queue::Config for Runtime { type IdleMaxServiceWeight = MessageQueueServiceWeight; } -parameter_types! { - // 2 storage items with values 20 and 32 - pub const AccountMappingStorageFee: u128 = deposit(2, 32 + 20); -} - -impl pallet_unified_accounts::Config for Runtime { - type Currency = Balances; - type DefaultMappings = HashedDefaultMappings; - type ChainId = EVMChainId; - type AccountMappingStorageFee = AccountMappingStorageFee; - type WeightInfo = pallet_unified_accounts::weights::SubstrateWeight; -} - parameter_types! { pub const CouncilMaxMembers: u32 = 16; pub const TechnicalCommitteeMaxMembers: u32 = 8; @@ -1639,8 +1623,7 @@ mod runtime { pub type EVMChainId = pallet_evm_chain_id; #[runtime::pallet_index(64)] pub type EthereumChecked = pallet_ethereum_checked; - #[runtime::pallet_index(65)] - pub type UnifiedAccounts = pallet_unified_accounts; + // skip 65 - pallet_unified_accounts previously #[runtime::pallet_index(70)] pub type Contracts = pallet_contracts; @@ -1721,8 +1704,14 @@ pub type Executive = frame_executive::Executive< /// __NOTE:__ THE ORDER IS IMPORTANT. pub type Migrations = (Unreleased, Permanent); +parameter_types! { + pub const UnifiedAccountsPalletName: &'static str = "UnifiedAccounts"; +} + /// Unreleased migrations. Add new ones here: -pub type Unreleased = (); +pub type Unreleased = ( + frame_support::migrations::RemovePallet, +); /// Migrations/checks that do not need to be versioned and can run on every upgrade. pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion,); @@ -1812,7 +1801,6 @@ mod benches { [pallet_xcm, PalletXcmExtrinsicsBenchmark::] [pallet_ethereum_checked, EthereumChecked] [pallet_dynamic_evm_base_fee, DynamicEvmBaseFee] - [pallet_unified_accounts, UnifiedAccounts] [xcm_benchmarks_generic, XcmGeneric] [xcm_benchmarks_fungible, XcmFungible] [pallet_collective_proxy, CollectiveProxy] diff --git a/runtime/shibuya/src/precompiles.rs b/runtime/shibuya/src/precompiles.rs index 5490b7ba5b..a59777b41b 100644 --- a/runtime/shibuya/src/precompiles.rs +++ b/runtime/shibuya/src/precompiles.rs @@ -18,7 +18,7 @@ //! The Astar Network EVM precompiles. This can be compiled with ``#[no_std]`, ready for Wasm. -use crate::{Runtime, RuntimeCall, UnifiedAccounts}; +use crate::{Runtime, RuntimeCall}; use astar_primitives::precompiles::DispatchFilterValidate; use frame_support::traits::ConstU32; use frame_support::{parameter_types, traits::Contains}; @@ -34,7 +34,6 @@ use pallet_evm_precompile_sha3fips::Sha3FIPS256; use pallet_evm_precompile_simple::{ECRecover, ECRecoverPublicKey, Identity, Ripemd160, Sha256}; use pallet_evm_precompile_sr25519::Sr25519Precompile; use pallet_evm_precompile_substrate_ecdsa::SubstrateEcdsaPrecompile; -use pallet_evm_precompile_unified_accounts::UnifiedAccountsPrecompile; use pallet_evm_precompile_xcm::XcmPrecompile; use precompile_utils::precompile_set::*; use sp_std::fmt::Debug; @@ -149,11 +148,7 @@ pub type ShibuyaPrecompilesSetAt = ( ), >, // Skipping 20485 to make sure all network have consistent precompiles address - PrecompileAt< - AddressU64<20486>, - UnifiedAccountsPrecompile, - (CallableByContract, CallableByPrecompile), - >, + // Skipping 20486 - UnifiedAccountsPrecompile previously PrecompileAt< AddressU64<20487>, DispatchLockdrop< diff --git a/tests/ink-contracts/au_ce_getters.json b/tests/ink-contracts/au_ce_getters.json deleted file mode 100644 index d3448d5c79..0000000000 --- a/tests/ink-contracts/au_ce_getters.json +++ /dev/null @@ -1,723 +0,0 @@ -{ - "source": { - "hash": "0x0cfe2b4d2b98a121c0ce38b07d826f1e4d0c7d9870ff84239cd554b32904617d", - "language": "ink! 4.3.0", - "compiler": "rustc 1.72.0", - "build_info": { - "build_mode": "Debug", - "cargo_contract_version": "3.2.0", - "rust_toolchain": "stable-aarch64-apple-darwin", - "wasm_opt_settings": { - "keep_debug_symbols": true, - "optimization_passes": "Z" - } - } - }, - "contract": { - "name": "au-ce-getters", - "version": "0.1.0", - "authors": [ - "Stake Technologies " - ], - "repository": "https://github.com/AstarNetwork/ink-test-contracts", - "homepage": "https://astar.network/" - }, - "spec": { - "constructors": [ - { - "args": [], - "default": false, - "docs": [], - "label": "new", - "payable": false, - "returnType": { - "displayName": [ - "ink_primitives", - "ConstructorResult" - ], - "type": 0 - }, - "selector": "0x9bae9d5e" - } - ], - "docs": [], - "environment": { - "accountId": { - "displayName": [ - "AccountId" - ], - "type": 3 - }, - "balance": { - "displayName": [ - "Balance" - ], - "type": 16 - }, - "blockNumber": { - "displayName": [ - "BlockNumber" - ], - "type": 19 - }, - "chainExtension": { - "displayName": [ - "ChainExtension" - ], - "type": 20 - }, - "hash": { - "displayName": [ - "Hash" - ], - "type": 17 - }, - "maxEventTopics": 4, - "timestamp": { - "displayName": [ - "Timestamp" - ], - "type": 18 - } - }, - "events": [], - "lang_error": { - "displayName": [ - "ink", - "LangError" - ], - "type": 2 - }, - "messages": [ - { - "args": [ - { - "label": "account_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 3 - } - } - ], - "default": false, - "docs": [], - "label": "to_h160", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "ink", - "MessageResult" - ], - "type": 6 - }, - "selector": "0x0000002a" - }, - { - "args": [ - { - "label": "account_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 3 - } - } - ], - "default": false, - "docs": [], - "label": "to_h160_or_default", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "ink", - "MessageResult" - ], - "type": 10 - }, - "selector": "0x0000002b" - }, - { - "args": [ - { - "label": "evm_address", - "type": { - "displayName": [ - "H160" - ], - "type": 8 - } - } - ], - "default": false, - "docs": [], - "label": "to_account_id", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "ink", - "MessageResult" - ], - "type": 12 - }, - "selector": "0x0000002c" - }, - { - "args": [ - { - "label": "evm_address", - "type": { - "displayName": [ - "H160" - ], - "type": 8 - } - } - ], - "default": false, - "docs": [], - "label": "to_account_id_or_default", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "ink", - "MessageResult" - ], - "type": 14 - }, - "selector": "0x0000002d" - } - ] - }, - "storage": { - "root": { - "layout": { - "struct": { - "fields": [], - "name": "UAMappingGetter" - } - }, - "root_key": "0x00000000" - } - }, - "types": [ - { - "id": 0, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 1 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 2 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 1 - }, - { - "name": "E", - "type": 2 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 1, - "type": { - "def": { - "tuple": [] - } - } - }, - { - "id": 2, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 1, - "name": "CouldNotReadInput" - } - ] - } - }, - "path": [ - "ink_primitives", - "LangError" - ] - } - }, - { - "id": 3, - "type": { - "def": { - "composite": { - "fields": [ - { - "type": 4, - "typeName": "[u8; 32]" - } - ] - } - }, - "path": [ - "ink_primitives", - "types", - "AccountId" - ] - } - }, - { - "id": 4, - "type": { - "def": { - "array": { - "len": 32, - "type": 5 - } - } - } - }, - { - "id": 5, - "type": { - "def": { - "primitive": "u8" - } - } - }, - { - "id": 6, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 7 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 2 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 7 - }, - { - "name": "E", - "type": 2 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 7, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 0, - "name": "None" - }, - { - "fields": [ - { - "type": 8 - } - ], - "index": 1, - "name": "Some" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 8 - } - ], - "path": [ - "Option" - ] - } - }, - { - "id": 8, - "type": { - "def": { - "composite": { - "fields": [ - { - "type": 9, - "typeName": "[u8; 20]" - } - ] - } - }, - "path": [ - "primitive_types", - "H160" - ] - } - }, - { - "id": 9, - "type": { - "def": { - "array": { - "len": 20, - "type": 5 - } - } - } - }, - { - "id": 10, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 11 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 2 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 11 - }, - { - "name": "E", - "type": 2 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 11, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 8, - "typeName": "T" - } - ], - "index": 0, - "name": "Mapped" - }, - { - "fields": [ - { - "type": 8, - "typeName": "T" - } - ], - "index": 1, - "name": "Default" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 8 - } - ], - "path": [ - "unified_accounts_chain_extension_types", - "UnifiedAddress" - ] - } - }, - { - "id": 12, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 13 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 2 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 13 - }, - { - "name": "E", - "type": 2 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 13, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 0, - "name": "None" - }, - { - "fields": [ - { - "type": 3 - } - ], - "index": 1, - "name": "Some" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 3 - } - ], - "path": [ - "Option" - ] - } - }, - { - "id": 14, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 15 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 2 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 15 - }, - { - "name": "E", - "type": 2 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 15, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 3, - "typeName": "T" - } - ], - "index": 0, - "name": "Mapped" - }, - { - "fields": [ - { - "type": 3, - "typeName": "T" - } - ], - "index": 1, - "name": "Default" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 3 - } - ], - "path": [ - "unified_accounts_chain_extension_types", - "UnifiedAddress" - ] - } - }, - { - "id": 16, - "type": { - "def": { - "primitive": "u128" - } - } - }, - { - "id": 17, - "type": { - "def": { - "composite": { - "fields": [ - { - "type": 4, - "typeName": "[u8; 32]" - } - ] - } - }, - "path": [ - "ink_primitives", - "types", - "Hash" - ] - } - }, - { - "id": 18, - "type": { - "def": { - "primitive": "u64" - } - } - }, - { - "id": 19, - "type": { - "def": { - "primitive": "u32" - } - } - }, - { - "id": 20, - "type": { - "def": { - "variant": {} - }, - "path": [ - "ink_env", - "types", - "NoChainExtension" - ] - } - } - ], - "version": "4" -} \ No newline at end of file diff --git a/tests/ink-contracts/au_ce_getters.wasm b/tests/ink-contracts/au_ce_getters.wasm deleted file mode 100644 index e93128bb916b660f1177837eb25278f5892ae910..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19694 zcmd^nZHy$xd0zF$?APqxHK~E79C?-~GBRbI7z4|m zo}SyC-JRK+ncd?FlI|#xwqVl&Wy=s9GJq2kkbWqEVHg1e2#DlJkOT+`69h$KprR$?X+#7b%!60o5UENts;_dDAWFy|}t*4KV(%x{h-xG7{W?{3pyEn?GF0|9u z-i7s@bT}kvA?H+!!|S)hSiHSHNJo2vo-mBGw?DO$?(_$jbxpU7Mrhz_==f(84P$zy zAoM9+pPCX{K@*0U)(cbm4B+cR%$n2YEUpI0h0|!enq^JRfDF;qt7dWfCf(!##EGeP zy1U)KEPiG7-I|EB;?Xd8@7*6fbl9x>XB{DHqA9`qMtNGAT(P<@9Wxz>e}YGGuyQbsuKwyfD;fQ0O>A?;s-Q< z6wA6_OWV15iV zmIxV^JOdC}v@F72)-kfIAG3XXSOx#Bv;Rrjpl;R z18ItBMoz3HplU6Hyqa~VDDICzo0LS!D}G`9)`!47lQ1Rot=mbn8Gg-McgQ&<0~?T~ zQq*;8nnHq3S;NxknWxCiul=54rbGm*!7fndK^8w-l}jJl8~mam_{wjw&w zwKQ9RaV2>XC7>vY5)~rT#+jdd_;|4iI%8u^N-?+oKIG`O=tam54Pay_!a;gD(})(kXY@d}PIV(wjbZgXZvDj<(VsyBmnAGTfS?a1 zvSp&R%$Bd)=z^HKbxagLqxM>Zu46A8gpicB`b*i~W^@n4j(eLC zZk@p8PktX$kEwnQE6m8jj<#%BXoa#hgO-DP$Dn%L{y0hd#8r*@DPZli=o_DtdS;8_ z17o4pfSMM~ch6`%xW=7a7?x!1OTB(&epOd z0Pdqb)3r`xst&49%8K`l4<}I~?u)ql)u(YJiP5uY5F@BDH57SnsxO5yb^k8*`v>Q=<4~Ewi{YWu-DvRKkKIG=i0@na2ANtJAy3d)rq42Ai5TGWm!L8E=ZAr zA=2!Euh%$}gmKWow&!tia4N2dOlx)lt5(E$b@_z4Ji1`$a3c91C;a{BuB{`cfK#7^ zCUdcbV?ofkn)0>=UlRQn(LJe27pg_ym6QJG#K^yvBmWm80`8Ksp`Fwo4UCXbJ~40J z05r_!{Pdymd9~%#jkf%b+~9wR?y`_>WxPS8Q&hPLtnmc?8L+~e17_sFGy;1&2amK2 zRIx-H?j%`3rJOzx7z}`r3>*xcfVP7>=6w**2m?4T$=o$tI|H!@^xr~Xa-Hl3*U5bF ztW3k zN-&NbKM(C$&~t%NSKEZZ=(fbHO6?yjPnq!|`2@BISUZ~`(6|r2(O%_!#2B1;3^T!vHF#Lbrfu{kn>Nq@ zXGQeaWRf*!1LjF%gWQ1^<_&NM7HJpU!DSKrz{M)f@DhSan4fWH1BPMVo&kTRz#;t> z?zXINfc5%=(!hamAIAJCUw;5_8COuitOeTrnMk|1Fh~BeH(S<^=$e=(1A$mJ5teO5 zY%Fl_hjQ>|O5MOvAq|6wG7TqXa1OB<7!Na!#E~9mFh$4Ta~`q(qA1H>LTQFfh;|Na(Exo(J{>el4>n4cwyv9vhTr;NF!%SyILq_C(nW zsYj=jJ)s+8AFCNq!hR@A!myl{1m@v}mLxIISHS z5SWHnV3Y+F3}GdT8&=_#*Dwo2M&_URK1AM6T%YukJu;w2e3 z88*Ao*Ph}M?EALn|<4Ttl@F1BQ%I={JlBb+ix{Tb4h_jT+^f3BAD{ ziy^oiQ|X>8dX;6wq@&<~^P&b|jF6d#=;!#ST}0f;s#eL2L`gH&Y^0cH7m)3fG+Gz4 zWxb$0g_z4&#wL&CT7$Y4t3ld|I3el76y}(u z4aqO-cFe{==LV*so@+67mvtkI=YunWfeKHCH>$`$4saHkGJ!KVVZojP`G6S_k>^6o z%#ViP6FZsqGz)x^T9S;@a>-cOCTWMFaaK77a06K&D?>#?pcXC^sX-0PibN5rY#h`~ zsmlD5bIKH)`EJH>=#eZx=@bJb!_igi9B4}QG9Mym(Y*H}CJj!DBeFNYAN`O$)M;>U zYJYrtAu{GwB@$IjZe>DynbS|gSjbm>L&Au3dd0~JsLLJ(JKi-%LxH$?KbpQ6y{w>^ zMazPyD6KR>mAqbxBGBP_sVaODJE%8If#eJ{j@bsE4M6&Fe2^7|8;Tywq!H>rSsC?t zRYpBKR%NAcD9*`*77$n)GE^RmS|s6|z=b+SNrG%ky;SALkB-5x3`SfaLT}t6a4tmj zSLLG26#R2zT%rdZz;qPGK~WTgVZzQWh+8P4CSpyNsv}uq8EiHlE49_vPjVrs@Cpc<;G<*+o+fq7~@b*4nGZ&-Jg3z!LuQ{a9DX0{e$CqBjD(bQVpmFiT4 z`V}O`D1NaJ3-E|e!9)tDsTd?jS&EM|?j?_q&CN#hgJD6D98;1YZ5FYXMhk+fYJr-p z1;Pnlz52K!i98_u2j>-`tPn0$Gz9%9o#YmT>Lt|XOVKO8Eeqtgf?Y7Q63YG9LmD^v zbU-~R_-##z3*56T2~()3u_wlrVen`X1226ZDLyMgxSRrxnykehldXBk-!hnlXI?V< zz)jYt7qM|xeHFRzf@G||BB)aE=qy=(Jt*Ev2rPg~;Ri8Q+4E0+2OA@_SAdk4jlTLj zS!qVQ5`Ff0rs)tx>n^%lDhVw=&=PNFyxLqpMdxbunA1bD?6B;Evg_c1w}F$Qv-FV2LRHzbU<_o{D7t zl!{r_|4C^9XkGJ%O`iEz0`>doPH5pm>4-tB%ySEKP$cFd#LnEZkJv}fVB*#C0xzHW z^jFFzvAu}ORJ=2Yx)*+YzjBGx74)56R-oF&5<)d|K`76{Y{V% z8{0bErM>VK?Dt;<9`eEPN}RGTfXI+Kh`Rrbn0M!F}fRU{}#f8!_T`jTx+zq|LxIn#@^p`7JDmwFAb4VU-xSI#M@Rgk74?z{$uq zM~ZQWLTXNySc#Ous6?}8@%Ri5&0|PlfzLcATr9hbB#lIUE{n5x6pqbVH5T>ld4|uL z4P%D*Kpsr)E@PU*pl3jG1scYcmEhUepco^B35r4c3d9qtUBf0i1Gwnr-{TX=A3l>k zPF8UX&EGe0qZEDV%kst%=p}e@i?IfY5XEP8<;b9ehpZi}I&2&;q9v0@InYT1QiMN5 zy`$(S&&p^JF)5S*M+H3)wQ5inlYu2bKp006=10~?j$20o5%!cMLIGHoYBfG4a%#aBoWJ&O1m%tlo;wW)X$QJ9W$O@s{mKn|7kB1sY z9#cH2&L6$}c{B0=bh#US>33Cj1}J<4hCB^WR12sB=QIE3*>C^(pZ?%y-@8LSul@G7 zU;3B-{V#v^_s60VOU;EN{ z8X^ydV07?m21z9#GW6+GNjL;NgY1@OIf|Xl@*D#U6J1TB0+_&hPU>%w;mY*BT|_)O zh@SZDlQXdUg5_>FK?qP}-4BbX7js$sF%aP+Y10NPM3GqmVzg*xKl=F-uS{P=Q(n7p z#^yG>3y8t@CT67M%mA+vq(!1dET$#C84Bhh6zGnofdZeOz-X5>ir(vQ_TYknh{V%-oa}riYEpchX?=wzPyti?&ZuZ0a_QvAv3-(7eowJ6_>?K;;#S^N7OOfJHV3N)iKZ#TG z-K8~5pb?$E;ge?>MBezxGZ-@uUOxSYSqO&95?~?Vqq$^@HjD!YPoBXaJT!Yo*QVr~ zLr58<2gS(|_K*O;oza@2B~B=GXzhv+W#luX=-6H)K7v9H@52l8KJPMb#8Hjt){C$P zM)aRG>f=;2HL^`SQzLJ<0`XhELdObFXlgW&uKQ(;F&={bXdWZu1C&A#h3;AZvD^OLbpE z(g$TJ!3Y&FMI7gOX!?%RV90z7XIdnhxh5zblmUYjg)-;!7}jdJ@E`~&6F3cE3R@_A zd6C9rli&wY1iJIGDk9$*LE&`*ei<9e!Vn{eDX=?_9Jt$!F`?wV%023P_KwLSgd7rV z12sr6H-R7hSe9Jmgd_R!h!ai|3(amOl$bAzFxUm+2qs8Q7XeL%5FnM*a7jBV`hzMl zLr$g20SF7ov8;qAqc>71@8c1UD(Mk924J$9XMnw|0`RRM9xwXtb7nM-1{INt?@{-1 z=ExITw-$@}S*@V>oS_1zm*CyUWd#_&lF-+%PO-p@UVPe&m_23zaK;4AVa!)9P$X&1 zPT(lt6605fpfvYjp5n!DkG;o6qpDHZY*4<5P3C_%7EPZYqM%tb!cqhZtYZ zP7h_qYfn5no;69{7XRDv0!^1$e4?=Wv0*wGuExWSy-|O-u^$h1;?+tL4=(gq2kC{) z;b?GqbvQ^?H+${$@k%m?N9nM#*nV-@Ucfd%m`O z#aIZTi5|Ycry+;O^_O{$w0B{%m#+4E>iy+apog;v@m=6Bz}`Q?XYn1zVRL79dk8E( ztZ8C|y_Z0T+i;zv@Ln%{d^b%-Ik8{D+!L6SulZkSzZahy((d6wzl*g)@^u9~AFU+) z9$xI`&_OHSTS?Ltya^7T4p+A~TO^FBYvLimy#t>DKG{p+c8c|v?Mv~{PIq=kmqi=% z-YZztEV?luV9*}*?YP~xFKv!C?EZc_=xp~d%>ss*edcg2;xmu;07|)&86%pS-oF(?aSiMVc%Wgcv`}%gjW81CEkOsRGLvP!_^KMfU@5XfvSJL@K z;1AspFW`*q$9AU=n=%?vy&*rFBb&0D?m!w8P^H%p(zvIL!aI1>&JI=iPl5YI;MxMM zZCu|$1Rxu$JN>qjk0tyrf%0+Jw4z?`&Tu-Bufh-wB-1X}FH-x>eV6Yi`~3-M|gqM%Agh)oRtN)~fZYUk$2Zwc$CQ z>s39^t9f;I}~+QW^z&xV@RAlp09N1=xFaC+)Q} zQ4!)F&uGHJ+N-#h-%**6xUFu&tx+|156jr= zk8IexWCKyn5LQnaxx-UGJgbamjO*QiHxHSoHokLwLtF_}KK8#K9~$$# zPcL4b=s$`!4N-o-gEo1c_vsMmyz>4dS^u3qSI#vdJ~gKd>KET}Jcz@pbax1@lSEn< zIQ60?J_B6-2p{tM&%k#^Z~qn@MoPI2-0Ly$U@#;jV@O)MjbIE0Ya)Q&>uvS=mwMxS z*DaF2ssod^+fpb8X-v(+FYR{YP3dj-db{yuxl{gQJO1jb_#NZ5d`CP)#vr2s6$6~M zcK{7PfCG-53Y1~_-c(U(K z^i#Aa@BcpfC46oy$8Y5vyYT>l-^vh~O^V1GY+msyexaBVVY z!u5Ul@I3FqhnWZaUxRFY8=t?z=Wp>T;_QEOyV;9(QtivP-zz?}{^&=7EJ^bf(ZW2X z@sQH^2+Vijz=oHHt~>GDPB+*HgP`56H|nhbJ|?Kun%duc6TpJ&eiRCjjdlvR==)wL zaFR4|oBAVf9AwpDLU`@3NddLvyH!7kTTaJ|-K3Q^jr-m>)VkCSKuKFc=(j?@n#7&d zsaKokgKr#)>mB;}Dvz4FwT1_fDS`{9R&N&G6e}iv_X=Qc5F-Ytwu7V*bn3C!oO+YM z#y^+^upp^7(njK>fmd}9i!`VC``Kjo^31auPVCkwF1v%xoz2naembm=F7Kv8cfH}S zFMartC5G`!dsSyi$@03C<#j2`l}dKGkBNOMXTjsk>tUFciUeAzM2U1q=h{p6KeFU2 zvj-Ggtwxx{ajVk_J--$B&DjK)`3;G|(nrrOE$!7?OM4+MZM1<+JbXQ*&d~;Pn;K0b zHmUl49HeR732W`duU4CL&;5eV--Nw>3+Hdp&bRSH>OQbb;#$XPR9!@aY0wV+X7Ndh zo#QArsJcs~qI9}a$(6cN$xLBIVeuPDe^;^M^-1&)oP?rL{SpjS3N+dcXnwmEw}N`R z+Nsx?^G{1O>SF;}m#nNy)`#`CBO}*b*8X55%kjc(pI~bgnrzphRq{qUK50`=y-@Ze!brIoQ79-+Hu(FG@3{6 z2aLMRnS+5!{@un$<4eDpCRCb7mVRw1;z?XL%d6A%&7LH0tI=_N@VF7QgNE0%&W-_j z$P!)uItYQRleO17gZ|FC3@`zw6NYZ;w7tY_cRXY!&6{WfJ!oA(##~5yVS979%K){J zKAt9fbmcH8Y47qnq5-DmfRco9J+60>xSFHc z(4pO7r6SR&RL&6_^6nh@cF2}V_|Y1KQ`=6g4>EXd4lZ>v%nq#Xu=l}gUTO69(cn=&?- zw1Da)tZ>LV*n;?b7$AnVRy+1Z{AkPhIaRVtawrVwRd0=A6YXl+JL8^yo!$o4-PW{+%T1oTx z=ifma*x210Zj7x)+z#8-R*(j*R;^u4n3Z|lJ95g)6}i2wHT*VQbKR}BlEC*HP5bEFNIZ{fd#anzO!3b8Ip9K^hJ)U^<_g^jRz*FM&T!8l@(vtwkm zj8b-XE0r_&jwrMoyk73){7U75+^kYjo67l=!|e3IhF5E}s|em(e(1REcG|qVg?**7 zp>laB^LaqAUcHgg$Akk@NhQid);+H}VLJWLb=s|3>bXc^(oU^;>hyRI_>Hi$*GuSB z{ji=P9EP-*OPr zDuW*PE+bm*Nn;)`;#%LNy9=SzDb0BTtLs(U&DC8}+?5AaE1{-vYAk70ehr$X;^ZtA zR5R2~Rkl!56^qVck>m?$E#q{aB|+U&T9B5XbQ-OubMKfA*hMGBlrLu zByRDL#AqP~g6Z;|Iu4N5{H9BlnurXlD$E}z8rQhn5PoxWv>r=;=6HU`sn=7lMu17P z%J6B-_{LfF5F#D8)m=n@n|KI$0jRiDWodTdST`RBPH87VHMZ4(0cmx>p{6&EG$=p^ zZ~}ngBTKAtPpt8cjviLi55j3=sqHXCV&lXyd~mb=(R`5# zPhRKn5TgF><-@U`>!(Rj_kjzJk%9>R9$;o#cS9LKY=au?Ta<(vo-e9kF+{G70J`qB zf`;QY0|tvV6Dob95+cBegV?RL{kj*{(`LwUx~A0iH9_(JjG9o=w2ELV zXt-6U<@qR`HybB&@{*4s3LLo{2SKL_8|8FbP)PXZ=IPqx)B~0ua^vkdMIPR2`>oV% zg|)Q#e)6yGP3W6E<7 libsecp256k1::SecretKey { - libsecp256k1::SecretKey::parse(&sp_io::hashing::keccak_256(b"Alith")).unwrap() - } - - /// H160 address mapped to `ALICE`. - pub fn alith() -> H160 { - UnifiedAccounts::eth_address(&alith_secret_key()) - } - - /// Build the signature payload for given native account and eth private key - fn get_evm_signature(who: &AccountId32, secret: &libsecp256k1::SecretKey) -> [u8; 65] { - // sign the payload - UnifiedAccounts::eth_sign_prehash(&UnifiedAccounts::build_signing_payload(who), secret) - } - - /// Create the mappings for the accounts - pub fn connect_accounts(who: &AccountId32, secret: &libsecp256k1::SecretKey) { - assert_ok!(UnifiedAccounts::claim_evm_address( - RuntimeOrigin::signed(who.clone()), - UnifiedAccounts::eth_address(secret), - get_evm_signature(who, secret) - )); - } } #[cfg(feature = "shiden")] @@ -360,40 +335,3 @@ pub fn expect_events(e: Vec) { pub fn init_env_logger() { let _ = env_logger::builder().is_test(true).try_init(); } - -/// Deploy a WASM contract via ALICE as origin. (The code is in `../ink-contracts/`.) -/// Assumption: Contract constructor is called "new" and take no arguments -#[allow(dead_code)] -pub fn deploy_wasm_contract(name: &str) -> AccountId32 { - let (address, _) = astar_test_utils::deploy_wasm_contract::( - name, - ALICE, - 0, - Weight::from_parts(10_000_000_000, 1024 * 1024), - None, - hex::decode("9bae9d5e").expect("invalid data hex"), - ); - - // On instantiation, the contract got existential deposit. - assert_eq!(Balances::free_balance(&address), ExistentialDeposit::get(),); - address -} - -/// Call a wasm smart contract method -#[allow(dead_code)] -pub fn call_wasm_contract_method( - origin: AccountId, - contract_id: AccountId, - data: Vec, -) -> V { - let (value, _, _) = astar_test_utils::call_wasm_contract_method::( - origin, - contract_id, - 0, - Weight::from_parts(10_000_000_000, 1024 * 1024), - None, - data, - false, - ); - value -} diff --git a/tests/integration/src/unified_accounts.rs b/tests/integration/src/unified_accounts.rs deleted file mode 100644 index d6951c23ed..0000000000 --- a/tests/integration/src/unified_accounts.rs +++ /dev/null @@ -1,121 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -use crate::setup::*; -use astar_primitives::evm::UnifiedAddress; -use parity_scale_codec::Encode; -use sp_io::hashing::keccak_256; - -const AU_CE_GETTER: &'static str = "au_ce_getters"; - -#[test] -fn transfer_to_h160_via_lookup() { - new_test_ext().execute_with(|| { - let eth_address = H160::from_slice(&keccak_256(b"Alice")[0..20]); - - // make sure account is empty - assert!(EVM::is_account_empty(ð_address)); - - // tranfer to evm account - assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(ALICE), - MultiAddress::Address20(eth_address.clone().into()), - UNIT, - )); - - // evm account should have received the funds - let (account, _) = EVM::account_basic(ð_address); - assert_eq!(account.balance, (UNIT - ExistentialDeposit::get()).into()); - }); -} - -#[test] -fn unified_accounts_chain_extension_works() { - use astar_primitives::evm::UnifiedAddressMapper; - - const GET_H160: [u8; 4] = [0x00, 0x00, 0x00, 0x2a]; - const GET_H160_OR_DEFAULT: [u8; 4] = [0x00, 0x00, 0x00, 0x2b]; - const GET_NATIVE: [u8; 4] = [0x00, 0x00, 0x00, 0x2c]; - const GET_NATIVE_OR_DEFAULT: [u8; 4] = [0x00, 0x00, 0x00, 0x2d]; - - new_test_ext().execute_with(|| { - let contract_id = deploy_wasm_contract(AU_CE_GETTER); - - // mapped h160 address should None - assert_eq!( - call_wasm_contract_method::>( - ALICE, - contract_id.clone(), - [GET_H160.to_vec(), ALICE.encode()].concat() - ), - None - ); - // default h160 address should match - assert_eq!( - call_wasm_contract_method::>( - ALICE, - contract_id.clone(), - [GET_H160_OR_DEFAULT.to_vec(), ALICE.encode()].concat() - ), - UnifiedAccounts::to_h160_or_default(&ALICE) - ); - // mapped native address should be None - assert_eq!( - call_wasm_contract_method::>( - ALICE, - contract_id.clone(), - [GET_NATIVE.to_vec(), alith().encode()].concat() - ), - None - ); - // default native address should match - assert_eq!( - call_wasm_contract_method::>( - ALICE, - contract_id.clone(), - [GET_NATIVE_OR_DEFAULT.to_vec(), alith().encode()].concat() - ), - UnifiedAccounts::to_account_id_or_default(&alith()) - ); - - // - // Create account mappings - // - connect_accounts(&ALICE, &alith_secret_key()); - - // ALICE mapped h160 address should be alith - assert_eq!( - call_wasm_contract_method::>( - ALICE, - contract_id.clone(), - [GET_H160.to_vec(), ALICE.encode()].concat() - ), - Some(alith()) - ); - - // alith mapped native address should ALICE - assert_eq!( - call_wasm_contract_method::>( - ALICE, - contract_id.clone(), - [GET_NATIVE.to_vec(), alith().encode()].concat() - ), - Some(ALICE) - ); - }); -} From be5667cd32751d229eb28135c6632477535ce18e Mon Sep 17 00:00:00 2001 From: Igor Papandinas <26460174+ipapandinas@users.noreply.github.com> Date: Fri, 22 May 2026 18:21:13 +0100 Subject: [PATCH 2/6] remove: pallet_ethereum_checked --- Cargo.lock | 27 -- Cargo.toml | 1 - pallets/ethereum-checked/Cargo.toml | 80 ----- pallets/ethereum-checked/src/benchmarking.rs | 71 ----- pallets/ethereum-checked/src/lib.rs | 296 ------------------- pallets/ethereum-checked/src/mock.rs | 290 ------------------ pallets/ethereum-checked/src/tests.rs | 133 --------- pallets/ethereum-checked/src/weights.rs | 87 ------ primitives/src/ethereum_checked.rs | 82 ----- primitives/src/evm.rs | 84 +----- primitives/src/lib.rs | 3 - runtime/shibuya/Cargo.toml | 4 - runtime/shibuya/src/lib.rs | 18 +- tests/integration/Cargo.toml | 2 - 14 files changed, 7 insertions(+), 1171 deletions(-) delete mode 100644 pallets/ethereum-checked/Cargo.toml delete mode 100644 pallets/ethereum-checked/src/benchmarking.rs delete mode 100644 pallets/ethereum-checked/src/lib.rs delete mode 100644 pallets/ethereum-checked/src/mock.rs delete mode 100644 pallets/ethereum-checked/src/tests.rs delete mode 100644 pallets/ethereum-checked/src/weights.rs delete mode 100644 primitives/src/ethereum_checked.rs diff --git a/Cargo.lock b/Cargo.lock index 8288eff380..9cd07d3c63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6657,7 +6657,6 @@ dependencies = [ "pallet-dapp-staking", "pallet-democracy", "pallet-ethereum", - "pallet-ethereum-checked", "pallet-evm", "pallet-evm-precompile-assets-erc20", "pallet-evm-precompile-dispatch", @@ -9633,31 +9632,6 @@ dependencies = [ "sp-version", ] -[[package]] -name = "pallet-ethereum-checked" -version = "0.1.0" -dependencies = [ - "astar-primitives", - "ethereum", - "ethereum-types 0.15.1", - "fp-ethereum", - "fp-evm", - "fp-rpc", - "frame-benchmarking", - "frame-support", - "frame-system", - "hex", - "pallet-balances", - "pallet-ethereum", - "pallet-evm", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-evm" version = "6.0.0-dev" @@ -15810,7 +15784,6 @@ dependencies = [ "pallet-democracy", "pallet-dynamic-evm-base-fee", "pallet-ethereum", - "pallet-ethereum-checked", "pallet-evm", "pallet-evm-chain-id", "pallet-evm-precompile-assets-erc20", diff --git a/Cargo.toml b/Cargo.toml index 5e3c1dc576..d5a7066247 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -313,7 +313,6 @@ orml-xcm-support = { git = "https://github.com/AstarNetwork/open-runtime-module- pallet-collator-selection = { path = "./pallets/collator-selection", default-features = false } pallet-dapp-staking = { path = "./pallets/dapp-staking", default-features = false } pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features = false } -pallet-ethereum-checked = { path = "./pallets/ethereum-checked", default-features = false } pallet-inflation = { path = "./pallets/inflation", default-features = false } pallet-dynamic-evm-base-fee = { path = "./pallets/dynamic-evm-base-fee", default-features = false } astar-xcm-benchmarks = { path = "./pallets/astar-xcm-benchmarks", default-features = false } diff --git a/pallets/ethereum-checked/Cargo.toml b/pallets/ethereum-checked/Cargo.toml deleted file mode 100644 index ed6f8a1daf..0000000000 --- a/pallets/ethereum-checked/Cargo.toml +++ /dev/null @@ -1,80 +0,0 @@ -[package] -name = "pallet-ethereum-checked" -version = "0.1.0" -description = "Pallet for Ethereum like checked transactions" -authors.workspace = true -edition.workspace = true -homepage.workspace = true -repository.workspace = true - -[lints] -workspace = true - -[dependencies] -hex = { workspace = true, optional = true } -parity-scale-codec = { workspace = true } -scale-info = { workspace = true } - -ethereum-types = { workspace = true } -fp-ethereum = { workspace = true } -fp-evm = { workspace = true } -pallet-evm = { workspace = true } - -frame-benchmarking = { workspace = true, optional = true } -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -astar-primitives = { workspace = true } - -[dev-dependencies] -ethereum = { workspace = true } -fp-rpc = { workspace = true } -pallet-balances = { workspace = true } -pallet-ethereum = { workspace = true } -pallet-evm = { workspace = true } -pallet-timestamp = { workspace = true } -sp-io = { workspace = true } - -[features] -default = ["std"] -std = [ - "hex/std", - "parity-scale-codec/std", - "scale-info/std", - "ethereum/std", - "ethereum-types/std", - "fp-ethereum/std", - "fp-evm/std", - "pallet-evm/std", - "sp-std/std", - "sp-runtime/std", - "sp-io/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "pallet-timestamp/std", - "pallet-evm/std", - "pallet-ethereum/std", - "astar-primitives/std", - "frame-benchmarking?/std", -] -runtime-benchmarks = [ - "hex", - "frame-benchmarking", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-ethereum/runtime-benchmarks", - "astar-primitives/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "pallet-evm/runtime-benchmarks", -] -try-runtime = [ - "frame-support/try-runtime", - "astar-primitives/try-runtime", - "frame-system/try-runtime", - "pallet-evm/try-runtime", - "sp-runtime/try-runtime", -] diff --git a/pallets/ethereum-checked/src/benchmarking.rs b/pallets/ethereum-checked/src/benchmarking.rs deleted file mode 100644 index 9c0090d642..0000000000 --- a/pallets/ethereum-checked/src/benchmarking.rs +++ /dev/null @@ -1,71 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -use super::*; - -use astar_primitives::ethereum_checked::EthereumTxInput; -use frame_benchmarking::v2::*; -use sp_std::prelude::*; - -#[benchmarks] -mod benchmarks { - use super::*; - - #[benchmark] - fn transact_without_apply() { - let origin = T::XcmTransactOrigin::try_successful_origin().unwrap(); - let target = - H160::from_slice(&hex::decode("dfb975d018f03994a3b943808e3aa0964bd78463").unwrap()); - // Calling `store(3)` - let input = EthereumTxInput::try_from( - hex::decode("6057361d0000000000000000000000000000000000000000000000000000000000000003") - .unwrap(), - ) - .unwrap(); - let checked_tx = CheckedEthereumTx { - gas_limit: U256::from(1_000_000), - target, - value: U256::zero(), - input, - maybe_access_list: None, - }; - - #[block] - { - Pallet::::transact_without_apply(origin, checked_tx).unwrap(); - } - - assert_eq!(Nonce::::get(), U256::one()) - } - - impl_benchmark_test_suite!( - Pallet, - crate::benchmarking::tests::new_test_ext(), - crate::mock::TestRuntime, - ); -} - -#[cfg(test)] -mod tests { - use crate::mock; - use sp_io::TestExternalities; - - pub fn new_test_ext() -> TestExternalities { - mock::ExtBuilder::default().build() - } -} diff --git a/pallets/ethereum-checked/src/lib.rs b/pallets/ethereum-checked/src/lib.rs deleted file mode 100644 index 2ff9fd399d..0000000000 --- a/pallets/ethereum-checked/src/lib.rs +++ /dev/null @@ -1,296 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -//! # Ethereum Checked Pallet -//! -//! ## Overview -//! -//! A `pallet-ethereum` like pallet that execute transactions from checked source, -//! like XCM remote call. Only `Call` transactions are supported -//! (no `Create`). -//! -//! The checked source guarantees that transactions are valid with prior checks, so these -//! transactions are not required to include valid signatures. Instead, `pallet-ethereum-checked` -//! will add the same dummy signature to them. To avoid transaction hash collisions, a global -//! nonce shared with all users are used. -//! -//! ## Interface -//! -//! ### Dispatch-able calls -//! -//! - `transact`: transact an Ethereum transaction. Similar to `pallet_ethereum::Transact`, -//! but is only for XCM remote call. -//! - -#![cfg_attr(not(feature = "std"), no_std)] - -use parity_scale_codec::{Decode, Encode}; -use scale_info::TypeInfo; - -use ethereum_types::U256; -use fp_ethereum::{Transaction, TransactionData, ValidatedTransaction}; -use fp_evm::{ - CallInfo, CallOrCreateInfo, CheckEvmTransaction, CheckEvmTransactionConfig, ExitReason, - ExitSucceed, TransactionValidationError, -}; -use pallet_evm::GasWeightMapping; - -use frame_support::{ - dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo}, - pallet_prelude::*, -}; -use frame_system::pallet_prelude::*; -#[cfg(feature = "runtime-benchmarks")] -use sp_runtime::traits::TrailingZeroInput; -use sp_runtime::traits::UniqueSaturatedInto; -use sp_std::{marker::PhantomData, result::Result}; - -use astar_primitives::{ - ethereum_checked::CheckedEthereumTx, - evm::{UnifiedAddressMapper, H160}, -}; - -pub use pallet::*; - -#[cfg(feature = "runtime-benchmarks")] -mod benchmarking; - -// TODO: after integrated into Astar/Shiden runtime, redo benchmarking with them. -// The reason is that `EVMChainId` storage read only happens in Shibuya -pub mod weights; -pub use weights::WeightInfo; - -mod mock; -mod tests; - -pub type WeightInfoOf = ::WeightInfo; - -/// Origin for dispatch-able calls. -#[derive( - PartialEq, - Eq, - Clone, - Encode, - Decode, - DecodeWithMemTracking, - RuntimeDebug, - TypeInfo, - MaxEncodedLen, -)] -pub enum RawOrigin { - XcmEthereumTx(AccountId), -} - -/// Ensure the origin is with XCM calls. -pub struct EnsureXcmEthereumTx(PhantomData); -impl, O>> + From>, AccountId: Decode> - EnsureOrigin for EnsureXcmEthereumTx -{ - type Success = AccountId; - - fn try_origin(o: O) -> Result { - o.into().map(|o| match o { - RawOrigin::XcmEthereumTx(account_id) => account_id, - }) - } - - #[cfg(feature = "runtime-benchmarks")] - fn try_successful_origin() -> Result { - let zero_account_id = - AccountId::decode(&mut TrailingZeroInput::zeroes()).map_err(|_| ())?; - Ok(O::from(RawOrigin::XcmEthereumTx(zero_account_id))) - } -} - -/// Transaction kind. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] -pub enum CheckedEthereumTxKind { - /// The tx is from XCM remote call. - Xcm, -} - -#[frame_support::pallet] -pub mod pallet { - use super::*; - - #[pallet::pallet] - pub struct Pallet(PhantomData); - - #[pallet::config] - pub trait Config: frame_system::Config + pallet_evm::Config { - /// Reserved Xcmp weight for block gas limit calculation. - type ReservedXcmpWeight: Get; - - /// Invalid tx error. - type InvalidEvmTransactionError: From; - - /// Validated tx execution. - type ValidatedTransaction: ValidatedTransaction; - - /// Account mapping. - type AddressMapper: UnifiedAddressMapper; - - /// Origin for `transact` call. - type XcmTransactOrigin: EnsureOrigin; - - /// Weight information for extrinsics in this pallet. - type WeightInfo: WeightInfo; - } - - #[pallet::origin] - pub type Origin = RawOrigin<::AccountId>; - - /// Global nonce for all transactions to avoid hash collision, which is - /// caused by the same dummy signatures for all transactions. - #[pallet::storage] - pub type Nonce = StorageValue<_, U256, ValueQuery>; - - #[pallet::call] - impl Pallet { - /// Transact an Ethereum transaction. Similar to `pallet_ethereum::Transact`, - /// but is only for XCM remote call. - #[pallet::call_index(0)] - #[pallet::weight({ - let weight_limit = T::GasWeightMapping::gas_to_weight(tx.gas_limit.unique_saturated_into(), false); - weight_limit.saturating_add(WeightInfoOf::::transact_without_apply()) - })] - pub fn transact(origin: OriginFor, tx: CheckedEthereumTx) -> DispatchResultWithPostInfo { - let source = T::XcmTransactOrigin::ensure_origin(origin)?; - Self::do_transact( - T::AddressMapper::to_h160_or_default(&source).into_address(), - tx.into(), - CheckedEthereumTxKind::Xcm, - false, - ) - .map(|(post_info, _)| post_info) - } - } -} - -impl Pallet { - /// Validate and execute the checked tx. Only `Call` transaction action is allowed. - fn do_transact( - source: H160, - checked_tx: CheckedEthereumTx, - tx_kind: CheckedEthereumTxKind, - skip_apply: bool, - ) -> Result<(PostDispatchInfo, CallInfo), DispatchErrorWithPostInfo> { - let chain_id = T::ChainId::get(); - let nonce = Nonce::::get(); - let tx: Transaction = checked_tx - .into_ethereum_tx(Nonce::::get(), chain_id) - .into(); - let tx_data: TransactionData = (&tx).into(); - - let (weight_limit, proof_size_base_cost) = - match ::GasWeightMapping::gas_to_weight( - tx_data.gas_limit.unique_saturated_into(), - true, - ) { - weight_limit if weight_limit.proof_size() > 0 => ( - Some(weight_limit), - // measured PoV should be correct to use here - Some(WeightInfoOf::::transact_without_apply().proof_size()), - ), - _ => (None, None), - }; - - // Validate the tx. - let _ = CheckEvmTransaction::::new( - CheckEvmTransactionConfig { - evm_config: T::config(), - block_gas_limit: U256::from(Self::block_gas_limit(&tx_kind)), - base_fee: U256::zero(), - chain_id, - is_transactional: true, - }, - tx_data.into(), - weight_limit, - proof_size_base_cost, - ) - // Gas limit validation. The fee payment has been validated as the tx is `checked`. - .validate_common() - .map_err(|_| DispatchErrorWithPostInfo { - post_info: PostDispatchInfo { - // actual_weight = overhead - nonce_write_1 - actual_weight: Some( - WeightInfoOf::::transact_without_apply() - .saturating_sub(T::DbWeight::get().writes(1)), - ), - pays_fee: Pays::Yes, - }, - error: DispatchError::Other("Failed to validate Ethereum tx"), - })?; - - Nonce::::put(nonce.saturating_add(U256::one())); - - if skip_apply { - return Ok(( - PostDispatchInfo { - actual_weight: Some(WeightInfoOf::::transact_without_apply()), - pays_fee: Pays::Yes, - }, - CallInfo { - exit_reason: ExitReason::Succeed(ExitSucceed::Returned), - value: Default::default(), - used_gas: fp_evm::UsedGas { - standard: checked_tx.gas_limit, - effective: checked_tx.gas_limit, - }, - weight_info: None, - logs: Default::default(), - }, - )); - } - - // Execute the tx. - let (post_info, apply_info) = T::ValidatedTransaction::apply(source, tx, None)?; - match apply_info { - CallOrCreateInfo::Call(info) => Ok((post_info, info)), - // It is not possible to have a `Create` transaction via `CheckedEthereumTx`. - CallOrCreateInfo::Create(_) => { - unreachable!("Cannot create a 'Create' transaction; qed") - } - } - } - - /// Block gas limit calculation based on the tx kind. - fn block_gas_limit(tx_kind: &CheckedEthereumTxKind) -> u64 { - let weight_limit = match tx_kind { - CheckedEthereumTxKind::Xcm => T::ReservedXcmpWeight::get(), - }; - T::GasWeightMapping::weight_to_gas(weight_limit) - } - - /// Similar to `transact` dispatch-able call that transacts an Ethereum transaction, - /// but not to apply it. This is to benchmark the weight overhead in addition to `gas_limit`. - #[cfg(feature = "runtime-benchmarks")] - pub fn transact_without_apply( - origin: OriginFor, - tx: CheckedEthereumTx, - ) -> DispatchResultWithPostInfo { - let source = T::XcmTransactOrigin::ensure_origin(origin)?; - Self::do_transact( - T::AddressMapper::to_h160_or_default(&source).into_address(), - tx.into(), - CheckedEthereumTxKind::Xcm, - true, - ) - .map(|(post_info, _)| post_info) - } -} diff --git a/pallets/ethereum-checked/src/mock.rs b/pallets/ethereum-checked/src/mock.rs deleted file mode 100644 index 586de8df9f..0000000000 --- a/pallets/ethereum-checked/src/mock.rs +++ /dev/null @@ -1,290 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg(test)] - -use super::*; -use crate as pallet_ethereum_checked; - -use ethereum_types::H256; - -use frame_support::{ - assert_ok, construct_runtime, derive_impl, parameter_types, - traits::{ConstU128, ConstU64, FindAuthor}, - weights::Weight, -}; -use pallet_ethereum::PostLogContent; -use pallet_evm::{AddressMapping, FeeCalculator}; -use sp_io::{hashing::blake2_256, TestExternalities}; -use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, - AccountId32, BuildStorage, ConsensusEngineId, -}; - -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, 0)); -} - -#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] -impl frame_system::Config for TestRuntime { - type Block = Block; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type AccountData = pallet_balances::AccountData; -} - -#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] -impl pallet_balances::Config for TestRuntime { - type Balance = Balance; - type ExistentialDeposit = ConstU128<2>; - type AccountStore = System; -} - -#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)] -impl pallet_timestamp::Config for TestRuntime { - type MinimumPeriod = ConstU64<3>; -} - -pub struct MockFeeCalculator; -impl FeeCalculator for MockFeeCalculator { - fn min_gas_price() -> (U256, Weight) { - (U256::one(), Weight::zero()) - } -} - -pub struct MockFindAuthor; -impl FindAuthor for MockFindAuthor { - fn find_author<'a, I>(_digests: I) -> Option - where - I: 'a + IntoIterator, - { - Some(H160::from_low_u64_be(1)) - } -} - -pub struct MockAddressMapping; -impl AddressMapping for MockAddressMapping { - fn into_account_id(address: H160) -> AccountId32 { - if address == ALICE_H160 { - return ALICE; - } - if address == BOB_H160 { - return BOB; - } - if address == CHARLIE_H160 { - return CHARLIE; - } - - return pallet_evm::HashedAddressMapping::::into_account_id(address); - } -} - -pub struct MockAddressMapper; -impl UnifiedAddressMapper for MockAddressMapper { - fn to_h160(account_id: &AccountId32) -> Option { - if account_id == &ALICE { - Some(ALICE_H160) - } else if account_id == &BOB { - Some(BOB_H160) - } else if account_id == &CHARLIE { - Some(CHARLIE_H160) - } else { - None - } - } - - fn to_default_h160(account_id: &AccountId32) -> H160 { - let data = (b"evm:", account_id); - H160::from_slice(&data.using_encoded(blake2_256)[0..20]) - } - - // this method is not used in tests - fn to_default_account_id(_: &H160) -> AccountId32 { - unimplemented!("not used in tests") - } - - // this method is not used in tests - fn to_account_id(_: &H160) -> Option { - unimplemented!("not used in tests") - } -} - -parameter_types! { - pub WeightPerGas: Weight = Weight::from_parts(1, 0); - pub const BlockGasLimit: U256 = U256::MAX; -} - -impl pallet_evm::Config for TestRuntime { - type FeeCalculator = MockFeeCalculator; - type GasWeightMapping = pallet_evm::FixedGasWeightMapping; - type WeightPerGas = WeightPerGas; - type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; - type CallOrigin = pallet_evm::EnsureAddressRoot; - type WithdrawOrigin = pallet_evm::EnsureAddressTruncated; - type AddressMapping = MockAddressMapping; - type Currency = Balances; - type Runner = pallet_evm::runner::stack::Runner; - type PrecompilesType = (); - type PrecompilesValue = (); - type ChainId = ConstU64<1024>; - type OnChargeTransaction = (); - type BlockGasLimit = BlockGasLimit; - type OnCreate = (); - type FindAuthor = MockFindAuthor; - type Timestamp = Timestamp; - type WeightInfo = pallet_evm::weights::SubstrateWeight; - type GasLimitPovSizeRatio = ConstU64<4>; - type AccountProvider = pallet_evm::FrameSystemAccountProvider; - type GasLimitStorageGrowthRatio = ConstU64<0>; - type CreateOriginFilter = (); - type CreateInnerOriginFilter = (); -} - -parameter_types! { - pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; -} - -impl pallet_ethereum::Config for TestRuntime { - type StateRoot = - pallet_ethereum::IntermediateStateRoot<::Version>; - type PostLogContent = PostBlockAndTxnHashes; - type ExtraDataLength = ConstU32<30>; -} - -parameter_types! { - pub TxWeightLimit: Weight = Weight::from_parts(u64::max_value(), 0); -} - -impl pallet_ethereum_checked::Config for TestRuntime { - type ReservedXcmpWeight = TxWeightLimit; - type InvalidEvmTransactionError = pallet_ethereum::InvalidTransactionWrapper; - type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; - type AddressMapper = MockAddressMapper; - type XcmTransactOrigin = EnsureXcmEthereumTx; - type WeightInfo = (); -} - -pub(crate) type AccountId = AccountId32; -pub(crate) type Balance = u128; - -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); -pub const BOB: AccountId32 = AccountId32::new([1u8; 32]); -pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]); - -type Block = frame_system::mocking::MockBlock; - -construct_runtime!( - pub struct TestRuntime - { - System: frame_system, - Timestamp: pallet_timestamp, - Balances: pallet_balances, - Evm: pallet_evm, - Ethereum: pallet_ethereum, - EthereumChecked: pallet_ethereum_checked::{Pallet, Call, Origin}, - } -); - -pub const ALICE_H160: H160 = H160::repeat_byte(1); -pub const BOB_H160: H160 = H160::repeat_byte(2); -pub const CHARLIE_H160: H160 = H160::repeat_byte(3); - -/* Testing contract - -pragma solidity >=0.8.2 <0.9.0; - -contract Storage { - uint256 number; - - /** - * @dev Store value in variable - * @param num value to store - */ - function store(uint256 num) public { - number = num; - } - - /** - * @dev Return value - * @return value of 'number' - */ - function retrieve() public view returns (uint256){ - return number; - } -} -*/ -const STORAGE_CONTRACT: &str = "608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea2646970667358221220322c78243e61b783558509c9cc22cb8493dde6925aa5e89a08cdf6e22f279ef164736f6c63430008120033"; - -pub fn contract_address() -> H160 { - H160::from_slice(&hex::decode("dfb975d018f03994a3b943808e3aa0964bd78463").unwrap()) -} - -pub struct ExtBuilder { - balances: Vec<(AccountId, Balance)>, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { - balances: vec![ - (ALICE, 1_000_000_000_000), - (BOB, 1_000_000_000_000), - (CHARLIE, 1_000_000_000_000), - ], - } - } -} - -impl ExtBuilder { - pub fn build(self) -> TestExternalities { - let mut t = frame_system::GenesisConfig::::default() - .build_storage() - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: self.balances, - ..Default::default() - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = TestExternalities::from(t); - ext.execute_with(|| { - System::set_block_number(1); - - assert_ok!(Evm::create2( - RuntimeOrigin::root(), - ALICE_H160, - hex::decode(STORAGE_CONTRACT).expect("invalid code hex"), - H256::zero(), - U256::zero(), - 1_000_000, - U256::one(), - None, - Some(U256::zero()), - vec![], - vec![], - )); - System::assert_last_event(RuntimeEvent::Evm(pallet_evm::Event::Created { - address: contract_address(), - })); - }); - ext - } -} diff --git a/pallets/ethereum-checked/src/tests.rs b/pallets/ethereum-checked/src/tests.rs deleted file mode 100644 index 504b9b46b3..0000000000 --- a/pallets/ethereum-checked/src/tests.rs +++ /dev/null @@ -1,133 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -#![cfg(test)] - -use super::*; -use mock::*; - -use astar_primitives::ethereum_checked::EthereumTxInput; -use ethereum::{ReceiptV4 as Receipt, TransactionV3 as Transaction}; -use frame_support::{assert_noop, assert_ok}; -use sp_runtime::DispatchError; - -fn bounded_input(data: &'static str) -> EthereumTxInput { - EthereumTxInput::try_from(hex::decode(data).expect("invalid input hex")) - .expect("input too large") -} - -#[test] -fn transact_works() { - ExtBuilder::default().build().execute_with(|| { - let store_tx = CheckedEthereumTx { - gas_limit: U256::from(1_000_000), - target: contract_address(), - value: U256::zero(), - // Calling `store(3)` - input: bounded_input( - "6057361d0000000000000000000000000000000000000000000000000000000000000003", - ), - maybe_access_list: None, - }; - assert_ok!(EthereumChecked::transact( - RawOrigin::XcmEthereumTx(ALICE).into(), - store_tx.clone() - )); - assert_ok!(EthereumChecked::transact( - RawOrigin::XcmEthereumTx(ALICE).into(), - store_tx - )); - let pending0 = pallet_ethereum::Pending::::get(0); - let pending1 = pallet_ethereum::Pending::::get(1); - assert_eq!(pallet_ethereum::Pending::::count(), 2); - - match pending0 { - Some((Transaction::EIP1559(ref t), _, Receipt::EIP1559(ref r))) => { - // nonce 0, status code 1 (success) - assert_eq!(t.nonce, U256::zero()); - assert_eq!(r.status_code, 1); - } - _ => panic!("unexpected transaction type"), - } - match pending1 { - Some((Transaction::EIP1559(ref t), _, Receipt::EIP1559(ref r))) => { - // nonce 1, status code 1 (success) - assert_eq!(t.nonce, U256::one()); - assert_eq!(r.status_code, 1); - } - _ => panic!("unexpected transaction type"), - } - assert_eq!(Nonce::::get(), U256::from(2)); - }); -} - -#[test] -fn origin_check_works() { - ExtBuilder::default().build().execute_with(|| { - let store_tx = CheckedEthereumTx { - gas_limit: U256::from(1_000_000), - target: contract_address(), - value: U256::zero(), - // Calling `store(3)` - input: bounded_input( - "6057361d0000000000000000000000000000000000000000000000000000000000000003", - ), - maybe_access_list: None, - }; - assert_noop!( - EthereumChecked::transact(RuntimeOrigin::signed(ALICE), store_tx.clone()), - DispatchError::BadOrigin - ); - assert_noop!( - EthereumChecked::transact(RuntimeOrigin::root(), store_tx.clone()), - DispatchError::BadOrigin - ); - assert_noop!( - EthereumChecked::transact(RuntimeOrigin::none(), store_tx), - DispatchError::BadOrigin - ); - }); -} - -#[test] -fn no_hash_collision() { - ExtBuilder::default().build().execute_with(|| { - let store_tx = CheckedEthereumTx { - gas_limit: U256::from(1_000_000), - target: contract_address(), - value: U256::zero(), - // Calling `store(3)` - input: bounded_input( - "6057361d0000000000000000000000000000000000000000000000000000000000000003", - ), - maybe_access_list: None, - }; - for _ in 0..5 { - assert_ok!(EthereumChecked::transact( - RawOrigin::XcmEthereumTx(ALICE).into(), - store_tx.clone() - )); - } - - let mut tx_hashes = pallet_ethereum::Pending::::iter() - .map(|(_, (tx, _, _))| tx.hash()) - .collect::>(); - tx_hashes.dedup(); - assert_eq!(tx_hashes.len(), 5); - }); -} diff --git a/pallets/ethereum-checked/src/weights.rs b/pallets/ethereum-checked/src/weights.rs deleted file mode 100644 index d47d3a1340..0000000000 --- a/pallets/ethereum-checked/src/weights.rs +++ /dev/null @@ -1,87 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -//! Autogenerated weights for pallet_ethereum_checked -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `devserver-01`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/astar-collator -// benchmark -// pallet -// --chain=shibuya-dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_ethereum_checked -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./benchmark-results/ethereum_checked_weights.rs -// --template=./scripts/templates/weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_ethereum_checked. -pub trait WeightInfo { - fn transact_without_apply() -> Weight; -} - -/// Weights for pallet_ethereum_checked using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// Storage: EVMChainId ChainId (r:1 w:0) - /// Proof: EVMChainId ChainId (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) - /// Storage: EthereumChecked Nonce (r:1 w:1) - /// Proof: EthereumChecked Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) - fn transact_without_apply() -> Weight { - // Proof Size summary in bytes: - // Measured: `150` - // Estimated: `3010` - // Minimum execution time: 8_838_000 picoseconds. - Weight::from_parts(9_229_000, 3010) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// Storage: EVMChainId ChainId (r:1 w:0) - /// Proof: EVMChainId ChainId (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) - /// Storage: EthereumChecked Nonce (r:1 w:1) - /// Proof: EthereumChecked Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) - fn transact_without_apply() -> Weight { - // Proof Size summary in bytes: - // Measured: `150` - // Estimated: `3010` - // Minimum execution time: 8_838_000 picoseconds. - Weight::from_parts(9_229_000, 3010) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } -} diff --git a/primitives/src/ethereum_checked.rs b/primitives/src/ethereum_checked.rs deleted file mode 100644 index 56117ba53e..0000000000 --- a/primitives/src/ethereum_checked.rs +++ /dev/null @@ -1,82 +0,0 @@ -// This file is part of Astar. - -// Copyright (C) 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 . - -use parity_scale_codec::{Decode, Encode}; -use scale_info::TypeInfo; - -use ethereum::{ - eip2930::TransactionSignature, AccessListItem, EIP1559Transaction, TransactionAction, - TransactionV2 as Transaction, -}; -use ethereum_types::{H160, H256, U256}; -use frame_support::{pallet_prelude::*, traits::ConstU32, BoundedVec}; -use sp_std::prelude::*; - -/// Max Ethereum tx input size: 65_536 bytes -pub const MAX_ETHEREUM_TX_INPUT_SIZE: u32 = 2u32.pow(16); - -pub type EthereumTxInput = BoundedVec>; - -/// The checked Ethereum transaction. Only contracts `call` is support(no `create`). -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo, DecodeWithMemTracking)] -pub struct CheckedEthereumTx { - /// Gas limit. - pub gas_limit: U256, - /// Contract address to call. - pub target: H160, - /// Amount to transfer. - pub value: U256, - /// Input of a contract call. - pub input: EthereumTxInput, - /// Optional access list, specified in EIP-2930. - pub maybe_access_list: Option)>>, -} - -impl CheckedEthereumTx { - pub fn into_ethereum_tx(&self, nonce: U256, chain_id: u64) -> Transaction { - let access_list = if let Some(ref list) = self.maybe_access_list { - list.iter() - .map(|(address, storage_keys)| AccessListItem { - address: *address, - storage_keys: storage_keys.clone(), - }) - .collect() - } else { - Vec::new() - }; - - Transaction::EIP1559(EIP1559Transaction { - chain_id, - nonce, - max_fee_per_gas: U256::zero(), - max_priority_fee_per_gas: U256::zero(), - gas_limit: self.gas_limit, - value: self.value, - action: TransactionAction::Call(self.target), - input: self.input.to_vec(), - access_list, - signature: TransactionSignature::new(true, dummy_rs(), dummy_rs()) - .expect("dummy signature must be valid"), - }) - } -} - -/// Dummy signature for all transactions. -fn dummy_rs() -> H256 { - H256::from_low_u64_be(1u64) -} diff --git a/primitives/src/evm.rs b/primitives/src/evm.rs index 0c8d10d768..fcf6ebc462 100644 --- a/primitives/src/evm.rs +++ b/primitives/src/evm.rs @@ -26,10 +26,8 @@ use frame_support::{ tokens::{fungible::Inspect, imbalance::OnUnbalanced}, }, }; -use pallet_evm::{AddressMapping, HashedAddressMapping, OnChargeEVMTransaction}; -use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; -use scale_info::TypeInfo; -pub use sp_core::{Hasher, H160, H256, U256}; +use pallet_evm::OnChargeEVMTransaction; +pub use sp_core::{H160, H256, U256}; use sp_runtime::traits::UniqueSaturatedInto; use sp_std::marker::PhantomData; @@ -69,84 +67,6 @@ where } } -/// Mapping between Native and EVM Addresses -pub trait UnifiedAddressMapper { - /// Gets the account id associated with given evm address, if mapped else None. - fn to_account_id(evm_address: &EvmAddress) -> Option; - - /// Gets the account id associated with given evm address. - /// If no mapping exists, then return the default evm address. - /// Returns `UnifiedAddress` enum which wraps the inner account id - fn to_account_id_or_default(evm_address: &EvmAddress) -> UnifiedAddress { - Self::to_account_id(evm_address).map_or_else( - // fallback to default account_id - || UnifiedAddress::Default(Self::to_default_account_id(evm_address)), - |a| UnifiedAddress::Mapped(a), - ) - } - /// Gets the default account id which is associated with given evm address. - fn to_default_account_id(evm_address: &EvmAddress) -> AccountId; - - /// Gets the evm address associated with given account id, if mapped else None. - fn to_h160(account_id: &AccountId) -> Option; - - /// Gets the evm address associated with given account id. - /// If no mapping exists, then return the default account id. - /// Returns `UnifiedAddress` enum which wraps the inner evm address - fn to_h160_or_default(account_id: &AccountId) -> UnifiedAddress { - Self::to_h160(account_id).map_or_else( - // fallback to default account_id - || UnifiedAddress::Default(Self::to_default_h160(account_id)), - |a| UnifiedAddress::Mapped(a), - ) - } - - /// Gets the default evm address which is associated with given account id. - fn to_default_h160(account_id: &AccountId) -> EvmAddress; -} - -/// Mappings derieved from hashing the original address -pub struct HashedDefaultMappings(PhantomData); -impl> UnifiedAddressMapper for HashedDefaultMappings { - fn to_default_account_id(evm_address: &EvmAddress) -> AccountId { - HashedAddressMapping::::into_account_id(*evm_address) - } - - fn to_default_h160(account_id: &AccountId) -> EvmAddress { - let payload = (b"evm:", account_id); - H160::from_slice(&payload.using_encoded(H::hash)[0..20]) - } - - fn to_account_id(_: &EvmAddress) -> Option { - None - } - - fn to_h160(_: &AccountId) -> Option { - None - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo)] -pub enum UnifiedAddress
{ - /// The address fetched from the mappings and the account - /// is unified - #[codec(index = 0)] - Mapped(Address), - /// The default address associated with account as there - /// is no mapping found and accounts are not unified - #[codec(index = 1)] - Default(Address), -} - -impl
UnifiedAddress
{ - /// Get the underlying address - pub fn into_address(self) -> Address { - match self { - Self::Default(a) => a, - Self::Mapped(a) => a, - } - } -} /// Wrapper around the `EvmFungibleAdapter` from the `pallet-evm`. /// diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 81dde7d267..3b783c5b83 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -23,9 +23,6 @@ //! These core Astar types are used by the Shiden, Shibuya and Astar runtimes. pub mod xcm; -/// Checked Ethereum transaction primitives. -pub mod ethereum_checked; - /// EVM primitives. pub mod evm; diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index 4bd8b27851..f5e29ad53a 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -116,7 +116,6 @@ pallet-collator-selection = { workspace = true } pallet-collective-proxy = { workspace = true } pallet-dapp-staking = { workspace = true } pallet-dynamic-evm-base-fee = { workspace = true } -pallet-ethereum-checked = { workspace = true } pallet-evm-precompile-assets-erc20 = { workspace = true } pallet-evm-precompile-dapp-staking = { workspace = true } pallet-evm-precompile-dispatch-lockdrop = { workspace = true } @@ -190,7 +189,6 @@ std = [ "pallet-dapp-staking/std", "pallet-democracy/std", "pallet-dynamic-evm-base-fee/std", - "pallet-ethereum-checked/std", "pallet-ethereum/std", "pallet-evm-chain-id/std", "pallet-evm-precompile-assets-erc20/std", @@ -284,7 +282,6 @@ runtime-benchmarks = [ "pallet-dapp-staking/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-dynamic-evm-base-fee/runtime-benchmarks", - "pallet-ethereum-checked/runtime-benchmarks", "pallet-ethereum/runtime-benchmarks", "pallet-evm-precompile-assets-erc20/runtime-benchmarks", "pallet-evm-precompile-dapp-staking/runtime-benchmarks", @@ -345,7 +342,6 @@ try-runtime = [ "pallet-dapp-staking/try-runtime", "pallet-democracy/try-runtime", "pallet-dynamic-evm-base-fee/try-runtime", - "pallet-ethereum-checked/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm-chain-id/try-runtime", "pallet-evm/try-runtime", diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 6e8f6b7208..1e26bd6d81 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -86,7 +86,7 @@ use astar_primitives::{ AccountCheck as DappStakingAccountCheck, CycleConfiguration, DAppId, EraNumber, PeriodNumber, RankedTier, SmartContract, FIXED_NUMBER_OF_TIER_SLOTS, }, - evm::{EVMFungibleAdapterWrapper, EvmRevertCodeHandler, HashedDefaultMappings}, + evm::{EVMFungibleAdapterWrapper, EvmRevertCodeHandler}, governance::{ CommunityCouncilCollectiveInst, CommunityCouncilMembershipInst, CommunityTreasuryInst, EnsureRootOrAllMainCouncil, EnsureRootOrAllTechnicalCommittee, @@ -215,7 +215,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_version: 2204, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 3, + transaction_version: 4, system_version: 1, }; @@ -914,14 +914,6 @@ impl pallet_dynamic_evm_base_fee::Config for Runtime { type WeightInfo = pallet_dynamic_evm_base_fee::weights::SubstrateWeight; } -impl pallet_ethereum_checked::Config for Runtime { - type ReservedXcmpWeight = ReservedXcmpWeight; - type InvalidEvmTransactionError = pallet_ethereum::InvalidTransactionWrapper; - type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; - type AddressMapper = HashedDefaultMappings; - type XcmTransactOrigin = pallet_ethereum_checked::EnsureXcmEthereumTx; - type WeightInfo = pallet_ethereum_checked::weights::SubstrateWeight; -} /// Current approximation of the gas/s consumption considering /// EVM execution over compiled WASM (on 4.4Ghz CPU). @@ -1621,8 +1613,7 @@ mod runtime { pub type DynamicEvmBaseFee = pallet_dynamic_evm_base_fee; #[runtime::pallet_index(63)] pub type EVMChainId = pallet_evm_chain_id; - #[runtime::pallet_index(64)] - pub type EthereumChecked = pallet_ethereum_checked; + // skip 64 - pallet_ethereum_checked previously // skip 65 - pallet_unified_accounts previously #[runtime::pallet_index(70)] @@ -1706,11 +1697,13 @@ pub type Migrations = (Unreleased, Permanent); parameter_types! { pub const UnifiedAccountsPalletName: &'static str = "UnifiedAccounts"; + pub const EthereumCheckedPalletName: &'static str = "EthereumChecked"; } /// Unreleased migrations. Add new ones here: pub type Unreleased = ( frame_support::migrations::RemovePallet, + frame_support::migrations::RemovePallet, ); /// Migrations/checks that do not need to be versioned and can run on every upgrade. @@ -1799,7 +1792,6 @@ mod benches { [pallet_xc_asset_config, XcAssetConfig] [pallet_collator_selection, CollatorSelection] [pallet_xcm, PalletXcmExtrinsicsBenchmark::] - [pallet_ethereum_checked, EthereumChecked] [pallet_dynamic_evm_base_fee, DynamicEvmBaseFee] [xcm_benchmarks_generic, XcmGeneric] [xcm_benchmarks_fungible, XcmFungible] diff --git a/tests/integration/Cargo.toml b/tests/integration/Cargo.toml index 61ef9eed0f..7960b18b2d 100644 --- a/tests/integration/Cargo.toml +++ b/tests/integration/Cargo.toml @@ -57,7 +57,6 @@ xcm-runtime-apis = { workspace = true } pallet-collator-selection = { workspace = true } pallet-collective-proxy = { workspace = true } pallet-dapp-staking = { workspace = true } -pallet-ethereum-checked = { workspace = true } pallet-evm-precompile-assets-erc20 = { workspace = true } pallet-evm-precompile-dispatch = { workspace = true } pallet-inflation = { workspace = true } @@ -104,7 +103,6 @@ std = [ "pallet-timestamp/std", "pallet-dapp-staking/std", "pallet-ethereum?/std", - "pallet-ethereum-checked/std", "pallet-evm/std", "pallet-evm-precompile-assets-erc20/std", "pallet-evm-precompile-dispatch/std", From d621f82e53d2f10e65e1d367a45585f5fc41d1d9 Mon Sep 17 00:00:00 2001 From: Igor Papandinas <26460174+ipapandinas@users.noreply.github.com> Date: Fri, 22 May 2026 18:25:36 +0100 Subject: [PATCH 3/6] fmt --- primitives/src/evm.rs | 1 - runtime/shibuya/src/lib.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/primitives/src/evm.rs b/primitives/src/evm.rs index fcf6ebc462..5c92634d0d 100644 --- a/primitives/src/evm.rs +++ b/primitives/src/evm.rs @@ -67,7 +67,6 @@ where } } - /// Wrapper around the `EvmFungibleAdapter` from the `pallet-evm`. /// /// While it provides most of the functionality we need, diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 1e26bd6d81..8cccdb350a 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -914,7 +914,6 @@ impl pallet_dynamic_evm_base_fee::Config for Runtime { type WeightInfo = pallet_dynamic_evm_base_fee::weights::SubstrateWeight; } - /// Current approximation of the gas/s consumption considering /// EVM execution over compiled WASM (on 4.4Ghz CPU). /// Given the 500ms Weight, from which 75% only are used for transactions, From 5fbf3136d805b1d0fd6d07fcb98a93104ae3767a Mon Sep 17 00:00:00 2001 From: Igor Papandinas <26460174+ipapandinas@users.noreply.github.com> Date: Fri, 22 May 2026 18:29:20 +0100 Subject: [PATCH 4/6] unused deps removed --- Cargo.lock | 4 ---- runtime/shibuya/Cargo.toml | 2 -- tests/integration/Cargo.toml | 2 -- 3 files changed, 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9cd07d3c63..fe6affe7da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6653,7 +6653,6 @@ dependencies = [ "pallet-collective", "pallet-collective-proxy", "pallet-contracts", - "pallet-contracts-uapi", "pallet-dapp-staking", "pallet-democracy", "pallet-ethereum", @@ -6675,7 +6674,6 @@ dependencies = [ "sha3", "shibuya-runtime", "shiden-runtime", - "smallvec", "sp-consensus-aura", "sp-core", "sp-io", @@ -15741,7 +15739,6 @@ dependencies = [ name = "shibuya-runtime" version = "22.0.4" dependencies = [ - "array-bytes 6.2.3", "astar-primitives", "astar-xcm-benchmarks", "cumulus-pallet-aura-ext", @@ -15764,7 +15761,6 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", "log", "moonbeam-evm-tracer", "moonbeam-rpc-primitives-debug", diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index f5e29ad53a..9fd99ad367 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -12,7 +12,6 @@ workspace = true [dependencies] # third-party dependencies -hex-literal = { workspace = true } log = { workspace = true, optional = true } num_enum = { workspace = true } parity-scale-codec = { workspace = true } @@ -137,7 +136,6 @@ moonbeam-rpc-primitives-debug = { workspace = true, optional = true } moonbeam-rpc-primitives-txpool = { workspace = true, optional = true } # benchmarking -array-bytes = { workspace = true } frame-benchmarking = { workspace = true, optional = true } frame-system-benchmarking = { workspace = true, optional = true } diff --git a/tests/integration/Cargo.toml b/tests/integration/Cargo.toml index 7960b18b2d..3e8cef29f5 100644 --- a/tests/integration/Cargo.toml +++ b/tests/integration/Cargo.toml @@ -15,7 +15,6 @@ env_logger = { workspace = true } hex = { workspace = true } parity-scale-codec = { workspace = true } sha3 = { workspace = true } -smallvec = { workspace = true } # frontier fp-evm = { workspace = true } @@ -33,7 +32,6 @@ pallet-aura = { workspace = true } pallet-balances = { workspace = true } pallet-collective = { workspace = true } pallet-contracts = { workspace = true } -pallet-contracts-uapi = { workspace = true } pallet-democracy = { workspace = true } pallet-membership = { workspace = true } pallet-proxy = { workspace = true } From 5c09c508e67a0ab4c13ce597391ceb3d868f9da1 Mon Sep 17 00:00:00 2001 From: Igor Papandinas <26460174+ipapandinas@users.noreply.github.com> Date: Tue, 26 May 2026 10:49:28 +0100 Subject: [PATCH 5/6] weights --- .../src/weights/frame_system_extensions.rs | 40 +-- runtime/shibuya/src/weights/pallet_assets.rs | 214 ++++++++------- .../shibuya/src/weights/pallet_balances.rs | 85 +++--- .../src/weights/pallet_dapp_staking.rs | 132 +++++----- .../shibuya/src/weights/pallet_inflation.rs | 24 +- .../src/weights/pallet_transaction_payment.rs | 8 +- runtime/shibuya/src/weights/pallet_xcm.rs | 72 ++--- runtime/shibuya/src/weights/xcm/fungible.rs | 133 +++++----- runtime/shibuya/src/weights/xcm/generic.rs | 247 +++++++++--------- 9 files changed, 474 insertions(+), 481 deletions(-) diff --git a/runtime/shibuya/src/weights/frame_system_extensions.rs b/runtime/shibuya/src/weights/frame_system_extensions.rs index 02a900c7cb..0bb9f95077 100644 --- a/runtime/shibuya/src/weights/frame_system_extensions.rs +++ b/runtime/shibuya/src/weights/frame_system_extensions.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for `frame_system_extensions` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 @@ -56,32 +56,32 @@ impl frame_system::ExtensionsWeightInfo for SubstrateWe // Proof Size summary in bytes: // Measured: `30` // Estimated: `0` - // Minimum execution time: 3_151_000 picoseconds. - Weight::from_parts(3_429_000, 0) + // Minimum execution time: 3_123_000 picoseconds. + Weight::from_parts(3_201_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_mortality_mortal_transaction() -> Weight { // Proof Size summary in bytes: // Measured: `68` // Estimated: `0` - // Minimum execution time: 6_181_000 picoseconds. - Weight::from_parts(6_558_000, 0) + // Minimum execution time: 5_953_000 picoseconds. + Weight::from_parts(6_116_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_mortality_immortal_transaction() -> Weight { // Proof Size summary in bytes: // Measured: `68` // Estimated: `0` - // Minimum execution time: 6_225_000 picoseconds. - Weight::from_parts(6_600_000, 0) + // Minimum execution time: 6_068_000 picoseconds. + Weight::from_parts(6_232_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_non_zero_sender() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 498_000 picoseconds. - Weight::from_parts(575_000, 0) + // Minimum execution time: 434_000 picoseconds. + Weight::from_parts(458_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `System::Account` (r:1 w:1) @@ -90,8 +90,8 @@ impl frame_system::ExtensionsWeightInfo for SubstrateWe // Proof Size summary in bytes: // Measured: `102` // Estimated: `3593` - // Minimum execution time: 7_549_000 picoseconds. - Weight::from_parts(7_980_000, 0) + // Minimum execution time: 7_191_000 picoseconds. + Weight::from_parts(7_362_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -100,32 +100,32 @@ impl frame_system::ExtensionsWeightInfo for SubstrateWe // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 382_000 picoseconds. - Weight::from_parts(454_000, 0) + // Minimum execution time: 322_000 picoseconds. + Weight::from_parts(369_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_tx_version() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 387_000 picoseconds. - Weight::from_parts(451_000, 0) + // Minimum execution time: 336_000 picoseconds. + Weight::from_parts(354_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn check_weight() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_110_000 picoseconds. - Weight::from_parts(4_411_000, 0) + // Minimum execution time: 3_948_000 picoseconds. + Weight::from_parts(4_040_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn weight_reclaim() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_518_000, 0) + // Minimum execution time: 2_297_000 picoseconds. + Weight::from_parts(2_372_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/runtime/shibuya/src/weights/pallet_assets.rs b/runtime/shibuya/src/weights/pallet_assets.rs index 2276368642..4b8c7d6cc9 100644 --- a/runtime/shibuya/src/weights/pallet_assets.rs +++ b/runtime/shibuya/src/weights/pallet_assets.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for `pallet_assets` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 @@ -62,11 +62,11 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `762` - // Estimated: `4227` - // Minimum execution time: 36_099_000 picoseconds. - Weight::from_parts(37_180_000, 0) - .saturating_add(Weight::from_parts(0, 4227)) + // Measured: `729` + // Estimated: `4194` + // Minimum execution time: 33_440_000 picoseconds. + Weight::from_parts(33_825_000, 0) + .saturating_add(Weight::from_parts(0, 4194)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -78,11 +78,11 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) fn force_create() -> Weight { // Proof Size summary in bytes: - // Measured: `622` - // Estimated: `4087` - // Minimum execution time: 20_900_000 picoseconds. - Weight::from_parts(21_680_000, 0) - .saturating_add(Weight::from_parts(0, 4087)) + // Measured: `589` + // Estimated: `4054` + // Minimum execution time: 19_511_000 picoseconds. + Weight::from_parts(19_749_000, 0) + .saturating_add(Weight::from_parts(0, 4054)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -92,8 +92,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `360` // Estimated: `3687` - // Minimum execution time: 12_851_000 picoseconds. - Weight::from_parts(13_490_000, 0) + // Minimum execution time: 12_165_000 picoseconds. + Weight::from_parts(12_361_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -104,20 +104,18 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1000 w:1000) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1000 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `560 + c * (208 ±0)` + // Measured: `488 + c * (208 ±0)` // Estimated: `3687 + c * (2621 ±0)` - // Minimum execution time: 17_046_000 picoseconds. - Weight::from_parts(17_396_000, 0) + // Minimum execution time: 15_742_000 picoseconds. + Weight::from_parts(15_916_000, 0) .saturating_add(Weight::from_parts(0, 3687)) - // Standard Error: 7_864 - .saturating_add(Weight::from_parts(14_196_885, 0).saturating_mul(c.into())) + // Standard Error: 8_493 + .saturating_add(Weight::from_parts(11_599_508, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 2621).saturating_mul(c.into())) @@ -131,11 +129,11 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `509 + a * (86 ±0)` // Estimated: `3687 + a * (2635 ±0)` - // Minimum execution time: 17_867_000 picoseconds. - Weight::from_parts(18_150_000, 0) + // Minimum execution time: 16_559_000 picoseconds. + Weight::from_parts(16_695_000, 0) .saturating_add(Weight::from_parts(0, 3687)) - // Standard Error: 4_702 - .saturating_add(Weight::from_parts(13_520_992, 0).saturating_mul(a.into())) + // Standard Error: 4_947 + .saturating_add(Weight::from_parts(11_949_220, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -152,8 +150,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 15_971_000 picoseconds. - Weight::from_parts(16_615_000, 0) + // Minimum execution time: 15_021_000 picoseconds. + Weight::from_parts(15_322_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -166,8 +164,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 23_500_000 picoseconds. - Weight::from_parts(24_302_000, 0) + // Minimum execution time: 21_765_000 picoseconds. + Weight::from_parts(22_148_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -176,16 +174,14 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(222), added: 2697, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:1 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `488` + // Measured: `446` // Estimated: `3687` - // Minimum execution time: 34_062_000 picoseconds. - Weight::from_parts(34_987_000, 0) + // Minimum execution time: 28_716_000 picoseconds. + Weight::from_parts(29_094_000, 0) .saturating_add(Weight::from_parts(0, 3687)) - .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `Assets::Asset` (r:1 w:1) @@ -194,16 +190,14 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `593` + // Measured: `551` // Estimated: `6232` - // Minimum execution time: 46_072_000 picoseconds. - Weight::from_parts(47_471_000, 0) + // Minimum execution time: 39_709_000 picoseconds. + Weight::from_parts(40_147_000, 0) .saturating_add(Weight::from_parts(0, 6232)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Assets::Asset` (r:1 w:1) @@ -216,8 +210,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `551` // Estimated: `6232` - // Minimum execution time: 38_222_000 picoseconds. - Weight::from_parts(39_315_000, 0) + // Minimum execution time: 34_975_000 picoseconds. + Weight::from_parts(35_538_000, 0) .saturating_add(Weight::from_parts(0, 6232)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -228,16 +222,14 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `593` + // Measured: `551` // Estimated: `6232` - // Minimum execution time: 46_158_000 picoseconds. - Weight::from_parts(47_514_000, 0) + // Minimum execution time: 39_064_000 picoseconds. + Weight::from_parts(39_558_000, 0) .saturating_add(Weight::from_parts(0, 6232)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Assets::Asset` (r:1 w:0) @@ -248,8 +240,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `446` // Estimated: `3687` - // Minimum execution time: 17_419_000 picoseconds. - Weight::from_parts(18_136_000, 0) + // Minimum execution time: 16_422_000 picoseconds. + Weight::from_parts(16_758_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -262,8 +254,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `446` // Estimated: `3687` - // Minimum execution time: 17_349_000 picoseconds. - Weight::from_parts(18_100_000, 0) + // Minimum execution time: 16_325_000 picoseconds. + Weight::from_parts(16_611_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -274,8 +266,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `360` // Estimated: `3687` - // Minimum execution time: 13_052_000 picoseconds. - Weight::from_parts(13_682_000, 0) + // Minimum execution time: 12_143_000 picoseconds. + Weight::from_parts(12_465_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -286,8 +278,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `360` // Estimated: `3687` - // Minimum execution time: 12_970_000 picoseconds. - Weight::from_parts(13_574_000, 0) + // Minimum execution time: 12_507_000 picoseconds. + Weight::from_parts(12_660_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -300,8 +292,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 14_675_000 picoseconds. - Weight::from_parts(15_340_000, 0) + // Minimum execution time: 13_910_000 picoseconds. + Weight::from_parts(14_104_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -312,8 +304,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 13_229_000 picoseconds. - Weight::from_parts(13_784_000, 0) + // Minimum execution time: 12_395_000 picoseconds. + Weight::from_parts(12_689_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -328,13 +320,13 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 27_873_000 picoseconds. - Weight::from_parts(28_673_243, 0) + // Minimum execution time: 25_418_000 picoseconds. + Weight::from_parts(25_994_458, 0) .saturating_add(Weight::from_parts(0, 3687)) - // Standard Error: 104 - .saturating_add(Weight::from_parts(4_007, 0).saturating_mul(n.into())) - // Standard Error: 104 - .saturating_add(Weight::from_parts(3_628, 0).saturating_mul(s.into())) + // Standard Error: 529 + .saturating_add(Weight::from_parts(1_116, 0).saturating_mul(n.into())) + // Standard Error: 529 + .saturating_add(Weight::from_parts(1_960, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -346,8 +338,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3687` - // Minimum execution time: 27_543_000 picoseconds. - Weight::from_parts(28_417_000, 0) + // Minimum execution time: 25_401_000 picoseconds. + Weight::from_parts(25_854_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -362,13 +354,13 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `165` // Estimated: `3687` - // Minimum execution time: 14_240_000 picoseconds. - Weight::from_parts(14_826_499, 0) + // Minimum execution time: 13_020_000 picoseconds. + Weight::from_parts(13_435_449, 0) .saturating_add(Weight::from_parts(0, 3687)) - // Standard Error: 52 - .saturating_add(Weight::from_parts(1_660, 0).saturating_mul(n.into())) - // Standard Error: 52 - .saturating_add(Weight::from_parts(2_370, 0).saturating_mul(s.into())) + // Standard Error: 313 + .saturating_add(Weight::from_parts(1_837, 0).saturating_mul(n.into())) + // Standard Error: 313 + .saturating_add(Weight::from_parts(2_225, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -380,8 +372,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `502` // Estimated: `3687` - // Minimum execution time: 27_046_000 picoseconds. - Weight::from_parts(27_922_000, 0) + // Minimum execution time: 25_476_000 picoseconds. + Weight::from_parts(25_854_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -392,8 +384,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 13_009_000 picoseconds. - Weight::from_parts(13_585_000, 0) + // Minimum execution time: 12_176_000 picoseconds. + Weight::from_parts(12_381_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -406,8 +398,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `360` // Estimated: `3687` - // Minimum execution time: 31_318_000 picoseconds. - Weight::from_parts(32_300_000, 0) + // Minimum execution time: 29_192_000 picoseconds. + Weight::from_parts(29_495_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -424,8 +416,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `784` // Estimated: `6232` - // Minimum execution time: 61_340_000 picoseconds. - Weight::from_parts(62_815_000, 0) + // Minimum execution time: 56_444_000 picoseconds. + Weight::from_parts(57_102_000, 0) .saturating_add(Weight::from_parts(0, 6232)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -438,8 +430,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `542` // Estimated: `3687` - // Minimum execution time: 32_818_000 picoseconds. - Weight::from_parts(33_768_000, 0) + // Minimum execution time: 30_452_000 picoseconds. + Weight::from_parts(31_084_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -452,8 +444,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `542` // Estimated: `3687` - // Minimum execution time: 32_861_000 picoseconds. - Weight::from_parts(33_795_000, 0) + // Minimum execution time: 30_690_000 picoseconds. + Weight::from_parts(31_171_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -464,8 +456,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 13_861_000 picoseconds. - Weight::from_parts(14_499_000, 0) + // Minimum execution time: 12_809_000 picoseconds. + Weight::from_parts(12_975_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -480,8 +472,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `533` // Estimated: `3687` - // Minimum execution time: 33_160_000 picoseconds. - Weight::from_parts(34_149_000, 0) + // Minimum execution time: 30_408_000 picoseconds. + Weight::from_parts(30_773_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -494,8 +486,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3687` - // Minimum execution time: 30_611_000 picoseconds. - Weight::from_parts(31_497_000, 0) + // Minimum execution time: 27_831_000 picoseconds. + Weight::from_parts(28_096_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -510,8 +502,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `671` // Estimated: `3687` - // Minimum execution time: 31_702_000 picoseconds. - Weight::from_parts(32_624_000, 0) + // Minimum execution time: 29_592_000 picoseconds. + Weight::from_parts(29_935_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -524,8 +516,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `497` // Estimated: `3687` - // Minimum execution time: 29_023_000 picoseconds. - Weight::from_parts(29_838_000, 0) + // Minimum execution time: 26_175_000 picoseconds. + Weight::from_parts(26_700_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -538,8 +530,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `446` // Estimated: `3687` - // Minimum execution time: 17_395_000 picoseconds. - Weight::from_parts(18_248_000, 0) + // Minimum execution time: 16_275_000 picoseconds. + Weight::from_parts(16_581_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -548,18 +540,16 @@ impl pallet_assets::WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(222), added: 2697, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:2 w:2) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `593` + // Measured: `551` // Estimated: `6232` - // Minimum execution time: 54_153_000 picoseconds. - Weight::from_parts(55_617_000, 0) + // Minimum execution time: 45_829_000 picoseconds. + Weight::from_parts(46_441_000, 0) .saturating_add(Weight::from_parts(0, 6232)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Assets::Asset` (r:1 w:0) @@ -568,8 +558,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `360` // Estimated: `3687` - // Minimum execution time: 6_033_000 picoseconds. - Weight::from_parts(6_430_000, 0) + // Minimum execution time: 5_749_000 picoseconds. + Weight::from_parts(5_908_000, 0) .saturating_add(Weight::from_parts(0, 3687)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -579,8 +569,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `234` // Estimated: `3611` - // Minimum execution time: 6_833_000 picoseconds. - Weight::from_parts(7_243_000, 0) + // Minimum execution time: 6_429_000 picoseconds. + Weight::from_parts(6_556_000, 0) .saturating_add(Weight::from_parts(0, 3611)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -590,8 +580,8 @@ impl pallet_assets::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `329` // Estimated: `3625` - // Minimum execution time: 9_629_000 picoseconds. - Weight::from_parts(10_043_000, 0) + // Minimum execution time: 8_845_000 picoseconds. + Weight::from_parts(8_997_000, 0) .saturating_add(Weight::from_parts(0, 3625)) .saturating_add(T::DbWeight::get().reads(1)) } diff --git a/runtime/shibuya/src/weights/pallet_balances.rs b/runtime/shibuya/src/weights/pallet_balances.rs index 413b762723..87ce797379 100644 --- a/runtime/shibuya/src/weights/pallet_balances.rs +++ b/runtime/shibuya/src/weights/pallet_balances.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for `pallet_balances` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 @@ -54,16 +54,14 @@ pub struct SubstrateWeight(PhantomData); impl pallet_balances::WeightInfo for SubstrateWeight { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn transfer_allow_death() -> Weight { // Proof Size summary in bytes: - // Measured: `94` + // Measured: `52` // Estimated: `3593` - // Minimum execution time: 51_205_000 picoseconds. - Weight::from_parts(52_468_000, 0) + // Minimum execution time: 41_968_000 picoseconds. + Weight::from_parts(43_180_000, 0) .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::Account` (r:1 w:1) @@ -72,8 +70,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 38_189_000 picoseconds. - Weight::from_parts(39_109_000, 0) + // Minimum execution time: 33_593_000 picoseconds. + Weight::from_parts(34_279_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -84,52 +82,46 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `72` // Estimated: `3593` - // Minimum execution time: 22_421_000 picoseconds. - Weight::from_parts(23_211_000, 0) + // Minimum execution time: 20_558_000 picoseconds. + Weight::from_parts(20_873_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn force_set_balance_killing() -> Weight { // Proof Size summary in bytes: - // Measured: `249` + // Measured: `207` // Estimated: `3593` - // Minimum execution time: 26_173_000 picoseconds. - Weight::from_parts(27_079_000, 0) + // Minimum execution time: 20_728_000 picoseconds. + Weight::from_parts(21_161_000, 0) .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `197` + // Measured: `155` // Estimated: `6196` - // Minimum execution time: 52_886_000 picoseconds. - Weight::from_parts(54_179_000, 0) + // Minimum execution time: 43_803_000 picoseconds. + Weight::from_parts(44_622_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `94` + // Measured: `52` // Estimated: `3593` - // Minimum execution time: 50_508_000 picoseconds. - Weight::from_parts(51_697_000, 0) + // Minimum execution time: 40_886_000 picoseconds. + Weight::from_parts(41_800_000, 0) .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `System::Account` (r:1 w:1) @@ -138,8 +130,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `207` // Estimated: `3593` - // Minimum execution time: 18_266_000 picoseconds. - Weight::from_parts(19_095_000, 0) + // Minimum execution time: 16_706_000 picoseconds. + Weight::from_parts(17_007_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -151,11 +143,11 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0 + u * (136 ±0)` // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 18_521_000 picoseconds. - Weight::from_parts(18_651_000, 0) + // Minimum execution time: 16_559_000 picoseconds. + Weight::from_parts(16_678_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 5_715 - .saturating_add(Weight::from_parts(12_635_694, 0).saturating_mul(u.into())) + // Standard Error: 5_389 + .saturating_add(Weight::from_parts(10_901_817, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) @@ -164,27 +156,24 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_339_000 picoseconds. - Weight::from_parts(7_733_000, 0) + // Minimum execution time: 6_821_000 picoseconds. + Weight::from_parts(6_971_000, 0) .saturating_add(Weight::from_parts(0, 0)) } - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) fn burn_allow_death() -> Weight { // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `3533` - // Minimum execution time: 33_541_000 picoseconds. - Weight::from_parts(34_499_000, 0) - .saturating_add(Weight::from_parts(0, 3533)) - .saturating_add(T::DbWeight::get().reads(1)) + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 26_758_000 picoseconds. + Weight::from_parts(27_119_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } fn burn_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 20_678_000 picoseconds. - Weight::from_parts(21_353_000, 0) + // Minimum execution time: 18_540_000 picoseconds. + Weight::from_parts(18_927_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/runtime/shibuya/src/weights/pallet_dapp_staking.rs b/runtime/shibuya/src/weights/pallet_dapp_staking.rs index 48ae8a3f52..c9b3343a9b 100644 --- a/runtime/shibuya/src/weights/pallet_dapp_staking.rs +++ b/runtime/shibuya/src/weights/pallet_dapp_staking.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for `pallet_dapp_staking` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 @@ -56,8 +56,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_047_000 picoseconds. - Weight::from_parts(7_443_000, 0) + // Minimum execution time: 6_756_000 picoseconds. + Weight::from_parts(6_941_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `DappStaking::IntegratedDApps` (r:1 w:1) @@ -70,8 +70,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `3086` - // Minimum execution time: 14_630_000 picoseconds. - Weight::from_parts(15_221_000, 0) + // Minimum execution time: 13_636_000 picoseconds. + Weight::from_parts(13_812_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -82,8 +82,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 12_434_000 picoseconds. - Weight::from_parts(13_029_000, 0) + // Minimum execution time: 12_077_000 picoseconds. + Weight::from_parts(12_276_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -94,8 +94,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 12_453_000 picoseconds. - Weight::from_parts(13_016_000, 0) + // Minimum execution time: 11_939_000 picoseconds. + Weight::from_parts(12_114_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -110,8 +110,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 17_476_000 picoseconds. - Weight::from_parts(18_251_000, 0) + // Minimum execution time: 16_588_000 picoseconds. + Weight::from_parts(16_919_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -130,8 +130,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `138` // Estimated: `4764` - // Minimum execution time: 33_533_000 picoseconds. - Weight::from_parts(34_502_000, 0) + // Minimum execution time: 30_662_000 picoseconds. + Weight::from_parts(31_158_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -148,8 +148,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `156` // Estimated: `4764` - // Minimum execution time: 33_962_000 picoseconds. - Weight::from_parts(34_987_000, 0) + // Minimum execution time: 31_946_000 picoseconds. + Weight::from_parts(32_487_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -166,8 +166,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `156` // Estimated: `4764` - // Minimum execution time: 31_163_000 picoseconds. - Weight::from_parts(32_249_000, 0) + // Minimum execution time: 29_407_000 picoseconds. + Weight::from_parts(29_939_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -185,11 +185,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `187` // Estimated: `4764` - // Minimum execution time: 34_323_000 picoseconds. - Weight::from_parts(35_679_353, 0) + // Minimum execution time: 31_489_000 picoseconds. + Weight::from_parts(32_651_074, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 1_752 - .saturating_add(Weight::from_parts(150_529, 0).saturating_mul(x.into())) + // Standard Error: 5_096 + .saturating_add(Weight::from_parts(145_511, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -205,8 +205,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `182` // Estimated: `4764` - // Minimum execution time: 31_025_000 picoseconds. - Weight::from_parts(31_985_000, 0) + // Minimum execution time: 28_872_000 picoseconds. + Weight::from_parts(29_435_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -229,8 +229,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `272` // Estimated: `4764` - // Minimum execution time: 44_407_000 picoseconds. - Weight::from_parts(45_586_000, 0) + // Minimum execution time: 40_981_000 picoseconds. + Weight::from_parts(41_434_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -253,8 +253,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `453` // Estimated: `4764` - // Minimum execution time: 48_864_000 picoseconds. - Weight::from_parts(50_136_000, 0) + // Minimum execution time: 45_669_000 picoseconds. + Weight::from_parts(46_439_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -274,11 +274,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `522` // Estimated: `4764` - // Minimum execution time: 50_337_000 picoseconds. - Weight::from_parts(50_074_593, 0) + // Minimum execution time: 45_775_000 picoseconds. + Weight::from_parts(45_432_763, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 1_376 - .saturating_add(Weight::from_parts(1_722_208, 0).saturating_mul(x.into())) + // Standard Error: 3_526 + .saturating_add(Weight::from_parts(1_567_460, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -295,11 +295,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `501` // Estimated: `4764` - // Minimum execution time: 47_789_000 picoseconds. - Weight::from_parts(47_274_230, 0) + // Minimum execution time: 43_286_000 picoseconds. + Weight::from_parts(42_644_737, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 1_266 - .saturating_add(Weight::from_parts(1_724_598, 0).saturating_mul(x.into())) + // Standard Error: 2_796 + .saturating_add(Weight::from_parts(1_606_514, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -313,8 +313,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `271` // Estimated: `3775` - // Minimum execution time: 39_816_000 picoseconds. - Weight::from_parts(40_839_000, 0) + // Minimum execution time: 36_871_000 picoseconds. + Weight::from_parts(37_382_000, 0) .saturating_add(Weight::from_parts(0, 3775)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -327,8 +327,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `647` // Estimated: `3660` - // Minimum execution time: 26_593_000 picoseconds. - Weight::from_parts(27_312_000, 0) + // Minimum execution time: 25_233_000 picoseconds. + Weight::from_parts(25_487_000, 0) .saturating_add(Weight::from_parts(0, 3660)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -349,8 +349,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `317` // Estimated: `4764` - // Minimum execution time: 40_807_000 picoseconds. - Weight::from_parts(41_933_000, 0) + // Minimum execution time: 37_812_000 picoseconds. + Weight::from_parts(38_485_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) @@ -368,11 +368,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `255 + x * (73 ±0)` // Estimated: `4764 + x * (2653 ±0)` - // Minimum execution time: 41_829_000 picoseconds. - Weight::from_parts(37_522_568, 0) + // Minimum execution time: 38_700_000 picoseconds. + Weight::from_parts(34_490_422, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 3_438 - .saturating_add(Weight::from_parts(5_808_166, 0).saturating_mul(x.into())) + // Standard Error: 11_214 + .saturating_add(Weight::from_parts(5_326_393, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -385,8 +385,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `1486` - // Minimum execution time: 10_205_000 picoseconds. - Weight::from_parts(10_717_000, 0) + // Minimum execution time: 9_963_000 picoseconds. + Weight::from_parts(10_121_000, 0) .saturating_add(Weight::from_parts(0, 1486)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -408,8 +408,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `547` // Estimated: `6296` - // Minimum execution time: 79_829_000 picoseconds. - Weight::from_parts(81_666_000, 0) + // Minimum execution time: 74_506_000 picoseconds. + Weight::from_parts(75_023_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(10)) .saturating_add(T::DbWeight::get().writes(7)) @@ -432,8 +432,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `414` // Estimated: `6296` - // Minimum execution time: 71_816_000 picoseconds. - Weight::from_parts(73_465_000, 0) + // Minimum execution time: 66_277_000 picoseconds. + Weight::from_parts(67_422_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(6)) @@ -450,8 +450,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `197` // Estimated: `4254` - // Minimum execution time: 21_318_000 picoseconds. - Weight::from_parts(22_006_000, 0) + // Minimum execution time: 20_113_000 picoseconds. + Weight::from_parts(20_328_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -474,8 +474,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `299` // Estimated: `4254` - // Minimum execution time: 34_132_000 picoseconds. - Weight::from_parts(34_951_000, 0) + // Minimum execution time: 32_198_000 picoseconds. + Weight::from_parts(32_589_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(7)) @@ -494,8 +494,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `251` // Estimated: `4254` - // Minimum execution time: 25_086_000 picoseconds. - Weight::from_parts(25_802_000, 0) + // Minimum execution time: 23_505_000 picoseconds. + Weight::from_parts(23_809_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -511,11 +511,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `194 + x * (33 ±0)` // Estimated: `3061 + x * (2071 ±0)` - // Minimum execution time: 9_098_000 picoseconds. - Weight::from_parts(12_565_972, 0) + // Minimum execution time: 8_445_000 picoseconds. + Weight::from_parts(11_548_999, 0) .saturating_add(Weight::from_parts(0, 3061)) - // Standard Error: 3_389 - .saturating_add(Weight::from_parts(2_827_355, 0).saturating_mul(x.into())) + // Standard Error: 10_584 + .saturating_add(Weight::from_parts(2_627_047, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(Weight::from_parts(0, 2071).saturating_mul(x.into())) @@ -530,8 +530,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `293` // Estimated: `4254` - // Minimum execution time: 8_420_000 picoseconds. - Weight::from_parts(8_859_000, 0) + // Minimum execution time: 8_244_000 picoseconds. + Weight::from_parts(8_417_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -542,8 +542,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_689_000 picoseconds. - Weight::from_parts(9_115_000, 0) + // Minimum execution time: 8_216_000 picoseconds. + Weight::from_parts(8_415_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/shibuya/src/weights/pallet_inflation.rs b/runtime/shibuya/src/weights/pallet_inflation.rs index 38c485af6c..861638a582 100644 --- a/runtime/shibuya/src/weights/pallet_inflation.rs +++ b/runtime/shibuya/src/weights/pallet_inflation.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for `pallet_inflation` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 @@ -58,8 +58,8 @@ impl pallet_inflation::WeightInfo for SubstrateWeight pallet_inflation::WeightInfo for SubstrateWeight pallet_inflation::WeightInfo for SubstrateWeight pallet_inflation::WeightInfo for SubstrateWeight pallet_inflation::WeightInfo for SubstrateWeight pallet_transaction_payment::WeightInfo for Substra // Proof Size summary in bytes: // Measured: `174` // Estimated: `6196` - // Minimum execution time: 53_400_000 picoseconds. - Weight::from_parts(54_654_000, 0) + // Minimum execution time: 47_074_000 picoseconds. + Weight::from_parts(47_449_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/shibuya/src/weights/pallet_xcm.rs b/runtime/shibuya/src/weights/pallet_xcm.rs index dc1a14e95c..c4a0705849 100644 --- a/runtime/shibuya/src/weights/pallet_xcm.rs +++ b/runtime/shibuya/src/weights/pallet_xcm.rs @@ -19,8 +19,8 @@ //! Autogenerated weights for `pallet_xcm` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2026-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 @@ -64,8 +64,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `246` // Estimated: `3711` - // Minimum execution time: 29_676_000 picoseconds. - Weight::from_parts(30_712_000, 0) + // Minimum execution time: 28_051_000 picoseconds. + Weight::from_parts(28_715_000, 0) .saturating_add(Weight::from_parts(0, 3711)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -98,8 +98,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3814` - // Minimum execution time: 88_250_000 picoseconds. - Weight::from_parts(90_070_000, 0) + // Minimum execution time: 80_695_000 picoseconds. + Weight::from_parts(81_484_000, 0) .saturating_add(Weight::from_parts(0, 3814)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) @@ -130,8 +130,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_500_000 picoseconds. - Weight::from_parts(10_051_000, 0) + // Minimum execution time: 8_910_000 picoseconds. + Weight::from_parts(9_034_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,8 +139,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_071_000 picoseconds. - Weight::from_parts(3_373_000, 0) + // Minimum execution time: 2_929_000 picoseconds. + Weight::from_parts(3_071_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1) @@ -161,8 +161,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `246` // Estimated: `3711` - // Minimum execution time: 33_714_000 picoseconds. - Weight::from_parts(34_770_000, 0) + // Minimum execution time: 31_704_000 picoseconds. + Weight::from_parts(32_072_000, 0) .saturating_add(Weight::from_parts(0, 3711)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -183,8 +183,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `370` // Estimated: `134571` - // Minimum execution time: 35_868_000 picoseconds. - Weight::from_parts(36_977_000, 0) + // Minimum execution time: 33_984_000 picoseconds. + Weight::from_parts(34_442_000, 0) .saturating_add(Weight::from_parts(0, 134571)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -195,8 +195,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_180_000 picoseconds. - Weight::from_parts(3_492_000, 0) + // Minimum execution time: 3_020_000 picoseconds. + Weight::from_parts(3_132_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -206,8 +206,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `22` // Estimated: `15862` - // Minimum execution time: 20_045_000 picoseconds. - Weight::from_parts(20_793_000, 0) + // Minimum execution time: 18_835_000 picoseconds. + Weight::from_parts(19_265_000, 0) .saturating_add(Weight::from_parts(0, 15862)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) @@ -218,8 +218,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `26` // Estimated: `15866` - // Minimum execution time: 20_223_000 picoseconds. - Weight::from_parts(21_057_000, 0) + // Minimum execution time: 19_057_000 picoseconds. + Weight::from_parts(19_328_000, 0) .saturating_add(Weight::from_parts(0, 15866)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) @@ -230,8 +230,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `78` // Estimated: `18393` - // Minimum execution time: 24_056_000 picoseconds. - Weight::from_parts(24_919_000, 0) + // Minimum execution time: 23_067_000 picoseconds. + Weight::from_parts(23_490_000, 0) .saturating_add(Weight::from_parts(0, 18393)) .saturating_add(T::DbWeight::get().reads(7)) } @@ -245,8 +245,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `112` // Estimated: `6052` - // Minimum execution time: 28_105_000 picoseconds. - Weight::from_parts(29_091_000, 0) + // Minimum execution time: 26_896_000 picoseconds. + Weight::from_parts(39_918_000, 0) .saturating_add(Weight::from_parts(0, 6052)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) @@ -257,8 +257,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `78` // Estimated: `13443` - // Minimum execution time: 16_807_000 picoseconds. - Weight::from_parts(17_590_000, 0) + // Minimum execution time: 16_206_000 picoseconds. + Weight::from_parts(16_592_000, 0) .saturating_add(Weight::from_parts(0, 13443)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -268,8 +268,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `33` // Estimated: `15873` - // Minimum execution time: 20_240_000 picoseconds. - Weight::from_parts(21_060_000, 0) + // Minimum execution time: 19_121_000 picoseconds. + Weight::from_parts(19_469_000, 0) .saturating_add(Weight::from_parts(0, 15873)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) @@ -284,8 +284,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `112` // Estimated: `15952` - // Minimum execution time: 37_349_000 picoseconds. - Weight::from_parts(38_609_000, 0) + // Minimum execution time: 35_556_000 picoseconds. + Weight::from_parts(36_429_000, 0) .saturating_add(Weight::from_parts(0, 15952)) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(1)) @@ -298,8 +298,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_948_000 picoseconds. - Weight::from_parts(3_193_000, 0) + // Minimum execution time: 2_844_000 picoseconds. + Weight::from_parts(2_948_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -310,8 +310,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `7576` // Estimated: `11041` - // Minimum execution time: 26_511_000 picoseconds. - Weight::from_parts(27_281_000, 0) + // Minimum execution time: 23_465_000 picoseconds. + Weight::from_parts(23_837_000, 0) .saturating_add(Weight::from_parts(0, 11041)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -324,8 +324,8 @@ impl pallet_xcm::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `23` // Estimated: `3488` - // Minimum execution time: 40_728_000 picoseconds. - Weight::from_parts(41_907_000, 0) + // Minimum execution time: 37_279_000 picoseconds. + Weight::from_parts(37_745_000, 0) .saturating_add(Weight::from_parts(0, 3488)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/shibuya/src/weights/xcm/fungible.rs b/runtime/shibuya/src/weights/xcm/fungible.rs index f4b6ee13b6..6967023a36 100644 --- a/runtime/shibuya/src/weights/xcm/fungible.rs +++ b/runtime/shibuya/src/weights/xcm/fungible.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `xcm_benchmarks_fungible` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("shibuya-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=shibuya-dev +// --runtime=./target/release/wbuild/shibuya-runtime/shibuya_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=xcm_benchmarks_fungible // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/shibuya-dev/benchmarks_fungible_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/shibuya/runtime/benchmarks_fungible_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -61,10 +62,10 @@ impl SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) pub fn transfer_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `612` + // Measured: `542` // Estimated: `6232` - // Minimum execution time: 49_024_000 picoseconds. - Weight::from_parts(49_695_000, 0) + // Minimum execution time: 44_974_000 picoseconds. + Weight::from_parts(45_571_000, 0) .saturating_add(Weight::from_parts(0, 6232)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -81,19 +82,21 @@ impl SubstrateWeight { /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `846` + // Measured: `916` // Estimated: `6232` - // Minimum execution time: 70_022_000 picoseconds. - Weight::from_parts(70_900_000, 0) + // Minimum execution time: 73_405_000 picoseconds. + Weight::from_parts(74_178_000, 0) .saturating_add(Weight::from_parts(0, 6232)) .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `Benchmark::Override` (r:0 w:0) /// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -123,43 +126,43 @@ impl SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `UnifiedAccounts::NativeToEvm` (r:1 w:0) - /// Proof: `UnifiedAccounts::NativeToEvm` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`) pub fn withdraw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `2062` - // Estimated: `5527` - // Minimum execution time: 63_796_000 picoseconds. - Weight::from_parts(64_485_000, 0) - .saturating_add(Weight::from_parts(0, 5527)) - .saturating_add(T::DbWeight::get().reads(5)) + // Measured: `1988` + // Estimated: `5453` + // Minimum execution time: 51_592_000 picoseconds. + Weight::from_parts(52_520_000, 0) + .saturating_add(Weight::from_parts(0, 5453)) + .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } pub fn reserve_asset_deposited() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_265_000 picoseconds. - Weight::from_parts(1_299_000, 0) + // Minimum execution time: 1_242_000 picoseconds. + Weight::from_parts(1_327_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 85_835_000 picoseconds. - Weight::from_parts(86_880_000, 0) - .saturating_add(Weight::from_parts(0, 3699)) + // Measured: `374` + // Estimated: `3839` + // Minimum execution time: 90_489_000 picoseconds. + Weight::from_parts(92_320_000, 0) + .saturating_add(Weight::from_parts(0, 3839)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `XcAssetConfig::AssetLocationToId` (r:1 w:0) /// Proof: `XcAssetConfig::AssetLocationToId` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -171,11 +174,11 @@ impl SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) pub fn deposit_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `1798` - // Estimated: `5263` - // Minimum execution time: 47_586_000 picoseconds. - Weight::from_parts(48_429_000, 0) - .saturating_add(Weight::from_parts(0, 5263)) + // Measured: `1728` + // Estimated: `5193` + // Minimum execution time: 44_080_000 picoseconds. + Weight::from_parts(45_302_000, 0) + .saturating_add(Weight::from_parts(0, 5193)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -191,19 +194,21 @@ impl SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `2032` - // Estimated: `5497` - // Minimum execution time: 77_265_000 picoseconds. - Weight::from_parts(77_763_000, 0) - .saturating_add(Weight::from_parts(0, 5497)) + // Measured: `2102` + // Estimated: `5567` + // Minimum execution time: 80_866_000 picoseconds. + Weight::from_parts(81_486_000, 0) + .saturating_add(Weight::from_parts(0, 5567)) .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `XcAssetConfig::AssetLocationToId` (r:1 w:0) /// Proof: `XcAssetConfig::AssetLocationToId` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -217,18 +222,20 @@ impl SubstrateWeight { /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) pub fn initiate_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `2032` - // Estimated: `5497` - // Minimum execution time: 75_766_000 picoseconds. - Weight::from_parts(76_240_000, 0) - .saturating_add(Weight::from_parts(0, 5497)) + // Measured: `2102` + // Estimated: `5567` + // Minimum execution time: 79_584_000 picoseconds. + Weight::from_parts(80_171_000, 0) + .saturating_add(Weight::from_parts(0, 5567)) .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes(5)) } } diff --git a/runtime/shibuya/src/weights/xcm/generic.rs b/runtime/shibuya/src/weights/xcm/generic.rs index a01dadbfae..d90b73ff67 100644 --- a/runtime/shibuya/src/weights/xcm/generic.rs +++ b/runtime/shibuya/src/weights/xcm/generic.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `xcm_benchmarks_generic` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 +//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("shibuya-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=shibuya-dev +// --runtime=./target/release/wbuild/shibuya-runtime/shibuya_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=xcm_benchmarks_generic // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/shibuya-dev/benchmarks_generic_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/shibuya/runtime/benchmarks_generic_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -63,11 +64,11 @@ impl SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) pub fn buy_execution() -> Weight { // Proof Size summary in bytes: - // Measured: `723` - // Estimated: `4188` - // Minimum execution time: 21_908_000 picoseconds. - Weight::from_parts(22_210_000, 0) - .saturating_add(Weight::from_parts(0, 4188)) + // Measured: `686` + // Estimated: `4151` + // Minimum execution time: 16_195_000 picoseconds. + Weight::from_parts(16_545_000, 0) + .saturating_add(Weight::from_parts(0, 4151)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -155,19 +156,21 @@ impl SubstrateWeight { /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn report_holding() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 53_572_000 picoseconds. - Weight::from_parts(54_287_000, 0) - .saturating_add(Weight::from_parts(0, 3699)) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) + pub fn report_holding() -> Weight { + // Proof Size summary in bytes: + // Measured: `374` + // Estimated: `3839` + // Minimum execution time: 59_295_000 picoseconds. + Weight::from_parts(59_916_000, 0) + .saturating_add(Weight::from_parts(0, 3839)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) @@ -175,8 +178,8 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 7_475_000 picoseconds. - Weight::from_parts(7_671_000, 0) + // Minimum execution time: 6_708_000 picoseconds. + Weight::from_parts(6_829_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -185,8 +188,8 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 990_000 picoseconds. - Weight::from_parts(1_037_000, 0) + // Minimum execution time: 823_000 picoseconds. + Weight::from_parts(853_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::Queries` (r:1 w:0) @@ -195,62 +198,60 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 6_905_000 picoseconds. - Weight::from_parts(7_048_000, 0) + // Minimum execution time: 5_585_000 picoseconds. + Weight::from_parts(5_745_000, 0) .saturating_add(Weight::from_parts(0, 3465)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `TxPause::PausedCalls` (r:1 w:0) - /// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`) - pub fn transact() -> Weight { + pub fn transact() -> Weight { // Proof Size summary in bytes: - // Measured: `8` - // Estimated: `3997` - // Minimum execution time: 14_987_000 picoseconds. - Weight::from_parts(15_264_000, 0) - .saturating_add(Weight::from_parts(0, 3997)) - .saturating_add(T::DbWeight::get().reads(2)) + // Measured: `76` + // Estimated: `1489` + // Minimum execution time: 11_010_000 picoseconds. + Weight::from_parts(11_230_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_191_000 picoseconds. - Weight::from_parts(4_333_000, 0) + // Minimum execution time: 1_822_000 picoseconds. + Weight::from_parts(1_890_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 972_000 picoseconds. - Weight::from_parts(1_003_000, 0) + // Minimum execution time: 852_000 picoseconds. + Weight::from_parts(876_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 999_000 picoseconds. - Weight::from_parts(1_064_000, 0) + // Minimum execution time: 874_000 picoseconds. + Weight::from_parts(913_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 966_000 picoseconds. - Weight::from_parts(1_022_000, 0) + // Minimum execution time: 773_000 picoseconds. + Weight::from_parts(822_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_035_000 picoseconds. - Weight::from_parts(1_103_000, 0) + // Minimum execution time: 828_000 picoseconds. + Weight::from_parts(861_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `Benchmark::Override` (r:0 w:0) @@ -267,27 +268,29 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 971_000 picoseconds. - Weight::from_parts(1_029_000, 0) + // Minimum execution time: 786_000 picoseconds. + Weight::from_parts(831_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn report_error() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 20_921_000 picoseconds. - Weight::from_parts(21_307_000, 0) - .saturating_add(Weight::from_parts(0, 3699)) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) + pub fn report_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `374` + // Estimated: `3839` + // Minimum execution time: 27_404_000 picoseconds. + Weight::from_parts(27_811_000, 0) + .saturating_add(Weight::from_parts(0, 3839)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) /// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -295,8 +298,8 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `23` // Estimated: `3488` - // Minimum execution time: 10_523_000 picoseconds. - Weight::from_parts(10_856_000, 0) + // Minimum execution time: 8_936_000 picoseconds. + Weight::from_parts(9_148_000, 0) .saturating_add(Weight::from_parts(0, 3488)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -305,8 +308,8 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 991_000 picoseconds. - Weight::from_parts(1_022_000, 0) + // Minimum execution time: 3_766_000 picoseconds. + Weight::from_parts(3_905_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1) @@ -319,11 +322,11 @@ impl SubstrateWeight { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: - // Measured: `131` - // Estimated: `3596` - // Minimum execution time: 21_737_000 picoseconds. - Weight::from_parts(21_911_000, 0) - .saturating_add(Weight::from_parts(0, 3596)) + // Measured: `168` + // Estimated: `3633` + // Minimum execution time: 22_125_000 picoseconds. + Weight::from_parts(22_586_000, 0) + .saturating_add(Weight::from_parts(0, 3633)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -333,8 +336,8 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_375_000 picoseconds. - Weight::from_parts(3_482_000, 0) + // Minimum execution time: 2_982_000 picoseconds. + Weight::from_parts(3_089_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -342,124 +345,128 @@ impl SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 24_240_000 picoseconds. - Weight::from_parts(24_437_000, 0) + // Minimum execution time: 21_856_000 picoseconds. + Weight::from_parts(21_989_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_490_000 picoseconds. - Weight::from_parts(8_775_000, 0) + // Minimum execution time: 7_762_000 picoseconds. + Weight::from_parts(7_848_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 968_000 picoseconds. - Weight::from_parts(1_005_000, 0) + // Minimum execution time: 3_780_000 picoseconds. + Weight::from_parts(3_922_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 955_000 picoseconds. - Weight::from_parts(1_008_000, 0) + // Minimum execution time: 3_768_000 picoseconds. + Weight::from_parts(3_862_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_139_000 picoseconds. - Weight::from_parts(1_173_000, 0) + // Minimum execution time: 899_000 picoseconds. + Weight::from_parts(940_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn query_pallet() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 28_867_000 picoseconds. - Weight::from_parts(29_201_000, 0) - .saturating_add(Weight::from_parts(0, 3699)) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) + pub fn query_pallet() -> Weight { + // Proof Size summary in bytes: + // Measured: `374` + // Estimated: `3839` + // Minimum execution time: 33_826_000 picoseconds. + Weight::from_parts(34_210_000, 0) + .saturating_add(Weight::from_parts(0, 3839)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(2)) } pub fn expect_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_276_000 picoseconds. - Weight::from_parts(7_416_000, 0) + // Minimum execution time: 5_307_000 picoseconds. + Weight::from_parts(5_416_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) - /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - pub fn report_transact_status() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 20_915_000 picoseconds. - Weight::from_parts(21_473_000, 0) - .saturating_add(Weight::from_parts(0, 3699)) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(131106), added: 133581, mode: `MaxEncodedLen`) + pub fn report_transact_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `374` + // Estimated: `3839` + // Minimum execution time: 27_613_000 picoseconds. + Weight::from_parts(28_057_000, 0) + .saturating_add(Weight::from_parts(0, 3839)) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(2)) } pub fn clear_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_030_000 picoseconds. - Weight::from_parts(1_083_000, 0) + // Minimum execution time: 811_000 picoseconds. + Weight::from_parts(838_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 981_000 picoseconds. - Weight::from_parts(1_053_000, 0) + // Minimum execution time: 779_000 picoseconds. + Weight::from_parts(807_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 973_000 picoseconds. - Weight::from_parts(1_009_000, 0) + // Minimum execution time: 777_000 picoseconds. + Weight::from_parts(810_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_013_000 picoseconds. - Weight::from_parts(1_053_000, 0) + // Minimum execution time: 766_000 picoseconds. + Weight::from_parts(813_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 992_000 picoseconds. - Weight::from_parts(1_060_000, 0) + // Minimum execution time: 799_000 picoseconds. + Weight::from_parts(834_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } From d21b0d1f4b53771b5b052f52a656f94ffc071653 Mon Sep 17 00:00:00 2001 From: Igor Papandinas <26460174+ipapandinas@users.noreply.github.com> Date: Tue, 26 May 2026 10:50:39 +0100 Subject: [PATCH 6/6] fmt --- Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5a7066247..653e27004d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -333,8 +333,6 @@ pallet-evm-precompile-xcm = { path = "./precompiles/xcm", default-features = fal pallet-evm-precompile-dapp-staking = { path = "./precompiles/dapp-staking", default-features = false } pallet-evm-precompile-dispatch-lockdrop = { path = "./precompiles/dispatch-lockdrop", default-features = false } - - shibuya-runtime = { path = "./runtime/shibuya", default-features = false } shiden-runtime = { path = "./runtime/shiden", default-features = false } astar-runtime = { path = "./runtime/astar", default-features = false }