mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Add set custom header to Seedling Runtime (#846)
* before adding seedling client side * seedling runtime compiles * create seedling spec script added * seedling node & BaseCallFilter fixes * update AllPalets * formatting * CallFilter + SignedExtra + AccountData fix * XCM removed * cleanup * solo-to-para pallet added & before testing * fix runtime upgrade method * soloToPara pallet + set header * clean up * clean up 2 * signed extension check sudo added * fmt + cleanup * Refac code and fixes * fmt * Update pallets/solo-to-para/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update pallets/solo-to-para/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update pallets/solo-to-para/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * small fixes * OnValidationData used * small changes * Update pallets/solo-to-para/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update pallets/solo-to-para/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update pallets/solo-to-para/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * OnValidationData replaced by OnSystemEvent * fmt + cargo fix * disable-default-bootnodes for seedling script Co-authored-by: Ricardo Rius <ricardo@parity.io> Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Generated
+18
-1
@@ -1686,6 +1686,7 @@ dependencies = [
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"hex-literal 0.2.1",
|
||||
"impl-trait-for-tuples",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"pallet-balances",
|
||||
@@ -1731,6 +1732,22 @@ dependencies = [
|
||||
"sp-std",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-pallet-solo-to-para"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-pallet-parachain-system",
|
||||
"cumulus-primitives-core",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"pallet-sudo",
|
||||
"parity-scale-codec",
|
||||
"polkadot-primitives",
|
||||
"scale-info",
|
||||
"sp-runtime",
|
||||
"sp-std",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-pallet-xcm"
|
||||
version = "0.1.0"
|
||||
@@ -1790,7 +1807,6 @@ name = "cumulus-primitives-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"impl-trait-for-tuples",
|
||||
"parity-scale-codec",
|
||||
"polkadot-core-primitives",
|
||||
"polkadot-parachain",
|
||||
@@ -9850,6 +9866,7 @@ name = "seedling-runtime"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-pallet-parachain-system",
|
||||
"cumulus-pallet-solo-to-para",
|
||||
"cumulus-primitives-core",
|
||||
"frame-executive",
|
||||
"frame-support",
|
||||
|
||||
@@ -35,6 +35,7 @@ scale-info = { version = "1.0.0", default-features = false, features = ["derive"
|
||||
serde = { version = "1.0.132", optional = true, features = ["derive"] }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
environmental = { version = "1.1.2", default-features = false }
|
||||
impl-trait-for-tuples = "0.2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
# Other Dependencies
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
use codec::Encode;
|
||||
use cumulus_primitives_core::{
|
||||
relay_chain, AbridgedHostConfiguration, ChannelStatus, CollationInfo, DmpMessageHandler,
|
||||
GetChannelInfo, InboundDownwardMessage, InboundHrmpMessage, MessageSendError, OnValidationData,
|
||||
GetChannelInfo, InboundDownwardMessage, InboundHrmpMessage, MessageSendError,
|
||||
OutboundHrmpMessage, ParaId, PersistedValidationData, UpwardMessage, UpwardMessageSender,
|
||||
XcmpMessageHandler, XcmpMessageSource,
|
||||
};
|
||||
@@ -105,7 +105,7 @@ pub mod pallet {
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
|
||||
/// Something which can be notified when the validation data is set.
|
||||
type OnValidationData: OnValidationData;
|
||||
type OnSystemEvent: OnSystemEvent;
|
||||
|
||||
/// Returns the parachain ID we are running with.
|
||||
type SelfParaId: Get<ParaId>;
|
||||
@@ -329,6 +329,7 @@ pub mod pallet {
|
||||
let validation_code = <PendingValidationCode<T>>::take();
|
||||
|
||||
Self::put_parachain_code(&validation_code);
|
||||
<T::OnSystemEvent as OnSystemEvent>::on_validation_code_applied();
|
||||
Self::deposit_event(Event::ValidationFunctionApplied(vfp.relay_parent_number));
|
||||
},
|
||||
Some(relay_chain::v1::UpgradeGoAhead::Abort) => {
|
||||
@@ -354,7 +355,7 @@ pub mod pallet {
|
||||
<RelevantMessagingState<T>>::put(relevant_messaging_state.clone());
|
||||
<HostConfiguration<T>>::put(host_config);
|
||||
|
||||
<T::OnValidationData as OnValidationData>::on_validation_data(&vfp);
|
||||
<T::OnSystemEvent as OnSystemEvent>::on_validation_data(&vfp);
|
||||
|
||||
// TODO: This is more than zero, but will need benchmarking to figure out what.
|
||||
let mut total_weight = 0;
|
||||
@@ -397,7 +398,7 @@ pub mod pallet {
|
||||
code: Vec<u8>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
Self::validate_authorized_upgrade(&code[..])?;
|
||||
Self::set_code_impl(code)?;
|
||||
Self::schedule_code_upgrade(code)?;
|
||||
AuthorizedUpgrade::<T>::kill();
|
||||
Ok(Pays::No.into())
|
||||
}
|
||||
@@ -883,7 +884,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
/// The implementation of the runtime upgrade functionality for parachains.
|
||||
fn set_code_impl(validation_function: Vec<u8>) -> DispatchResult {
|
||||
pub fn schedule_code_upgrade(validation_function: Vec<u8>) -> DispatchResult {
|
||||
// Ensure that `ValidationData` exists. We do not care about the validation data per se,
|
||||
// but we do care about the [`UpgradeRestrictionSignal`] which arrives with the same inherent.
|
||||
ensure!(<ValidationData<T>>::exists(), Error::<T>::ValidationDataNotAvailable,);
|
||||
@@ -949,7 +950,7 @@ pub struct ParachainSetCode<T>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config> frame_system::SetCode<T> for ParachainSetCode<T> {
|
||||
fn set_code(code: Vec<u8>) -> DispatchResult {
|
||||
Pallet::<T>::set_code_impl(code)
|
||||
Pallet::<T>::schedule_code_upgrade(code)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,6 +1008,21 @@ pub trait CheckInherents<Block: BlockT> {
|
||||
) -> frame_support::inherent::CheckInherentsResult;
|
||||
}
|
||||
|
||||
/// Something that should be informed about system related events.
|
||||
///
|
||||
/// This includes events like [`on_validation_data`](Self::on_validation_data) that is being
|
||||
/// called when the parachain inherent is executed that contains the validation data.
|
||||
/// Or like [`on_validation_code_applied`](Self::on_validation_code_applied) that is called
|
||||
/// when the new validation is written to the state. This means that
|
||||
/// from the next block the runtime is being using this new code.
|
||||
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
||||
pub trait OnSystemEvent {
|
||||
/// Called in each blocks once when the validation data is set by the inherent.
|
||||
fn on_validation_data(data: &PersistedValidationData);
|
||||
/// Called when the validation code is being applied, aka from the next block on this is the new runtime.
|
||||
fn on_validation_code_applied();
|
||||
}
|
||||
|
||||
/// Implements [`BlockNumberProvider`] that returns relay chain block number fetched from
|
||||
/// validation data.
|
||||
/// NTOE: When validation data is not available (e.g. within on_initialize), 0 will be returned.
|
||||
|
||||
@@ -100,7 +100,7 @@ impl frame_system::Config for Test {
|
||||
}
|
||||
impl Config for Test {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = ParachainId;
|
||||
type OutboundXcmpMessageSource = FromThreadLocal;
|
||||
type DmpMessageHandler = SaveIntoThreadLocal;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
[package]
|
||||
name = "cumulus-pallet-solo-to-para"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Adds functionality to migrate from a Solo to a Parachain"
|
||||
|
||||
[dependencies]
|
||||
# Substrate dependencies
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-pallet-parachain-system = { default-features = false, path = "../parachain-system" }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
|
||||
# Polkadot dependecies
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Other Dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"]}
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"pallet-sudo/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"polkadot-primitives/std",
|
||||
"frame-support/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"frame-system/std",
|
||||
]
|
||||
@@ -0,0 +1,181 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
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 scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
traits::{DispatchInfoOf, Dispatchable, SignedExtension},
|
||||
transaction_validity::{
|
||||
InvalidTransaction, TransactionLongevity, TransactionPriority, TransactionValidity,
|
||||
TransactionValidityError, ValidTransaction,
|
||||
},
|
||||
};
|
||||
use sp_std::{prelude::*, vec::Vec};
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config:
|
||||
frame_system::Config + parachain_system::Config + pallet_sudo::Config
|
||||
{
|
||||
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::generate_store(pub(super) trait Store)]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
/// In case of a scheduled migration, this storage field contains the custom head data to be applied.
|
||||
#[pallet::storage]
|
||||
pub(super) type PendingCustomValidationHeadData<T: Config> =
|
||||
StorageValue<_, Vec<u8>, OptionQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event {
|
||||
/// The custom validation head data has been scheduled to apply.
|
||||
CustomValidationHeadDataStored,
|
||||
/// The custom validation head data was applied as of the contained relay chain block number.
|
||||
CustomValidationHeadDataApplied,
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
pub enum Error<T> {
|
||||
/// CustomHeadData is not stored in storage.
|
||||
NoCustomHeadData,
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::weight(0)]
|
||||
pub fn schedule_migration(
|
||||
origin: OriginFor<T>,
|
||||
code: Vec<u8>,
|
||||
head_data: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
parachain_system::Pallet::<T>::schedule_code_upgrade(code)?;
|
||||
Self::store_pending_custom_validation_head_data(head_data);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Set a custom head data that should only be applied when upgradeGoAheadSignal from
|
||||
/// the Relay Chain is GoAhead
|
||||
fn store_pending_custom_validation_head_data(head_data: Vec<u8>) {
|
||||
PendingCustomValidationHeadData::<T>::put(head_data);
|
||||
Self::deposit_event(Event::CustomValidationHeadDataStored);
|
||||
}
|
||||
|
||||
/// Set pending custom head data as head data that will be returned by `validate_block`. on the relay chain.
|
||||
fn set_pending_custom_validation_head_data() {
|
||||
if let Some(head_data) = <PendingCustomValidationHeadData<T>>::take() {
|
||||
parachain_system::Pallet::<T>::set_custom_validation_head_data(head_data);
|
||||
Self::deposit_event(Event::CustomValidationHeadDataApplied);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> parachain_system::OnSystemEvent for Pallet<T> {
|
||||
fn on_validation_data(_data: &PersistedValidationData) {}
|
||||
fn on_validation_code_applied() {
|
||||
crate::Pallet::<T>::set_pending_custom_validation_head_data();
|
||||
}
|
||||
}
|
||||
|
||||
/// Ensure that signed transactions are only valid if they are signed by root.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo, Default)]
|
||||
#[scale_info(skip_type_params(T))]
|
||||
pub struct CheckSudo<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config + Send + Sync> CheckSudo<T> {
|
||||
pub fn new() -> Self {
|
||||
Self(Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckSudo<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckSudo")
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckSudo<T>
|
||||
where
|
||||
<T as frame_system::Config>::Call: Dispatchable<Info = DispatchInfo>,
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as frame_system::Config>::Call;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckSudo";
|
||||
|
||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn pre_dispatch(
|
||||
self,
|
||||
who: &Self::AccountId,
|
||||
call: &Self::Call,
|
||||
info: &DispatchInfoOf<Self::Call>,
|
||||
len: usize,
|
||||
) -> Result<Self::Pre, TransactionValidityError> {
|
||||
Ok(self.validate(who, call, info, len).map(|_| ())?)
|
||||
}
|
||||
|
||||
fn validate(
|
||||
&self,
|
||||
who: &Self::AccountId,
|
||||
_call: &Self::Call,
|
||||
info: &DispatchInfoOf<Self::Call>,
|
||||
_len: usize,
|
||||
) -> TransactionValidity {
|
||||
let root_account = match pallet_sudo::Pallet::<T>::key() {
|
||||
Some(account) => account,
|
||||
None => return Err(InvalidTransaction::BadSigner.into()),
|
||||
};
|
||||
|
||||
if *who == root_account {
|
||||
Ok(ValidTransaction {
|
||||
priority: info.weight as TransactionPriority,
|
||||
longevity: TransactionLongevity::max_value(),
|
||||
propagate: true,
|
||||
..Default::default()
|
||||
})
|
||||
} else {
|
||||
Err(InvalidTransaction::BadSigner.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ impl pallet_balances::Config for Test {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Test {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = ();
|
||||
type OutboundXcmpMessageSource = XcmpQueue;
|
||||
type DmpMessageHandler = ();
|
||||
|
||||
@@ -371,7 +371,7 @@ parameter_types! {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
|
||||
@@ -258,7 +258,7 @@ parameter_types! {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type OutboundXcmpMessageSource = XcmpQueue;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
|
||||
@@ -32,6 +32,7 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", default-fea
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false }
|
||||
cumulus-pallet-solo-to-para = { path = "../../pallets/solo-to-para", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
@@ -62,5 +63,6 @@ std = [
|
||||
"pallet-balances/std",
|
||||
"parachain-info/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-solo-to-para/std",
|
||||
"cumulus-primitives-core/std",
|
||||
]
|
||||
|
||||
@@ -38,7 +38,7 @@ use sp_version::RuntimeVersion;
|
||||
// A few exports that help ease life for downstream crates.
|
||||
pub use frame_support::{
|
||||
construct_runtime, match_type, parameter_types,
|
||||
traits::{Contains, IsInVec, Randomness},
|
||||
traits::{IsInVec, Randomness},
|
||||
weights::{
|
||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
||||
DispatchClass, IdentityFee, Weight,
|
||||
@@ -103,23 +103,6 @@ parameter_types! {
|
||||
.build_or_panic();
|
||||
pub const SS58Prefix: u8 = 42;
|
||||
}
|
||||
|
||||
pub struct BaseFilter;
|
||||
impl Contains<Call> for BaseFilter {
|
||||
fn contains(c: &Call) -> bool {
|
||||
// Disallow everything that is not set_validation_data or set_code
|
||||
match c {
|
||||
Call::ParachainSystem(cumulus_pallet_parachain_system::Call::set_validation_data {
|
||||
..
|
||||
}) => true,
|
||||
Call::Sudo(pallet_sudo::Call::sudo_unchecked_weight { call: ref x, .. }) => {
|
||||
matches!(x.as_ref(), &Call::System(frame_system::Call::set_code { .. }))
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
/// The identifier used to distinguish between accounts.
|
||||
type AccountId = AccountId;
|
||||
@@ -151,7 +134,7 @@ impl frame_system::Config for Runtime {
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type DbWeight = ();
|
||||
type BaseCallFilter = BaseFilter;
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type SystemWeightInfo = ();
|
||||
type BlockWeights = RuntimeBlockWeights;
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
@@ -165,9 +148,13 @@ impl pallet_sudo::Config for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_solo_to_para::Config for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = cumulus_pallet_solo_to_para::Pallet<Runtime>;
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type OutboundXcmpMessageSource = ();
|
||||
type DmpMessageHandler = ();
|
||||
@@ -186,10 +173,12 @@ construct_runtime! {
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
},
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config},
|
||||
SoloToPara: cumulus_pallet_solo_to_para::{Pallet, Call, Storage, Event},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +210,7 @@ pub type SignedExtra = (
|
||||
frame_system::CheckGenesis<Runtime>,
|
||||
frame_system::CheckEra<Runtime>,
|
||||
frame_system::CheckNonce<Runtime>,
|
||||
cumulus_pallet_solo_to_para::CheckSudo<Runtime>,
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
|
||||
@@ -162,7 +162,7 @@ parameter_types! {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type OutboundXcmpMessageSource = ();
|
||||
type DmpMessageHandler = cumulus_pallet_xcm::UnlimitedDmpExecution<Runtime>;
|
||||
|
||||
@@ -414,7 +414,7 @@ parameter_types! {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
|
||||
@@ -426,7 +426,7 @@ parameter_types! {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
|
||||
@@ -412,7 +412,7 @@ parameter_types! {
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
|
||||
@@ -18,7 +18,6 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-
|
||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Other dependencies
|
||||
impl-trait-for-tuples = "0.2.1"
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = [ "derive" ] }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -139,12 +139,6 @@ pub enum ServiceQuality {
|
||||
Fast,
|
||||
}
|
||||
|
||||
/// A trait which is called when the validation data is set.
|
||||
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
||||
pub trait OnValidationData {
|
||||
fn on_validation_data(data: &PersistedValidationData);
|
||||
}
|
||||
|
||||
/// The parachain block that is created by a collator.
|
||||
///
|
||||
/// This is send as PoV (proof of validity block) to the relay-chain validators. There it will be
|
||||
|
||||
@@ -29,7 +29,7 @@ sudo=$8
|
||||
binary="./target/release/polkadot-collator"
|
||||
|
||||
# build the chain spec we'll manipulate
|
||||
$binary build-spec --chain seedling > seedling-spec-plain.json
|
||||
$binary build-spec --disable-default-bootnode --chain seedling > seedling-spec-plain.json
|
||||
|
||||
# convert runtime to hex
|
||||
cat $runtime_path | od -A n -v -t x1 | tr -d ' \n' > seedling-hex.txt
|
||||
@@ -47,7 +47,7 @@ cat seedling-spec-plain.json | jq --rawfile code seedling-hex.txt '.genesis.runt
|
||||
> edited-seedling-plain.json
|
||||
|
||||
# build a raw spec
|
||||
$binary build-spec --chain edited-seedling-plain.json --raw > seedling-spec-raw.json
|
||||
$binary build-spec --disable-default-bootnode --chain edited-seedling-plain.json --raw > seedling-spec-raw.json
|
||||
|
||||
# build genesis data
|
||||
$binary export-genesis-state --parachain-id=$para_id --chain seedling-spec-raw.json > seedling-head-data
|
||||
|
||||
@@ -259,7 +259,7 @@ impl pallet_sudo::Config for Runtime {
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type SelfParaId = ParachainId;
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type OnSystemEvent = ();
|
||||
type OutboundXcmpMessageSource = ();
|
||||
type DmpMessageHandler = ();
|
||||
type ReservedDmpWeight = ();
|
||||
|
||||
Reference in New Issue
Block a user