mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
Companion for primitives consolidation into v2 (#1071)
* branches * update all primitives references * fmt * Update Polkadot & Substrate * Again Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
committed by
GitHub
parent
f70d2f2fed
commit
544501a241
@@ -321,7 +321,7 @@ pub mod pallet {
|
||||
.read_upgrade_go_ahead_signal()
|
||||
.expect("Invalid upgrade go ahead signal");
|
||||
match upgrade_go_ahead_signal {
|
||||
Some(relay_chain::v1::UpgradeGoAhead::GoAhead) => {
|
||||
Some(relay_chain::v2::UpgradeGoAhead::GoAhead) => {
|
||||
assert!(
|
||||
<PendingValidationCode<T>>::exists(),
|
||||
"No new validation function found in storage, GoAhead signal is not expected",
|
||||
@@ -332,7 +332,7 @@ pub mod pallet {
|
||||
<T::OnSystemEvent as OnSystemEvent>::on_validation_code_applied();
|
||||
Self::deposit_event(Event::ValidationFunctionApplied(vfp.relay_parent_number));
|
||||
},
|
||||
Some(relay_chain::v1::UpgradeGoAhead::Abort) => {
|
||||
Some(relay_chain::v2::UpgradeGoAhead::Abort) => {
|
||||
<PendingValidationCode<T>>::kill();
|
||||
Self::deposit_event(Event::ValidationFunctionDiscarded);
|
||||
},
|
||||
@@ -482,7 +482,7 @@ pub mod pallet {
|
||||
/// set after the inherent.
|
||||
#[pallet::storage]
|
||||
pub(super) type UpgradeRestrictionSignal<T: Config> =
|
||||
StorageValue<_, Option<relay_chain::v1::UpgradeRestriction>, ValueQuery>;
|
||||
StorageValue<_, Option<relay_chain::v2::UpgradeRestriction>, ValueQuery>;
|
||||
|
||||
/// The snapshot of some state related to messaging relevant to the current parachain as per
|
||||
/// the relay parent.
|
||||
@@ -531,7 +531,7 @@ pub mod pallet {
|
||||
/// This will be cleared in `on_initialize` of each new block.
|
||||
#[pallet::storage]
|
||||
pub(super) type HrmpWatermark<T: Config> =
|
||||
StorageValue<_, relay_chain::v1::BlockNumber, ValueQuery>;
|
||||
StorageValue<_, relay_chain::v2::BlockNumber, ValueQuery>;
|
||||
|
||||
/// HRMP messages that were sent in a block.
|
||||
///
|
||||
@@ -779,7 +779,7 @@ impl<T: Config> Pallet<T> {
|
||||
fn process_inbound_horizontal_messages(
|
||||
ingress_channels: &[(ParaId, cumulus_primitives_core::AbridgedHrmpChannel)],
|
||||
horizontal_messages: BTreeMap<ParaId, Vec<InboundHrmpMessage>>,
|
||||
relay_parent_number: relay_chain::v1::BlockNumber,
|
||||
relay_parent_number: relay_chain::v2::BlockNumber,
|
||||
) -> Weight {
|
||||
// First, check that all submitted messages are sent from channels that exist. The
|
||||
// channel exists if its MQC head is present in `vfp.hrmp_mqc_heads`.
|
||||
|
||||
@@ -145,7 +145,7 @@ impl RelayChainStateProof {
|
||||
/// `proof`.
|
||||
pub fn new(
|
||||
para_id: ParaId,
|
||||
relay_parent_storage_root: relay_chain::v1::Hash,
|
||||
relay_parent_storage_root: relay_chain::v2::Hash,
|
||||
proof: StorageProof,
|
||||
) -> Result<Self, Error> {
|
||||
let db = proof.into_memory_db::<HashFor<relay_chain::Block>>();
|
||||
@@ -191,7 +191,7 @@ impl RelayChainStateProof {
|
||||
|
||||
let mut ingress_channels = Vec::with_capacity(ingress_channel_index.len());
|
||||
for sender in ingress_channel_index {
|
||||
let channel_id = relay_chain::v1::HrmpChannelId { sender, recipient: self.para_id };
|
||||
let channel_id = relay_chain::v2::HrmpChannelId { sender, recipient: self.para_id };
|
||||
let hrmp_channel: AbridgedHrmpChannel = read_entry(
|
||||
&self.trie_backend,
|
||||
&relay_chain::well_known_keys::hrmp_channels(channel_id),
|
||||
@@ -203,7 +203,7 @@ impl RelayChainStateProof {
|
||||
|
||||
let mut egress_channels = Vec::with_capacity(egress_channel_index.len());
|
||||
for recipient in egress_channel_index {
|
||||
let channel_id = relay_chain::v1::HrmpChannelId { sender: self.para_id, recipient };
|
||||
let channel_id = relay_chain::v2::HrmpChannelId { sender: self.para_id, recipient };
|
||||
let hrmp_channel: AbridgedHrmpChannel = read_entry(
|
||||
&self.trie_backend,
|
||||
&relay_chain::well_known_keys::hrmp_channels(channel_id),
|
||||
@@ -231,12 +231,12 @@ impl RelayChainStateProof {
|
||||
.map_err(Error::Config)
|
||||
}
|
||||
|
||||
/// Read the [`Slot`](relay_chain::v1::Slot) from the relay chain state proof.
|
||||
/// Read the [`Slot`](relay_chain::v2::Slot) from the relay chain state proof.
|
||||
///
|
||||
/// The slot is slot of the relay chain block this state proof was extracted from.
|
||||
///
|
||||
/// Returns an error if anything failed at reading or decoding.
|
||||
pub fn read_slot(&self) -> Result<relay_chain::v1::Slot, Error> {
|
||||
pub fn read_slot(&self) -> Result<relay_chain::v2::Slot, Error> {
|
||||
read_entry(&self.trie_backend, relay_chain::well_known_keys::CURRENT_SLOT, None)
|
||||
.map_err(Error::Slot)
|
||||
}
|
||||
@@ -250,7 +250,7 @@ impl RelayChainStateProof {
|
||||
/// Returns an error if anything failed at reading or decoding.
|
||||
pub fn read_upgrade_go_ahead_signal(
|
||||
&self,
|
||||
) -> Result<Option<relay_chain::v1::UpgradeGoAhead>, Error> {
|
||||
) -> Result<Option<relay_chain::v2::UpgradeGoAhead>, Error> {
|
||||
read_optional_entry(
|
||||
&self.trie_backend,
|
||||
&relay_chain::well_known_keys::upgrade_go_ahead_signal(self.para_id),
|
||||
@@ -266,7 +266,7 @@ impl RelayChainStateProof {
|
||||
/// Returns an error if anything failed at reading or decoding.
|
||||
pub fn read_upgrade_restriction_signal(
|
||||
&self,
|
||||
) -> Result<Option<relay_chain::v1::UpgradeRestriction>, Error> {
|
||||
) -> Result<Option<relay_chain::v2::UpgradeRestriction>, Error> {
|
||||
read_optional_entry(
|
||||
&self.trie_backend,
|
||||
&relay_chain::well_known_keys::upgrade_restriction_signal(self.para_id),
|
||||
|
||||
@@ -31,7 +31,7 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::RawOrigin;
|
||||
use hex_literal::hex;
|
||||
use relay_chain::v1::HrmpChannelId;
|
||||
use relay_chain::v2::HrmpChannelId;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
@@ -392,7 +392,7 @@ fn events() {
|
||||
BlockTests::new()
|
||||
.with_relay_sproof_builder(|_, block_number, builder| {
|
||||
if block_number > 123 {
|
||||
builder.upgrade_go_ahead = Some(relay_chain::v1::UpgradeGoAhead::GoAhead);
|
||||
builder.upgrade_go_ahead = Some(relay_chain::v2::UpgradeGoAhead::GoAhead);
|
||||
}
|
||||
})
|
||||
.add_with_post_test(
|
||||
@@ -443,7 +443,7 @@ fn manipulates_storage() {
|
||||
BlockTests::new()
|
||||
.with_relay_sproof_builder(|_, block_number, builder| {
|
||||
if block_number > 123 {
|
||||
builder.upgrade_go_ahead = Some(relay_chain::v1::UpgradeGoAhead::GoAhead);
|
||||
builder.upgrade_go_ahead = Some(relay_chain::v2::UpgradeGoAhead::GoAhead);
|
||||
}
|
||||
})
|
||||
.add(123, || {
|
||||
@@ -471,7 +471,7 @@ fn aborted_upgrade() {
|
||||
BlockTests::new()
|
||||
.with_relay_sproof_builder(|_, block_number, builder| {
|
||||
if block_number > 123 {
|
||||
builder.upgrade_go_ahead = Some(relay_chain::v1::UpgradeGoAhead::Abort);
|
||||
builder.upgrade_go_ahead = Some(relay_chain::v2::UpgradeGoAhead::Abort);
|
||||
}
|
||||
})
|
||||
.add(123, || {
|
||||
|
||||
@@ -21,7 +21,7 @@ use cumulus_pallet_parachain_system as parachain_system;
|
||||
use frame_support::{dispatch::DispatchResult, pallet_prelude::*, weights::DispatchInfo};
|
||||
use frame_system::pallet_prelude::*;
|
||||
pub use pallet::*;
|
||||
use polkadot_primitives::v1::PersistedValidationData;
|
||||
use polkadot_primitives::v2::PersistedValidationData;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
traits::{DispatchInfoOf, Dispatchable, SignedExtension},
|
||||
|
||||
@@ -56,6 +56,6 @@ std = [
|
||||
|
||||
runtime-benchmarks = [
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user