diff --git a/Cargo.lock b/Cargo.lock index 29876dad7..9dec9d5ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -648,8 +648,11 @@ dependencies = [ "pallet-balances", "pallet-chain-extension-assets", "pallet-collator-selection 3.3.2", + "pallet-collective", + "pallet-collective-proxy", "pallet-contracts", "pallet-dapp-staking", + "pallet-democracy", "pallet-dynamic-evm-base-fee", "pallet-ethereum", "pallet-evm", @@ -672,13 +675,16 @@ dependencies = [ "pallet-message-queue", "pallet-migrations", "pallet-multisig", + "pallet-preimage", "pallet-price-aggregator", "pallet-proxy", + "pallet-scheduler", "pallet-session", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury 36.0.1", "pallet-utility", "pallet-vesting", "pallet-xc-asset-config", diff --git a/runtime/astar/Cargo.toml b/runtime/astar/Cargo.toml index 9c3f9632a..9ad0359ea 100644 --- a/runtime/astar/Cargo.toml +++ b/runtime/astar/Cargo.toml @@ -47,7 +47,9 @@ pallet-assets = { workspace = true } pallet-aura = { workspace = true } pallet-authorship = { workspace = true } pallet-balances = { workspace = true } +pallet-collective = { workspace = true } pallet-contracts = { workspace = true } +pallet-democracy = { workspace = true } pallet-dynamic-evm-base-fee = { workspace = true } pallet-ethereum = { workspace = true } pallet-evm = { workspace = true } @@ -63,12 +65,15 @@ pallet-membership = { workspace = true } pallet-message-queue = { workspace = true } pallet-migrations = { workspace = true } pallet-multisig = { workspace = true } +pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } +pallet-scheduler = { workspace = true } pallet-session = { workspace = true, features = ["historical"] } pallet-sudo = { workspace = true } pallet-timestamp = { workspace = true } pallet-transaction-payment = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } pallet-utility = { workspace = true } pallet-vesting = { workspace = true } pallet-xcm-benchmarks = { workspace = true, optional = true } @@ -110,6 +115,7 @@ frame-try-runtime = { workspace = true, optional = true } astar-primitives = { workspace = true } astar-xcm-benchmarks = { workspace = true, optional = true } pallet-collator-selection = { workspace = true } +pallet-collective-proxy = { workspace = true } pallet-dapp-staking = { workspace = true } pallet-evm-precompile-assets-erc20 = { workspace = true } pallet-evm-precompile-dapp-staking = { workspace = true } @@ -139,200 +145,218 @@ substrate-wasm-builder = { workspace = true, optional = true } [features] default = ["std"] std = [ - "parity-scale-codec/std", - "serde_json/std", - "sp-genesis-builder/std", - "fp-rpc/std", + "astar-primitives/std", + "astar-xcm-benchmarks?/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "dapp-staking-runtime-api/std", "fp-evm/std", + "fp-rpc/std", "fp-self-contained/std", - "sp-std/std", - "sp-api/std", - "sp-core/std", - "pallet-membership/std", - "pallet-price-aggregator/std", - "orml-oracle/std", - "sp-consensus-aura/std", - "sp-arithmetic/std", - "sp-io/std", - "sp-runtime/std", - "sp-runtime-interface/std", - "sp-version/std", - "sp-block-builder/std", - "sp-transaction-pool/std", - "sp-inherents/std", - "frame-support/std", + "frame-benchmarking/std", "frame-executive/std", - "frame-system/std", + "frame-metadata-hash-extension/std", + "frame-support/std", + "frame-system-benchmarking?/std", "frame-system-rpc-runtime-api/std", + "frame-system/std", "frame-try-runtime/std", - "frame-metadata-hash-extension/std", + "log?/std", + "moonbeam-evm-tracer/std", + "moonbeam-rpc-primitives-debug/std", + "moonbeam-rpc-primitives-txpool/std", + "num_enum/std", + "orml-oracle/std", + "orml-xcm-support/std", + "orml-xtokens/std", "pallet-assets/std", - "pallet-authorship/std", "pallet-aura/std", + "pallet-authorship/std", "pallet-balances/std", - "pallet-proxy/std", + "pallet-chain-extension-assets/std", + "pallet-collator-selection/std", + "pallet-collective-proxy/std", + "pallet-collective/std", + "pallet-contracts/std", "pallet-dapp-staking/std", - "xcm-runtime-apis/std", - "dapp-staking-runtime-api/std", - "pallet-inflation/std", - "pallet-evm-precompile-dapp-staking/std", - "pallet-evm-precompile-sr25519/std", - "pallet-evm-precompile-assets-erc20/std", - "pallet-evm-precompile-substrate-ecdsa/std", - "pallet-evm-precompile-xcm/std", + "pallet-democracy/std", "pallet-dynamic-evm-base-fee/std", "pallet-ethereum/std", - "pallet-evm/std", + "pallet-evm-precompile-assets-erc20/std", "pallet-evm-precompile-blake2/std", - "pallet-evm-precompile-simple/std", "pallet-evm-precompile-bn128/std", - "pallet-evm-precompile-dispatch/std", + "pallet-evm-precompile-dapp-staking/std", "pallet-evm-precompile-dispatch-lockdrop/std", + "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-ed25519/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", + "pallet-evm-precompile-simple/std", + "pallet-evm-precompile-sr25519/std", + "pallet-evm-precompile-substrate-ecdsa/std", + "pallet-evm-precompile-xcm/std", + "pallet-evm/std", "pallet-identity/std", - "pallet-multisig/std", + "pallet-inflation/std", + "pallet-membership/std", + "pallet-message-queue/std", "pallet-migrations/std", + "pallet-multisig/std", + "pallet-preimage/std", + "pallet-price-aggregator/std", + "pallet-proxy/std", + "pallet-scheduler/std", "pallet-session/std", - "pallet-utility/std", - "pallet-timestamp/std", - "pallet-vesting/std", - "sp-offchain/std", - "sp-session/std", "pallet-sudo/std", - "pallet-transaction-payment/std", + "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "pallet-xc-asset-config/std", + "pallet-xcm-benchmarks?/std", "pallet-xcm/std", "parachain-info/std", + "parachains-common/std", + "parity-scale-codec/std", "polkadot-parachain/std", "polkadot-primitives/std", "polkadot-runtime-common/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-xcmp-queue/std", - "pallet-message-queue/std", - "parachains-common/std", - "pallet-contracts/std", - "cumulus-pallet-xcm/std", - "pallet-collator-selection/std", - "frame-benchmarking/std", - "moonbeam-evm-tracer/std", - "moonbeam-rpc-primitives-debug/std", - "moonbeam-rpc-primitives-txpool/std", - "xcm/std", - "xcm-builder/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", - "astar-xcm-benchmarks?/std", - "frame-system-benchmarking?/std", - "log?/std", - "num_enum/std", - "pallet-xcm-benchmarks?/std", "precompile-utils/std", "scale-info/std", + "serde_json/std", + "sp-api/std", + "sp-arithmetic/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime-interface/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "xcm-builder/std", + "xcm-executor/std", + "xcm-runtime-apis/std", + "xcm/std", ] runtime-benchmarks = [ - 'frame-benchmarking', - 'frame-support/runtime-benchmarks', - 'frame-system-benchmarking/runtime-benchmarks', - 'frame-system/runtime-benchmarks', - 'sp-runtime/runtime-benchmarks', - 'pallet-balances/runtime-benchmarks', - "pallet-proxy/runtime-benchmarks", - 'pallet-timestamp/runtime-benchmarks', - "pallet-ethereum/runtime-benchmarks", - "pallet-dapp-staking/runtime-benchmarks", - "pallet-price-aggregator/runtime-benchmarks", - "pallet-inflation/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "pallet-xc-asset-config/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "orml-xtokens/runtime-benchmarks", "astar-primitives/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-dynamic-evm-base-fee/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", "astar-xcm-benchmarks/runtime-benchmarks", - "pallet-xcm-benchmarks/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking", "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "orml-oracle/runtime-benchmarks", + "orml-xtokens/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", "pallet-chain-extension-assets/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-collective-proxy/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", "pallet-contracts/runtime-benchmarks", - "pallet-evm/runtime-benchmarks", + "pallet-dapp-staking/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-dynamic-evm-base-fee/runtime-benchmarks", + "pallet-ethereum/runtime-benchmarks", "pallet-evm-precompile-assets-erc20/runtime-benchmarks", "pallet-evm-precompile-dapp-staking/runtime-benchmarks", "pallet-evm-precompile-xcm/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", + "pallet-inflation/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", "pallet-migrations/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-price-aggregator/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", + "pallet-xc-asset-config/runtime-benchmarks", + "pallet-xcm-benchmarks/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", "xcm-runtime-apis/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "orml-oracle/runtime-benchmarks", ] try-runtime = [ + "astar-primitives/try-runtime", + "astar-xcm-benchmarks?/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", "fp-self-contained/try-runtime", - "log", - "frame-try-runtime/try-runtime", "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "log", + "orml-oracle/try-runtime", + "orml-xtokens/try-runtime", + "pallet-assets/try-runtime", "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", "pallet-balances/try-runtime", - "pallet-proxy/try-runtime", + "pallet-chain-extension-assets/try-runtime", + "pallet-collator-selection/try-runtime", + "pallet-collective-proxy/try-runtime", + "pallet-collective/try-runtime", + "pallet-contracts/try-runtime", "pallet-dapp-staking/try-runtime", + "pallet-democracy/try-runtime", + "pallet-dynamic-evm-base-fee/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + "pallet-identity/try-runtime", "pallet-inflation/try-runtime", + "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-migrations/try-runtime", + "pallet-multisig/try-runtime", + "pallet-preimage/try-runtime", + "pallet-price-aggregator/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", "pallet-xc-asset-config/try-runtime", - "pallet-ethereum/try-runtime", - "orml-oracle/try-runtime", - "pallet-price-aggregator/try-runtime", - "pallet-membership/try-runtime", - "pallet-assets/try-runtime", - "pallet-authorship/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-session/try-runtime", "pallet-xcm/try-runtime", - "pallet-identity/try-runtime", - "pallet-multisig/try-runtime", - "pallet-migrations/try-runtime", - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", "parachain-info/try-runtime", - "pallet-dynamic-evm-base-fee/try-runtime", - "pallet-contracts/try-runtime", - "pallet-evm/try-runtime", - "orml-xtokens/try-runtime", - "pallet-message-queue/try-runtime", - "astar-primitives/try-runtime", - "astar-xcm-benchmarks?/try-runtime", - "pallet-chain-extension-assets/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", ] diff --git a/runtime/astar/src/genesis_config.rs b/runtime/astar/src/genesis_config.rs index 5e45a694e..de2080edb 100644 --- a/runtime/astar/src/genesis_config.rs +++ b/runtime/astar/src/genesis_config.rs @@ -36,17 +36,28 @@ pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { pub fn default_config(para_id: u32) -> serde_json::Value { let alice = GenesisAccount::::from_seed("Alice"); let bob = GenesisAccount::::from_seed("Bob"); + let charlie = GenesisAccount::::from_seed("Charlie"); + let dave = GenesisAccount::::from_seed("Dave"); + let eve = GenesisAccount::::from_seed("Eve"); let balances: Vec<(AccountId, Balance)> = vec![ - (alice.account_id(), 1_000_000_000_000 * ASTR), - (bob.account_id(), 1_000_000_000_000 * ASTR), + (alice.account_id(), 1_000_000_000 * ASTR), + (bob.account_id(), 1_000_000_000 * ASTR), ( TreasuryPalletId::get().into_account_truncating(), 1_000_000_000 * ASTR, ), + ( + CommunityTreasuryPalletId::get().into_account_truncating(), + 1_000_000_000 * ASTR, + ), ]; let authorities = vec![&alice, &bob]; + let accounts = vec![&alice, &bob, &charlie, &dave, &eve] + .iter() + .map(|x| x.account_id()) + .collect::>(); let config = RuntimeGenesisConfig { system: Default::default(), @@ -155,6 +166,32 @@ pub fn default_config(para_id: u32) -> serde_json::Value { .try_into() .expect("Must work since buffer should have at least a single value."), }, + council_membership: CouncilMembershipConfig { + members: accounts + .clone() + .try_into() + .expect("Should support at least 5 members."), + phantom: Default::default(), + }, + technical_committee_membership: TechnicalCommitteeMembershipConfig { + members: accounts[..3] + .to_vec() + .try_into() + .expect("Should support at least 3 members."), + phantom: Default::default(), + }, + community_council_membership: CommunityCouncilMembershipConfig { + members: accounts + .try_into() + .expect("Should support at least 5 members."), + phantom: Default::default(), + }, + council: Default::default(), + technical_committee: Default::default(), + community_council: Default::default(), + democracy: Default::default(), + treasury: Default::default(), + community_treasury: Default::default(), }; serde_json::to_value(&config).expect("Could not build genesis config.") diff --git a/runtime/astar/src/lib.rs b/runtime/astar/src/lib.rs index a0e52da84..2470d17d1 100644 --- a/runtime/astar/src/lib.rs +++ b/runtime/astar/src/lib.rs @@ -19,8 +19,8 @@ //! The Astar Network runtime. This can be compiled with ``#[no_std]`, ready for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. -#![recursion_limit = "256"] +// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 512. +#![recursion_limit = "512"] use cumulus_primitives_core::AggregateMessageOrigin; use frame_support::{ @@ -28,9 +28,11 @@ use frame_support::{ dispatch::DispatchClass, genesis_builder_helper, parameter_types, traits::{ - fungible::{Balanced, Credit}, - AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, Contains, FindAuthor, Get, Imbalance, - InstanceFilter, Nothing, OnFinalize, OnUnbalanced, Randomness, WithdrawReasons, + fungible::{Balanced, Credit, HoldConsideration}, + tokens::{PayFromAccount, UnityAssetBalanceConversion}, + AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, Contains, + EqualPrivilegeOnly, FindAuthor, Get, Imbalance, InstanceFilter, LinearStoragePrice, + Nothing, OnFinalize, OnUnbalanced, Randomness, WithdrawReasons, }, weights::{ constants::{ @@ -61,7 +63,8 @@ use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{ AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, - DispatchInfoOf, Dispatchable, OpaqueKeys, PostDispatchInfoOf, UniqueSaturatedInto, Zero, + DispatchInfoOf, Dispatchable, IdentityLookup, OpaqueKeys, PostDispatchInfoOf, + UniqueSaturatedInto, Zero, }, transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError}, ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Permill, Perquintill, RuntimeDebug, @@ -82,11 +85,19 @@ use astar_primitives::{ PeriodNumber, RankedTier, SmartContract, StandardTierSlots, }, evm::EvmRevertCodeHandler, + governance::{ + CommunityCouncilCollectiveInst, CommunityCouncilMembershipInst, CommunityTreasuryInst, + EnsureRootOrAllMainCouncil, EnsureRootOrAllTechnicalCommittee, + EnsureRootOrFourFifthsCommunityCouncil, EnsureRootOrTwoThirdsCommunityCouncil, + EnsureRootOrTwoThirdsMainCouncil, EnsureRootOrTwoThirdsTechnicalCommittee, + MainCouncilCollectiveInst, MainCouncilMembershipInst, MainTreasuryInst, + OracleMembershipInst, TechnicalCommitteeCollectiveInst, TechnicalCommitteeMembershipInst, + }, oracle::{CurrencyAmount, CurrencyId, DummyCombineData, Price}, xcm::AssetLocationIdConverter, Address, AssetId, BlockNumber, Hash, Header, Nonce, UnfreezeChainOnFailedMigration, }; -pub use astar_primitives::{governance::OracleMembershipInst, AccountId, Balance, Signature}; +pub use astar_primitives::{AccountId, Balance, Signature}; pub use pallet_dapp_staking::TierThreshold; pub use pallet_inflation::InflationParameters; @@ -357,6 +368,42 @@ impl pallet_multisig::Config for Runtime { type WeightInfo = pallet_multisig::weights::SubstrateWeight; } +parameter_types! { + pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block; +} + +impl pallet_scheduler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = EnsureRoot; + type MaxScheduledPerBlock = ConstU32<32>; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; + type OriginPrivilegeCmp = EqualPrivilegeOnly; + type Preimages = Preimage; +} + +parameter_types! { + pub const PreimageBaseDeposit: Balance = deposit(1, 0); + pub const PreimageByteDeposit: Balance = deposit(0, 1); + pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage); +} + +impl pallet_preimage::Config for Runtime { + type WeightInfo = pallet_preimage::weights::SubstrateWeight; + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type Consideration = HoldConsideration< + AccountId, + Balances, + PreimageHoldReason, + LinearStoragePrice, + >; +} + parameter_types! { pub const MinimumStakingAmount: Balance = 500 * ASTR; pub const BaseNativeCurrencyPrice: FixedU128 = FixedU128::from_rational(5, 100); @@ -395,8 +442,8 @@ impl pallet_dapp_staking::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type Currency = Balances; type SmartContract = SmartContract; - type ContractRegisterOrigin = frame_system::EnsureRoot; - type ContractUnregisterOrigin = frame_system::EnsureRoot; + type ContractRegisterOrigin = EnsureRootOrTwoThirdsCommunityCouncil; + type ContractUnregisterOrigin = EnsureRootOrFourFifthsCommunityCouncil; type ManagerOrigin = frame_system::EnsureRoot; type NativePriceProvider = PriceAggregator; type StakingRewardHandler = Inflation; @@ -1193,6 +1240,250 @@ impl frame_support::traits::SortedMembers for OracleMembershipWrapper } } +parameter_types! { + pub const CouncilMaxMembers: u32 = 16; + pub const TechnicalCommitteeMaxMembers: u32 = 8; + pub const CommunityCouncilMaxMembers: u32 = 32; +} + +impl pallet_membership::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddOrigin = EnsureRootOrTwoThirdsMainCouncil; + type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil; + type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil; + type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil; + type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil; + type MembershipInitialized = Council; + type MembershipChanged = Council; + type MaxMembers = CouncilMaxMembers; + type WeightInfo = pallet_membership::weights::SubstrateWeight; +} + +impl pallet_membership::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddOrigin = EnsureRootOrTwoThirdsMainCouncil; + type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil; + type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil; + type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil; + type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil; + type MembershipInitialized = TechnicalCommittee; + type MembershipChanged = TechnicalCommittee; + type MaxMembers = TechnicalCommitteeMaxMembers; + type WeightInfo = pallet_membership::weights::SubstrateWeight; +} + +impl pallet_membership::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddOrigin = EnsureRootOrTwoThirdsMainCouncil; + type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil; + type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil; + type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil; + type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil; + type MembershipInitialized = CommunityCouncil; + type MembershipChanged = CommunityCouncil; + type MaxMembers = CommunityCouncilMaxMembers; + type WeightInfo = pallet_membership::weights::SubstrateWeight; +} + +parameter_types! { + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; +} + +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = ConstU32<{ 5 * DAYS }>; + type MaxProposals = ConstU32<16>; + type MaxMembers = CouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} + +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = ConstU32<{ 5 * DAYS }>; + type MaxProposals = ConstU32<16>; + type MaxMembers = TechnicalCommitteeMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} + +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = ConstU32<{ 5 * DAYS }>; + type MaxProposals = ConstU32<16>; + type MaxMembers = CommunityCouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} + +impl pallet_democracy::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type EnactmentPeriod = ConstU32<{ 2 * DAYS }>; + type LaunchPeriod = ConstU32<{ 7 * DAYS }>; + type VotingPeriod = ConstU32<{ 7 * DAYS }>; + // Match with dApp staking unlocking period + type VoteLockingPeriod = ConstU32<{ 9 * DAYS }>; + type MinimumDeposit = ConstU128<{ 1000 * ASTR }>; + type FastTrackVotingPeriod = ConstU32<{ 2 * HOURS }>; + type CooloffPeriod = ConstU32<{ 7 * DAYS }>; + + type MaxVotes = ConstU32<128>; + type MaxProposals = ConstU32<128>; + type MaxDeposits = ConstU32<128>; + type MaxBlacklisted = ConstU32<128>; + + /// A two third majority of the Council can choose the next external "super majority approve" proposal. + type ExternalOrigin = EnsureRootOrTwoThirdsMainCouncil; + /// A two third majority of the Council can choose the next external "majority approve" proposal. Also bypasses blacklist filter. + type ExternalMajorityOrigin = EnsureRootOrTwoThirdsMainCouncil; + /// Unanimous approval of the Council can choose the next external "super majority against" proposal. + type ExternalDefaultOrigin = EnsureRootOrAllMainCouncil; + /// A two third majority of the Technical Committee can have an external proposal tabled immediately + /// for a _fast track_ vote, and a custom enactment period. + type FastTrackOrigin = EnsureRootOrTwoThirdsTechnicalCommittee; + /// Unanimous approval of the Technical Committee can have an external proposal tabled immediately + /// for a completely custom _voting period length_ vote, and a custom enactment period. + type InstantOrigin = EnsureRootOrAllTechnicalCommittee; + type InstantAllowed = ConstBool; + + /// A two third majority of the Council can cancel a passed proposal. Can happen only once per unique proposal. + type CancellationOrigin = EnsureRootOrTwoThirdsMainCouncil; + /// Only a passed public referendum can permanently blacklist a proposal. + type BlacklistOrigin = EnsureRoot; + /// An unanimous Technical Committee can cancel a public proposal, slashing the deposit(s). + type CancelProposalOrigin = EnsureRootOrAllTechnicalCommittee; + /// Any member of the Technical Committee can veto Council's proposal. This can be only done once per proposal, and _veto_ lasts for a _cooloff_ period. + type VetoOrigin = pallet_collective::EnsureMember; + + type SubmitOrigin = EnsureSigned; + type PalletsOrigin = OriginCaller; + type Preimages = Preimage; + type Scheduler = Scheduler; + type Slash = Treasury; + type WeightInfo = pallet_democracy::weights::SubstrateWeight; +} + +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub MainTreasuryAccount: AccountId = Treasury::account_id(); +} + +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryPalletId; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + + // Two origins which can either approve or reject the spending proposal + type ApproveOrigin = EnsureRootOrTwoThirdsMainCouncil; + type RejectOrigin = EnsureRootOrTwoThirdsMainCouncil; + + type OnSlash = Treasury; + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ConstU128<{ 100 * ASTR }>; + type ProposalBondMaximum = ConstU128<{ 1000 * ASTR }>; + type SpendPeriod = ConstU32<{ 7 * DAYS }>; + + // We don't do periodic burns of the treasury + type Burn = (); + type BurnDestination = (); + type SpendFunds = (); + + type MaxApprovals = ConstU32<64>; + type AssetKind = (); // Only native asset is supported + type Beneficiary = AccountId; + type BeneficiaryLookup = IdentityLookup; + type Paymaster = PayFromAccount; + type BalanceConverter = UnityAssetBalanceConversion; + + // New approach to using treasury, useful for OpenGov but not necessarily for us. + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + // Only used by 'spend' approach which is disabled + type PayoutPeriod = ConstU32<0>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); + type WeightInfo = pallet_treasury::weights::SubstrateWeight; +} + +parameter_types! { + pub const CommunityTreasuryPalletId: PalletId = PalletId(*b"py/comtr"); +} + +impl pallet_treasury::Config for Runtime { + type PalletId = CommunityTreasuryPalletId; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + + // Two origins which can either approve or reject the spending proposal + type ApproveOrigin = EnsureRootOrTwoThirdsCommunityCouncil; + type RejectOrigin = EnsureRootOrTwoThirdsCommunityCouncil; + + type OnSlash = CommunityTreasury; + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ConstU128<{ 100 * ASTR }>; + type ProposalBondMaximum = ConstU128<{ 1000 * ASTR }>; + type SpendPeriod = ConstU32<{ 7 * DAYS }>; + + // We don't do periodic burns of the community treasury + type Burn = (); + type BurnDestination = (); + type SpendFunds = (); + + type MaxApprovals = ConstU32<64>; + type AssetKind = (); // Only native asset is supported + type Beneficiary = AccountId; + type BeneficiaryLookup = IdentityLookup; + type Paymaster = PayFromAccount; + type BalanceConverter = UnityAssetBalanceConversion; + + // New approach to using treasury, useful for OpenGov but not necessarily for us. + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + // Only used by 'spend' approach which is disabled + type PayoutPeriod = ConstU32<0>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); + type WeightInfo = pallet_treasury::weights::SubstrateWeight; +} + +parameter_types! { + pub CommunityTreasuryAccountId: AccountId = CommunityTreasuryPalletId::get().into_account_truncating(); +} + +#[derive(Default)] +pub struct CommunityCouncilCallFilter; +impl InstanceFilter for CommunityCouncilCallFilter { + fn filter(&self, c: &RuntimeCall) -> bool { + matches!( + c, + RuntimeCall::DappStaking(..) + | RuntimeCall::System(frame_system::Call::remark { .. }) + | RuntimeCall::Utility(pallet_utility::Call::batch { .. }) + | RuntimeCall::Utility(pallet_utility::Call::batch_all { .. }) + ) + } +} + +impl pallet_collective_proxy::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type CollectiveProxy = EnsureRootOrTwoThirdsCommunityCouncil; + type ProxyAccountId = CommunityTreasuryAccountId; + type CallFilter = CommunityCouncilCallFilter; + type WeightInfo = pallet_collective_proxy::weights::SubstrateWeight; +} + parameter_types! { pub MbmServiceWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } @@ -1226,6 +1517,7 @@ construct_runtime!( Timestamp: pallet_timestamp = 13, Multisig: pallet_multisig = 14, Proxy: pallet_proxy = 15, + Scheduler: pallet_scheduler = 17, ParachainSystem: cumulus_pallet_parachain_system = 20, ParachainInfo: parachain_info = 21, @@ -1233,7 +1525,7 @@ construct_runtime!( TransactionPayment: pallet_transaction_payment = 30, Balances: pallet_balances = 31, Vesting: pallet_vesting = 32, -// Inflation needs to execute `on_initialize` as soon as possible, and `on_finalize` as late as possible. + // Inflation needs to execute `on_initialize` as soon as possible, and `on_finalize` as late as possible. // However, we need to execute Balance genesis before Inflation genesis, otherwise we'll have zero issuance when Inflation // logic is executed. // TODO: Address this later. It would be best if Inflation was first pallet. @@ -1264,7 +1556,20 @@ construct_runtime!( Contracts: pallet_contracts = 70, + Preimage: pallet_preimage = 84, + + // Governance Sudo: pallet_sudo = 99, + CouncilMembership: pallet_membership:: = 100, + TechnicalCommitteeMembership: pallet_membership:: = 101, + CommunityCouncilMembership: pallet_membership:: = 102, + Council: pallet_collective:: = 103, + TechnicalCommittee: pallet_collective:: = 104, + CommunityCouncil: pallet_collective:: = 105, + Democracy: pallet_democracy = 106, + Treasury: pallet_treasury:: = 107, + CommunityTreasury: pallet_treasury:: = 108, + CollectiveProxy: pallet_collective_proxy = 109, MultiBlockMigrations: pallet_migrations = 120, } diff --git a/runtime/astar/src/precompiles.rs b/runtime/astar/src/precompiles.rs index c2d85d001..6ee6e1391 100644 --- a/runtime/astar/src/precompiles.rs +++ b/runtime/astar/src/precompiles.rs @@ -63,6 +63,11 @@ impl Contains for WhitelistedCalls { RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true, RuntimeCall::XTokens(orml_xtokens::Call::transfer_multiasset_with_fee { .. }) => true, RuntimeCall::XTokens(orml_xtokens::Call::transfer_multiasset { .. }) => true, + // Governance related calls + RuntimeCall::Democracy(_) + | RuntimeCall::Treasury(_) + | RuntimeCall::CommunityTreasury(_) + | RuntimeCall::Preimage(_) => true, _ => false, } } diff --git a/runtime/local/src/lib.rs b/runtime/local/src/lib.rs index 185347545..650698f91 100644 --- a/runtime/local/src/lib.rs +++ b/runtime/local/src/lib.rs @@ -1112,7 +1112,8 @@ impl InstanceFilter for CommunityCouncilCallFilter { c, RuntimeCall::DappStaking(..) | RuntimeCall::System(frame_system::Call::remark { .. }) - | RuntimeCall::Utility(..) + | RuntimeCall::Utility(pallet_utility::Call::batch { .. }) + | RuntimeCall::Utility(pallet_utility::Call::batch_all { .. }) ) } } diff --git a/runtime/local/src/precompiles.rs b/runtime/local/src/precompiles.rs index 0daf444b5..8a29d1ab7 100644 --- a/runtime/local/src/precompiles.rs +++ b/runtime/local/src/precompiles.rs @@ -61,6 +61,10 @@ impl Contains for WhitelistedCalls { } RuntimeCall::DappStaking(_) => true, RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true, + RuntimeCall::Democracy(_) + | RuntimeCall::Treasury(_) + | RuntimeCall::CommunityTreasury(_) + | RuntimeCall::Preimage(_) => true, _ => false, } } diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index 1393276fb..fa1abf2c0 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -48,7 +48,6 @@ pallet-aura = { workspace = true } pallet-authorship = { workspace = true } pallet-balances = { workspace = true } pallet-collective = { workspace = true } -pallet-collective-proxy = { workspace = true } pallet-contracts = { workspace = true } pallet-democracy = { workspace = true } pallet-ethereum = { workspace = true } @@ -110,6 +109,7 @@ 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 } pallet-dynamic-evm-base-fee = { workspace = true } pallet-ethereum-checked = { workspace = true } @@ -153,232 +153,232 @@ substrate-wasm-builder = { workspace = true, optional = true } [features] default = ["std"] std = [ - "parity-scale-codec/std", - "serde_json/std", - "fp-rpc/std", + "astar-primitives/std", + "astar-xcm-benchmarks?/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "dapp-staking-runtime-api/std", "fp-evm/std", + "fp-rpc/std", "fp-self-contained/std", - "sp-std/std", - "sp-api/std", - "pallet-democracy/std", - "pallet-collective/std", - "pallet-collective-proxy/std", - "pallet-treasury/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-consensus-aura/std", - "sp-io/std", - "sp-runtime/std", - "sp-runtime-interface/std", - "pallet-membership/std", - "sp-version/std", - "sp-block-builder/std", - "sp-transaction-pool/std", - "sp-inherents/std", - "sp-arithmetic/std", - "frame-support/std", + "frame-benchmarking/std", "frame-executive/std", - "frame-system/std", - "frame-system-rpc-runtime-api/std", "frame-metadata-hash-extension/std", - "pallet-authorship/std", - "pallet-aura/std", + "frame-support/std", + "frame-system-benchmarking?/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "log?/std", + "moonbeam-evm-tracer/std", + "moonbeam-rpc-primitives-debug/std", + "moonbeam-rpc-primitives-txpool/std", + "num_enum/std", + "orml-oracle/std", + "orml-xcm-support/std", + "orml-xtokens/std", "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", "pallet-balances/std", - "pallet-contracts/std", + "pallet-chain-extension-assets/std", "pallet-chain-extension-unified-accounts/std", + "pallet-collator-selection/std", + "pallet-collective-proxy/std", + "pallet-collective/std", + "pallet-contracts/std", + "pallet-dapp-staking/std", + "pallet-democracy/std", "pallet-dynamic-evm-base-fee/std", + "pallet-ethereum-checked/std", "pallet-ethereum/std", - "pallet-preimage/std", - "pallet-evm/std", "pallet-evm-chain-id/std", + "pallet-evm-precompile-assets-erc20/std", "pallet-evm-precompile-blake2/std", - "pallet-evm-precompile-simple/std", "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dapp-staking/std", + "pallet-evm-precompile-dispatch-lockdrop/std", "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-ed25519/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", - "pallet-evm-precompile-dapp-staking/std", + "pallet-evm-precompile-simple/std", "pallet-evm-precompile-sr25519/std", "pallet-evm-precompile-substrate-ecdsa/std", - "pallet-evm-precompile-assets-erc20/std", - "pallet-evm-precompile-xcm/std", "pallet-evm-precompile-unified-accounts/std", - "xcm-runtime-apis/std", - "pallet-evm-precompile-dispatch-lockdrop/std", - "pallet-dapp-staking/std", - "orml-oracle/std", - "dapp-staking-runtime-api/std", - "pallet-inflation/std", - "pallet-price-aggregator/std", + "pallet-evm-precompile-xcm/std", + "pallet-evm/std", "pallet-identity/std", - "pallet-multisig/std", - "pallet-migrations/std", + "pallet-inflation/std", "pallet-insecure-randomness-collective-flip/std", - "pallet-session/std", - "pallet-utility/std", - "pallet-timestamp/std", - "pallet-vesting/std", + "pallet-membership/std", + "pallet-message-queue/std", + "pallet-migrations/std", + "pallet-multisig/std", + "pallet-preimage/std", + "pallet-price-aggregator/std", "pallet-proxy/std", - "sp-offchain/std", - "sp-session/std", + "pallet-scheduler/std", + "pallet-session/std", "pallet-sudo/std", - "pallet-transaction-payment/std", + "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-xcm/std", - "pallet-xc-asset-config/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", "pallet-unified-accounts/std", - "pallet-ethereum-checked/std", - "pallet-scheduler/std", + "pallet-utility/std", + "pallet-vesting/std", + "pallet-xc-asset-config/std", + "pallet-xcm-benchmarks?/std", + "pallet-xcm/std", "parachain-info/std", + "parachains-common/std", + "parity-scale-codec/std", "polkadot-parachain/std", "polkadot-primitives/std", "polkadot-runtime-common/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-pallet-xcm/std", - "pallet-collator-selection/std", - "frame-benchmarking/std", - "frame-try-runtime/std", - "moonbeam-evm-tracer/std", - "moonbeam-rpc-primitives-debug/std", - "moonbeam-rpc-primitives-txpool/std", - "xcm/std", - "xcm-builder/std", - "xcm-executor/std", - "substrate-wasm-builder", - "pallet-chain-extension-assets/std", - "orml-xtokens/std", - "orml-xcm-support/std", - "astar-primitives/std", - "pallet-message-queue/std", - "parachains-common/std", - "astar-xcm-benchmarks?/std", - "frame-system-benchmarking?/std", - "log?/std", - "num_enum/std", - "pallet-xcm-benchmarks?/std", "precompile-utils/std", "scale-info/std", + "serde_json/std", + "sp-api/std", + "sp-arithmetic/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime-interface/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", "vesting-mbm/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm-runtime-apis/std", + "xcm/std", ] runtime-benchmarks = [ + "astar-primitives/runtime-benchmarks", "astar-xcm-benchmarks/runtime-benchmarks", - "pallet-xcm-benchmarks/runtime-benchmarks", - "pallet-collective-proxy/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", "frame-benchmarking", + "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-dapp-staking/runtime-benchmarks", - "pallet-inflation/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-ethereum/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "pallet-xc-asset-config/runtime-benchmarks", - "pallet-price-aggregator/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-ethereum-checked/runtime-benchmarks", - "pallet-unified-accounts/runtime-benchmarks", + "orml-oracle/runtime-benchmarks", "orml-xtokens/runtime-benchmarks", - "astar-primitives/runtime-benchmarks", "pallet-assets/runtime-benchmarks", - "pallet-dynamic-evm-base-fee/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", "pallet-chain-extension-assets/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-collective-proxy/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", "pallet-contracts/runtime-benchmarks", - "pallet-evm/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", "pallet-evm-precompile-xcm/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", + "pallet-inflation/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", "pallet-migrations/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-price-aggregator/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-unified-accounts/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", + "pallet-xc-asset-config/runtime-benchmarks", + "pallet-xcm-benchmarks/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "vesting-mbm/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", "xcm-runtime-apis/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "orml-oracle/runtime-benchmarks", - "vesting-mbm/runtime-benchmarks", ] try-runtime = [ + "astar-primitives/try-runtime", + "astar-xcm-benchmarks?/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", "fp-self-contained/try-runtime", - "log", - "frame-try-runtime/try-runtime", "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "log", + "orml-oracle/try-runtime", + "orml-xtokens/try-runtime", + "pallet-assets/try-runtime", "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", "pallet-balances/try-runtime", + "pallet-chain-extension-assets/try-runtime", + "pallet-collator-selection/try-runtime", + "pallet-collective-proxy/try-runtime", + "pallet-collective/try-runtime", + "pallet-contracts/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", + "pallet-identity/try-runtime", "pallet-inflation/try-runtime", + "pallet-insecure-randomness-collective-flip/try-runtime", + "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-migrations/try-runtime", + "pallet-multisig/try-runtime", + "pallet-preimage/try-runtime", + "pallet-price-aggregator/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", - "orml-oracle/try-runtime", + "pallet-treasury/try-runtime", + "pallet-unified-accounts/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", - "pallet-price-aggregator/try-runtime", - "pallet-ethereum/try-runtime", - "pallet-membership/try-runtime", "pallet-xc-asset-config/try-runtime", - "pallet-collective-proxy/try-runtime", - "pallet-treasury/try-runtime", - "pallet-collective/try-runtime", - "pallet-democracy/try-runtime", - "pallet-assets/try-runtime", - "pallet-authorship/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-session/try-runtime", "pallet-xcm/try-runtime", - "pallet-identity/try-runtime", - "pallet-multisig/try-runtime", - "pallet-migrations/try-runtime", - "pallet-insecure-randomness-collective-flip/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-proxy/try-runtime", - "pallet-contracts/try-runtime", - "pallet-evm-chain-id/try-runtime", - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", "parachain-info/try-runtime", - "pallet-preimage/try-runtime", - "pallet-dynamic-evm-base-fee/try-runtime", - "pallet-evm/try-runtime", - "pallet-unified-accounts/try-runtime", - "pallet-ethereum-checked/try-runtime", - "orml-xtokens/try-runtime", - "pallet-message-queue/try-runtime", - "astar-primitives/try-runtime", - "astar-xcm-benchmarks?/try-runtime", - "pallet-chain-extension-assets/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", "vesting-mbm/try-runtime", diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index ada15891d..39829378a 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1501,7 +1501,8 @@ impl InstanceFilter for CommunityCouncilCallFilter { c, RuntimeCall::DappStaking(..) | RuntimeCall::System(frame_system::Call::remark { .. }) - | RuntimeCall::Utility(..) + | RuntimeCall::Utility(pallet_utility::Call::batch { .. }) + | RuntimeCall::Utility(pallet_utility::Call::batch_all { .. }) ) } } diff --git a/runtime/shibuya/src/precompiles.rs b/runtime/shibuya/src/precompiles.rs index 642e7e491..19a413321 100644 --- a/runtime/shibuya/src/precompiles.rs +++ b/runtime/shibuya/src/precompiles.rs @@ -64,6 +64,11 @@ impl Contains for WhitelistedCalls { RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true, RuntimeCall::XTokens(orml_xtokens::Call::transfer_multiasset_with_fee { .. }) => true, RuntimeCall::XTokens(orml_xtokens::Call::transfer_multiasset { .. }) => true, + // Governance related calls + RuntimeCall::Democracy(_) + | RuntimeCall::Treasury(_) + | RuntimeCall::CommunityTreasury(_) + | RuntimeCall::Preimage(_) => true, _ => false, } } diff --git a/tests/integration/src/lib.rs b/tests/integration/src/lib.rs index a46917f7d..f4dfb40e8 100644 --- a/tests/integration/src/lib.rs +++ b/tests/integration/src/lib.rs @@ -47,7 +47,7 @@ mod oracle; #[cfg(any(feature = "shibuya", feature = "shiden", feature = "astar"))] mod evm_tracing; -#[cfg(any(feature = "shibuya"))] +#[cfg(any(feature = "shibuya", feature = "astar"))] mod governance; #[cfg(any(feature = "shibuya", feature = "shiden", feature = "astar"))] diff --git a/tests/integration/src/setup.rs b/tests/integration/src/setup.rs index 760931af3..df985e1ab 100644 --- a/tests/integration/src/setup.rs +++ b/tests/integration/src/setup.rs @@ -35,7 +35,7 @@ use cumulus_primitives_parachain_inherent::ParachainInherentData; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; use sp_consensus_aura::{Slot, SlotDuration, AURA_ENGINE_ID}; -#[cfg(feature = "shibuya")] +#[cfg(any(feature = "shibuya", feature = "astar"))] pub use astar_primitives::governance::{ CommunityCouncilMembershipInst, MainCouncilMembershipInst, TechnicalCommitteeMembershipInst, }; @@ -177,7 +177,7 @@ impl ExtBuilder { ) .unwrap(); - #[cfg(any(feature = "shibuya"))] + #[cfg(any(feature = "shibuya", feature = "astar"))] // Governance related storage initialization { as BuildStorage>::assimilate_storage(