Skip to content

Commit

Permalink
fix collator selection merge failure
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Jun 4, 2024
1 parent d75c46d commit 6fe8f4c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
55 changes: 54 additions & 1 deletion polkadot-parachains/integritee-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,50 @@ impl pallet_assets::Config<PoolAssetsInstance> for Runtime {
type BenchmarkHelper = ();
}

impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
type EventHandler = (CollatorSelection,);
}

parameter_types! {
pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0;
}
impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
// we don't have stash and controller, thus we don't need the convert as well.
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = CollatorSelection;
// Essentially just Aura, but let's be pedantic.
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}

parameter_types! {
pub const PotId: PalletId = PalletId(*b"PotStake");
pub const SessionLength: BlockNumber = 6 * HOURS;
}

impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type UpdateOrigin = EnsureRootOrMoreThanHalfCouncil;
type PotId = PotId;
type MaxCandidates = ConstU32<100>;
type MinEligibleCollators = ConstU32<4>;
type MaxInvulnerables = ConstU32<20>;
// should be a multiple of session or things will get inconsistent
type KickThreshold = Period;
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ValidatorRegistration = Session;
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
}

construct_runtime!(
pub enum Runtime
{
Expand Down Expand Up @@ -974,6 +1018,9 @@ construct_runtime!(
ChildBounties: pallet_child_bounties = 19,

// Consensus.
Authorship: pallet_authorship = 20,
CollatorSelection: pallet_collator_selection = 21,
Session: pallet_session = 22,
Aura: pallet_aura = 23,
AuraExt: cumulus_pallet_aura_ext = 24,

Expand Down Expand Up @@ -1027,6 +1074,7 @@ pub type BlockId = generic::BlockId<Block>;
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
migrations::scheduler::v4::PurgeV4Agenda<Runtime>,
migrations::collator_selection_init::v0::InitInvulnerables<Runtime>,
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
);

Expand Down Expand Up @@ -1055,13 +1103,15 @@ mod benches {
[pallet_bounties, Bounties]
[pallet_child_bounties, ChildBounties]
[pallet_claims, Claims]
[pallet_collator_selection, CollatorSelection]
[pallet_collective, Council]
[pallet_democracy, Democracy]
[pallet_message_queue, MessageQueue]
[pallet_multisig, Multisig]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
[pallet_session, SessionBench::<Runtime>]
[pallet_sidechain, Sidechain]
[pallet_teeracle, Teeracle]
[pallet_teerex, Teerex]
Expand Down Expand Up @@ -1247,6 +1297,7 @@ impl_runtime_apis! {
use frame_benchmarking::{Benchmarking, BenchmarkList};
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);
Expand All @@ -1260,8 +1311,10 @@ impl_runtime_apis! {
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError};
use sp_storage::TrackedStorageKey;

use frame_system_benchmarking::Pallet as SystemBench;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

impl frame_system_benchmarking::Config for Runtime {
fn setup_set_code_requirements(code: &sp_std::vec::Vec<u8>) -> Result<(), BenchmarkError> {
ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachains/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![allow(clippy::inconsistent_digit_grouping)]

use cumulus_primitives_core::ParaId;
use integritee_parachains_common::AccountId;
use integritee_parachains_common::{AccountId, AuraId};
use integritee_runtime::TEER;
use parity_scale_codec::{Decode, Encode};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
Expand Down Expand Up @@ -263,7 +263,7 @@ fn shell_genesis_config(
.map(|acc| {
Decode::decode(&mut acc.encode().as_ref()).unwrap() }, // session keys
)
.collect(),
.collect::<Vec<AuraId>>(),
},
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 100 * TEER)).collect::<Vec<_>>(),
Expand Down

0 comments on commit 6fe8f4c

Please sign in to comment.