Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P-805 add required pallets to Litentry #2988

Merged
merged 6 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

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

16 changes: 13 additions & 3 deletions node/src/chain_specs/litentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use super::*;
use cumulus_primitives_core::ParaId;
use litentry_parachain_runtime::{
AccountId, AuraId, Balance, BalancesConfig, BitacrossConfig, CouncilMembershipConfig,
GenesisConfig, ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, SessionConfig,
SystemConfig, TechnicalCommitteeMembershipConfig, TeebagConfig, TeebagOperationalMode, UNIT,
WASM_BINARY,
DeveloperCommitteeMembershipConfig, GenesisConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, SessionConfig, SystemConfig, TechnicalCommitteeMembershipConfig,
TeebagConfig, TeebagOperationalMode, VCManagementConfig, UNIT, WASM_BINARY,
};
use sc_service::ChainType;
use sc_telemetry::TelemetryEndpoints;
Expand Down Expand Up @@ -50,6 +50,7 @@ struct GenesisInfo {
endowed_accounts: Vec<(AccountId, String)>,
council: Vec<AccountId>,
technical_committee: Vec<AccountId>,
developer_committee: Vec<AccountId>,
boot_nodes: Vec<String>,
telemetry_endpoints: Vec<String>,
}
Expand Down Expand Up @@ -88,6 +89,7 @@ pub fn get_chain_spec_dev() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Bob"),
],
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
DEFAULT_PARA_ID.into(),
)
},
Expand Down Expand Up @@ -159,6 +161,7 @@ fn get_chain_spec_from_genesis_info(
.collect(),
genesis_info_cloned.council,
genesis_info_cloned.technical_committee,
genesis_info_cloned.developer_committee,
para_id,
)
},
Expand Down Expand Up @@ -187,6 +190,7 @@ fn generate_genesis(
endowed_accounts: Vec<(AccountId, Balance)>,
council_members: Vec<AccountId>,
technical_committee_members: Vec<AccountId>,
developer_committee_members: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
Expand Down Expand Up @@ -224,12 +228,18 @@ fn generate_genesis(
members: technical_committee_members.try_into().expect("error convert to BoundedVec"),
phantom: Default::default(),
},
developer_committee: Default::default(),
developer_committee_membership: DeveloperCommitteeMembershipConfig {
members: developer_committee_members.try_into().expect("error convert to BoundedVec"),
phantom: Default::default(),
},
treasury: Default::default(),
vesting: Default::default(),
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
vc_management: VCManagementConfig { admin: None },
transaction_payment: Default::default(),
assets: Default::default(),
ethereum: Default::default(),
Expand Down
10 changes: 10 additions & 0 deletions runtime/litentry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ pallet-asset-manager = { workspace = true }
pallet-bitacross = { workspace = true }
pallet-bridge = { workspace = true }
pallet-bridge-transfer = { workspace = true }
pallet-evm-assertions = { workspace = true }
pallet-extrinsic-filter = { workspace = true }
pallet-group = { workspace = true }
pallet-identity-management = { workspace = true }
pallet-parachain-staking = { workspace = true }
pallet-score-staking = { workspace = true }
pallet-teebag = { workspace = true }
pallet-vc-management = { workspace = true }
runtime-common = { workspace = true }

fp-evm = { workspace = true }
Expand Down Expand Up @@ -246,8 +250,10 @@ std = [
"pallet-bridge-transfer/std",
"pallet-extrinsic-filter/std",
"pallet-bitacross/std",
"pallet-identity-management/std",
"pallet-score-staking/std",
"pallet-teebag/std",
"pallet-vc-management/std",
"moonbeam-evm-tracer/std",
"moonbeam-rpc-primitives-debug/std",
"moonbeam-rpc-primitives-txpool/std",
Expand Down Expand Up @@ -282,7 +288,10 @@ try-runtime = [
"pallet-democracy/try-runtime",
"pallet-ethereum/try-runtime",
"pallet-evm/try-runtime",
"pallet-evm-assertions/try-runtime",
"pallet-identity/try-runtime",
"pallet-group/try-runtime",
"pallet-identity-management/try-runtime",
"pallet-extrinsic-filter/try-runtime",
"pallet-membership/try-runtime",
"pallet-multisig/try-runtime",
Expand All @@ -296,6 +305,7 @@ try-runtime = [
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-vc-management/try-runtime",
"pallet-vesting/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
Expand Down
115 changes: 99 additions & 16 deletions runtime/litentry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ pub use core_primitives::{
pub use runtime_common::currency::*;
use runtime_common::{
impl_runtime_transaction_payment_fees, prod_or_fast, BlockHashCount, BlockLength,
CouncilInstance, CouncilMembershipInstance, EnsureEnclaveSigner, EnsureRootOrAllCouncil,
CouncilInstance, CouncilMembershipInstance, DeveloperCommitteeInstance,
DeveloperCommitteeMembershipInstance, EnsureEnclaveSigner, EnsureRootOrAllCouncil,
EnsureRootOrAllTechnicalCommittee, EnsureRootOrHalfCouncil, EnsureRootOrHalfTechnicalCommittee,
EnsureRootOrTwoThirdsCouncil, EnsureRootOrTwoThirdsTechnicalCommittee, NegativeImbalance,
RuntimeBlockWeights, SlowAdjustingFeeUpdate, TechnicalCommitteeInstance,
TechnicalCommitteeMembershipInstance, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
WEIGHT_PER_GAS, WEIGHT_TO_FEE_FACTOR,
EnsureRootOrTwoThirdsCouncil, EnsureRootOrTwoThirdsTechnicalCommittee,
IMPExtrinsicWhitelistInstance, NegativeImbalance, RuntimeBlockWeights, SlowAdjustingFeeUpdate,
TechnicalCommitteeInstance, TechnicalCommitteeMembershipInstance,
VCMPExtrinsicWhitelistInstance, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, WEIGHT_PER_GAS,
WEIGHT_TO_FEE_FACTOR,
};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};

Expand Down Expand Up @@ -613,6 +615,32 @@ impl pallet_membership::Config<TechnicalCommitteeMembershipInstance> for Runtime
type WeightInfo = weights::pallet_membership::WeightInfo<Runtime>;
}

impl pallet_collective::Config<DeveloperCommitteeInstance> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration;
type MaxProposals = ConstU32<100>;
type MaxMembers = CouncilDefaultMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
}

impl pallet_membership::Config<DeveloperCommitteeMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsCouncil;
type MembershipInitialized = DeveloperCommittee;
type MembershipChanged = DeveloperCommittee;
type MaxMembers = CouncilDefaultMaxMembers;
type WeightInfo = weights::pallet_membership::WeightInfo<Runtime>;
}

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
Expand Down Expand Up @@ -935,12 +963,47 @@ impl pallet_teebag::Config for Runtime {
type WeightInfo = weights::pallet_teebag::WeightInfo<Runtime>;
}

impl pallet_identity_management::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type TEECallOrigin = EnsureEnclaveSigner<Runtime>;
type DelegateeAdminOrigin = EnsureRootOrAllCouncil;
type ExtrinsicWhitelistOrigin = IMPExtrinsicWhitelist;
type MaxOIDCClientRedirectUris = ConstU32<10>;
}

impl pallet_bitacross::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type TEECallOrigin = EnsureEnclaveSigner<Runtime>;
type SetAdminOrigin = EnsureRootOrHalfCouncil;
}

impl pallet_evm_assertions::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AssertionId = H160;
type ContractDevOrigin = pallet_collective::EnsureMember<AccountId, DeveloperCommitteeInstance>;
type TEECallOrigin = EnsureEnclaveSigner<Runtime>;
}

impl pallet_group::Config<IMPExtrinsicWhitelistInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type GroupManagerOrigin = EnsureRootOrAllCouncil;
}

impl pallet_vc_management::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type TEECallOrigin = EnsureEnclaveSigner<Runtime>;
type SetAdminOrigin = EnsureRootOrHalfCouncil;
type DelegateeAdminOrigin = EnsureRootOrAllCouncil;
type ExtrinsicWhitelistOrigin = VCMPExtrinsicWhitelist;
}

impl pallet_group::Config<VCMPExtrinsicWhitelistInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type GroupManagerOrigin = EnsureRootOrAllCouncil;
}

// For OnChargeEVMTransaction implementation
type CurrencyAccountId<T> = <T as frame_system::Config>::AccountId;
type BalanceFor<T> =
Expand Down Expand Up @@ -1089,7 +1152,6 @@ impl pallet_score_staking::Config for Runtime {
}

impl runtime_common::BaseRuntimeRequirements for Runtime {}

impl runtime_common::ParaRuntimeRequirements for Runtime {}

construct_runtime! {
Expand Down Expand Up @@ -1162,9 +1224,17 @@ construct_runtime! {
Teebag: pallet_teebag = 65,
Bitacross: pallet_bitacross = 66,
AssetsHandler: pallet_assets_handler = 68,
EvmAssertions: pallet_evm_assertions = 71,

DeveloperCommittee: pallet_collective::<Instance3> = 73,
DeveloperCommitteeMembership: pallet_membership::<Instance3> = 74,
ScoreStaking: pallet_score_staking = 75,

IdentityManagement: pallet_identity_management = 80,
VCManagement: pallet_vc_management = 81,
IMPExtrinsicWhitelist: pallet_group::<Instance1> = 82,
VCMPExtrinsicWhitelist: pallet_group::<Instance2> = 83,

// Frontier
EVM: pallet_evm = 120,
Ethereum: pallet_ethereum = 121,
Expand Down Expand Up @@ -1220,33 +1290,43 @@ impl Contains<RuntimeCall> for NormalModeFilter {
RuntimeCall::Bounties(_) |
// BridgeTransfer
RuntimeCall::BridgeTransfer(_) |
// Utility
RuntimeCall::Utility(_) |
// Session
RuntimeCall::Session(_) |
// ParachainStaking
RuntimeCall::ParachainStaking(_) |
// collective
RuntimeCall::DeveloperCommittee(_) |
// memberships
RuntimeCall::CouncilMembership(_) |
RuntimeCall::TechnicalCommitteeMembership(_) |
RuntimeCall::DeveloperCommitteeMembership(_) |
// democracy, we don't subdivide the calls, so we allow public proposals
RuntimeCall::Democracy(_) |
// Preimage
RuntimeCall::Preimage(_) |
// Identity
RuntimeCall::ParachainIdentity(_) |
// Utility
RuntimeCall::Utility(_) |
// Session
RuntimeCall::Session(_) |
// Balance
RuntimeCall::Balances(_) |
// IMP and VCMP
RuntimeCall::IdentityManagement(_) |
RuntimeCall::VCManagement(_) |
// TEE pallets
RuntimeCall::Teebag(_) |
// ParachainStaking
RuntimeCall::ParachainStaking(_) |
// Group
RuntimeCall::IMPExtrinsicWhitelist(_) |
RuntimeCall::VCMPExtrinsicWhitelist(_) |
// EVM
// Substrate EVM extrinsic not allowed
// So no EVM pallet
RuntimeCall::Ethereum(_) |
// AccountFix
RuntimeCall::AccountFix(_) |
// TEE enclave management
RuntimeCall::Teebag(_) |
// Bitacross
RuntimeCall::Bitacross(_)
RuntimeCall::Bitacross(_) |
RuntimeCall::EvmAssertions(_) |
RuntimeCall::ScoreStaking(_)
)
}
}
Expand All @@ -1265,12 +1345,15 @@ mod benches {
[pallet_proxy, Proxy]
[pallet_membership, CouncilMembership]
[pallet_multisig, Multisig]
[paleet_evm, EVM]
[pallet_extrinsic_filter, ExtrinsicFilter]
[pallet_scheduler, Scheduler]
[pallet_preimage, Preimage]
[pallet_session, SessionBench::<Runtime>]
[pallet_parachain_staking, ParachainStaking]
[cumulus_pallet_xcmp_queue, XcmpQueue]
// [pallet_identity_management, IdentityManagement]
// [pallet_vc_management, VCManagement]
[pallet_bridge,ChainBridge]
[pallet_bridge_transfer,BridgeTransfer]
[pallet_teebag, Teebag]
Expand Down