diff --git a/Cargo.lock b/Cargo.lock
index d3e973af3..5c5a5f695 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -619,7 +619,7 @@ dependencies = [
[[package]]
name = "astar-collator"
-version = "5.36.0"
+version = "5.37.0"
dependencies = [
"astar-primitives",
"astar-runtime",
@@ -753,7 +753,7 @@ dependencies = [
[[package]]
name = "astar-runtime"
-version = "5.36.0"
+version = "5.37.0"
dependencies = [
"array-bytes",
"astar-primitives",
@@ -788,6 +788,7 @@ dependencies = [
"pallet-aura",
"pallet-authorship",
"pallet-balances",
+ "pallet-chain-extension-assets",
"pallet-collator-selection",
"pallet-contracts",
"pallet-contracts-primitives",
@@ -802,6 +803,7 @@ dependencies = [
"pallet-evm-precompile-bn128",
"pallet-evm-precompile-dapp-staking-v3",
"pallet-evm-precompile-dispatch",
+ "pallet-evm-precompile-dispatch-lockdrop",
"pallet-evm-precompile-ed25519",
"pallet-evm-precompile-modexp",
"pallet-evm-precompile-sha3fips",
@@ -6625,7 +6627,7 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "local-runtime"
-version = "5.36.0"
+version = "5.37.0"
dependencies = [
"array-bytes",
"astar-primitives",
@@ -13989,7 +13991,7 @@ dependencies = [
[[package]]
name = "shibuya-runtime"
-version = "5.36.0"
+version = "5.37.0"
dependencies = [
"array-bytes",
"astar-primitives",
@@ -14109,7 +14111,7 @@ dependencies = [
[[package]]
name = "shiden-runtime"
-version = "5.36.0"
+version = "5.37.0"
dependencies = [
"array-bytes",
"astar-primitives",
diff --git a/bin/collator/Cargo.toml b/bin/collator/Cargo.toml
index 9bfc01ea2..a6097c41f 100644
--- a/bin/collator/Cargo.toml
+++ b/bin/collator/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "astar-collator"
-version = "5.36.0"
+version = "5.37.0"
description = "Astar collator implementation in Rust."
build = "build.rs"
default-run = "astar-collator"
diff --git a/runtime/astar/Cargo.toml b/runtime/astar/Cargo.toml
index 75b4c0fca..0aa85c357 100644
--- a/runtime/astar/Cargo.toml
+++ b/runtime/astar/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "astar-runtime"
-version = "5.36.0"
+version = "5.37.0"
build = "build.rs"
authors.workspace = true
edition.workspace = true
@@ -107,6 +107,7 @@ pallet-dapp-staking-v3 = { workspace = true }
pallet-dapps-staking = { workspace = true }
pallet-evm-precompile-assets-erc20 = { workspace = true }
pallet-evm-precompile-dapp-staking-v3 = { 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-xcm = { workspace = true }
@@ -123,6 +124,9 @@ moonbeam-rpc-primitives-debug = { workspace = true, optional = true }
moonbeam-rpc-primitives-txpool = { workspace = true, optional = true }
precompile-utils = { workspace = true }
+# chain-extensions
+pallet-chain-extension-assets = { workspace = true }
+
[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true }
@@ -171,6 +175,7 @@ std = [
"pallet-evm-precompile-simple/std",
"pallet-evm-precompile-bn128/std",
"pallet-evm-precompile-dispatch/std",
+ "pallet-evm-precompile-dispatch-lockdrop/std",
"pallet-evm-precompile-ed25519/std",
"pallet-evm-precompile-modexp/std",
"pallet-evm-precompile-sha3fips/std",
@@ -210,6 +215,7 @@ std = [
"xcm-executor/std",
"pallet-xc-asset-config/std",
"substrate-wasm-builder",
+ "pallet-chain-extension-assets/std",
"orml-xtokens/std",
"orml-xcm-support/std",
"astar-primitives/std",
diff --git a/runtime/astar/src/chain_extensions.rs b/runtime/astar/src/chain_extensions.rs
new file mode 100644
index 000000000..6744b643b
--- /dev/null
+++ b/runtime/astar/src/chain_extensions.rs
@@ -0,0 +1,30 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+use super::Runtime;
+
+/// Registered WASM contracts chain extensions.
+pub use pallet_chain_extension_assets::AssetsExtension;
+use pallet_contracts::chain_extension::RegisteredChainExtension;
+
+// Following impls defines chain extension IDs.
+impl RegisteredChainExtension for AssetsExtension {
+ const ID: u16 = 02;
+}
+
+pub type AstarChainExtensions = AssetsExtension;
diff --git a/runtime/astar/src/lib.rs b/runtime/astar/src/lib.rs
index 71552f056..70ec9bc66 100644
--- a/runtime/astar/src/lib.rs
+++ b/runtime/astar/src/lib.rs
@@ -92,6 +92,7 @@ pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
+mod chain_extensions;
mod precompiles;
mod weights;
mod xcm_config;
@@ -101,6 +102,8 @@ pub type AstarAssetLocationIdConverter = AssetLocationIdConverter;
+use chain_extensions::AstarChainExtensions;
+
/// Constant values used within the runtime.
pub const MICROASTR: Balance = 1_000_000_000_000;
pub const MILLIASTR: Balance = 1_000 * MICROASTR;
@@ -148,7 +151,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("astar"),
impl_name: create_runtime_str!("astar"),
authoring_version: 1,
- spec_version: 84,
+ spec_version: 85,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
@@ -669,7 +672,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 = ();
+ type ChainExtension = AstarChainExtensions;
type Schedule = Schedule;
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
type MaxCodeLen = ConstU32<{ 123 * 1024 }>;
diff --git a/runtime/astar/src/precompiles.rs b/runtime/astar/src/precompiles.rs
index d19aebecc..cd2ed4014 100644
--- a/runtime/astar/src/precompiles.rs
+++ b/runtime/astar/src/precompiles.rs
@@ -26,6 +26,7 @@ use pallet_evm_precompile_blake2::Blake2F;
use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing};
use pallet_evm_precompile_dapp_staking_v3::DappStakingV3Precompile;
use pallet_evm_precompile_dispatch::Dispatch;
+use pallet_evm_precompile_dispatch_lockdrop::DispatchLockdrop;
use pallet_evm_precompile_ed25519::Ed25519Verify;
use pallet_evm_precompile_modexp::Modexp;
use pallet_evm_precompile_sha3fips::Sha3FIPS256;
@@ -34,6 +35,7 @@ use pallet_evm_precompile_sr25519::Sr25519Precompile;
use pallet_evm_precompile_substrate_ecdsa::SubstrateEcdsaPrecompile;
use pallet_evm_precompile_xcm::XcmPrecompile;
use precompile_utils::precompile_set::*;
+use sp_core::ConstU32;
use sp_std::fmt::Debug;
/// The asset precompile address prefix. Addresses that match against this prefix will be routed
@@ -65,6 +67,32 @@ impl Contains for WhitelistedCalls {
}
}
}
+
+/// Filter that only allows whitelisted runtime call to pass through dispatch-lockdrop precompile
+pub struct WhitelistedLockdropCalls;
+
+impl Contains for WhitelistedLockdropCalls {
+ fn contains(t: &RuntimeCall) -> bool {
+ match t {
+ RuntimeCall::Utility(pallet_utility::Call::batch { calls })
+ | RuntimeCall::Utility(pallet_utility::Call::batch_all { calls }) => calls
+ .iter()
+ .all(|call| WhitelistedLockdropCalls::contains(call)),
+ RuntimeCall::DappStaking(pallet_dapp_staking_v3::Call::unbond_and_unstake {
+ ..
+ }) => true,
+ RuntimeCall::DappStaking(pallet_dapp_staking_v3::Call::withdraw_unbonded {
+ ..
+ }) => true,
+ RuntimeCall::Balances(pallet_balances::Call::transfer_all { .. }) => true,
+ RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { .. }) => true,
+ RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { .. }) => true,
+ RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true,
+ _ => false,
+ }
+ }
+}
+
/// The PrecompileSet installed in the Astar runtime.
#[precompile_utils::precompile_name_from_address]
pub type AstarPrecompilesSetAt = (
@@ -115,6 +143,18 @@ pub type AstarPrecompilesSetAt = (
CallableByPrecompile,
),
>,
+ // Skipping 20485 and 20486 to make sure all network have consistent
+ // precompiles address
+ PrecompileAt<
+ AddressU64<20487>,
+ DispatchLockdrop<
+ R,
+ DispatchFilterValidate,
+ ConstU32<8>,
+ >,
+ // Not callable from smart contract nor precompiled, only EOA accounts
+ (),
+ >,
);
pub type AstarPrecompiles = PrecompileSetBuilder<
@@ -123,7 +163,7 @@ pub type AstarPrecompiles = PrecompileSetBuilder<
// Skip precompiles if out of range.
PrecompilesInRangeInclusive<
// We take range as last precompile index, UPDATE this once new prcompile is added
- (AddressU64<1>, AddressU64<20484>),
+ (AddressU64<1>, AddressU64<20487>),
AstarPrecompilesSetAt,
>,
// Prefixed precompile sets (XC20)
diff --git a/runtime/local/Cargo.toml b/runtime/local/Cargo.toml
index 1fbf077f6..179ecfd85 100644
--- a/runtime/local/Cargo.toml
+++ b/runtime/local/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "local-runtime"
-version = "5.36.0"
+version = "5.37.0"
build = "build.rs"
authors.workspace = true
edition.workspace = true
diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml
index 15aec0925..f8d87232b 100644
--- a/runtime/shibuya/Cargo.toml
+++ b/runtime/shibuya/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "shibuya-runtime"
-version = "5.36.0"
+version = "5.37.0"
build = "build.rs"
authors.workspace = true
edition.workspace = true
diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs
index ff601784b..959ab1c1c 100644
--- a/runtime/shibuya/src/lib.rs
+++ b/runtime/shibuya/src/lib.rs
@@ -174,7 +174,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shibuya"),
impl_name: create_runtime_str!("shibuya"),
authoring_version: 1,
- spec_version: 126,
+ spec_version: 127,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
@@ -1459,33 +1459,7 @@ pub type Executive = frame_executive::Executive<
/// All migrations that will run on the next runtime upgrade.
///
/// Once done, migrations should be removed from the tuple.
-pub type Migrations = (
- OracleIntegrationLogic,
- pallet_price_aggregator::PriceAggregatorInitializer,
-);
-
-pub struct InitPrice;
-impl Get for InitPrice {
- fn get() -> CurrencyAmount {
- // 0.15 $
- CurrencyAmount::from_rational(15, 100)
- }
-}
-
-use frame_support::traits::OnRuntimeUpgrade;
-pub struct OracleIntegrationLogic;
-impl OnRuntimeUpgrade for OracleIntegrationLogic {
- fn on_runtime_upgrade() -> Weight {
- // 1. Set initial storage versions for the membership pallet
- use frame_support::traits::StorageVersion;
- StorageVersion::new(4)
- .put::>();
-
- // No storage version for the `orml_oracle` pallet, it's essentially 0
-
- ::DbWeight::get().writes(1)
- }
-}
+pub type Migrations = ();
type EventRecord = frame_system::EventRecord<
::RuntimeEvent,
diff --git a/runtime/shiden/Cargo.toml b/runtime/shiden/Cargo.toml
index 4e1862ccf..1b65b7c40 100644
--- a/runtime/shiden/Cargo.toml
+++ b/runtime/shiden/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "shiden-runtime"
-version = "5.36.0"
+version = "5.37.0"
build = "build.rs"
authors.workspace = true
edition.workspace = true
diff --git a/runtime/shiden/src/lib.rs b/runtime/shiden/src/lib.rs
index 195be1df5..319ac7cef 100644
--- a/runtime/shiden/src/lib.rs
+++ b/runtime/shiden/src/lib.rs
@@ -153,7 +153,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shiden"),
impl_name: create_runtime_str!("shiden"),
authoring_version: 1,
- spec_version: 123,
+ spec_version: 124,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
@@ -1129,40 +1129,7 @@ parameter_types! {
/// All migrations that will run on the next runtime upgrade.
///
/// Once done, migrations should be removed from the tuple.
-pub type Migrations = (pallet_static_price_provider::ActivePriceUpdate,);
-
-use frame_support::traits::OnRuntimeUpgrade;
-pub struct SetNewTierConfig;
-impl OnRuntimeUpgrade for SetNewTierConfig {
- fn on_runtime_upgrade() -> Weight {
- use astar_primitives::oracle::PriceProvider;
- use frame_support::BoundedVec;
-
- // Set new init tier config values according to the forum post
- let mut init_tier_config = pallet_dapp_staking_v3::TierConfig::::get();
- init_tier_config.number_of_slots = 55;
- init_tier_config.slots_per_tier =
- BoundedVec::try_from(vec![2, 11, 16, 24]).unwrap_or_default();
-
- #[cfg(feature = "try-runtime")]
- {
- assert!(
- init_tier_config.number_of_slots >= init_tier_config.slots_per_tier.iter().sum::() as u16,
- "Safety check, sum of slots per tier must be equal or less than max number of slots (due to possible rounding)"
- );
- }
-
- // Based on the new init config, calculate the new tier config based on the 'average' price
- let price = StaticPriceProvider::average_price();
- let tier_params = pallet_dapp_staking_v3::StaticTierParams::::get();
-
- let new_tier_config = init_tier_config.calculate_new(price, &tier_params);
-
- pallet_dapp_staking_v3::TierConfig::::put(new_tier_config);
-
- ::DbWeight::get().reads_writes(3, 1)
- }
-}
+pub type Migrations = ();
type EventRecord = frame_system::EventRecord<
::RuntimeEvent,
diff --git a/runtime/shiden/src/precompiles.rs b/runtime/shiden/src/precompiles.rs
index ab7ecdece..9de966c18 100644
--- a/runtime/shiden/src/precompiles.rs
+++ b/runtime/shiden/src/precompiles.rs
@@ -142,8 +142,10 @@ pub type ShidenPrecompilesSetAt = (
CallableByPrecompile,
),
>,
+ // Skipping 20485 and 20486 to make sure all network have consistent
+ // precompiles address
PrecompileAt<
- AddressU64<20485>,
+ AddressU64<20487>,
DispatchLockdrop<
R,
DispatchFilterValidate,
@@ -160,7 +162,7 @@ pub type ShidenPrecompiles = PrecompileSetBuilder<
// Skip precompiles if out of range.
PrecompilesInRangeInclusive<
// We take range as last precompile index, UPDATE this once new prcompile is added
- (AddressU64<1>, AddressU64<20485>),
+ (AddressU64<1>, AddressU64<20487>),
ShidenPrecompilesSetAt,
>,
// Prefixed precompile sets (XC20)
diff --git a/tests/integration/src/lib.rs b/tests/integration/src/lib.rs
index 59b5062b5..7b494d1d0 100644
--- a/tests/integration/src/lib.rs
+++ b/tests/integration/src/lib.rs
@@ -41,7 +41,7 @@ mod unified_accounts;
#[cfg(any(feature = "shibuya", feature = "shiden", feature = "astar"))]
mod dapp_staking_v3;
-#[cfg(any(feature = "shibuya", feature = "shiden"))]
+#[cfg(any(feature = "shibuya", feature = "shiden", feature = "astar"))]
mod assets_chain_extensions;
#[cfg(any(feature = "shibuya"))]