From b91aef7cd6bc18f0f0060f3ba3c5133850407eb5 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Wed, 25 Jan 2023 22:06:19 +0100 Subject: [PATCH] Make node capable of handling minimal runtime --- Cargo.lock | 15 +-- Cargo.toml | 8 +- node/Cargo.toml | 1 - node/src/chain_spec/additional_chain_spec.rs | 1 - node/src/chain_spec/mod.rs | 24 ----- node/src/chain_spec/zeitgeist.rs | 86 +++++++++------- node/src/main.rs | 2 +- node/src/rpc.rs | 3 - node/src/service.rs | 4 +- runtime/battery-station/src/lib.rs | 34 +------ runtime/common/src/lib.rs | 99 +++++++++--------- runtime/zeitgeist/Cargo.toml | 3 + runtime/zeitgeist/src/lib.rs | 101 ++----------------- zrml/swaps/rpc/src/lib.rs | 3 - 14 files changed, 121 insertions(+), 263 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0e78e4f6..91f707a49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12724,7 +12724,6 @@ dependencies = [ "zeitgeist-primitives", "zeitgeist-runtime", "zrml-liquidity-mining", - "zrml-swaps-rpc", ] [[package]] @@ -12795,6 +12794,7 @@ dependencies = [ "pallet-proxy", "pallet-randomness-collective-flip", "pallet-scheduler", + "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -13151,19 +13151,6 @@ dependencies = [ "zrml-swaps", ] -[[package]] -name = "zrml-swaps-rpc" -version = "0.3.8" -dependencies = [ - "jsonrpsee", - "parity-scale-codec", - "sp-api", - "sp-blockchain", - "sp-runtime", - "zeitgeist-primitives", - "zrml-swaps-runtime-api", -] - [[package]] name = "zrml-swaps-runtime-api" version = "0.3.8" diff --git a/Cargo.toml b/Cargo.toml index d38578d8b..345b4c47f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ default-members = [ "zrml/rikiddo", "zrml/simple-disputes", "zrml/swaps", - "zrml/swaps/rpc", - "zrml/swaps/runtime-api", +# "zrml/swaps/rpc", +# "zrml/swaps/runtime-api", "zrml/styx", ] members = [ @@ -41,8 +41,8 @@ members = [ "zrml/simple-disputes", "zrml/swaps", "zrml/swaps/fuzz", - "zrml/swaps/rpc", - "zrml/swaps/runtime-api", +# "zrml/swaps/rpc", +# "zrml/swaps/runtime-api", "zrml/styx", ] resolver = "2" diff --git a/node/Cargo.toml b/node/Cargo.toml index a66b5e24b..b1ff68885 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -106,7 +106,6 @@ battery-station-runtime = { path = "../runtime/battery-station", optional = true zeitgeist-primitives = { path = "../primitives" } zeitgeist-runtime = { path = "../runtime/zeitgeist", optional = true } zrml-liquidity-mining = { path = "../zrml/liquidity-mining" } -zrml-swaps-rpc = { path = "../zrml/swaps/rpc" } [features] default = ["with-battery-station-runtime", "with-zeitgeist-runtime"] parachain = [ diff --git a/node/src/chain_spec/additional_chain_spec.rs b/node/src/chain_spec/additional_chain_spec.rs index de4c9e73b..43fb925fd 100644 --- a/node/src/chain_spec/additional_chain_spec.rs +++ b/node/src/chain_spec/additional_chain_spec.rs @@ -29,7 +29,6 @@ pub struct AdditionalChainSpec { pub blocks_per_round: u32, pub candidates: Vec<(AccountId, NimbusId, Balance)>, pub collator_commission: Perbill, - pub crowdloan_fund_pot: Balance, pub inflation_info: InflationInfo, pub nominations: Vec<(AccountId, AccountId, Balance, Percent)>, pub parachain_bond_reserve_percent: Percent, diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 58340be30..d95845d2f 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -103,11 +103,6 @@ macro_rules! generate_generic_genesis_function { ) -> $runtime::GenesisConfig { $runtime::GenesisConfig { // Common genesis - advisory_committee: Default::default(), - advisory_committee_membership: $runtime::AdvisoryCommitteeMembershipConfig { - members: vec![].try_into().unwrap(), - phantom: Default::default(), - }, #[cfg(feature = "parachain")] asset_registry: Default::default(), #[cfg(not(feature = "parachain"))] @@ -130,22 +125,10 @@ macro_rules! generate_generic_genesis_function { balances: $runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k.0, k.1)).collect(), }, - council: Default::default(), - council_membership: $runtime::CouncilMembershipConfig { - members: vec![].try_into().unwrap(), - phantom: Default::default(), - }, - #[cfg(feature = "parachain")] - crowdloan: $runtime::CrowdloanConfig { funded_amount: acs.crowdloan_fund_pot }, - democracy: Default::default(), #[cfg(not(feature = "parachain"))] grandpa: $runtime::GrandpaConfig { authorities: acs.initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(), }, - liquidity_mining: $runtime::LiquidityMiningConfig { - initial_balance: LIQUIDITY_MINING, - per_block_distribution: LIQUIDITY_MINING_PTD.mul_ceil(LIQUIDITY_MINING), - }, #[cfg(feature = "parachain")] parachain_info: $runtime::ParachainInfoConfig { parachain_id: acs.parachain_id }, #[cfg(feature = "parachain")] @@ -168,15 +151,8 @@ macro_rules! generate_generic_genesis_function { // Default should use the pallet configuration polkadot_xcm: PolkadotXcmConfig::default(), system: $runtime::SystemConfig { code: wasm_binary.to_vec() }, - technical_committee: Default::default(), - technical_committee_membership: $runtime::TechnicalCommitteeMembershipConfig { - members: vec![].try_into().unwrap(), - phantom: Default::default(), - }, - treasury: Default::default(), transaction_payment: Default::default(), tokens: Default::default(), - vesting: Default::default(), // Additional genesis $($additional_genesis)* diff --git a/node/src/chain_spec/zeitgeist.rs b/node/src/chain_spec/zeitgeist.rs index b5990c7bd..278f177f8 100644 --- a/node/src/chain_spec/zeitgeist.rs +++ b/node/src/chain_spec/zeitgeist.rs @@ -24,7 +24,10 @@ use sc_service::ChainType; use sp_core::crypto::UncheckedInto; use zeitgeist_runtime::parameters::SS58Prefix; -use zeitgeist_primitives::constants::ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD}; +use zeitgeist_primitives::{types::{AccountId,Balance}, constants::{ + BASE, + ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD} +}}; #[cfg(feature = "parachain")] use { @@ -48,26 +51,29 @@ cfg_if::cfg_if! { } } +const DEFAULT_SUDO_BALANCE: Balance = 1000 * BASE; + fn endowed_accounts_staging_zeitgeist() -> Vec { vec![ - // dDzt4vaprRfHqGBat44bWD4i36WMDXjsGXmCHoxMom2eQgQCd + // dE4NNpcWPCk8TH3GM9eJV1jauEmHC3rQcxMdnTtrc3NgDGUNo #[cfg(feature = "parachain")] EndowedAccountWithBalance( - hex!["524e9aac979cbb9ecdb7acd1635755c3b15696321a3345ca77f0ab0ae23f675a"].into(), - DEFAULT_COLLATOR_BALANCE_ZEITGEIST.unwrap(), + hex!["ec9a6c37972582ce411546f96f806cfc2bb0670f60c30cbc3ad4276834b0253c"].into(), + DEFAULT_COLLATOR_BALANCE_RAUMGEIST.unwrap(), ), - // dDy7WSPy4pvWBKsUta8MdWxduWFTpJtv9zgBiVGtqWmMh6bi6 + // dDzXWuvDPSRXMQFAq2cJdr9NtEjtB8bohFhE3Ap9yM9s7rUQf #[cfg(feature = "parachain")] EndowedAccountWithBalance( - hex!["04163722a7f1f900c1ec502383d4959360e374c8808e13d47b3e553d761a6329"].into(), - DEFAULT_COLLATOR_BALANCE_ZEITGEIST.unwrap(), + hex!["42a1ef95149913305fb05b6ac325ab9ed4b68c8d7aa60e3ea4daf4237dd9fc09"].into(), + DEFAULT_COLLATOR_BALANCE_RAUMGEIST.unwrap(), ), - // dE36Y98QpX8hEkLANntbtUvt7figSPGxSrDxU4sscuX989CTJ + // dE375YCauT8vxvXwzBGaeCfPsKTXuuBpJaqCsBqRhoySNdmtE #[cfg(feature = "parachain")] EndowedAccountWithBalance( - hex!["b449a256f73e59602eb742071a07e4d94aaae91e6872f28e161f34982a0bfc0d"].into(), - DEFAULT_COLLATOR_BALANCE_ZEITGEIST.unwrap(), + hex!["b4b3541a95c83a71de977a6f1e7e66e594a4d47c48b030802c90ba589c8bba16"].into(), + DEFAULT_COLLATOR_BALANCE_RAUMGEIST.unwrap(), ), + EndowedAccountWithBalance(root_key_staging_zeitgeist(), DEFAULT_SUDO_BALANCE), ] } @@ -76,32 +82,29 @@ fn additional_chain_spec_staging_zeitgeist( parachain_id: cumulus_primitives_core::ParaId, ) -> AdditionalChainSpec { AdditionalChainSpec { - blocks_per_round: DefaultBlocksPerRound::get(), candidates: vec![ ( - hex!["524e9aac979cbb9ecdb7acd1635755c3b15696321a3345ca77f0ab0ae23f675a"].into(), - hex!["e251731d35dd19aeb7db1ffe06227d0b7da3b3eabb5ec1d79da453ac9949e80b"] + hex!["ec9a6c37972582ce411546f96f806cfc2bb0670f60c30cbc3ad4276834b0253c"].into(), + hex!["725d4d2948ae3a703f7a4911daa6d3022b45dc54fe1998ea88cb33a6f2bd805a"] .unchecked_into(), - DEFAULT_STAKING_AMOUNT_ZEITGEIST, + DEFAULT_STAKING_AMOUNT_RAUMGEIST, ), ( - hex!["04163722a7f1f900c1ec502383d4959360e374c8808e13d47b3e553d761a6329"].into(), - hex!["76d3384620053d1eb67e0f7fa8af93a8028e5cf74f22a12a5f2393b286463753"] + hex!["42a1ef95149913305fb05b6ac325ab9ed4b68c8d7aa60e3ea4daf4237dd9fc09"].into(), + hex!["2cb04566bb52665950acf535c6b03312b00d896a3e33534e09dc948e16c06042"] .unchecked_into(), - DEFAULT_STAKING_AMOUNT_ZEITGEIST, + DEFAULT_STAKING_AMOUNT_RAUMGEIST, ), ( - hex!["b449a256f73e59602eb742071a07e4d94aaae91e6872f28e161f34982a0bfc0d"].into(), - hex!["14a3becfeeb700ff6a41927a2924493717aea238d9c5bea15368d61550f63e44"] + hex!["b4b3541a95c83a71de977a6f1e7e66e594a4d47c48b030802c90ba589c8bba16"].into(), + hex!["e23846832242a083b94df7640257a243fe1c5a730890b254600d953ddd65011c"] .unchecked_into(), - DEFAULT_STAKING_AMOUNT_ZEITGEIST, + DEFAULT_STAKING_AMOUNT_RAUMGEIST, ), ], - collator_commission: DefaultCollatorCommission::get(), - crowdloan_fund_pot: DEFAULT_INITIAL_CROWDLOAN_FUNDS_ZEITGEIST, - inflation_info: DEFAULT_COLLATOR_INFLATION_INFO, + crowdloan_fund_pot: DEFAULT_INITIAL_CROWDLOAN_FUNDS_RAUMGEIST, + inflation_info: inflation_config(Perbill::from_percent(5), TOTAL_INITIAL_ZTG * BASE), nominations: vec![], - parachain_bond_reserve_percent: DefaultParachainBondReservePercent::get(), parachain_id, } } @@ -110,11 +113,11 @@ fn additional_chain_spec_staging_zeitgeist( fn additional_chain_spec_staging_zeitgeist() -> AdditionalChainSpec { AdditionalChainSpec { initial_authorities: vec![( - // 5FCSJzvmeUW1hBo3ASnLzSxpUdn5QUDt1Eqobj1meiQB7mLu - hex!["8a9a54bdf73fb4a757f5ab81fabe2f173922fdb92bb8b6e8bedf8b17fa38f500"] + // Aura + hex!["5ce5033dba3f6f730f11c20d00c34c4d3fbe23eb81471255bfde689f25dc966e"] .unchecked_into(), - // 5HGProUwcyCDMJDxjBBKbv8u7ehr5uoTBS3bckYHPcZMTifW - hex!["e61786c6426b55a034f9c4b78dc57d4183927cef8e64b2e496225ed6fca41758"] + // Grandpa + hex!["ffd00bcb47e83ed435ce55264cf89969041a5108fdfb3198c79dfe0b75f66600"] .unchecked_into(), )], } @@ -125,20 +128,33 @@ pub(super) fn get_wasm() -> Result<&'static [u8], String> { zeitgeist_runtime::WASM_BINARY.ok_or_else(|| "WASM binary is not available".to_string()) } -generate_generic_genesis_function!(zeitgeist_runtime,); +#[inline] +fn root_key_staging_zeitgeist() -> AccountId { + hex!["e6c622c6f2eaba444b68955501e535247c192b35e7b3e44e4c1dc24a514b4965"].into() +} + +generate_generic_genesis_function!( + zeitgeist_runtime, + sudo: zeitgeist_runtime::SudoConfig { key: Some(root_key_staging_zeitgeist()) }, +); + +#[cfg(feature = "parachain")] +super::generate_inflation_config_function!(zeitgeist_runtime); -pub fn zeitgeist_staging_config() -> Result { +pub fn zeitgeist_staging_config( + #[cfg(feature = "parachain")] parachain_id: cumulus_primitives_core::ParaId, +) -> Result { let wasm = get_wasm()?; Ok(ZeitgeistChainSpec::from_genesis( - "Zeitgeist Staging", + "Raumgeist Staging", "zeitgeist_staging", ChainType::Live, move || { generic_genesis( additional_chain_spec_staging_zeitgeist( #[cfg(feature = "parachain")] - KUSAMA_PARACHAIN_ID.into(), + parachain_id, ), endowed_accounts_staging_zeitgeist(), wasm, @@ -148,11 +164,11 @@ pub fn zeitgeist_staging_config() -> Result { telemetry_endpoints(), Some("zeitgeist"), None, - Some(token_properties("ZTG", SS58Prefix::get())), + Some(token_properties("RGT", SS58Prefix::get())), #[cfg(feature = "parachain")] crate::chain_spec::Extensions { - relay_chain: "kusama".into(), - parachain_id: KUSAMA_PARACHAIN_ID, + relay_chain: "polkadot".into(), + parachain_id: parachain_id.into(), }, #[cfg(not(feature = "parachain"))] Default::default(), diff --git a/node/src/main.rs b/node/src/main.rs index 45eb875a9..ec07e15cd 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -34,7 +34,7 @@ pub const ZEITGEIST_RUNTIME_NOT_AVAILABLE: &str = "Zeitgeist runtime is not avai cfg_if::cfg_if!( if #[cfg(feature = "parachain")] { - const KUSAMA_PARACHAIN_ID: u32 = 2101; + const KUSAMA_PARACHAIN_ID: u32 = 2092; const BATTERY_STATION_PARACHAIN_ID: u32 = 2050; const KUSAMA_BLOCK_DURATION: core::time::Duration = core::time::Duration::from_secs(6); const SOFT_DEADLINE_PERCENT: sp_runtime::Percent = sp_runtime::Percent::from_percent(100); diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 4fa35ceec..f78aa9c7c 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -54,20 +54,17 @@ where + 'static, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, - C::Api: zrml_swaps_rpc::SwapsRuntimeApi, C::Api: BlockBuilder, P: TransactionPool + Sync + Send + 'static, { use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; - use zrml_swaps_rpc::{Swaps, SwapsApiServer}; let mut io = RpcModule::new(()); let FullDeps { client, pool, deny_unsafe } = deps; io.merge(System::new(Arc::clone(&client), Arc::clone(&pool), deny_unsafe).into_rpc())?; io.merge(TransactionPayment::new(Arc::clone(&client)).into_rpc())?; - io.merge(Swaps::new(client).into_rpc())?; Ok(io) } diff --git a/node/src/service.rs b/node/src/service.rs index aa89dfb2e..0a1a1960c 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -106,7 +106,6 @@ pub trait RuntimeApiCollection: + sp_api::Metadata + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys - + zrml_swaps_rpc::SwapsRuntimeApi where >::StateBackend: sp_api::StateBackend, { @@ -121,8 +120,7 @@ where + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi + sp_api::Metadata + sp_offchain::OffchainWorkerApi - + sp_session::SessionKeys - + zrml_swaps_rpc::SwapsRuntimeApi, + + sp_session::SessionKeys, >::StateBackend: sp_api::StateBackend, { } diff --git a/runtime/battery-station/src/lib.rs b/runtime/battery-station/src/lib.rs index f117fc81b..8dbf081f3 100644 --- a/runtime/battery-station/src/lib.rs +++ b/runtime/battery-station/src/lib.rs @@ -101,46 +101,14 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { #[derive(scale_info::TypeInfo)] pub struct IsCallable; -// Currently disables Court, Rikiddo and creation of markets using Court. impl Contains for IsCallable { fn contains(call: &Call) -> bool { - use zeitgeist_primitives::types::{ - MarketDisputeMechanism::Court, ScoringRule::RikiddoSigmoidFeeMarketEma, - }; - use zrml_prediction_markets::Call::{ - create_cpmm_market_and_deploy_assets, create_market, edit_market, - }; - - #[allow(clippy::match_like_matches_macro)] - match call { - Call::Court(_) => false, - Call::LiquidityMining(_) => false, - Call::PredictionMarkets(inner_call) => { - match inner_call { - // Disable Rikiddo markets - create_market { scoring_rule: RikiddoSigmoidFeeMarketEma, .. } => false, - edit_market { scoring_rule: RikiddoSigmoidFeeMarketEma, .. } => false, - // Disable Court dispute resolution mechanism - create_market { dispute_mechanism: Court, .. } => false, - create_cpmm_market_and_deploy_assets { dispute_mechanism: Court, .. } => false, - edit_market { dispute_mechanism: Court, .. } => false, - _ => true, - } - } - _ => true, - } + true } } decl_common_types!(); -#[cfg(feature = "with-global-disputes")] -create_runtime_with_additional_pallets!( - GlobalDisputes: zrml_global_disputes::{Call, Event, Pallet, Storage} = 59, - Sudo: pallet_sudo::{Call, Config, Event, Pallet, Storage} = 150, -); - -#[cfg(not(feature = "with-global-disputes"))] create_runtime_with_additional_pallets!( Sudo: pallet_sudo::{Call, Config, Event, Pallet, Storage} = 150, ); diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 15e4efdb1..0b05d6c30 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -51,31 +51,12 @@ macro_rules! decl_common_types { type Address = sp_runtime::MultiAddress; - #[cfg(feature = "parachain")] - pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllPalletsWithSystem, - ( - pallet_parachain_staking::migrations::MigrateAtStakeAutoCompound, - zrml_prediction_markets::migrations::UpdateMarketsForBaseAssetAndRecordBonds, - zrml_prediction_markets::migrations::AddFieldToAuthorityReport, - ), - >; - - #[cfg(not(feature = "parachain"))] pub type Executive = frame_executive::Executive< Runtime, Block, frame_system::ChainContext, Runtime, AllPalletsWithSystem, - ( - zrml_prediction_markets::migrations::UpdateMarketsForBaseAssetAndRecordBonds, - zrml_prediction_markets::migrations::AddFieldToAuthorityReport, - ), >; pub type Header = generic::Header; @@ -215,7 +196,7 @@ macro_rules! decl_common_types { FEES_AND_TIPS_TREASURY_PERCENTAGE, FEES_AND_TIPS_BURN_PERCENTAGE, ); - Treasury::on_unbalanced(split.0); + // Treasury::on_unbalanced(split.0); } } } @@ -271,45 +252,45 @@ macro_rules! create_runtime { System: frame_system::{Call, Config, Event, Pallet, Storage} = 0, Timestamp: pallet_timestamp::{Call, Pallet, Storage, Inherent} = 1, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 2, - Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 3, - Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 4, + // Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 3, + // Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 4, // Money Balances: pallet_balances::{Call, Config, Event, Pallet, Storage} = 10, TransactionPayment: pallet_transaction_payment::{Config, Event, Pallet, Storage} = 11, - Treasury: pallet_treasury::{Call, Config, Event, Pallet, Storage} = 12, - Vesting: pallet_vesting::{Call, Config, Event, Pallet, Storage} = 13, - MultiSig: pallet_multisig::{Call, Event, Pallet, Storage} = 14, - Bounties: pallet_bounties::{Call, Event, Pallet, Storage} = 15, + // Treasury: pallet_treasury::{Call, Config, Event, Pallet, Storage} = 12, + // Vesting: pallet_vesting::{Call, Config, Event, Pallet, Storage} = 13, + // MultiSig: pallet_multisig::{Call, Event, Pallet, Storage} = 14, + // Bounties: pallet_bounties::{Call, Event, Pallet, Storage} = 15, // Governance - Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 20, - AdvisoryCommittee: pallet_collective::::{Call, Config, Event, Origin, Pallet, Storage} = 21, - AdvisoryCommitteeMembership: pallet_membership::::{Call, Config, Event, Pallet, Storage} = 22, - Council: pallet_collective::::{Call, Config, Event, Origin, Pallet, Storage} = 23, - CouncilMembership: pallet_membership::::{Call, Config, Event, Pallet, Storage} = 24, - TechnicalCommittee: pallet_collective::::{Call, Config, Event, Origin, Pallet, Storage} = 25, - TechnicalCommitteeMembership: pallet_membership::::{Call, Config, Event, Pallet, Storage} = 26, + // Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 20, + // AdvisoryCommittee: pallet_collective::::{Call, Config, Event, Origin, Pallet, Storage} = 21, + // AdvisoryCommitteeMembership: pallet_membership::::{Call, Config, Event, Pallet, Storage} = 22, + // Council: pallet_collective::::{Call, Config, Event, Origin, Pallet, Storage} = 23, + // CouncilMembership: pallet_membership::::{Call, Config, Event, Pallet, Storage} = 24, + // TechnicalCommittee: pallet_collective::::{Call, Config, Event, Origin, Pallet, Storage} = 25, + // TechnicalCommitteeMembership: pallet_membership::::{Call, Config, Event, Pallet, Storage} = 26, // Other Parity pallets - Identity: pallet_identity::{Call, Event, Pallet, Storage} = 30, + // Identity: pallet_identity::{Call, Event, Pallet, Storage} = 30, Utility: pallet_utility::{Call, Event, Pallet, Storage} = 31, - Proxy: pallet_proxy::{Call, Event, Pallet, Storage} = 32, + // Proxy: pallet_proxy::{Call, Event, Pallet, Storage} = 32, // Third-party AssetManager: orml_currencies::{Call, Pallet, Storage} = 40, Tokens: orml_tokens::{Config, Event, Pallet, Storage} = 41, // Zeitgeist - MarketCommons: zrml_market_commons::{Pallet, Storage} = 50, - Authorized: zrml_authorized::{Call, Event, Pallet, Storage} = 51, - Court: zrml_court::{Call, Event, Pallet, Storage} = 52, - LiquidityMining: zrml_liquidity_mining::{Call, Config, Event, Pallet, Storage} = 53, - RikiddoSigmoidFeeMarketEma: zrml_rikiddo::::{Pallet, Storage} = 54, - SimpleDisputes: zrml_simple_disputes::{Event, Pallet, Storage} = 55, - Swaps: zrml_swaps::{Call, Event, Pallet, Storage} = 56, - PredictionMarkets: zrml_prediction_markets::{Call, Event, Pallet, Storage} = 57, - Styx: zrml_styx::{Call, Event, Pallet, Storage} = 58, + // MarketCommons: zrml_market_commons::{Pallet, Storage} = 50, + // Authorized: zrml_authorized::{Call, Event, Pallet, Storage} = 51, + // Court: zrml_court::{Call, Event, Pallet, Storage} = 52, + // LiquidityMining: zrml_liquidity_mining::{Call, Config, Event, Pallet, Storage} = 53, + // RikiddoSigmoidFeeMarketEma: zrml_rikiddo::::{Pallet, Storage} = 54, + // SimpleDisputes: zrml_simple_disputes::{Event, Pallet, Storage} = 55, + // Swaps: zrml_swaps::{Call, Event, Pallet, Storage} = 56, + // PredictionMarkets: zrml_prediction_markets::{Call, Event, Pallet, Storage} = 57, + // Styx: zrml_styx::{Call, Event, Pallet, Storage} = 58, $($additional_pallets)* } @@ -342,7 +323,7 @@ macro_rules! create_runtime_with_additional_pallets { XTokens: orml_xtokens::{Pallet, Storage, Call, Event} = 126, // Third-party - Crowdloan: pallet_crowdloan_rewards::{Call, Config, Event, Pallet, Storage} = 130, + // Crowdloan: pallet_crowdloan_rewards::{Call, Config, Event, Pallet, Storage} = 130, // Others $($additional_pallets)* @@ -595,6 +576,7 @@ macro_rules! impl_config_traits { type XcmExecutor = xcm_executor::XcmExecutor; } + /* #[cfg(feature = "parachain")] impl pallet_crowdloan_rewards::Config for Runtime { type Event = Event; @@ -613,6 +595,7 @@ macro_rules! impl_config_traits { cumulus_pallet_parachain_system::RelaychainBlockNumberProvider; type WeightInfo = pallet_crowdloan_rewards::weights::SubstrateWeight; } + */ impl pallet_balances::Config for Runtime { type AccountStore = System; @@ -626,6 +609,7 @@ macro_rules! impl_config_traits { type WeightInfo = weights::pallet_balances::WeightInfo; } + /* impl pallet_collective::Config for Runtime { type DefaultVote = PrimeDefaultVote; type Event = Event; @@ -822,9 +806,11 @@ macro_rules! impl_config_traits { type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; } + */ impl pallet_randomness_collective_flip::Config for Runtime {} + /* impl pallet_scheduler::Config for Runtime { type Event = Event; type Origin = Origin; @@ -838,6 +824,7 @@ macro_rules! impl_config_traits { type PreimageProvider = Preimage; type NoPreimagePostponement = NoPreimagePostponement; } + */ // Timestamp /// Custom getter for minimum timestamp delta. @@ -891,6 +878,7 @@ macro_rules! impl_config_traits { type WeightToFee = IdentityFee; } + /* impl pallet_treasury::Config for Runtime { type ApproveOrigin = EnsureRootOrTwoThirdsCouncil; type Burn = Burn; @@ -924,6 +912,7 @@ macro_rules! impl_config_traits { type MaximumReasonLength = MaximumReasonLength; type WeightInfo = weights::pallet_bounties::WeightInfo; } + */ impl pallet_utility::Config for Runtime { type Event = Event; @@ -932,6 +921,7 @@ macro_rules! impl_config_traits { type WeightInfo = weights::pallet_utility::WeightInfo; } + /* impl pallet_vesting::Config for Runtime { type Event = Event; type Currency = Balances; @@ -943,10 +933,12 @@ macro_rules! impl_config_traits { // highest number of schedules that encodes less than 2^10. const MAX_VESTING_SCHEDULES: u32 = 28; } + */ #[cfg(feature = "parachain")] impl parachain_info::Config for Runtime {} + /* impl zrml_authorized::Config for Runtime { type AuthorizedDisputeResolutionOrigin = EnsureRootOrHalfAdvisoryCommittee; type CorrectionPeriod = CorrectionPeriod; @@ -1128,6 +1120,7 @@ macro_rules! impl_config_traits { type Currency = Balances; type WeightInfo = zrml_styx::weights::WeightInfo; } + */ } } @@ -1213,6 +1206,7 @@ macro_rules! create_runtime_api { orml_list_benchmark!(list, extra, orml_currencies, crate::benchmarks::currencies); orml_list_benchmark!(list, extra, orml_tokens, crate::benchmarks::tokens); list_benchmark!(list, extra, pallet_balances, Balances); + /* list_benchmark!(list, extra, pallet_bounties, Bounties); list_benchmark!(list, extra, pallet_collective, AdvisoryCommittee); list_benchmark!(list, extra, pallet_democracy, Democracy); @@ -1222,9 +1216,11 @@ macro_rules! create_runtime_api { list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, pallet_proxy, Proxy); list_benchmark!(list, extra, pallet_scheduler, Scheduler); + */ list_benchmark!(list, extra, pallet_timestamp, Timestamp); - list_benchmark!(list, extra, pallet_treasury, Treasury); + //list_benchmark!(list, extra, pallet_treasury, Treasury); list_benchmark!(list, extra, pallet_utility, Utility); + /* list_benchmark!(list, extra, pallet_vesting, Vesting); list_benchmark!(list, extra, zrml_swaps, Swaps); list_benchmark!(list, extra, zrml_authorized, Authorized); @@ -1235,6 +1231,7 @@ macro_rules! create_runtime_api { list_benchmark!(list, extra, zrml_prediction_markets, PredictionMarkets); list_benchmark!(list, extra, zrml_liquidity_mining, LiquidityMining); list_benchmark!(list, extra, zrml_styx, Styx); + */ cfg_if::cfg_if! { if #[cfg(feature = "parachain")] { @@ -1243,7 +1240,7 @@ macro_rules! create_runtime_api { list_benchmark!(list, extra, pallet_author_mapping, AuthorMapping); list_benchmark!(list, extra, pallet_author_slot_filter, AuthorFilter); list_benchmark!(list, extra, pallet_parachain_staking, ParachainStaking); - list_benchmark!(list, extra, pallet_crowdloan_rewards, Crowdloan); + // list_benchmark!(list, extra, pallet_crowdloan_rewards, Crowdloan); } else { list_benchmark!(list, extra, pallet_grandpa, Grandpa); } @@ -1292,6 +1289,7 @@ macro_rules! create_runtime_api { orml_add_benchmark!(params, batches, orml_currencies, crate::benchmarks::currencies); orml_add_benchmark!(params, batches, orml_tokens, crate::benchmarks::tokens); add_benchmark!(params, batches, pallet_balances, Balances); + /* add_benchmark!(params, batches, pallet_bounties, Bounties); add_benchmark!(params, batches, pallet_collective, AdvisoryCommittee); add_benchmark!(params, batches, pallet_democracy, Democracy); @@ -1301,9 +1299,11 @@ macro_rules! create_runtime_api { add_benchmark!(params, batches, pallet_preimage, Preimage); add_benchmark!(params, batches, pallet_proxy, Proxy); add_benchmark!(params, batches, pallet_scheduler, Scheduler); + */ add_benchmark!(params, batches, pallet_timestamp, Timestamp); - add_benchmark!(params, batches, pallet_treasury, Treasury); + //add_benchmark!(params, batches, pallet_treasury, Treasury); add_benchmark!(params, batches, pallet_utility, Utility); + /* add_benchmark!(params, batches, pallet_vesting, Vesting); add_benchmark!(params, batches, zrml_swaps, Swaps); add_benchmark!(params, batches, zrml_authorized, Authorized); @@ -1314,6 +1314,7 @@ macro_rules! create_runtime_api { add_benchmark!(params, batches, zrml_prediction_markets, PredictionMarkets); add_benchmark!(params, batches, zrml_liquidity_mining, LiquidityMining); add_benchmark!(params, batches, zrml_styx, Styx); + */ cfg_if::cfg_if! { @@ -1501,6 +1502,7 @@ macro_rules! create_runtime_api { } } + /* impl zrml_swaps_runtime_api::SwapsApi for Runtime { @@ -1521,6 +1523,7 @@ macro_rules! create_runtime_api { Asset::PoolShare(SerdeWrapper(pool_id)) } } + */ #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { diff --git a/runtime/zeitgeist/Cargo.toml b/runtime/zeitgeist/Cargo.toml index 5ae8d91e0..500f4b336 100644 --- a/runtime/zeitgeist/Cargo.toml +++ b/runtime/zeitgeist/Cargo.toml @@ -21,6 +21,7 @@ pallet-preimage = { branch = "moonbeam-polkadot-v0.9.29", default-features = fal pallet-proxy = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } pallet-randomness-collective-flip = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } pallet-scheduler = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } +pallet-sudo = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } pallet-timestamp = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } pallet-transaction-payment = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } pallet-transaction-payment-rpc-runtime-api = { branch = "moonbeam-polkadot-v0.9.29", default-features = false, git = "https://github.com/zeitgeistpm/substrate" } @@ -233,6 +234,7 @@ std = [ "pallet-proxy/std", "pallet-randomness-collective-flip/std", "pallet-scheduler/std", + "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", @@ -329,6 +331,7 @@ try-runtime = [ "pallet-timestamp/try-runtime", "pallet-randomness-collective-flip/try-runtime", "pallet-scheduler/try-runtime", + "pallet-sudo/try-runtime", "pallet-preimage/try-runtime", # Money runtime pallets diff --git a/runtime/zeitgeist/src/lib.rs b/runtime/zeitgeist/src/lib.rs index def87361b..459ead042 100644 --- a/runtime/zeitgeist/src/lib.rs +++ b/runtime/zeitgeist/src/lib.rs @@ -87,8 +87,8 @@ pub mod parameters; pub mod xcm_config; pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("zeitgeist"), - impl_name: create_runtime_str!("zeitgeist"), + spec_name: create_runtime_str!("zeitgeist-polkadot"), + impl_name: create_runtime_str!("zeitgeist-forecasting-technologies"), authoring_version: 1, spec_version: 42, impl_version: 1, @@ -100,107 +100,22 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { #[derive(scale_info::TypeInfo)] pub struct IsCallable; -// Currently disables Court, Rikiddo and creation of markets using Court or SimpleDisputes -// dispute mechanism. impl Contains for IsCallable { fn contains(call: &Call) -> bool { - #[cfg(feature = "parachain")] - use cumulus_pallet_dmp_queue::Call::service_overweight; - use frame_system::Call::{ - kill_prefix, kill_storage, set_code, set_code_without_checks, set_storage, - }; - use orml_currencies::Call::update_balance; - use pallet_balances::Call::{force_transfer, set_balance}; - use pallet_collective::Call::set_members; - use pallet_vesting::Call::force_vested_transfer; - - use zeitgeist_primitives::types::{ - MarketDisputeMechanism::{Court, SimpleDisputes}, - ScoringRule::RikiddoSigmoidFeeMarketEma, - }; - use zrml_prediction_markets::Call::{ - create_cpmm_market_and_deploy_assets, create_market, edit_market, - }; - - #[allow(clippy::match_like_matches_macro)] - match call { - // Membership is managed by the respective Membership instance - Call::AdvisoryCommittee(set_members { .. }) => false, - // See "balance.set_balance" - Call::AssetManager(update_balance { .. }) => false, - Call::Balances(inner_call) => { - match inner_call { - // Balances should not be set. All newly generated tokens be minted by well - // known and approved processes, like staking. However, this could be used - // in some cases to fund system accounts like the parachain sorveign account - // in case something goes terribly wrong (like a hack that draws the funds - // from such an account, see Maganta hack). Invoking this function one can - // also easily mess up consistency in regards to reserved tokens and locks. - set_balance { .. } => false, - // There should be no reason to force an account to transfer funds. - force_transfer { .. } => false, - _ => true, - } - } - // Membership is managed by the respective Membership instance - Call::Council(set_members { .. }) => false, - Call::Court(_) => false, - #[cfg(feature = "parachain")] - Call::DmpQueue(service_overweight { .. }) => false, - Call::LiquidityMining(_) => false, - Call::PredictionMarkets(inner_call) => { - match inner_call { - // Disable Rikiddo markets - create_market { scoring_rule: RikiddoSigmoidFeeMarketEma, .. } => false, - edit_market { scoring_rule: RikiddoSigmoidFeeMarketEma, .. } => false, - // Disable Court & SimpleDisputes dispute resolution mechanism - create_market { dispute_mechanism: Court | SimpleDisputes, .. } => false, - edit_market { dispute_mechanism: Court | SimpleDisputes, .. } => false, - create_cpmm_market_and_deploy_assets { - dispute_mechanism: Court | SimpleDisputes, - .. - } => false, - _ => true, - } - } - Call::System(inner_call) => { - match inner_call { - // Some "waste" storage will never impact proper operation. - // Cleaning up storage should be done by pallets or independent migrations. - kill_prefix { .. } => false, - // See "killPrefix" - kill_storage { .. } => false, - // A parachain uses ParachainSystem to enact and authorized a runtime upgrade. - // This ensure proper synchronization with the relay chain. - // Calling `setCode` will wreck the chain. - set_code { .. } => false, - // See "setCode" - set_code_without_checks { .. } => false, - // Setting the storage directly is a dangerous operation that can lead to an - // inconsistent state. There might be scenarios where this is helpful, however, - // a well reviewed migration is better suited for that. - set_storage { .. } => false, - _ => true, - } - } - // Membership is managed by the respective Membership instance - Call::TechnicalCommittee(set_members { .. }) => false, - // There should be no reason to force vested transfer. - Call::Vesting(force_vested_transfer { .. }) => false, - _ => true, - } + true } } decl_common_types!(); -#[cfg(feature = "with-global-disputes")] create_runtime_with_additional_pallets!( - GlobalDisputes: zrml_global_disputes::{Call, Event, Pallet, Storage} = 59, + Sudo: pallet_sudo::{Call, Config, Event, Pallet, Storage} = 150, ); -#[cfg(not(feature = "with-global-disputes"))] -create_runtime_with_additional_pallets!(); +impl pallet_sudo::Config for Runtime { + type Call = Call; + type Event = Event; +} impl_config_traits!(); create_runtime_api!(); diff --git a/zrml/swaps/rpc/src/lib.rs b/zrml/swaps/rpc/src/lib.rs index 5d8accf7e..f5fd72838 100644 --- a/zrml/swaps/rpc/src/lib.rs +++ b/zrml/swaps/rpc/src/lib.rs @@ -35,8 +35,6 @@ use sp_runtime::{ }; use zeitgeist_primitives::types::{Asset, SerdeWrapper}; -pub use zrml_swaps_runtime_api::SwapsApi as SwapsRuntimeApi; - #[rpc(client, server)] pub trait SwapsApi where @@ -110,7 +108,6 @@ impl where Block: BlockT, C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend, - C::Api: SwapsRuntimeApi, PoolId: Clone + Codec + MaybeDisplay + MaybeFromStr + Send + 'static, AccountId: Clone + Display + Codec + Send + 'static, Balance: Codec + MaybeDisplay + MaybeFromStr + MaxEncodedLen + Send + 'static,