mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Update polkadot to the latest master (#251)
* update cumulus to latest polkadot * s/Trait/Config To be more consistent with the new naming. * Update Cargo.lock * fix network tests
This commit is contained in:
Generated
+276
-253
File diff suppressed because it is too large
Load Diff
@@ -37,19 +37,19 @@ use cumulus_primitives::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Configuration trait of the message broker pallet.
|
/// Configuration trait of the message broker pallet.
|
||||||
pub trait Trait: frame_system::Trait {
|
pub trait Config: frame_system::Config {
|
||||||
/// The downward message handlers that will be informed when a message is received.
|
/// The downward message handlers that will be informed when a message is received.
|
||||||
type DownwardMessageHandlers: DownwardMessageHandler;
|
type DownwardMessageHandlers: DownwardMessageHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_storage! {
|
decl_storage! {
|
||||||
trait Store for Module<T: Trait> as MessageBroker {
|
trait Store for Module<T: Config> as MessageBroker {
|
||||||
PendingUpwardMessages: Vec<UpwardMessage>;
|
PendingUpwardMessages: Vec<UpwardMessage>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_module! {
|
decl_module! {
|
||||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||||
/// An entrypoint for an inherent to deposit downward messages into the runtime. It accepts
|
/// An entrypoint for an inherent to deposit downward messages into the runtime. It accepts
|
||||||
/// and processes the list of downward messages.
|
/// and processes the list of downward messages.
|
||||||
#[weight = (10, DispatchClass::Mandatory)]
|
#[weight = (10, DispatchClass::Mandatory)]
|
||||||
@@ -96,7 +96,7 @@ pub enum SendUpErr {
|
|||||||
TooBig,
|
TooBig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Trait> Module<T> {
|
impl<T: Config> Module<T> {
|
||||||
pub fn send_upward_message(message: UpwardMessage) -> Result<(), SendUpErr> {
|
pub fn send_upward_message(message: UpwardMessage) -> Result<(), SendUpErr> {
|
||||||
// TODO: check the message against the limit. The limit should be sourced from the
|
// TODO: check the message against the limit. The limit should be sourced from the
|
||||||
// relay-chain configuration.
|
// relay-chain configuration.
|
||||||
@@ -105,7 +105,7 @@ impl<T: Trait> Module<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Trait> ProvideInherent for Module<T> {
|
impl<T: Config> ProvideInherent for Module<T> {
|
||||||
type Call = Call<T>;
|
type Call = Call<T>;
|
||||||
type Error = MakeFatalError<()>;
|
type Error = MakeFatalError<()>;
|
||||||
const INHERENT_IDENTIFIER: InherentIdentifier = DOWNWARD_MESSAGES_IDENTIFIER;
|
const INHERENT_IDENTIFIER: InherentIdentifier = DOWNWARD_MESSAGES_IDENTIFIER;
|
||||||
|
|||||||
+26
-16
@@ -26,7 +26,7 @@ mod wait_on_relay_chain_block;
|
|||||||
|
|
||||||
use sc_client_api::{Backend, BlockchainEvents};
|
use sc_client_api::{Backend, BlockchainEvents};
|
||||||
use sp_api::ProvideRuntimeApi;
|
use sp_api::ProvideRuntimeApi;
|
||||||
use sp_blockchain::{Error as ClientError, HeaderBackend};
|
use sp_blockchain::HeaderBackend;
|
||||||
use sp_consensus::{
|
use sp_consensus::{
|
||||||
block_validation::{BlockAnnounceValidator as BlockAnnounceValidatorT, Validation},
|
block_validation::{BlockAnnounceValidator as BlockAnnounceValidatorT, Validation},
|
||||||
SyncOracle,
|
SyncOracle,
|
||||||
@@ -54,11 +54,21 @@ use futures::{
|
|||||||
};
|
};
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
use std::{marker::PhantomData, pin::Pin, sync::Arc};
|
use std::{marker::PhantomData, pin::Pin, sync::Arc, fmt};
|
||||||
|
|
||||||
use wait_on_relay_chain_block::WaitOnRelayChainBlock;
|
use wait_on_relay_chain_block::WaitOnRelayChainBlock;
|
||||||
|
|
||||||
type BlockAnnounceError = Box<dyn std::error::Error + Send>;
|
type BoxedError = Box<dyn std::error::Error + Send>;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct BlockAnnounceError(String);
|
||||||
|
impl std::error::Error for BlockAnnounceError { }
|
||||||
|
|
||||||
|
impl fmt::Display for BlockAnnounceError {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
self.0.fmt(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Parachain specific block announce validator.
|
/// Parachain specific block announce validator.
|
||||||
///
|
///
|
||||||
@@ -131,7 +141,7 @@ where
|
|||||||
fn handle_empty_block_announce_data(
|
fn handle_empty_block_announce_data(
|
||||||
&self,
|
&self,
|
||||||
header: Block::Header,
|
header: Block::Header,
|
||||||
) -> impl Future<Output = Result<Validation, BlockAnnounceError>> {
|
) -> impl Future<Output = Result<Validation, BoxedError>> {
|
||||||
let relay_chain_client = self.relay_chain_client.clone();
|
let relay_chain_client = self.relay_chain_client.clone();
|
||||||
let relay_chain_backend = self.relay_chain_backend.clone();
|
let relay_chain_backend = self.relay_chain_backend.clone();
|
||||||
let para_id = self.para_id;
|
let para_id = self.para_id;
|
||||||
@@ -149,15 +159,15 @@ where
|
|||||||
para_id,
|
para_id,
|
||||||
OccupiedCoreAssumption::TimedOut,
|
OccupiedCoreAssumption::TimedOut,
|
||||||
)
|
)
|
||||||
.map_err(|e| Box::new(ClientError::Msg(format!("{:?}", e))) as Box<_>)?
|
.map_err(|e| Box::new(BlockAnnounceError(format!("{:?}", e))) as Box<_>)?
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
Box::new(ClientError::Msg(
|
Box::new(BlockAnnounceError(
|
||||||
"Could not find parachain head in relay chain".into(),
|
"Could not find parachain head in relay chain".into(),
|
||||||
)) as Box<_>
|
)) as Box<_>
|
||||||
})?;
|
})?;
|
||||||
let parent_head = Block::Header::decode(&mut &local_validation_data.parent_head.0[..])
|
let parent_head = Block::Header::decode(&mut &local_validation_data.parent_head.0[..])
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
Box::new(ClientError::Msg(format!(
|
Box::new(BlockAnnounceError(format!(
|
||||||
"Failed to decode parachain head: {:?}",
|
"Failed to decode parachain head: {:?}",
|
||||||
e
|
e
|
||||||
))) as Box<_>
|
))) as Box<_>
|
||||||
@@ -192,7 +202,7 @@ where
|
|||||||
&mut self,
|
&mut self,
|
||||||
header: &Block::Header,
|
header: &Block::Header,
|
||||||
mut data: &[u8],
|
mut data: &[u8],
|
||||||
) -> Pin<Box<dyn Future<Output = Result<Validation, BlockAnnounceError>> + Send>> {
|
) -> Pin<Box<dyn Future<Output = Result<Validation, BoxedError>> + Send>> {
|
||||||
if self.relay_chain_sync_oracle.is_major_syncing() {
|
if self.relay_chain_sync_oracle.is_major_syncing() {
|
||||||
return ready(Ok(Validation::Success { is_new_best: false })).boxed();
|
return ready(Ok(Validation::Success { is_new_best: false })).boxed();
|
||||||
}
|
}
|
||||||
@@ -205,7 +215,7 @@ where
|
|||||||
|
|
||||||
let signed_stmt = match SignedFullStatement::decode(&mut data) {
|
let signed_stmt = match SignedFullStatement::decode(&mut data) {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(_) => return ready(Err(Box::new(ClientError::Msg(
|
Err(_) => return ready(Err(Box::new(BlockAnnounceError(
|
||||||
"cannot decode block announcement justification, must be a `SignedFullStatement`"
|
"cannot decode block announcement justification, must be a `SignedFullStatement`"
|
||||||
.into(),
|
.into(),
|
||||||
)) as Box<_>))
|
)) as Box<_>))
|
||||||
@@ -221,7 +231,7 @@ where
|
|||||||
let candidate_receipt = match signed_stmt.payload() {
|
let candidate_receipt = match signed_stmt.payload() {
|
||||||
Statement::Seconded(ref candidate_receipt) => candidate_receipt,
|
Statement::Seconded(ref candidate_receipt) => candidate_receipt,
|
||||||
_ => {
|
_ => {
|
||||||
return Err(Box::new(ClientError::Msg(
|
return Err(Box::new(BlockAnnounceError(
|
||||||
"block announcement justification must be a `Statement::Seconded`".into(),
|
"block announcement justification must be a `Statement::Seconded`".into(),
|
||||||
)) as Box<_>)
|
)) as Box<_>)
|
||||||
}
|
}
|
||||||
@@ -229,7 +239,7 @@ where
|
|||||||
|
|
||||||
// Check the header in the candidate_receipt match header given header.
|
// Check the header in the candidate_receipt match header given header.
|
||||||
if header_encoded != candidate_receipt.commitments.head_data.0 {
|
if header_encoded != candidate_receipt.commitments.head_data.0 {
|
||||||
return Err(Box::new(ClientError::Msg(
|
return Err(Box::new(BlockAnnounceError(
|
||||||
"block announcement header does not match the one justified".into(),
|
"block announcement header does not match the one justified".into(),
|
||||||
)) as Box<_>);
|
)) as Box<_>);
|
||||||
}
|
}
|
||||||
@@ -239,7 +249,7 @@ where
|
|||||||
wait_on_relay_chain_block
|
wait_on_relay_chain_block
|
||||||
.wait_on_relay_chain_block(*relay_parent)
|
.wait_on_relay_chain_block(*relay_parent)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Box::new(ClientError::Msg(e.to_string())) as Box<_>)?;
|
.map_err(|e| Box::new(BlockAnnounceError(e.to_string())) as Box<_>)?;
|
||||||
|
|
||||||
let runtime_api = relay_chain_client.runtime_api();
|
let runtime_api = relay_chain_client.runtime_api();
|
||||||
let validator_index = signed_stmt.validator_index();
|
let validator_index = signed_stmt.validator_index();
|
||||||
@@ -248,7 +258,7 @@ where
|
|||||||
let session_index = match runtime_api.session_index_for_child(&runtime_api_block_id) {
|
let session_index = match runtime_api.session_index_for_child(&runtime_api_block_id) {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(Box::new(ClientError::Msg(format!("{:?}", e))) as Box<_>);
|
return Err(Box::new(BlockAnnounceError(format!("{:?}", e))) as Box<_>);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -261,13 +271,13 @@ where
|
|||||||
let authorities = match runtime_api.validators(&runtime_api_block_id) {
|
let authorities = match runtime_api.validators(&runtime_api_block_id) {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(Box::new(ClientError::Msg(format!("{:?}", e))) as Box<_>);
|
return Err(Box::new(BlockAnnounceError(format!("{:?}", e))) as Box<_>);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let signer = match authorities.get(validator_index as usize) {
|
let signer = match authorities.get(validator_index as usize) {
|
||||||
Some(r) => r,
|
Some(r) => r,
|
||||||
None => {
|
None => {
|
||||||
return Err(Box::new(ClientError::Msg(
|
return Err(Box::new(BlockAnnounceError(
|
||||||
"block accouncement justification signer is a validator index out of bound"
|
"block accouncement justification signer is a validator index out of bound"
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)) as Box<_>);
|
)) as Box<_>);
|
||||||
@@ -279,7 +289,7 @@ where
|
|||||||
.check_signature(&signing_context, &signer)
|
.check_signature(&signing_context, &signer)
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
return Err(Box::new(ClientError::Msg(
|
return Err(Box::new(BlockAnnounceError(
|
||||||
"block announcement justification signature is invalid".to_string(),
|
"block announcement justification signature is invalid".to_string(),
|
||||||
)) as Box<_>);
|
)) as Box<_>);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ use polkadot_primitives::v1::{
|
|||||||
CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash as PHash,
|
CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash as PHash,
|
||||||
HeadData, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
|
HeadData, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
|
||||||
ParachainHost, PersistedValidationData, SessionIndex, SigningContext, ValidationCode,
|
ParachainHost, PersistedValidationData, SessionIndex, SigningContext, ValidationCode,
|
||||||
ValidationData, ValidationOutputs, ValidatorId, ValidatorIndex, SessionInfo,
|
ValidationData, ValidatorId, ValidatorIndex, SessionInfo,
|
||||||
};
|
};
|
||||||
use polkadot_test_client::{
|
use polkadot_test_client::{
|
||||||
Client as PClient, ClientBlockImportExt, DefaultTestClientBuilderExt, FullBackend as PBackend,
|
Client as PClient, ClientBlockImportExt, DefaultTestClientBuilderExt, FullBackend as PBackend,
|
||||||
InitPolkadotBlockBuilder, TestClientBuilder, TestClientBuilderExt,
|
InitPolkadotBlockBuilder, TestClientBuilder, TestClientBuilderExt,
|
||||||
};
|
};
|
||||||
use sp_api::{ApiRef, ProvideRuntimeApi};
|
use sp_api::{ApiRef, ProvideRuntimeApi};
|
||||||
use sp_blockchain::{Error as ClientError, HeaderBackend};
|
use sp_blockchain::HeaderBackend;
|
||||||
use sp_consensus::{block_validation::BlockAnnounceValidator as _, BlockOrigin};
|
use sp_consensus::{block_validation::BlockAnnounceValidator as _, BlockOrigin};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_keyring::Sr25519Keyring;
|
use sp_keyring::Sr25519Keyring;
|
||||||
@@ -38,9 +38,9 @@ use sp_keystore::{testing::KeyStore, SyncCryptoStore, SyncCryptoStorePtr};
|
|||||||
use sp_runtime::RuntimeAppPublic;
|
use sp_runtime::RuntimeAppPublic;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
fn check_error(error: crate::BlockAnnounceError, check_error: impl Fn(&ClientError) -> bool) {
|
fn check_error(error: crate::BoxedError, check_error: impl Fn(&BlockAnnounceError) -> bool) {
|
||||||
let error = *error
|
let error = *error
|
||||||
.downcast::<ClientError>()
|
.downcast::<BlockAnnounceError>()
|
||||||
.expect("Downcasts error to `ClientError`");
|
.expect("Downcasts error to `ClientError`");
|
||||||
if !check_error(&error) {
|
if !check_error(&error) {
|
||||||
panic!("Invalid error: {:?}", error);
|
panic!("Invalid error: {:?}", error);
|
||||||
@@ -192,7 +192,7 @@ fn check_statement_is_encoded_correctly() {
|
|||||||
check_error(res, |error| {
|
check_error(res, |error| {
|
||||||
matches!(
|
matches!(
|
||||||
error,
|
error,
|
||||||
ClientError::Msg(x) if x.contains("must be a `SignedFullStatement`")
|
BlockAnnounceError(x) if x.contains("must be a `SignedFullStatement`")
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -209,8 +209,8 @@ fn check_signer_is_legit_validator() {
|
|||||||
.expect("Should fail on invalid validator");
|
.expect("Should fail on invalid validator");
|
||||||
|
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*res.downcast::<ClientError>().unwrap(),
|
*res.downcast::<BlockAnnounceError>().unwrap(),
|
||||||
ClientError::Msg(x) if x.contains("signer is a validator")
|
BlockAnnounceError(x) if x.contains("signer is a validator")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ fn check_statement_is_correctly_signed() {
|
|||||||
check_error(res, |error| {
|
check_error(res, |error| {
|
||||||
matches!(
|
matches!(
|
||||||
error,
|
error,
|
||||||
ClientError::Msg(x) if x.contains("signature is invalid")
|
BlockAnnounceError(x) if x.contains("signature is invalid")
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ fn check_statement_seconded() {
|
|||||||
check_error(res, |error| {
|
check_error(res, |error| {
|
||||||
matches!(
|
matches!(
|
||||||
error,
|
error,
|
||||||
ClientError::Msg(x) if x.contains("must be a `Statement::Seconded`")
|
BlockAnnounceError(x) if x.contains("must be a `Statement::Seconded`")
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ fn check_header_match_candidate_receipt_header() {
|
|||||||
check_error(res, |error| {
|
check_error(res, |error| {
|
||||||
matches!(
|
matches!(
|
||||||
error,
|
error,
|
||||||
ClientError::Msg(x) if x.contains("header does not match")
|
BlockAnnounceError(x) if x.contains("header does not match")
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,7 @@ sp_api::mock_impl_runtime_apis! {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_validation_outputs(_: ParaId, _: ValidationOutputs) -> bool {
|
fn check_validation_outputs(_: ParaId, _: CandidateCommitments) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ use sp_std::vec::Vec;
|
|||||||
type System<T> = frame_system::Module<T>;
|
type System<T> = frame_system::Module<T>;
|
||||||
|
|
||||||
/// The pallet's configuration trait.
|
/// The pallet's configuration trait.
|
||||||
pub trait Trait: frame_system::Trait {
|
pub trait Config: frame_system::Config {
|
||||||
/// The overarching event type.
|
/// The overarching event type.
|
||||||
type Event: From<Event> + Into<<Self as frame_system::Trait>::Event>;
|
type Event: From<Event> + Into<<Self as frame_system::Config>::Event>;
|
||||||
|
|
||||||
/// Something which can be notified when the validation data is set.
|
/// Something which can be notified when the validation data is set.
|
||||||
type OnValidationData: OnValidationData;
|
type OnValidationData: OnValidationData;
|
||||||
@@ -57,7 +57,7 @@ pub trait Trait: frame_system::Trait {
|
|||||||
|
|
||||||
// This pallet's storage items.
|
// This pallet's storage items.
|
||||||
decl_storage! {
|
decl_storage! {
|
||||||
trait Store for Module<T: Trait> as ParachainUpgrade {
|
trait Store for Module<T: Config> as ParachainUpgrade {
|
||||||
// we need to store the new validation function for the span between
|
// we need to store the new validation function for the span between
|
||||||
// setting it and applying it.
|
// setting it and applying it.
|
||||||
PendingValidationFunction get(fn new_validation_function):
|
PendingValidationFunction get(fn new_validation_function):
|
||||||
@@ -73,7 +73,7 @@ decl_storage! {
|
|||||||
|
|
||||||
// The pallet's dispatchable functions.
|
// The pallet's dispatchable functions.
|
||||||
decl_module! {
|
decl_module! {
|
||||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||||
// Initializing events
|
// Initializing events
|
||||||
// this is needed only if you are using events in your pallet
|
// this is needed only if you are using events in your pallet
|
||||||
fn deposit_event() = default;
|
fn deposit_event() = default;
|
||||||
@@ -146,7 +146,7 @@ decl_module! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Trait> Module<T> {
|
impl<T: Config> Module<T> {
|
||||||
/// Get validation data.
|
/// Get validation data.
|
||||||
///
|
///
|
||||||
/// Returns `Some(_)` after the inherent set the data for the current block.
|
/// Returns `Some(_)` after the inherent set the data for the current block.
|
||||||
@@ -213,7 +213,7 @@ impl<T: Trait> Module<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Trait> ProvideInherent for Module<T> {
|
impl<T: Config> ProvideInherent for Module<T> {
|
||||||
type Call = Call<T>;
|
type Call = Call<T>;
|
||||||
type Error = sp_inherents::MakeFatalError<()>;
|
type Error = sp_inherents::MakeFatalError<()>;
|
||||||
const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER;
|
const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER;
|
||||||
@@ -239,7 +239,7 @@ decl_event! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
decl_error! {
|
decl_error! {
|
||||||
pub enum Error for Module<T: Trait> {
|
pub enum Error for Module<T: Config> {
|
||||||
/// Attempt to upgrade validation function while existing upgrade pending
|
/// Attempt to upgrade validation function while existing upgrade pending
|
||||||
OverlappingUpgrades,
|
OverlappingUpgrades,
|
||||||
/// Polkadot currently prohibits this parachain from upgrading its validation function
|
/// Polkadot currently prohibits this parachain from upgrading its validation function
|
||||||
@@ -309,7 +309,7 @@ mod tests {
|
|||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
impl frame_system::Trait for Test {
|
impl frame_system::Config for Test {
|
||||||
type Origin = Origin;
|
type Origin = Origin;
|
||||||
type Call = ();
|
type Call = ();
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
@@ -336,7 +336,7 @@ mod tests {
|
|||||||
type BaseCallFilter = ();
|
type BaseCallFilter = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
}
|
}
|
||||||
impl Trait for Test {
|
impl Config for Test {
|
||||||
type Event = TestEvent;
|
type Event = TestEvent;
|
||||||
type OnValidationData = ();
|
type OnValidationData = ();
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct BlockTest {
|
struct BlockTest {
|
||||||
n: <Test as frame_system::Trait>::BlockNumber,
|
n: <Test as frame_system::Config>::BlockNumber,
|
||||||
within_block: Box<dyn Fn()>,
|
within_block: Box<dyn Fn()>,
|
||||||
after_block: Option<Box<dyn Fn()>>,
|
after_block: Option<Box<dyn Fn()>>,
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,7 @@ mod tests {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add<F>(self, n: <Test as frame_system::Trait>::BlockNumber, within_block: F) -> Self
|
fn add<F>(self, n: <Test as frame_system::Config>::BlockNumber, within_block: F) -> Self
|
||||||
where
|
where
|
||||||
F: 'static + Fn(),
|
F: 'static + Fn(),
|
||||||
{
|
{
|
||||||
@@ -423,7 +423,7 @@ mod tests {
|
|||||||
|
|
||||||
fn add_with_post_test<F1, F2>(
|
fn add_with_post_test<F1, F2>(
|
||||||
self,
|
self,
|
||||||
n: <Test as frame_system::Trait>::BlockNumber,
|
n: <Test as frame_system::Config>::BlockNumber,
|
||||||
within_block: F1,
|
within_block: F1,
|
||||||
after_block: F2,
|
after_block: F2,
|
||||||
) -> Self
|
) -> Self
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ parameter_types! {
|
|||||||
pub const ExtrinsicBaseWeight: Weight = 10_000_000;
|
pub const ExtrinsicBaseWeight: Weight = 10_000_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl frame_system::Trait for Runtime {
|
impl frame_system::Config for Runtime {
|
||||||
/// The identifier used to distinguish between accounts.
|
/// The identifier used to distinguish between accounts.
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
/// The aggregated dispatch type that is available for extrinsics.
|
/// The aggregated dispatch type that is available for extrinsics.
|
||||||
@@ -155,7 +155,7 @@ parameter_types! {
|
|||||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Trait for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
/// A timestamp: milliseconds since the unix epoch.
|
/// A timestamp: milliseconds since the unix epoch.
|
||||||
type Moment = u64;
|
type Moment = u64;
|
||||||
type OnTimestampSet = ();
|
type OnTimestampSet = ();
|
||||||
@@ -170,7 +170,7 @@ parameter_types! {
|
|||||||
pub const TransactionByteFee: u128 = 1;
|
pub const TransactionByteFee: u128 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Trait for Runtime {
|
impl pallet_balances::Config for Runtime {
|
||||||
/// The type for recording an account's balance.
|
/// The type for recording an account's balance.
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
@@ -181,7 +181,7 @@ impl pallet_balances::Trait for Runtime {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Trait for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type OnTransactionPayment = ();
|
type OnTransactionPayment = ();
|
||||||
type TransactionByteFee = TransactionByteFee;
|
type TransactionByteFee = TransactionByteFee;
|
||||||
@@ -189,17 +189,17 @@ impl pallet_transaction_payment::Trait for Runtime {
|
|||||||
type FeeMultiplierUpdate = ();
|
type FeeMultiplierUpdate = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_sudo::Trait for Runtime {
|
impl pallet_sudo::Config for Runtime {
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_parachain_upgrade::Trait for Runtime {
|
impl cumulus_parachain_upgrade::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type OnValidationFunctionParams = ();
|
type OnValidationFunctionParams = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_message_broker::Trait for Runtime {
|
impl cumulus_message_broker::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type DownwardMessageHandlers = TokenDealer;
|
type DownwardMessageHandlers = TokenDealer;
|
||||||
type UpwardMessage = cumulus_upward_message::RococoUpwardMessage;
|
type UpwardMessage = cumulus_upward_message::RococoUpwardMessage;
|
||||||
@@ -208,7 +208,7 @@ impl cumulus_message_broker::Trait for Runtime {
|
|||||||
type XCMPMessageHandlers = TokenDealer;
|
type XCMPMessageHandlers = TokenDealer;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_token_dealer::Trait for Runtime {
|
impl cumulus_token_dealer::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type UpwardMessageSender = MessageBroker;
|
type UpwardMessageSender = MessageBroker;
|
||||||
type UpwardMessage = cumulus_upward_message::RococoUpwardMessage;
|
type UpwardMessage = cumulus_upward_message::RococoUpwardMessage;
|
||||||
@@ -216,7 +216,7 @@ impl cumulus_token_dealer::Trait for Runtime {
|
|||||||
type XCMPMessageSender = MessageBroker;
|
type XCMPMessageSender = MessageBroker;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl parachain_info::Trait for Runtime {}
|
impl parachain_info::Config for Runtime {}
|
||||||
|
|
||||||
// We disable the rent system for easier testing.
|
// We disable the rent system for easier testing.
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -226,7 +226,7 @@ parameter_types! {
|
|||||||
pub const SurchargeReward: Balance = 0;
|
pub const SurchargeReward: Balance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_pallet_contracts::Trait for Runtime {
|
impl cumulus_pallet_contracts::Config for Runtime {
|
||||||
type Time = Timestamp;
|
type Time = Timestamp;
|
||||||
type Randomness = RandomnessCollectiveFlip;
|
type Randomness = RandomnessCollectiveFlip;
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
|
|||||||
@@ -23,20 +23,20 @@ use frame_support::{decl_module, decl_storage, traits::Get};
|
|||||||
use cumulus_primitives::ParaId;
|
use cumulus_primitives::ParaId;
|
||||||
|
|
||||||
/// Configuration trait of this pallet.
|
/// Configuration trait of this pallet.
|
||||||
pub trait Trait: frame_system::Trait {}
|
pub trait Config: frame_system::Config {}
|
||||||
|
|
||||||
impl<T: Trait> Get<ParaId> for Module<T> {
|
impl<T: Config> Get<ParaId> for Module<T> {
|
||||||
fn get() -> ParaId {
|
fn get() -> ParaId {
|
||||||
Self::parachain_id()
|
Self::parachain_id()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_storage! {
|
decl_storage! {
|
||||||
trait Store for Module<T: Trait> as ParachainUpgrade {
|
trait Store for Module<T: Config> as ParachainUpgrade {
|
||||||
ParachainId get(fn parachain_id) config(): ParaId = 100.into();
|
ParachainId get(fn parachain_id) config(): ParaId = 100.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_module! {
|
decl_module! {
|
||||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
|
pub struct Module<T: Config> for enum Call where origin: T::Origin {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ parameter_types! {
|
|||||||
pub const ExtrinsicBaseWeight: Weight = 10_000_000;
|
pub const ExtrinsicBaseWeight: Weight = 10_000_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl frame_system::Trait for Runtime {
|
impl frame_system::Config for Runtime {
|
||||||
/// The identifier used to distinguish between accounts.
|
/// The identifier used to distinguish between accounts.
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
/// The aggregated dispatch type that is available for extrinsics.
|
/// The aggregated dispatch type that is available for extrinsics.
|
||||||
@@ -155,7 +155,7 @@ parameter_types! {
|
|||||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Trait for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
/// A timestamp: milliseconds since the unix epoch.
|
/// A timestamp: milliseconds since the unix epoch.
|
||||||
type Moment = u64;
|
type Moment = u64;
|
||||||
type OnTimestampSet = ();
|
type OnTimestampSet = ();
|
||||||
@@ -171,7 +171,7 @@ parameter_types! {
|
|||||||
pub const MaxLocks: u32 = 50;
|
pub const MaxLocks: u32 = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Trait for Runtime {
|
impl pallet_balances::Config for Runtime {
|
||||||
/// The type for recording an account's balance.
|
/// The type for recording an account's balance.
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
@@ -183,28 +183,28 @@ impl pallet_balances::Trait for Runtime {
|
|||||||
type MaxLocks = MaxLocks;
|
type MaxLocks = MaxLocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Trait for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
|
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
|
||||||
type TransactionByteFee = TransactionByteFee;
|
type TransactionByteFee = TransactionByteFee;
|
||||||
type WeightToFee = IdentityFee<Balance>;
|
type WeightToFee = IdentityFee<Balance>;
|
||||||
type FeeMultiplierUpdate = ();
|
type FeeMultiplierUpdate = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_sudo::Trait for Runtime {
|
impl pallet_sudo::Config for Runtime {
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_parachain_upgrade::Trait for Runtime {
|
impl cumulus_parachain_upgrade::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type OnValidationData = ();
|
type OnValidationData = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_message_broker::Trait for Runtime {
|
impl cumulus_message_broker::Config for Runtime {
|
||||||
type DownwardMessageHandlers = ();
|
type DownwardMessageHandlers = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl parachain_info::Trait for Runtime {}
|
impl parachain_info::Config for Runtime {}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime where
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ where
|
|||||||
fn execute_with_client<PClient, Api, PBackend>(self, client: Arc<PClient>) -> Self::Output
|
fn execute_with_client<PClient, Api, PBackend>(self, client: Arc<PClient>) -> Self::Output
|
||||||
where
|
where
|
||||||
<Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
|
<Api as sp_api::ApiExt<PBlock>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
|
||||||
PBackend: sc_client_api::Backend<PBlock>,
|
PBackend: sc_client_api::Backend<PBlock> + 'static,
|
||||||
PBackend::State: sp_api::StateBackend<BlakeTwo256>,
|
PBackend::State: sp_api::StateBackend<BlakeTwo256>,
|
||||||
Api: RuntimeApiCollection<StateBackend = PBackend::State>,
|
Api: RuntimeApiCollection<StateBackend = PBackend::State>,
|
||||||
PClient: AbstractClient<PBlock, PBackend, Api = Api> + 'static,
|
PClient: AbstractClient<PBlock, PBackend, Api = Api> + 'static,
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ parameter_types! {
|
|||||||
pub const ExtrinsicBaseWeight: Weight = 10_000_000;
|
pub const ExtrinsicBaseWeight: Weight = 10_000_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl frame_system::Trait for Runtime {
|
impl frame_system::Config for Runtime {
|
||||||
/// The identifier used to distinguish between accounts.
|
/// The identifier used to distinguish between accounts.
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
/// The aggregated dispatch type that is available for extrinsics.
|
/// The aggregated dispatch type that is available for extrinsics.
|
||||||
@@ -147,7 +147,7 @@ parameter_types! {
|
|||||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Trait for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
/// A timestamp: milliseconds since the unix epoch.
|
/// A timestamp: milliseconds since the unix epoch.
|
||||||
type Moment = u64;
|
type Moment = u64;
|
||||||
type OnTimestampSet = ();
|
type OnTimestampSet = ();
|
||||||
@@ -162,7 +162,7 @@ parameter_types! {
|
|||||||
pub const TransactionByteFee: u128 = 1;
|
pub const TransactionByteFee: u128 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Trait for Runtime {
|
impl pallet_balances::Config for Runtime {
|
||||||
/// The type for recording an account's balance.
|
/// The type for recording an account's balance.
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
@@ -174,19 +174,19 @@ impl pallet_balances::Trait for Runtime {
|
|||||||
type MaxLocks = ();
|
type MaxLocks = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Trait for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
|
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
|
||||||
type TransactionByteFee = TransactionByteFee;
|
type TransactionByteFee = TransactionByteFee;
|
||||||
type WeightToFee = IdentityFee<Balance>;
|
type WeightToFee = IdentityFee<Balance>;
|
||||||
type FeeMultiplierUpdate = ();
|
type FeeMultiplierUpdate = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_sudo::Trait for Runtime {
|
impl pallet_sudo::Config for Runtime {
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_parachain_upgrade::Trait for Runtime {
|
impl cumulus_parachain_upgrade::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type OnValidationData = ();
|
type OnValidationData = ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user