Skip to content
Merged
21 changes: 19 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ members = [
"substrate/frame/assets",
"substrate/frame/assets-freezer",
"substrate/frame/assets-holder",
"substrate/frame/assets/precompiles",
"substrate/frame/atomic-swap",
"substrate/frame/aura",
"substrate/frame/authority-discovery",
Expand Down Expand Up @@ -951,6 +952,7 @@ pallet-asset-tx-payment = { path = "substrate/frame/transaction-payment/asset-tx
pallet-assets = { path = "substrate/frame/assets", default-features = false }
pallet-assets-freezer = { path = "substrate/frame/assets-freezer", default-features = false }
pallet-assets-holder = { path = "substrate/frame/assets-holder", default-features = false }
pallet-assets-precompiles = { path = "substrate/frame/assets/precompiles", default-features = false }
pallet-atomic-swap = { default-features = false, path = "substrate/frame/atomic-swap" }
pallet-aura = { path = "substrate/frame/aura", default-features = false }
pallet-authority-discovery = { path = "substrate/frame/authority-discovery", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pallet-asset-rate = { workspace = true }
pallet-asset-rewards = { workspace = true }
pallet-assets = { workspace = true }
pallet-assets-freezer = { workspace = true }
pallet-assets-precompiles = { workspace = true }
pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-bags-list = { workspace = true }
Expand Down Expand Up @@ -165,6 +166,7 @@ runtime-benchmarks = [
"pallet-asset-rate/runtime-benchmarks",
"pallet-asset-rewards/runtime-benchmarks",
"pallet-assets-freezer/runtime-benchmarks",
"pallet-assets-precompiles/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-bags-list/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
Expand Down Expand Up @@ -233,6 +235,7 @@ try-runtime = [
"pallet-asset-rate/try-runtime",
"pallet-asset-rewards/try-runtime",
"pallet-assets-freezer/try-runtime",
"pallet-assets-precompiles/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
Expand Down Expand Up @@ -311,6 +314,7 @@ std = [
"pallet-asset-rate/std",
"pallet-asset-rewards/std",
"pallet-assets-freezer/std",
"pallet-assets-precompiles/std",
"pallet-assets/std",
"pallet-aura/std",
"pallet-authorship/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use frame_system::{
EnsureRoot, EnsureSigned, EnsureSignedBy,
};
use pallet_asset_conversion_tx_payment::SwapAssetAdapter;
use pallet_assets::precompiles::{InlineIdConfig, ERC20};
use pallet_assets_precompiles::{InlineIdConfig, ERC20};
use pallet_nfts::{DestroyWitness, PalletFeatures};
use pallet_nomination_pools::PoolId;
use pallet_revive::evm::runtime::EthExtra;
Expand Down
13 changes: 13 additions & 0 deletions prdoc/pr_9796.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: "pallet-assets: extract precompiles to its own pallet"

doc:
- audience: Runtime Dev
description: |
Assets pallet includes pallet-revive precompiles and subsequently pull a lot of EVM related dependencies by default. This change
extracts the precompiles into a new pallet `pallet-assets-precompiles`.

crates:
- name: pallet-assets
bump: minor
- name: pallet-assets-precompiles
bump: minor
6 changes: 3 additions & 3 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub use node_primitives::{AccountId, Signature};
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce};
use pallet_asset_conversion::{AccountIdConverter, Ascending, Chain, WithFirstAsset};
use pallet_asset_conversion_tx_payment::SwapAssetAdapter;
use pallet_assets::precompiles::{InlineIdConfig, ERC20};
use pallet_assets_precompiles::{InlineIdConfig, ERC20};
use pallet_broker::{CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600};
use pallet_election_provider_multi_phase::{GeometricDepositBase, SolutionAccuracyOf};
use pallet_identity::legacy::IdentityInfo;
Expand Down Expand Up @@ -2480,11 +2480,11 @@ impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParamet
match key {
RuntimeParametersKey::Storage(_) => {
frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
return Ok(())
return Ok(());
},
RuntimeParametersKey::Referenda(_) => {
frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
return Ok(())
return Ok(());
},
}
}
Expand Down
5 changes: 0 additions & 5 deletions substrate/frame/assets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { workspace = true }
ethereum-standards = { workspace = true }
impl-trait-for-tuples = { workspace = true }
log = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
Expand All @@ -28,7 +27,6 @@ frame-support = { workspace = true }
# `system` module provides us with all sorts of useful stuff and macros depend on it being around.
frame-benchmarking = { optional = true, workspace = true }
frame-system = { workspace = true }
pallet-revive = { workspace = true }
sp-core = { workspace = true }

[dev-dependencies]
Expand All @@ -44,7 +42,6 @@ std = [
"frame-system/std",
"log/std",
"pallet-balances/std",
"pallet-revive/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
Expand All @@ -55,13 +52,11 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-revive/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-revive/try-runtime",
"sp-runtime/try-runtime",
]
61 changes: 61 additions & 0 deletions substrate/frame/assets/precompiles/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[package]
name = "pallet-assets-precompiles"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "Provides precompiles for `pallet-assets`"

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ethereum-standards = { workspace = true }
frame-support = { workspace = true }
pallet-assets = { workspace = true }
pallet-revive = { workspace = true }

[dev-dependencies]
codec = { workspace = true }
frame-system = { workspace = true }
pallet-balances = { workspace = true }
scale-info = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }

[features]
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"pallet-assets/std",
"pallet-balances/std",
"pallet-revive/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-revive/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-assets/try-runtime",
"pallet-balances/try-runtime",
"pallet-revive/try-runtime",
"sp-runtime/try-runtime",
]
Loading
Loading