Skip to content

Commit

Permalink
bump parachain host api to v11 for polkadot and kusama (#348)
Browse files Browse the repository at this point in the history
<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [ ] Does not require a CHANGELOG entry

---------

Signed-off-by: alindima <alin@parity.io>
  • Loading branch information
alindima authored Jun 13, 2024
1 parent 085b452 commit c85bc45
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion integration-tests/emulated/chains/relays/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use emulated_integration_tests_common::{

// Kusama declaration
decl_test_relay_chains! {
#[api_version(10)]
#[api_version(11)]
pub struct Kusama {
genesis = genesis::genesis(),
on_init = (),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use emulated_integration_tests_common::{

// Polkadot declaration
decl_test_relay_chains! {
#[api_version(10)]
#[api_version(11)]
pub struct Polkadot {
genesis = genesis::genesis(),
on_init = (),
Expand Down
22 changes: 18 additions & 4 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use frame_support::weights::constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIM
use pallet_nis::WithMaximumOf;
use polkadot_primitives::{
slashing, AccountId, AccountIndex, ApprovalVotingParams, Balance, BlockNumber, CandidateEvent,
CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams,
CandidateHash, CommittedCandidateReceipt, CoreIndex, CoreState, DisputeState, ExecutorParams,
GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment,
NodeFeatures, Nonce, OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes,
SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
Expand All @@ -42,7 +42,11 @@ use polkadot_runtime_common::{
U256ToBalance,
};
use scale_info::TypeInfo;
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
use sp_std::{
cmp::Ordering,
collections::{btree_map::BTreeMap, vec_deque::VecDeque},
prelude::*,
};

use runtime_parachains::{
assigner_coretime as parachains_assigner_coretime,
Expand Down Expand Up @@ -1208,7 +1212,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down Expand Up @@ -2169,7 +2174,7 @@ sp_api::impl_runtime_apis! {
}
}

#[api_version(10)]
#[api_version(11)]
impl polkadot_primitives::runtime_api::ParachainHost<Block> for Runtime {
fn validators() -> Vec<ValidatorId> {
parachains_runtime_api_impl::validators::<Runtime>()
Expand Down Expand Up @@ -2215,6 +2220,7 @@ sp_api::impl_runtime_apis! {
}

fn candidate_pending_availability(para_id: ParaId) -> Option<CommittedCandidateReceipt<Hash>> {
#[allow(deprecated)]
parachains_runtime_api_impl::candidate_pending_availability::<Runtime>(para_id)
}

Expand Down Expand Up @@ -2324,6 +2330,14 @@ sp_api::impl_runtime_apis! {
fn approval_voting_params() -> ApprovalVotingParams {
parachains_runtime_api_impl::approval_voting_params::<Runtime>()
}

fn claim_queue() -> BTreeMap<CoreIndex, VecDeque<ParaId>> {
parachains_vstaging_api_impl::claim_queue::<Runtime>()
}

fn candidates_pending_availability(para_id: ParaId) -> Vec<CommittedCandidateReceipt<Hash>> {
parachains_vstaging_api_impl::candidates_pending_availability::<Runtime>(para_id)
}
}

impl beefy_primitives::BeefyApi<Block, BeefyId> for Runtime {
Expand Down
22 changes: 18 additions & 4 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ use pallet_session::historical as session_historical;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use polkadot_primitives::{
slashing, AccountId, AccountIndex, ApprovalVotingParams, Balance, BlockNumber, CandidateEvent,
CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams,
CandidateHash, CommittedCandidateReceipt, CoreIndex, CoreState, DisputeState, ExecutorParams,
GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment,
NodeFeatures, Nonce, OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes,
SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
Expand All @@ -95,7 +95,11 @@ use sp_runtime::{
RuntimeAppPublic, RuntimeDebug,
};
use sp_staking::SessionIndex;
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
use sp_std::{
cmp::Ordering,
collections::{btree_map::BTreeMap, vec_deque::VecDeque},
prelude::*,
};
#[cfg(any(feature = "std", test))]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
Expand Down Expand Up @@ -1242,7 +1246,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down Expand Up @@ -2089,7 +2094,7 @@ sp_api::impl_runtime_apis! {
}
}

#[api_version(10)]
#[api_version(11)]
impl polkadot_primitives::runtime_api::ParachainHost<Block> for Runtime {
fn validators() -> Vec<ValidatorId> {
parachains_runtime_api_impl::validators::<Runtime>()
Expand Down Expand Up @@ -2135,6 +2140,7 @@ sp_api::impl_runtime_apis! {
}

fn candidate_pending_availability(para_id: ParaId) -> Option<CommittedCandidateReceipt<Hash>> {
#[allow(deprecated)]
parachains_runtime_api_impl::candidate_pending_availability::<Runtime>(para_id)
}

Expand Down Expand Up @@ -2244,6 +2250,14 @@ sp_api::impl_runtime_apis! {
fn approval_voting_params() -> ApprovalVotingParams {
parachains_runtime_api_impl::approval_voting_params::<Runtime>()
}

fn claim_queue() -> BTreeMap<CoreIndex, VecDeque<ParaId>> {
parachains_vstaging_api_impl::claim_queue::<Runtime>()
}

fn candidates_pending_availability(para_id: ParaId) -> Vec<CommittedCandidateReceipt<Hash>> {
parachains_vstaging_api_impl::candidates_pending_availability::<Runtime>(para_id)
}
}

impl beefy_primitives::BeefyApi<Block, BeefyId> for Runtime {
Expand Down

0 comments on commit c85bc45

Please sign in to comment.