mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
* tweaks from template downstream review #80 * more tweaks * Update parachain-template/node/src/command.rs * tweaks to template and other chainspecs * fmt * update more tweaks from downstream * fix build
This commit is contained in:
@@ -30,7 +30,7 @@ use std::{
|
||||
};
|
||||
use structopt::StructOpt;
|
||||
|
||||
/// The `purge-chain` command used to remove the whole chain: the parachain and the relaychain.
|
||||
/// The `purge-chain` command used to remove the whole chain: the parachain and the relay chain.
|
||||
#[derive(Debug, StructOpt)]
|
||||
pub struct PurgeChainCmd {
|
||||
/// The base struct of the purge-chain command.
|
||||
|
||||
@@ -29,7 +29,7 @@ async fn sync_blocks_from_tip_without_being_connected_to_a_collator() {
|
||||
let tokio_handle = tokio::runtime::Handle::current();
|
||||
|
||||
// start alice
|
||||
let alice = run_relay_chain_validator_node(tokio_handle.clone(), Alice, || {}, vec![]);
|
||||
let alice = run_relay_chain_validator_node(tokio_handle.clone(), Alice, || {}, Vec::new());
|
||||
|
||||
// start bob
|
||||
let bob =
|
||||
|
||||
@@ -39,7 +39,7 @@ async fn pov_recovery() {
|
||||
tokio_handle.clone(),
|
||||
Alice,
|
||||
|| {},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
// Start bob
|
||||
|
||||
@@ -255,7 +255,7 @@ impl ExtBuilder {
|
||||
(6, 60 * self.balance_factor),
|
||||
]
|
||||
} else {
|
||||
vec![]
|
||||
Vec::new()
|
||||
},
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
|
||||
@@ -88,7 +88,7 @@ fn register_validators<T: Config + session::Config>(count: u32) {
|
||||
let validators = (0..count).map(|c| validator::<T>(c)).collect::<Vec<_>>();
|
||||
|
||||
for (who, keys) in validators {
|
||||
<session::Pallet<T>>::set_keys(RawOrigin::Signed(who).into(), keys, vec![]).unwrap();
|
||||
<session::Module<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ benchmarks! {
|
||||
<session::Pallet<T>>::set_keys(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
keys::<T>(c + 1),
|
||||
vec![]
|
||||
Vec::new()
|
||||
).unwrap();
|
||||
|
||||
}: _(RawOrigin::Signed(caller.clone()))
|
||||
|
||||
@@ -145,7 +145,7 @@ impl From<UintAuthorityId> for MockSessionKeys {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub static SessionHandlerCollators: Vec<u64> = vec![];
|
||||
pub static SessionHandlerCollators: Vec<u64> = Vec::new();
|
||||
pub static SessionChangeBlock: u64 = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ fn register_as_candidate_works() {
|
||||
// given
|
||||
assert_eq!(CollatorSelection::desired_candidates(), 2);
|
||||
assert_eq!(CollatorSelection::candidacy_bond(), 10);
|
||||
assert_eq!(CollatorSelection::candidates(), vec![]);
|
||||
assert_eq!(CollatorSelection::candidates(), Vec::new());
|
||||
assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);
|
||||
|
||||
// take two endowed, non-invulnerables accounts.
|
||||
|
||||
@@ -475,7 +475,7 @@ mod tests {
|
||||
Xcm(vec![Transact {
|
||||
origin_type: OriginKind::Native,
|
||||
require_weight_at_most: weight,
|
||||
call: vec![].into(),
|
||||
call: Vec::new().into(),
|
||||
}])
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
let weight_used = handle_messages(&[], 1000);
|
||||
assert_eq!(weight_used, 0);
|
||||
assert_eq!(take_trace(), vec![]);
|
||||
assert_eq!(take_trace(), Vec::new());
|
||||
assert!(queue_is_empty());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ pub mod pallet {
|
||||
if let Ok(hash) = Self::validate_authorized_upgrade(code) {
|
||||
return Ok(ValidTransaction {
|
||||
priority: 100,
|
||||
requires: vec![],
|
||||
requires: Vec::new(),
|
||||
provides: vec![hash.as_ref().to_vec()],
|
||||
longevity: TransactionLongevity::max_value(),
|
||||
propagate: true,
|
||||
@@ -1008,7 +1008,7 @@ pub trait CheckInherents<Block: BlockT> {
|
||||
) -> frame_support::inherent::CheckInherentsResult;
|
||||
}
|
||||
|
||||
/// Implements [`BlockNumberProvider`] that returns relaychain block number fetched from
|
||||
/// 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.
|
||||
pub struct RelaychainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
@@ -92,7 +92,7 @@ fn validate_block_no_extra_extrinsics() {
|
||||
|
||||
let (client, parent_head) = create_test_client();
|
||||
let TestBlockData { block, validation_data } =
|
||||
build_block_with_witness(&client, vec![], parent_head.clone(), Default::default());
|
||||
build_block_with_witness(&client, Vec::new(), parent_head.clone(), Default::default());
|
||||
let header = block.header().clone();
|
||||
|
||||
let res_header =
|
||||
@@ -133,7 +133,7 @@ fn validate_block_invalid_parent_hash() {
|
||||
if env::var("RUN_TEST").is_ok() {
|
||||
let (client, parent_head) = create_test_client();
|
||||
let TestBlockData { block, validation_data } =
|
||||
build_block_with_witness(&client, vec![], parent_head.clone(), Default::default());
|
||||
build_block_with_witness(&client, Vec::new(), parent_head.clone(), Default::default());
|
||||
let (mut header, extrinsics, witness) = block.deconstruct();
|
||||
header.set_parent_hash(Hash::from_low_u64_be(1));
|
||||
|
||||
@@ -159,7 +159,7 @@ fn validate_block_fails_on_invalid_validation_data() {
|
||||
if env::var("RUN_TEST").is_ok() {
|
||||
let (client, parent_head) = create_test_client();
|
||||
let TestBlockData { block, .. } =
|
||||
build_block_with_witness(&client, vec![], parent_head.clone(), Default::default());
|
||||
build_block_with_witness(&client, Vec::new(), parent_head.clone(), Default::default());
|
||||
|
||||
call_validate_block(parent_head, block, Hash::random()).unwrap_err();
|
||||
} else {
|
||||
@@ -184,7 +184,7 @@ fn check_inherent_fails_on_validate_block_as_expected() {
|
||||
|
||||
let TestBlockData { block, validation_data } = build_block_with_witness(
|
||||
&client,
|
||||
vec![],
|
||||
Vec::new(),
|
||||
parent_head.clone(),
|
||||
RelayStateSproofBuilder { current_slot: 1337.into(), ..Default::default() },
|
||||
);
|
||||
|
||||
@@ -2,13 +2,21 @@
|
||||
|
||||
A new [Cumulus](https://github.com/paritytech/cumulus/)-based Substrate node, ready for hacking ☁️..
|
||||
|
||||
This project is a fork of the [Substrate Node Template](https://github.com/substrate-developer-hub/substrate-node-template)
|
||||
This project is originally a fork of the
|
||||
[Substrate Node Template](https://github.com/substrate-developer-hub/substrate-node-template)
|
||||
modified to include dependencies required for registering this node as a **parathread** or
|
||||
**parachain** to the Rococo **relay chain**.
|
||||
Rococo is [Polkadot's parachain testnet](https://polkadot.network/blog/introducing-rococo-polkadots-parachain-testnet/) 👑.
|
||||
**parachain** to a **relay chain**.
|
||||
|
||||
The stand-alone version of this template is hosted on the
|
||||
[Substrate Devhub Parachain Template](https://github.com/substrate-developer-hub/substrate-parachain-template/)
|
||||
for each release of Polkadot. It is generated directly to the upstream
|
||||
[Parachain Template in Cumulus](https://github.com/paritytech/cumulus/tree/master/parachain-template)
|
||||
at each release branch using the
|
||||
[Substrate Template Generator](https://github.com/paritytech/substrate-template-generator/).
|
||||
|
||||
👉 Learn more about parachains [here](https://wiki.polkadot.network/docs/learn-parachains), and
|
||||
parathreads [here](https://wiki.polkadot.network/docs/learn-parathreads).
|
||||
|
||||
To learn about how to actually use the template to hack together your own parachain check out the
|
||||
`README` from the [`substrate-parachain-template` repository](https://github.com/substrate-developer-hub/substrate-parachain-template/).
|
||||
|
||||
🧙 Learn about how to use this template and run your own parachain testnet for it in the
|
||||
[Devhub Cumulus Tutorial](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/).
|
||||
@@ -11,7 +11,7 @@ pub type ChainSpec =
|
||||
sc_service::GenericChainSpec<parachain_template_runtime::GenesisConfig, Extensions>;
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_pair_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
@@ -40,7 +40,7 @@ type AccountPublic = <Signature as Verify>::Signer;
|
||||
///
|
||||
/// This function's return type must always match the session keys of the chain in tuple format.
|
||||
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
|
||||
get_pair_from_seed::<AuraId>(seed)
|
||||
get_public_from_seed::<AuraId>(seed)
|
||||
}
|
||||
|
||||
/// Helper function to generate an account ID from seed
|
||||
@@ -48,7 +48,7 @@ pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
|
||||
where
|
||||
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
|
||||
{
|
||||
AccountPublic::from(get_pair_from_seed::<TPublic>(seed)).into_account()
|
||||
AccountPublic::from(get_public_from_seed::<TPublic>(seed)).into_account()
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
@@ -61,7 +61,7 @@ pub fn template_session_keys(keys: AuraId) -> parachain_template_runtime::Sessio
|
||||
pub fn development_config() -> ChainSpec {
|
||||
// Give your base currency a unit name and decimal places
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "ROC".into());
|
||||
properties.insert("tokenSymbol".into(), "UNIT".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
@@ -101,7 +101,7 @@ pub fn development_config() -> ChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -115,7 +115,7 @@ pub fn development_config() -> ChainSpec {
|
||||
pub fn local_testnet_config() -> ChainSpec {
|
||||
// Give your base currency a unit name and decimal places
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "ROC".into());
|
||||
properties.insert("tokenSymbol".into(), "UNIT".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
@@ -156,7 +156,7 @@ pub fn local_testnet_config() -> ChainSpec {
|
||||
)
|
||||
},
|
||||
// Bootnodes
|
||||
vec![],
|
||||
Vec::new(),
|
||||
// Telemetry
|
||||
None,
|
||||
// Protocol ID
|
||||
@@ -194,8 +194,7 @@ fn testnet_genesis(
|
||||
},
|
||||
session: parachain_template_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.iter()
|
||||
.cloned()
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
|
||||
@@ -51,7 +51,7 @@ pub struct ExportGenesisStateCommand {
|
||||
pub raw: bool,
|
||||
|
||||
/// The name of the chain for that the genesis state should be exported.
|
||||
#[structopt(long, conflicts_with = "parachain-id")]
|
||||
#[structopt(long)]
|
||||
pub chain: Option<String>,
|
||||
}
|
||||
|
||||
@@ -84,9 +84,9 @@ pub struct Cli {
|
||||
#[structopt(flatten)]
|
||||
pub run: cumulus_client_cli::RunCmd,
|
||||
|
||||
/// Relaychain arguments
|
||||
/// Relay chain arguments
|
||||
#[structopt(raw = true)]
|
||||
pub relaychain_args: Vec<String>,
|
||||
pub relay_chain_args: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -37,13 +37,11 @@ impl SubstrateCli for Cli {
|
||||
}
|
||||
|
||||
fn description() -> String {
|
||||
format!(
|
||||
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
|
||||
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
|
||||
passed to the parachain node, while the arguments provided after -- will be passed \
|
||||
to the relaychain node.\n\n\
|
||||
{} [parachain-args] -- [relaychain-args]",
|
||||
Self::executable_name()
|
||||
)
|
||||
to the relay chain node.\n\n\
|
||||
parachain-collator <parachain-args> -- <relay-chain-args>"
|
||||
.into()
|
||||
}
|
||||
|
||||
fn author() -> String {
|
||||
@@ -79,8 +77,8 @@ impl SubstrateCli for RelayChainCli {
|
||||
fn description() -> String {
|
||||
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
|
||||
passed to the parachain node, while the arguments provided after -- will be passed \
|
||||
to the relaychain node.\n\n\
|
||||
parachain-collator [parachain-args] -- [relaychain-args]"
|
||||
to the relay chain node.\n\n\
|
||||
parachain-collator <parachain-args> -- <relay-chain-args>"
|
||||
.into()
|
||||
}
|
||||
|
||||
@@ -168,7 +166,7 @@ pub fn run() -> Result<()> {
|
||||
runner.sync_run(|config| {
|
||||
let polkadot_cli = RelayChainCli::new(
|
||||
&config,
|
||||
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
|
||||
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
|
||||
);
|
||||
|
||||
let polkadot_config = SubstrateCli::create_configuration(
|
||||
@@ -245,11 +243,11 @@ pub fn run() -> Result<()> {
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||
.map(|e| e.para_id)
|
||||
.ok_or_else(|| "Could not find parachain extension for chain-spec.")?;
|
||||
.ok_or_else(|| "Could not find parachain ID in chain-spec.")?;
|
||||
|
||||
let polkadot_cli = RelayChainCli::new(
|
||||
&config,
|
||||
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
|
||||
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
|
||||
);
|
||||
|
||||
let id = ParaId::from(para_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Substrate Node CLI library.
|
||||
//! Substrate Parachain Node Template CLI
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use sp_version::RuntimeVersion;
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime, match_type, parameter_types,
|
||||
traits::Everything,
|
||||
traits::{Everything, Nothing},
|
||||
weights::{
|
||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
|
||||
DispatchClass, IdentityFee, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
|
||||
@@ -33,7 +33,7 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::{
|
||||
limits::{BlockLength, BlockWeights},
|
||||
EnsureOneOf, EnsureRoot,
|
||||
EnsureRoot,
|
||||
};
|
||||
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
pub use sp_runtime::{MultiAddress, Perbill, Permill};
|
||||
@@ -42,18 +42,18 @@ pub use sp_runtime::{MultiAddress, Perbill, Permill};
|
||||
pub use sp_runtime::BuildStorage;
|
||||
|
||||
// Polkadot Imports
|
||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use polkadot_parachain::primitives::Sibling;
|
||||
use polkadot_runtime_common::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
|
||||
|
||||
// XCM Imports
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
|
||||
FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser,
|
||||
ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
|
||||
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsDefault,
|
||||
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
||||
UsingComponents,
|
||||
};
|
||||
use xcm_executor::{Config, XcmExecutor};
|
||||
|
||||
@@ -118,18 +118,8 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPallets,
|
||||
OnRuntimeUpgrade,
|
||||
>;
|
||||
|
||||
pub struct OnRuntimeUpgrade;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for OnRuntimeUpgrade {
|
||||
fn on_runtime_upgrade() -> u64 {
|
||||
frame_support::migrations::migrate_from_pallet_version_to_storage_version::<
|
||||
AllPalletsWithSystem,
|
||||
>(&RocksDbWeight::get())
|
||||
}
|
||||
}
|
||||
|
||||
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
|
||||
/// node's balance type.
|
||||
///
|
||||
@@ -213,12 +203,9 @@ pub const UNIT: Balance = 1_000_000_000_000;
|
||||
pub const MILLIUNIT: Balance = 1_000_000_000;
|
||||
pub const MICROUNIT: Balance = 1_000_000;
|
||||
|
||||
/// The existential deposit. Set to 1/10 of the Rococo Relay Chain.
|
||||
/// The existential deposit. Set to 1/10 of the Connected Relay Chain.
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
|
||||
|
||||
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
|
||||
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
||||
|
||||
/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is
|
||||
/// used to limit the maximal weight of a single extrinsic.
|
||||
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
|
||||
@@ -395,7 +382,7 @@ impl parachain_info::Config for Runtime {}
|
||||
impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const RocLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const RelayLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Any;
|
||||
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
@@ -418,7 +405,7 @@ pub type LocalAssetTransactor = CurrencyAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<RocLocation>,
|
||||
IsConcrete<RelayLocation>,
|
||||
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
@@ -436,14 +423,11 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// foreign chains who want to have a local sovereign account on this chain which they control.
|
||||
SovereignSignedViaLocation<LocationToAccountId, Origin>,
|
||||
// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
|
||||
// recognised.
|
||||
// recognized.
|
||||
RelayChainAsNative<RelayChainOrigin, Origin>,
|
||||
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
|
||||
// recognised.
|
||||
// recognized.
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<Origin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `Origin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, Origin>,
|
||||
@@ -463,22 +447,12 @@ match_type! {
|
||||
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }
|
||||
};
|
||||
}
|
||||
match_type! {
|
||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(_) }
|
||||
};
|
||||
}
|
||||
|
||||
pub type Barrier = (
|
||||
TakeWeightCredit,
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
|
||||
// ^^^ Parent and its exec plurality get free execution
|
||||
// Expected responses are OK.
|
||||
AllowKnownQueryResponses<PolkadotXcm>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
||||
);
|
||||
|
||||
pub struct XcmConfig;
|
||||
@@ -489,11 +463,11 @@ impl Config for XcmConfig {
|
||||
type AssetTransactor = LocalAssetTransactor;
|
||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
type IsReserve = NativeAsset;
|
||||
type IsTeleporter = NativeAsset; // Should be enough to allow teleportation of ROC
|
||||
type IsTeleporter = (); // Teleporting is disabled.
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Trader = UsingComponents<IdentityFee<Balance>, RocLocation, AccountId, Balances, ()>;
|
||||
type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
type AssetTrap = PolkadotXcm;
|
||||
type AssetClaims = PolkadotXcm;
|
||||
@@ -505,13 +479,13 @@ parameter_types! {
|
||||
}
|
||||
|
||||
/// No local origins on this chain are allowed to dispatch XCM sends/executions.
|
||||
pub type LocalOriginToLocation = ();
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
|
||||
|
||||
/// The means for routing XCM messages which are not for local execution into the right message
|
||||
/// queues.
|
||||
pub type XcmRouter = (
|
||||
// Two routers - use UMP to communicate with the relay chain:
|
||||
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm>,
|
||||
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,
|
||||
// ..and XCMP to communicate with the sibling chains.
|
||||
XcmpQueue,
|
||||
);
|
||||
@@ -521,16 +495,19 @@ impl pallet_xcm::Config for Runtime {
|
||||
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecuteFilter = Nothing;
|
||||
// ^ Disable dispatchable execute on the XCM pallet.
|
||||
// Needs to be `Everything` for local testing.
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type XcmReserveTransferFilter = Nothing;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
// ^ Override for AdvertisedXcmVersion default
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
}
|
||||
|
||||
@@ -543,7 +520,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ChannelInfo = ParachainSystem;
|
||||
type VersionWrapper = PolkadotXcm;
|
||||
type VersionWrapper = ();
|
||||
}
|
||||
|
||||
impl cumulus_pallet_dmp_queue::Config for Runtime {
|
||||
@@ -587,12 +564,8 @@ parameter_types! {
|
||||
pub const ExecutiveBody: BodyId = BodyId::Executive;
|
||||
}
|
||||
|
||||
// We allow root and the Relay Chain council to execute privileged collator selection operations.
|
||||
pub type CollatorSelectionUpdateOrigin = EnsureOneOf<
|
||||
AccountId,
|
||||
EnsureRoot<AccountId>,
|
||||
EnsureXcm<IsMajorityOfBody<RocLocation, ExecutiveBody>>,
|
||||
>;
|
||||
// We allow root only to execute privileged collator selection operations.
|
||||
pub type CollatorSelectionUpdateOrigin = EnsureRoot<AccountId>;
|
||||
|
||||
impl pallet_collator_selection::Config for Runtime {
|
||||
type Event = Event;
|
||||
@@ -627,8 +600,8 @@ construct_runtime!(
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
} = 1,
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3,
|
||||
|
||||
// Monetary stuff.
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
|
||||
@@ -775,7 +748,6 @@ impl_runtime_apis! {
|
||||
|
||||
list_benchmark!(list, extra, frame_system, SystemBench::<Runtime>);
|
||||
list_benchmark!(list, extra, pallet_balances, Balances);
|
||||
list_benchmark!(list, extra, pallet_session, SessionBench::<Runtime>);
|
||||
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
|
||||
list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
|
||||
|
||||
@@ -816,6 +788,7 @@ impl_runtime_apis! {
|
||||
add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
|
||||
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
||||
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
|
||||
add_benchmark!(params, batches, pallet_session, Session);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
|
||||
@@ -90,7 +90,7 @@ pub fn get_chain_spec() -> ChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -104,7 +104,7 @@ pub fn get_shell_chain_spec() -> ShellChainSpec {
|
||||
"shell_local_testnet",
|
||||
ChainType::Local,
|
||||
move || shell_testnet_genesis(1000.into()),
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -194,7 +194,7 @@ const STATEMINE_ED: StatemintBalance = statemine_runtime::constants::currency::E
|
||||
const WESTMINT_ED: StatemintBalance = westmint_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_pair_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
@@ -204,7 +204,7 @@ pub fn get_pair_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair
|
||||
///
|
||||
/// This function's return type must always match the session keys of the chain in tuple format.
|
||||
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
|
||||
get_pair_from_seed::<AuraId>(seed)
|
||||
get_public_from_seed::<AuraId>(seed)
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
@@ -255,7 +255,7 @@ pub fn statemint_development_config() -> StatemintChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -304,7 +304,7 @@ pub fn statemint_local_config() -> StatemintChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -335,12 +335,11 @@ fn statemint_genesis(
|
||||
},
|
||||
session: statemint_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.iter()
|
||||
.cloned()
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc.clone(), // validator id
|
||||
acc, // validator id
|
||||
statemint_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
@@ -381,7 +380,7 @@ pub fn statemine_development_config() -> StatemineChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -430,7 +429,7 @@ pub fn statemine_local_config() -> StatemineChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -478,11 +477,11 @@ pub fn statemine_config() -> StatemineChainSpec {
|
||||
.unchecked_into(),
|
||||
),
|
||||
],
|
||||
vec![],
|
||||
Vec::new(),
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -513,12 +512,11 @@ fn statemine_genesis(
|
||||
},
|
||||
session: statemine_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.iter()
|
||||
.cloned()
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc.clone(), // validator id
|
||||
acc, // validator id
|
||||
statemine_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
@@ -558,7 +556,7 @@ pub fn westmint_development_config() -> WestmintChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -608,7 +606,7 @@ pub fn westmint_local_config() -> WestmintChainSpec {
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -656,13 +654,13 @@ pub fn westmint_config() -> WestmintChainSpec {
|
||||
.unchecked_into(),
|
||||
),
|
||||
],
|
||||
vec![],
|
||||
Vec::new(),
|
||||
// re-use the Westend sudo key
|
||||
hex!("6648d7f3382690650c681aba1b993cd11e54deb4df21a3a18c3e2177de9f7342").into(),
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Some(properties),
|
||||
@@ -695,12 +693,11 @@ fn westmint_genesis(
|
||||
},
|
||||
session: westmint_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
.iter()
|
||||
.cloned()
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc.clone(), // validator id
|
||||
acc, // validator id
|
||||
westmint_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
|
||||
@@ -110,7 +110,7 @@ pub struct Cli {
|
||||
#[structopt(flatten)]
|
||||
pub run: cumulus_client_cli::RunCmd,
|
||||
|
||||
/// Relaychain arguments
|
||||
/// Relay chain arguments
|
||||
#[structopt(raw = true)]
|
||||
pub relaychain_args: Vec<String>,
|
||||
}
|
||||
|
||||
@@ -185,8 +185,8 @@ impl SubstrateCli for RelayChainCli {
|
||||
format!(
|
||||
"Polkadot collator\n\nThe command-line arguments provided first will be \
|
||||
passed to the parachain node, while the arguments provided after -- will be passed \
|
||||
to the relaychain node.\n\n\
|
||||
{} [parachain-args] -- [relaychain-args]",
|
||||
to the relay chain node.\n\n\
|
||||
{} [parachain-args] -- [relay_chain-args]",
|
||||
Self::executable_name()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ pub trait XcmpMessageSource {
|
||||
|
||||
impl XcmpMessageSource for () {
|
||||
fn take_outbound_messages(_maximum_channels: usize) -> Vec<(ParaId, Vec<u8>)> {
|
||||
vec![]
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ fn collect_relay_storage_proof(
|
||||
.ok()?
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut relevant_keys = vec![];
|
||||
let mut relevant_keys = Vec::new();
|
||||
relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec());
|
||||
relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec());
|
||||
relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id));
|
||||
|
||||
@@ -120,7 +120,7 @@ impl RelayStateSproofBuilder {
|
||||
let (db, root) = MemoryDB::<HashFor<polkadot_primitives::v1::Block>>::default_with_root();
|
||||
let mut backend = sp_state_machine::TrieBackend::new(db, root);
|
||||
|
||||
let mut relevant_keys = vec![];
|
||||
let mut relevant_keys = Vec::new();
|
||||
{
|
||||
use codec::Encode as _;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
||||
"local_testnet",
|
||||
ChainType::Local,
|
||||
move || GenesisExt { runtime_genesis_config: local_testnet_genesis() },
|
||||
vec![],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
||||
@@ -30,7 +30,7 @@ async fn test_collating_and_non_collator_mode_catching_up() {
|
||||
let tokio_handle = tokio::runtime::Handle::current();
|
||||
|
||||
// start alice
|
||||
let alice = run_relay_chain_validator_node(tokio_handle.clone(), Alice, || {}, vec![]);
|
||||
let alice = run_relay_chain_validator_node(tokio_handle.clone(), Alice, || {}, Vec::new());
|
||||
|
||||
// start bob
|
||||
let bob =
|
||||
|
||||
@@ -31,7 +31,7 @@ async fn test_runtime_upgrade() {
|
||||
let tokio_handle = tokio::runtime::Handle::current();
|
||||
|
||||
// start alice
|
||||
let alice = run_relay_chain_validator_node(tokio_handle.clone(), Alice, || {}, vec![]);
|
||||
let alice = run_relay_chain_validator_node(tokio_handle.clone(), Alice, || {}, Vec::new());
|
||||
|
||||
// start bob
|
||||
let bob =
|
||||
|
||||
Reference in New Issue
Block a user