From 0e973984f96e37c77da788c166e1ce2b66e5b9c7 Mon Sep 17 00:00:00 2001 From: William Freudenberger Date: Wed, 1 Nov 2023 17:00:37 +0100 Subject: [PATCH] debug: add SUDO to Centrifuge runtime for chopticks usage --- Cargo.lock | 1 + runtime/centrifuge/Cargo.toml | 5 +++++ runtime/centrifuge/src/lib.rs | 13 ++++++++++++- src/chain_spec.rs | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index a54105c53d..dc91f92c8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1221,6 +1221,7 @@ dependencies = [ "pallet-rewards", "pallet-scheduler", "pallet-session", + "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index f0b814a988..0262ac6e0b 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -9,6 +9,9 @@ homepage = "https://centrifuge.io/" repository = "https://github.com/centrifuge/centrifuge-chain" [dependencies] +# WARNING: This dependency should never be merged into production. The purpose is to streamline chopsticks integration. +pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } + # third-party dependencies codec = { package = "parity-scale-codec", version = "3.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.3.4", default-features = false } @@ -259,6 +262,7 @@ std = [ "xcm-primitives/std", "xcm/std", "axelar-gateway-precompile/std", + "pallet-sudo/std", ] runtime-benchmarks = [ @@ -412,6 +416,7 @@ try-runtime = [ "runtime-common/try-runtime", "sp-runtime/try-runtime", "axelar-gateway-precompile/try-runtime", + "pallet-sudo/std", ] # A feature that should be enabled when the runtime should be build for on-chain diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 6ab2b6d205..170f013471 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -76,11 +76,12 @@ use pallet_restricted_tokens::{ pub use pallet_timestamp::Call as TimestampCall; pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment}; use pallet_transaction_payment_rpc_runtime_api::{FeeDetails, RuntimeDispatchInfo}; +use pallet_uniques::mock::{Balances, Uniques}; use polkadot_runtime_common::{prod_or_fast, BlockHashCount, SlowAdjustingFeeUpdate}; use runtime_common::{account_conversion::AccountConverter, xcm::AccountIdToMultiLocation}; use scale_info::TypeInfo; use sp_api::impl_runtime_apis; -use sp_core::{OpaqueMetadata, H160, H256, U256}; +use sp_core::{offchain::Timestamp, OpaqueMetadata, H160, H256, U256}; use sp_inherents::{CheckInherentsResult, InherentData}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -1819,6 +1820,12 @@ impl pallet_order_book::Config for Runtime { type Weights = weights::pallet_order_book::WeightInfo; } +// WARNING: Never merge into production! +impl pallet_sudo::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; +} + // Frame Order in this block dictates the index of each one in the metadata // Any addition should be done at the bottom // Any deletion affects the following frames during runtime upgrades @@ -1835,6 +1842,9 @@ construct_runtime!( Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, + // WARNING: Never merge into production + Sudo: pallet_sudo = 10, + // money stuff Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 20, TransactionPayment: pallet_transaction_payment::{Event, Pallet, Storage} = 21, @@ -1987,6 +1997,7 @@ mod __runtime_api_use { #[cfg(not(feature = "disable-runtime-api"))] use __runtime_api_use::*; +use cfg_traits::{fees::Fees, interest::InterestAccrual}; #[cfg(not(feature = "disable-runtime-api"))] impl_runtime_apis! { diff --git a/src/chain_spec.rs b/src/chain_spec.rs index 0363d00a64..6ebaaa64a2 100644 --- a/src/chain_spec.rs +++ b/src/chain_spec.rs @@ -672,6 +672,7 @@ fn centrifuge_genesis( polkadot_xcm: centrifuge_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, + sudo: Default::default(), } }