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:
Ignacio Palacios
2022-01-14 14:21:10 +01:00
committed by GitHub
parent 60f5e0cf2d
commit 6f763b5e71
19 changed files with 285 additions and 45 deletions
@@ -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",
]
+10 -20
View File
@@ -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>;
+1 -1
View File
@@ -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;