Bump dependencies (#1180)

* substrate: d0f6c1c60da22e04dd25c2eca46ebfe6f1571af0
polkadot: dd4b2e6a34a08a01b876d14641e99e7011be3463
cumulus: 9379cd6c18

* fmt

* fixed lost refs

* spelling

* benckhmarks

* fmt
This commit is contained in:
Svyatoslav Nikolsky
2021-10-25 13:24:36 +03:00
committed by Bastian Köcher
parent 6396239e18
commit e23266c7e6
78 changed files with 510 additions and 376 deletions
+2
View File
@@ -210,6 +210,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(), backend.clone(),
grandpa_link.shared_authority_set().clone(), grandpa_link.shared_authority_set().clone(),
vec![],
)); ));
let (network, system_rpc_tx, network_starter) = let (network, system_rpc_tx, network_starter) =
@@ -470,6 +471,7 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(), backend.clone(),
grandpa_link.shared_authority_set().clone(), grandpa_link.shared_authority_set().clone(),
vec![],
)); ));
let (network, system_rpc_tx, network_starter) = let (network, system_rpc_tx, network_starter) =
+2
View File
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
hex-literal = "0.3" hex-literal = "0.3"
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -89,6 +90,7 @@ std = [
"pallet-timestamp/std", "pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std", "pallet-transaction-payment/std",
"scale-info/std",
"serde", "serde",
"sp-api/std", "sp-api/std",
"sp-block-builder/std", "sp-block-builder/std",
+4 -2
View File
@@ -240,6 +240,7 @@ impl pallet_grandpa::Config for Runtime {
type HandleEquivocation = (); type HandleEquivocation = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = (); type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
} }
parameter_types! { parameter_types! {
@@ -281,6 +282,7 @@ impl pallet_balances::Config for Runtime {
parameter_types! { parameter_types! {
pub const TransactionBaseFee: Balance = 0; pub const TransactionBaseFee: Balance = 0;
pub const TransactionByteFee: Balance = 1; pub const TransactionByteFee: Balance = 1;
pub const OperationalFeeMultiplier: u8 = 5;
// values for following parameters are copied from polkadot repo, but it is fine // values for following parameters are copied from polkadot repo, but it is fine
// not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains // not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
@@ -291,6 +293,7 @@ parameter_types! {
impl pallet_transaction_payment::Config 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 OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = bp_millau::WeightToFee; type WeightToFee = bp_millau::WeightToFee;
type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment< type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
Runtime, Runtime,
@@ -320,7 +323,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_shift_session_manager::Pallet<Runtime>; type SessionManager = pallet_shift_session_manager::Pallet<Runtime>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys; type Keys = SessionKeys;
type DisabledValidatorsThreshold = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = (); type WeightInfo = ();
} }
@@ -523,7 +525,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -31,6 +31,7 @@ use frame_support::{
weights::{DispatchClass, Weight}, weights::{DispatchClass, Weight},
RuntimeDebug, RuntimeDebug,
}; };
use scale_info::TypeInfo;
use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128}; use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128};
use sp_std::{convert::TryFrom, ops::RangeInclusive}; use sp_std::{convert::TryFrom, ops::RangeInclusive};
@@ -274,7 +275,7 @@ impl SourceHeaderChain<bp_rialto::Balance> for Rialto {
} }
/// Millau -> Rialto message lane pallet parameters. /// Millau -> Rialto message lane pallet parameters.
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq)] #[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
pub enum MillauToRialtoMessagesParameter { pub enum MillauToRialtoMessagesParameter {
/// The conversion formula we use is: `MillauTokens = RialtoTokens * conversion_rate`. /// The conversion formula we use is: `MillauTokens = RialtoTokens * conversion_rate`.
RialtoToMillauConversionRate(FixedU128), RialtoToMillauConversionRate(FixedU128),
@@ -13,6 +13,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran
[dependencies] [dependencies]
codec = { package = 'parity-scale-codec', version = '2.0.0', default-features = false, features = ['derive']} codec = { package = 'parity-scale-codec', version = '2.0.0', default-features = false, features = ['derive']}
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = '1.0', optional = true, features = ['derive'] } serde = { version = '1.0', optional = true, features = ['derive'] }
# Bridge depedencies # Bridge depedencies
@@ -83,8 +84,9 @@ runtime-benchmarks = [
std = [ std = [
"bp-rialto-parachain/std", "bp-rialto-parachain/std",
"codec/std", "codec/std",
"serde",
"log/std", "log/std",
"scale-info/std",
"serde",
"sp-api/std", "sp-api/std",
"sp-std/std", "sp-std/std",
"sp-io/std", "sp-io/std",
@@ -228,6 +228,7 @@ parameter_types! {
pub const TransferFee: u128 = MILLIUNIT; pub const TransferFee: u128 = MILLIUNIT;
pub const CreationFee: u128 = MILLIUNIT; pub const CreationFee: u128 = MILLIUNIT;
pub const TransactionByteFee: u128 = MICROUNIT; pub const TransactionByteFee: u128 = MICROUNIT;
pub const OperationalFeeMultiplier: u8 = 5;
pub const MaxLocks: u32 = 50; pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50; pub const MaxReserves: u32 = 50;
} }
@@ -249,6 +250,7 @@ impl pallet_balances::Config for Runtime {
impl pallet_transaction_payment::Config 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 OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = IdentityFee<Balance>; type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = (); type FeeMultiplierUpdate = ();
} }
@@ -486,7 +488,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
+1
View File
@@ -14,6 +14,7 @@ futures = "0.3"
jsonrpc-core = "18.0" jsonrpc-core = "18.0"
kvdb = "0.10" kvdb = "0.10"
kvdb-rocksdb = "0.12" kvdb-rocksdb = "0.12"
lru = "0.7"
structopt = "0.3.21" structopt = "0.3.21"
serde_json = "1.0.59" serde_json = "1.0.59"
thiserror = "1.0" thiserror = "1.0"
@@ -264,7 +264,6 @@ fn testnet_genesis(
ump_service_total_weight: 4 * 1_000_000_000, ump_service_total_weight: 4 * 1_000_000_000,
max_upward_message_size: 1024 * 1024, max_upward_message_size: 1024 * 1024,
max_upward_message_num_per_candidate: 5, max_upward_message_num_per_candidate: 5,
_hrmp_open_request_ttl: 5,
hrmp_sender_deposit: 0, hrmp_sender_deposit: 0,
hrmp_recipient_deposit: 0, hrmp_recipient_deposit: 0,
hrmp_channel_max_capacity: 8, hrmp_channel_max_capacity: 8,
+87 -66
View File
@@ -23,6 +23,7 @@
use crate::service::{AuthorityDiscoveryApi, Error}; use crate::service::{AuthorityDiscoveryApi, Error};
use rialto_runtime::{opaque::Block, Hash}; use rialto_runtime::{opaque::Block, Hash};
use lru::LruCache;
use polkadot_availability_distribution::IncomingRequestReceivers; use polkadot_availability_distribution::IncomingRequestReceivers;
use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig; use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig;
use polkadot_node_core_av_store::Config as AvailabilityConfig; use polkadot_node_core_av_store::Config as AvailabilityConfig;
@@ -30,7 +31,10 @@ use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig
use polkadot_node_core_chain_selection::Config as ChainSelectionConfig; use polkadot_node_core_chain_selection::Config as ChainSelectionConfig;
use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig; use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig;
use polkadot_node_network_protocol::request_response::{v1 as request_v1, IncomingRequestReceiver}; use polkadot_node_network_protocol::request_response::{v1 as request_v1, IncomingRequestReceiver};
use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandle}; use polkadot_overseer::{
metrics::Metrics as OverseerMetrics, BlockInfo, MetricsTrait, Overseer, OverseerBuilder,
OverseerConnector, OverseerHandle,
};
use polkadot_primitives::v1::ParachainHost; use polkadot_primitives::v1::ParachainHost;
use sc_authority_discovery::Service as AuthorityDiscoveryService; use sc_authority_discovery::Service as AuthorityDiscoveryService;
use sc_client_api::AuxStore; use sc_client_api::AuxStore;
@@ -107,12 +111,11 @@ where
pub dispute_coordinator_config: DisputeCoordinatorConfig, pub dispute_coordinator_config: DisputeCoordinatorConfig,
} }
/// Create a default, unaltered set of subsystems. /// Obtain a prepared `OverseerBuilder`, that is initialized
/// /// with all default values.
/// A convenience for usage with malus, to avoid pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>(
/// repetitive code across multiple behavior strain implementations.
pub fn create_default_subsystems<Spawner, RuntimeClient>(
OverseerGenArgs { OverseerGenArgs {
leaves,
keystore, keystore,
runtime_client, runtime_client,
parachains_db, parachains_db,
@@ -120,6 +123,7 @@ pub fn create_default_subsystems<Spawner, RuntimeClient>(
authority_discovery_service, authority_discovery_service,
pov_req_receiver, pov_req_receiver,
chunk_req_receiver, chunk_req_receiver,
collation_req_receiver: _,
available_data_req_receiver, available_data_req_receiver,
statement_req_receiver, statement_req_receiver,
dispute_req_receiver, dispute_req_receiver,
@@ -130,10 +134,11 @@ pub fn create_default_subsystems<Spawner, RuntimeClient>(
candidate_validation_config, candidate_validation_config,
chain_selection_config, chain_selection_config,
dispute_coordinator_config, dispute_coordinator_config,
.. }: OverseerGenArgs<'a, Spawner, RuntimeClient>,
}: OverseerGenArgs<'_, Spawner, RuntimeClient>,
) -> Result< ) -> Result<
AllSubsystems< OverseerBuilder<
Spawner,
Arc<RuntimeClient>,
CandidateValidationSubsystem, CandidateValidationSubsystem,
CandidateBackingSubsystem<Spawner>, CandidateBackingSubsystem<Spawner>,
StatementDistributionSubsystem, StatementDistributionSubsystem,
@@ -153,7 +158,7 @@ pub fn create_default_subsystems<Spawner, RuntimeClient>(
CollatorProtocolSubsystem, CollatorProtocolSubsystem,
ApprovalDistributionSubsystem, ApprovalDistributionSubsystem,
ApprovalVotingSubsystem, ApprovalVotingSubsystem,
GossipSupportSubsystem, GossipSupportSubsystem<AuthorityDiscoveryService>,
DisputeCoordinatorSubsystem, DisputeCoordinatorSubsystem,
DisputeParticipationSubsystem, DisputeParticipationSubsystem,
DisputeDistributionSubsystem<AuthorityDiscoveryService>, DisputeDistributionSubsystem<AuthorityDiscoveryService>,
@@ -167,86 +172,104 @@ where
Spawner: 'static + SpawnNamed + Clone + Unpin, Spawner: 'static + SpawnNamed + Clone + Unpin,
{ {
use polkadot_node_subsystem_util::metrics::Metrics; use polkadot_node_subsystem_util::metrics::Metrics;
use std::iter::FromIterator;
let all_subsystems = AllSubsystems { let metrics = <OverseerMetrics as MetricsTrait>::register(registry)?;
availability_distribution: AvailabilityDistributionSubsystem::new(
let builder = Overseer::builder()
.availability_distribution(AvailabilityDistributionSubsystem::new(
keystore.clone(), keystore.clone(),
IncomingRequestReceivers { pov_req_receiver, chunk_req_receiver }, IncomingRequestReceivers { pov_req_receiver, chunk_req_receiver },
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
availability_recovery: AvailabilityRecoverySubsystem::with_chunks_only( .availability_recovery(AvailabilityRecoverySubsystem::with_chunks_only(
available_data_req_receiver, available_data_req_receiver,
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
availability_store: AvailabilityStoreSubsystem::new( .availability_store(AvailabilityStoreSubsystem::new(
parachains_db.clone(), parachains_db.clone(),
availability_config, availability_config,
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
bitfield_distribution: BitfieldDistributionSubsystem::new(Metrics::register(registry)?), .bitfield_distribution(BitfieldDistributionSubsystem::new(Metrics::register(registry)?))
bitfield_signing: BitfieldSigningSubsystem::new( .bitfield_signing(BitfieldSigningSubsystem::new(
spawner.clone(), spawner.clone(),
keystore.clone(), keystore.clone(),
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
candidate_backing: CandidateBackingSubsystem::new( .candidate_backing(CandidateBackingSubsystem::new(
spawner.clone(), spawner.clone(),
keystore.clone(), keystore.clone(),
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
candidate_validation: CandidateValidationSubsystem::with_config( .candidate_validation(CandidateValidationSubsystem::with_config(
candidate_validation_config, candidate_validation_config,
Metrics::register(registry)?, // candidate-validation metrics Metrics::register(registry)?, // candidate-validation metrics
Metrics::register(registry)?, // validation host metrics Metrics::register(registry)?, // validation host metrics
), ))
chain_api: ChainApiSubsystem::new(runtime_client.clone(), Metrics::register(registry)?), .chain_api(ChainApiSubsystem::new(runtime_client.clone(), Metrics::register(registry)?))
collation_generation: CollationGenerationSubsystem::new(Metrics::register(registry)?), .collation_generation(CollationGenerationSubsystem::new(Metrics::register(registry)?))
collator_protocol: CollatorProtocolSubsystem::new(ProtocolSide::Validator { .collator_protocol(CollatorProtocolSubsystem::new(ProtocolSide::Validator {
keystore: keystore.clone(), keystore: keystore.clone(),
eviction_policy: Default::default(), eviction_policy: Default::default(),
metrics: Metrics::register(registry)?, metrics: Metrics::register(registry)?,
}), }))
network_bridge: NetworkBridgeSubsystem::new( .network_bridge(NetworkBridgeSubsystem::new(
network_service.clone(), network_service.clone(),
authority_discovery_service.clone(), authority_discovery_service.clone(),
Box::new(network_service.clone()), Box::new(network_service.clone()),
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
provisioner: ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?), .provisioner(ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?))
runtime_api: RuntimeApiSubsystem::new( .runtime_api(RuntimeApiSubsystem::new(
runtime_client, runtime_client.clone(),
Metrics::register(registry)?, Metrics::register(registry)?,
spawner, spawner.clone(),
), ))
statement_distribution: StatementDistributionSubsystem::new( .statement_distribution(StatementDistributionSubsystem::new(
keystore.clone(), keystore.clone(),
statement_req_receiver, statement_req_receiver,
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
approval_distribution: ApprovalDistributionSubsystem::new(Metrics::register(registry)?), .approval_distribution(ApprovalDistributionSubsystem::new(Metrics::register(registry)?))
approval_voting: ApprovalVotingSubsystem::with_config( .approval_voting(ApprovalVotingSubsystem::with_config(
approval_voting_config, approval_voting_config,
parachains_db.clone(), parachains_db.clone(),
keystore.clone(), keystore.clone(),
Box::new(network_service), Box::new(network_service.clone()),
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
gossip_support: GossipSupportSubsystem::new(keystore.clone()), .gossip_support(GossipSupportSubsystem::new(
dispute_coordinator: DisputeCoordinatorSubsystem::new( keystore.clone(),
authority_discovery_service.clone(),
))
.dispute_coordinator(DisputeCoordinatorSubsystem::new(
parachains_db.clone(), parachains_db.clone(),
dispute_coordinator_config, dispute_coordinator_config,
keystore.clone(), keystore.clone(),
),
dispute_participation: DisputeParticipationSubsystem::new(),
dispute_distribution: DisputeDistributionSubsystem::new(
keystore,
dispute_req_receiver,
authority_discovery_service,
Metrics::register(registry)?, Metrics::register(registry)?,
), ))
chain_selection: ChainSelectionSubsystem::new(chain_selection_config, parachains_db), .dispute_participation(DisputeParticipationSubsystem::new())
}; .dispute_distribution(DisputeDistributionSubsystem::new(
Ok(all_subsystems) keystore.clone(),
dispute_req_receiver,
authority_discovery_service.clone(),
Metrics::register(registry)?,
))
.chain_selection(ChainSelectionSubsystem::new(chain_selection_config, parachains_db))
.leaves(Vec::from_iter(
leaves
.into_iter()
.map(|BlockInfo { hash, parent_hash: _, number }| (hash, number)),
))
.activation_external_listeners(Default::default())
.span_per_active_leaf(Default::default())
.active_leaves(Default::default())
.supports_parachains(runtime_client)
.known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE))
.metrics(metrics)
.spawner(spawner);
Ok(builder)
} }
/// Trait for the `fn` generating the overseer. /// Trait for the `fn` generating the overseer.
@@ -255,9 +278,10 @@ where
/// would do. /// would do.
pub trait OverseerGen { pub trait OverseerGen {
/// Overwrite the full generation of the overseer, including the subsystems. /// Overwrite the full generation of the overseer, including the subsystems.
fn generate<Spawner, RuntimeClient>( fn generate<'a, Spawner, RuntimeClient>(
&self, &self,
args: OverseerGenArgs<'_, Spawner, RuntimeClient>, connector: OverseerConnector,
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error> ) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
where where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore, RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
@@ -265,34 +289,31 @@ pub trait OverseerGen {
Spawner: 'static + SpawnNamed + Clone + Unpin, Spawner: 'static + SpawnNamed + Clone + Unpin,
{ {
let gen = RealOverseerGen; let gen = RealOverseerGen;
RealOverseerGen::generate::<Spawner, RuntimeClient>(&gen, args) RealOverseerGen::generate::<Spawner, RuntimeClient>(&gen, connector, args)
} }
// It would be nice to make `create_subsystems` part of this trait, // It would be nice to make `create_subsystems` part of this trait,
// but the amount of generic arguments that would be required as // but the amount of generic arguments that would be required as
// as consequence make this rather annoying to implement and use. // as consequence make this rather annoying to implement and use.
} }
use polkadot_overseer::KNOWN_LEAVES_CACHE_SIZE;
/// The regular set of subsystems. /// The regular set of subsystems.
pub struct RealOverseerGen; pub struct RealOverseerGen;
impl OverseerGen for RealOverseerGen { impl OverseerGen for RealOverseerGen {
fn generate<Spawner, RuntimeClient>( fn generate<'a, Spawner, RuntimeClient>(
&self, &self,
args: OverseerGenArgs<'_, Spawner, RuntimeClient>, connector: OverseerConnector,
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error> ) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
where where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore, RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>, RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Spawner: 'static + SpawnNamed + Clone + Unpin, Spawner: 'static + SpawnNamed + Clone + Unpin,
{ {
let spawner = args.spawner.clone(); prepared_overseer_builder(args)?
let leaves = args.leaves.clone(); .build_with_connector(connector)
let runtime_client = args.runtime_client.clone();
let registry = args.registry;
let all_subsystems = create_default_subsystems::<Spawner, RuntimeClient>(args)?;
Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner)
.map_err(|e| e.into()) .map_err(|e| e.into())
} }
} }
+49 -41
View File
@@ -33,7 +33,7 @@ use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig
use polkadot_node_core_chain_selection::Config as ChainSelectionConfig; use polkadot_node_core_chain_selection::Config as ChainSelectionConfig;
use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig; use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig;
use polkadot_node_network_protocol::request_response::IncomingRequest; use polkadot_node_network_protocol::request_response::IncomingRequest;
use polkadot_overseer::BlockInfo; use polkadot_overseer::{BlockInfo, OverseerConnector};
use polkadot_primitives::v1::BlockId; use polkadot_primitives::v1::BlockId;
use rialto_runtime::{self, opaque::Block, RuntimeApi}; use rialto_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::ExecutorProvider; use sc_client_api::ExecutorProvider;
@@ -47,7 +47,7 @@ use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use substrate_prometheus_endpoint::Registry; use substrate_prometheus_endpoint::Registry;
pub use polkadot_overseer::{Handle, Overseer, OverseerHandle}; pub use polkadot_overseer::Handle;
pub use polkadot_primitives::v1::ParachainHost; pub use polkadot_primitives::v1::ParachainHost;
pub use sc_client_api::AuxStore; pub use sc_client_api::AuxStore;
pub use sp_authority_discovery::AuthorityDiscoveryApi; pub use sp_authority_discovery::AuthorityDiscoveryApi;
@@ -432,6 +432,8 @@ where
let prometheus_registry = config.prometheus_registry().cloned(); let prometheus_registry = config.prometheus_registry().cloned();
let overseer_connector = OverseerConnector::default();
let shared_voter_state = rpc_setup; let shared_voter_state = rpc_setup;
let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht; let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht;
@@ -462,6 +464,7 @@ where
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(), backend.clone(),
import_setup.1.shared_authority_set().clone(), import_setup.1.shared_authority_set().clone(),
vec![],
)); ));
let (network, system_rpc_tx, network_starter) = let (network, system_rpc_tx, network_starter) =
@@ -586,50 +589,55 @@ where
let overseer_handle = if let Some((authority_discovery_service, keystore)) = maybe_params { let overseer_handle = if let Some((authority_discovery_service, keystore)) = maybe_params {
let (overseer, overseer_handle) = overseer_gen let (overseer, overseer_handle) = overseer_gen
.generate::<sc_service::SpawnTaskHandle, FullClient>(OverseerGenArgs { .generate::<sc_service::SpawnTaskHandle, FullClient>(
leaves: active_leaves, overseer_connector,
keystore, OverseerGenArgs {
runtime_client: overseer_client.clone(), leaves: active_leaves,
parachains_db, keystore,
availability_config, runtime_client: overseer_client.clone(),
approval_voting_config, parachains_db,
network_service: network.clone(), availability_config,
authority_discovery_service, approval_voting_config,
registry: prometheus_registry.as_ref(), network_service: network.clone(),
spawner, authority_discovery_service,
candidate_validation_config, registry: prometheus_registry.as_ref(),
available_data_req_receiver, spawner,
chain_selection_config, candidate_validation_config,
chunk_req_receiver, available_data_req_receiver,
collation_req_receiver, chain_selection_config,
dispute_coordinator_config, chunk_req_receiver,
dispute_req_receiver, collation_req_receiver,
pov_req_receiver, dispute_coordinator_config,
statement_req_receiver, dispute_req_receiver,
})?; pov_req_receiver,
let handle = Handle::Connected(overseer_handle); statement_req_receiver,
let handle_clone = handle.clone(); },
)?;
let handle = Handle::new(overseer_handle.clone());
task_manager.spawn_essential_handle().spawn_blocking( {
"overseer", let handle = handle.clone();
Box::pin(async move { task_manager.spawn_essential_handle().spawn_blocking(
use futures::{pin_mut, select, FutureExt}; "overseer",
Box::pin(async move {
use futures::{pin_mut, select, FutureExt};
let forward = polkadot_overseer::forward_events(overseer_client, handle_clone); let forward = polkadot_overseer::forward_events(overseer_client, handle);
let forward = forward.fuse(); let forward = forward.fuse();
let overseer_fut = overseer.run().fuse(); let overseer_fut = overseer.run().fuse();
pin_mut!(overseer_fut); pin_mut!(overseer_fut);
pin_mut!(forward); pin_mut!(forward);
select! { select! {
_ = forward => (), _ = forward => (),
_ = overseer_fut => (), _ = overseer_fut => (),
complete => (), complete => (),
} }
}), }),
); );
}
Some(handle) Some(handle)
} else { } else {
+2
View File
@@ -12,6 +12,7 @@ codec = { package = "parity-scale-codec", version = "2.2.0", default-features =
hex-literal = "0.3" hex-literal = "0.3"
libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] } libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -112,6 +113,7 @@ std = [
"polkadot-primitives/std", "polkadot-primitives/std",
"polkadot-runtime-common/std", "polkadot-runtime-common/std",
"polkadot-runtime-parachains/std", "polkadot-runtime-parachains/std",
"scale-info/std",
"serde", "serde",
"sp-api/std", "sp-api/std",
"sp-authority-discovery/std", "sp-authority-discovery/std",
+3 -2
View File
@@ -35,13 +35,14 @@ use bp_eth_poa::{transaction_decode_rlp, RawTransaction, RawTransactionReceipt};
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::RuntimeDebug; use frame_support::RuntimeDebug;
use hex_literal::hex; use hex_literal::hex;
use scale_info::TypeInfo;
use sp_std::vec::Vec; use sp_std::vec::Vec;
/// Ethereum address where locked PoA funds must be sent to. /// Ethereum address where locked PoA funds must be sent to.
pub const LOCK_FUNDS_ADDRESS: [u8; 20] = hex!("DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"); pub const LOCK_FUNDS_ADDRESS: [u8; 20] = hex!("DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF");
/// Ethereum transaction inclusion proof. /// Ethereum transaction inclusion proof.
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug)] #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
pub struct EthereumTransactionInclusionProof { pub struct EthereumTransactionInclusionProof {
/// Hash of the block with transaction. /// Hash of the block with transaction.
pub block: sp_core::H256, pub block: sp_core::H256,
@@ -58,7 +59,7 @@ pub struct EthereumTransactionInclusionProof {
/// transactions included into finalized blocks. This is obviously true /// transactions included into finalized blocks. This is obviously true
/// for any existing eth-like chain (that keep current TX format), because /// for any existing eth-like chain (that keep current TX format), because
/// otherwise transaction can be replayed over and over. /// otherwise transaction can be replayed over and over.
#[derive(Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
pub struct EthereumTransactionTag { pub struct EthereumTransactionTag {
/// Account that has locked funds. /// Account that has locked funds.
pub account: [u8; 20], pub account: [u8; 20],
+12 -8
View File
@@ -226,11 +226,13 @@ pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
parameter_types! { parameter_types! {
pub const EpochDuration: u64 = bp_rialto::EPOCH_DURATION_IN_SLOTS as u64; pub const EpochDuration: u64 = bp_rialto::EPOCH_DURATION_IN_SLOTS as u64;
pub const ExpectedBlockTime: bp_rialto::Moment = bp_rialto::time_units::MILLISECS_PER_BLOCK; pub const ExpectedBlockTime: bp_rialto::Moment = bp_rialto::time_units::MILLISECS_PER_BLOCK;
pub const MaxAuthorities: u32 = 10;
} }
impl pallet_babe::Config for Runtime { impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration; type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime; type ExpectedBlockTime = ExpectedBlockTime;
type MaxAuthorities = MaxAuthorities;
// session module is the trigger // session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger; type EpochChangeTrigger = pallet_babe::ExternalTrigger;
@@ -370,6 +372,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
type MaxAuthorities = MaxAuthorities;
type KeyOwnerProofSystem = (); type KeyOwnerProofSystem = ();
type KeyOwnerProof = type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
@@ -421,6 +424,7 @@ impl pallet_balances::Config for Runtime {
parameter_types! { parameter_types! {
pub const TransactionBaseFee: Balance = 0; pub const TransactionBaseFee: Balance = 0;
pub const TransactionByteFee: Balance = 1; pub const TransactionByteFee: Balance = 1;
pub const OperationalFeeMultiplier: u8 = 5;
// values for following parameters are copied from polkadot repo, but it is fine // values for following parameters are copied from polkadot repo, but it is fine
// not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains // not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
@@ -431,6 +435,7 @@ parameter_types! {
impl pallet_transaction_payment::Config 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 OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = bp_rialto::WeightToFee; type WeightToFee = bp_rialto::WeightToFee;
type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment< type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
Runtime, Runtime,
@@ -454,15 +459,10 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_shift_session_manager::Pallet<Runtime>; type SessionManager = pallet_shift_session_manager::Pallet<Runtime>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys; type Keys = SessionKeys;
type DisabledValidatorsThreshold = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = (); type WeightInfo = ();
} }
parameter_types! {
pub const MaxAuthorities: u32 = 10;
}
impl pallet_authority_discovery::Config for Runtime { impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
} }
@@ -662,7 +662,7 @@ impl_runtime_apis! {
impl sp_api::Metadata<Block> for Runtime { impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata { fn metadata() -> OpaqueMetadata {
Runtime::metadata().into() OpaqueMetadata::new(Runtime::metadata().into())
} }
} }
@@ -783,7 +783,7 @@ impl_runtime_apis! {
slot_duration: Babe::slot_duration(), slot_duration: Babe::slot_duration(),
epoch_length: EpochDuration::get(), epoch_length: EpochDuration::get(),
c: BABE_GENESIS_EPOCH_CONFIG.c, c: BABE_GENESIS_EPOCH_CONFIG.c,
genesis_authorities: Babe::authorities(), genesis_authorities: Babe::authorities().to_vec(),
randomness: Babe::randomness(), randomness: Babe::randomness(),
allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots, allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
} }
@@ -902,6 +902,10 @@ impl_runtime_apis! {
) -> Option<polkadot_primitives::v1::ValidationCode> { ) -> Option<polkadot_primitives::v1::ValidationCode> {
polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_by_hash::<Runtime>(hash) polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_by_hash::<Runtime>(hash)
} }
fn on_chain_votes() -> Option<polkadot_primitives::v1::ScrapedOnChainVotes<Hash>> {
polkadot_runtime_parachains::runtime_api_impl::v1::on_chain_votes::<Runtime>()
}
} }
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime { impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
@@ -1172,7 +1176,7 @@ impl_runtime_apis! {
MessagesProofSize::Minimal(ref size) => vec![0u8; *size as _], MessagesProofSize::Minimal(ref size) => vec![0u8; *size as _],
_ => vec![], _ => vec![],
}; };
let call = Call::System(SystemCall::remark(remark)); let call = Call::System(SystemCall::remark { remark });
let call_weight = call.get_dispatch_info().weight; let call_weight = call.get_dispatch_info().weight;
let millau_account_id: bp_millau::AccountId = Default::default(); let millau_account_id: bp_millau::AccountId = Default::default();
@@ -31,6 +31,7 @@ use frame_support::{
weights::{DispatchClass, Weight}, weights::{DispatchClass, Weight},
RuntimeDebug, RuntimeDebug,
}; };
use scale_info::TypeInfo;
use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128}; use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128};
use sp_std::{convert::TryFrom, ops::RangeInclusive}; use sp_std::{convert::TryFrom, ops::RangeInclusive};
@@ -272,7 +273,7 @@ impl SourceHeaderChain<bp_millau::Balance> for Millau {
} }
/// Rialto -> Millau message lane pallet parameters. /// Rialto -> Millau message lane pallet parameters.
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq)] #[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
pub enum RialtoToMillauMessagesParameter { pub enum RialtoToMillauMessagesParameter {
/// The conversion formula we use is: `RialtoTokens = MillauTokens * conversion_rate`. /// The conversion formula we use is: `RialtoTokens = MillauTokens * conversion_rate`.
MillauToRialtoConversionRate(FixedU128), MillauToRialtoConversionRate(FixedU128),
@@ -315,7 +316,7 @@ mod tests {
SystemConfig::default().build_storage::<Runtime>().unwrap().into(); SystemConfig::default().build_storage::<Runtime>().unwrap().into();
ext.execute_with(|| { ext.execute_with(|| {
let bridge = MILLAU_CHAIN_ID; let bridge = MILLAU_CHAIN_ID;
let call: Call = SystemCall::remark(vec![]).into(); let call: Call = SystemCall::remark { remark: vec![] }.into();
let dispatch_weight = call.get_dispatch_info().weight; let dispatch_weight = call.get_dispatch_info().weight;
let dispatch_fee = <Runtime as pallet_transaction_payment::Config>::WeightToFee::calc( let dispatch_fee = <Runtime as pallet_transaction_payment::Config>::WeightToFee::calc(
&dispatch_weight, &dispatch_weight,
+7 -1
View File
@@ -39,7 +39,9 @@ impl polkadot_runtime_parachains::inclusion::RewardValidators for RewardValidato
// all required parachain modules from `polkadot-runtime-parachains` crate // all required parachain modules from `polkadot-runtime-parachains` crate
impl parachains_configuration::Config for Runtime {} impl parachains_configuration::Config for Runtime {
type WeightInfo = parachains_configuration::TestWeightInfo;
}
impl parachains_dmp::Config for Runtime {} impl parachains_dmp::Config for Runtime {}
@@ -58,6 +60,7 @@ impl parachains_inclusion::Config for Runtime {
impl parachains_initializer::Config for Runtime { impl parachains_initializer::Config for Runtime {
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>; type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
type ForceOrigin = EnsureRoot<AccountId>; type ForceOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
} }
impl parachains_origin::Config for Runtime {} impl parachains_origin::Config for Runtime {}
@@ -65,6 +68,7 @@ impl parachains_origin::Config for Runtime {}
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Origin = Origin; type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = parachains_paras::TestWeightInfo;
} }
impl parachains_paras_inherent::Config for Runtime {} impl parachains_paras_inherent::Config for Runtime {}
@@ -83,6 +87,7 @@ impl parachains_ump::Config for Runtime {
type Event = Event; type Event = Event;
type UmpSink = (); type UmpSink = ();
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
} }
// required onboarding pallets. We're not going to use auctions or crowdloans, so they're missing // required onboarding pallets. We're not going to use auctions or crowdloans, so they're missing
@@ -112,6 +117,7 @@ impl slots::Config for Runtime {
type Registrar = Registrar; type Registrar = Registrar;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
type WeightInfo = slots::TestWeightInfo; type WeightInfo = slots::TestWeightInfo;
type LeaseOffset = ();
} }
impl paras_sudo_wrapper::Config for Runtime {} impl paras_sudo_wrapper::Config for Runtime {}
+2
View File
@@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] }
ed25519-dalek = { version = "1.0", default-features = false, optional = true } ed25519-dalek = { version = "1.0", default-features = false, optional = true }
hash-db = { version = "0.15.2", default-features = false } hash-db = { version = "0.15.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -44,6 +45,7 @@ std = [
"pallet-bridge-grandpa/std", "pallet-bridge-grandpa/std",
"pallet-bridge-messages/std", "pallet-bridge-messages/std",
"pallet-transaction-payment/std", "pallet-transaction-payment/std",
"scale-info/std",
"sp-core/std", "sp-core/std",
"sp-runtime/std", "sp-runtime/std",
"sp-state-machine/std", "sp-state-machine/std",
+3 -2
View File
@@ -37,6 +37,7 @@ use frame_support::{
RuntimeDebug, RuntimeDebug,
}; };
use hash_db::Hasher; use hash_db::Hasher;
use scale_info::TypeInfo;
use sp_runtime::{ use sp_runtime::{
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, Saturating, Zero}, traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, Saturating, Zero},
FixedPointNumber, FixedPointOperand, FixedU128, FixedPointNumber, FixedPointOperand, FixedU128,
@@ -216,7 +217,7 @@ pub mod source {
/// - hash of finalized header; /// - hash of finalized header;
/// - storage proof of inbound lane state; /// - storage proof of inbound lane state;
/// - lane id. /// - lane id.
#[derive(Clone, Decode, Encode, Eq, PartialEq, RuntimeDebug)] #[derive(Clone, Decode, Encode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
pub struct FromBridgedChainMessagesDeliveryProof<BridgedHeaderHash> { pub struct FromBridgedChainMessagesDeliveryProof<BridgedHeaderHash> {
/// Hash of the bridge header the proof is for. /// Hash of the bridge header the proof is for.
pub bridged_header_hash: BridgedHeaderHash, pub bridged_header_hash: BridgedHeaderHash,
@@ -456,7 +457,7 @@ pub mod target {
/// - storage proof of messages and (optionally) outbound lane state; /// - storage proof of messages and (optionally) outbound lane state;
/// - lane id; /// - lane id;
/// - nonces (inclusive range) of messages which are included in this proof. /// - nonces (inclusive range) of messages which are included in this proof.
#[derive(Clone, Decode, Encode, Eq, PartialEq, RuntimeDebug)] #[derive(Clone, Decode, Encode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
pub struct FromBridgedChainMessagesProof<BridgedHeaderHash> { pub struct FromBridgedChainMessagesProof<BridgedHeaderHash> {
/// Hash of the finalized bridged header the proof is for. /// Hash of the finalized bridged header the proof is for.
pub bridged_header_hash: BridgedHeaderHash, pub bridged_header_hash: BridgedHeaderHash,
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Bridge dependencies # Bridge dependencies
@@ -38,6 +39,7 @@ std = [
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"log/std", "log/std",
"scale-info/std",
"serde", "serde",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std", "sp-std/std",
+2
View File
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -34,6 +35,7 @@ std = [
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"log/std", "log/std",
"scale-info/std",
"sp-core/std", "sp-core/std",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std", "sp-std/std",
+29 -31
View File
@@ -22,7 +22,6 @@
//! a successful dispatch an event is emitted. //! a successful dispatch an event is emitted.
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
// Generated by `decl_event!` // Generated by `decl_event!`
#![allow(clippy::unused_unit)] #![allow(clippy::unused_unit)]
@@ -111,7 +110,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(<T as frame_system::Config>::AccountId = "AccountId", BridgeMessageIdOf<T, I> = "BridgeMessageId")]
pub enum Event<T: Config<I>, I: 'static = ()> { pub enum Event<T: Config<I>, I: 'static = ()> {
/// Message has been rejected before reaching dispatch. /// Message has been rejected before reaching dispatch.
MessageRejected(ChainId, BridgeMessageIdOf<T, I>), MessageRejected(ChainId, BridgeMessageIdOf<T, I>),
@@ -431,6 +429,7 @@ mod tests {
use codec::Decode; use codec::Decode;
use frame_support::{parameter_types, weights::Weight}; use frame_support::{parameter_types, weights::Weight};
use frame_system::{EventRecord, Phase}; use frame_system::{EventRecord, Phase};
use scale_info::TypeInfo;
use sp_core::H256; use sp_core::H256;
use sp_runtime::{ use sp_runtime::{
testing::Header, testing::Header,
@@ -444,7 +443,7 @@ mod tests {
const SOURCE_CHAIN_ID: ChainId = *b"srce"; const SOURCE_CHAIN_ID: ChainId = *b"srce";
const TARGET_CHAIN_ID: ChainId = *b"trgt"; const TARGET_CHAIN_ID: ChainId = *b"trgt";
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq)] #[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
pub struct TestAccountPublic(AccountId); pub struct TestAccountPublic(AccountId);
impl IdentifyAccount for TestAccountPublic { impl IdentifyAccount for TestAccountPublic {
@@ -455,7 +454,7 @@ mod tests {
} }
} }
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq)] #[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
pub struct TestSignature(AccountId); pub struct TestSignature(AccountId);
impl Verify for TestSignature { impl Verify for TestSignature {
@@ -548,7 +547,7 @@ mod tests {
impl Contains<Call> for TestCallFilter { impl Contains<Call> for TestCallFilter {
fn contains(call: &Call) -> bool { fn contains(call: &Call) -> bool {
!matches!(*call, Call::System(frame_system::Call::fill_block(_))) !matches!(*call, Call::System(frame_system::Call::fill_block { .. }))
} }
} }
@@ -611,9 +610,9 @@ mod tests {
let id = [0; 4]; let id = [0; 4];
const BAD_SPEC_VERSION: SpecVersion = 99; const BAD_SPEC_VERSION: SpecVersion = 99;
let mut message = prepare_root_message(Call::System( let mut message = prepare_root_message(Call::System(frame_system::Call::remark {
<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3]), remark: vec![1, 2, 3],
)); }));
let weight = message.weight; let weight = message.weight;
message.spec_version = BAD_SPEC_VERSION; message.spec_version = BAD_SPEC_VERSION;
@@ -650,7 +649,7 @@ mod tests {
fn should_fail_on_weight_mismatch() { fn should_fail_on_weight_mismatch() {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3])); let call = Call::System(frame_system::Call::remark { remark: vec![1, 2, 3] });
let call_weight = call.get_dispatch_info().weight; let call_weight = call.get_dispatch_info().weight;
let mut message = prepare_root_message(call); let mut message = prepare_root_message(call);
message.weight = 7; message.weight = 7;
@@ -693,7 +692,7 @@ mod tests {
let call_origin = CallOrigin::TargetAccount(1, TestAccountPublic(1), TestSignature(99)); let call_origin = CallOrigin::TargetAccount(1, TestAccountPublic(1), TestSignature(99));
let message = prepare_message( let message = prepare_message(
call_origin, call_origin,
Call::System(<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3])), Call::System(frame_system::Call::remark { remark: vec![1, 2, 3] }),
); );
let weight = message.weight; let weight = message.weight;
@@ -757,9 +756,9 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let mut message = prepare_root_message(Call::System( let mut message = prepare_root_message(Call::System(frame_system::Call::remark {
<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3]), remark: vec![1, 2, 3],
)); }));
let weight = message.weight; let weight = message.weight;
message.call.0 = vec![]; message.call.0 = vec![];
@@ -795,9 +794,8 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let call = Call::System(<frame_system::Call<TestRuntime>>::fill_block( let call =
Perbill::from_percent(75), Call::System(frame_system::Call::fill_block { ratio: Perbill::from_percent(75) });
));
let weight = call.get_dispatch_info().weight; let weight = call.get_dispatch_info().weight;
let mut message = prepare_root_message(call); let mut message = prepare_root_message(call);
message.weight = weight; message.weight = weight;
@@ -834,9 +832,9 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let mut message = prepare_root_message(Call::System( let mut message = prepare_root_message(Call::System(frame_system::Call::remark {
<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3]), remark: vec![1, 2, 3],
)); }));
let weight = message.weight; let weight = message.weight;
message.dispatch_fee_payment = DispatchFeePayment::AtTargetChain; message.dispatch_fee_payment = DispatchFeePayment::AtTargetChain;
@@ -874,9 +872,9 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let mut message = prepare_root_message(Call::System( let mut message = prepare_root_message(Call::System(frame_system::Call::remark {
<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3]), remark: vec![1, 2, 3],
)); }));
message.dispatch_fee_payment = DispatchFeePayment::AtTargetChain; message.dispatch_fee_payment = DispatchFeePayment::AtTargetChain;
System::set_block_number(1); System::set_block_number(1);
@@ -910,7 +908,7 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let call = Call::System(<frame_system::Call<TestRuntime>>::set_heap_pages(1)); let call = Call::System(frame_system::Call::set_heap_pages { pages: 1 });
let message = prepare_target_message(call); let message = prepare_target_message(call);
System::set_block_number(1); System::set_block_number(1);
@@ -943,9 +941,9 @@ mod tests {
fn should_dispatch_bridge_message_from_root_origin() { fn should_dispatch_bridge_message_from_root_origin() {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let message = prepare_root_message(Call::System( let message = prepare_root_message(Call::System(frame_system::Call::remark {
<frame_system::Call<TestRuntime>>::remark(vec![1, 2, 3]), remark: vec![1, 2, 3],
)); }));
System::set_block_number(1); System::set_block_number(1);
let result = Dispatch::dispatch( let result = Dispatch::dispatch(
@@ -978,7 +976,7 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![])); let call = Call::System(frame_system::Call::remark { remark: vec![] });
let message = prepare_target_message(call); let message = prepare_target_message(call);
System::set_block_number(1); System::set_block_number(1);
@@ -1012,7 +1010,7 @@ mod tests {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let id = [0; 4]; let id = [0; 4];
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![])); let call = Call::System(frame_system::Call::remark { remark: vec![] });
let message = prepare_source_message(call); let message = prepare_source_message(call);
System::set_block_number(1); System::set_block_number(1);
@@ -1043,7 +1041,7 @@ mod tests {
#[test] #[test]
fn origin_is_checked_when_verifying_sending_message_using_source_root_account() { fn origin_is_checked_when_verifying_sending_message_using_source_root_account() {
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![])); let call = Call::System(frame_system::Call::remark { remark: vec![] });
let message = prepare_root_message(call); let message = prepare_root_message(call);
// When message is sent by Root, CallOrigin::SourceRoot is allowed // When message is sent by Root, CallOrigin::SourceRoot is allowed
@@ -1055,7 +1053,7 @@ mod tests {
#[test] #[test]
fn origin_is_checked_when_verifying_sending_message_using_target_account() { fn origin_is_checked_when_verifying_sending_message_using_target_account() {
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![])); let call = Call::System(frame_system::Call::remark { remark: vec![] });
let message = prepare_target_message(call); let message = prepare_target_message(call);
// When message is sent by Root, CallOrigin::TargetAccount is not allowed // When message is sent by Root, CallOrigin::TargetAccount is not allowed
@@ -1071,7 +1069,7 @@ mod tests {
#[test] #[test]
fn origin_is_checked_when_verifying_sending_message_using_source_account() { fn origin_is_checked_when_verifying_sending_message_using_source_account() {
let call = Call::System(<frame_system::Call<TestRuntime>>::remark(vec![])); let call = Call::System(frame_system::Call::remark { remark: vec![] });
let message = prepare_source_message(call); let message = prepare_source_message(call);
// Sending a message from the expected origin account works // Sending a message from the expected origin account works
+2
View File
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac"], optional = true } libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac"], optional = true }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Bridge dependencies # Bridge dependencies
@@ -38,6 +39,7 @@ std = [
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"log/std", "log/std",
"scale-info/std",
"serde", "serde",
"sp-io/std", "sp-io/std",
"sp-runtime/std", "sp-runtime/std",
+3 -2
View File
@@ -17,6 +17,7 @@
use crate::{error::Error, Storage}; use crate::{error::Error, Storage};
use bp_eth_poa::{public_to_address, Address, AuraHeader, HeaderId, SealedEmptyStep, H256}; use bp_eth_poa::{public_to_address, Address, AuraHeader, HeaderId, SealedEmptyStep, H256};
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_io::crypto::secp256k1_ecdsa_recover; use sp_io::crypto::secp256k1_ecdsa_recover;
use sp_runtime::RuntimeDebug; use sp_runtime::RuntimeDebug;
use sp_std::{ use sp_std::{
@@ -55,7 +56,7 @@ pub struct FinalityEffects<Submitter> {
} }
/// Finality votes for given block. /// Finality votes for given block.
#[derive(RuntimeDebug, Decode, Encode)] #[derive(RuntimeDebug, Decode, Encode, TypeInfo)]
#[cfg_attr(test, derive(Clone, PartialEq))] #[cfg_attr(test, derive(Clone, PartialEq))]
pub struct FinalityVotes<Submitter> { pub struct FinalityVotes<Submitter> {
/// Number of votes per each validator. /// Number of votes per each validator.
@@ -66,7 +67,7 @@ pub struct FinalityVotes<Submitter> {
} }
/// Information about block ancestor that is used in computations. /// Information about block ancestor that is used in computations.
#[derive(RuntimeDebug, Decode, Encode)] #[derive(RuntimeDebug, Decode, Encode, TypeInfo)]
#[cfg_attr(test, derive(Clone, Default, PartialEq))] #[cfg_attr(test, derive(Clone, Default, PartialEq))]
pub struct FinalityAncestor<Submitter> { pub struct FinalityAncestor<Submitter> {
/// Bock id. /// Bock id.
+6 -5
View File
@@ -24,6 +24,7 @@ use bp_eth_poa::{
}; };
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::traits::Get; use frame_support::traits::Get;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug; use sp_runtime::RuntimeDebug;
use sp_std::{boxed::Box, cmp::Ord, collections::btree_map::BTreeMap, prelude::*}; use sp_std::{boxed::Box, cmp::Ord, collections::btree_map::BTreeMap, prelude::*};
@@ -81,7 +82,7 @@ pub struct PoolConfiguration {
} }
/// Block header as it is stored in the runtime storage. /// Block header as it is stored in the runtime storage.
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
pub struct StoredHeader<Submitter> { pub struct StoredHeader<Submitter> {
/// Submitter of this header. May be `None` if header has been submitted /// Submitter of this header. May be `None` if header has been submitted
/// using unsigned transaction. /// using unsigned transaction.
@@ -102,7 +103,7 @@ pub struct StoredHeader<Submitter> {
} }
/// Validators set as it is stored in the runtime storage. /// Validators set as it is stored in the runtime storage.
#[derive(Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
#[cfg_attr(test, derive(Clone))] #[cfg_attr(test, derive(Clone))]
pub struct ValidatorsSet { pub struct ValidatorsSet {
/// Validators of this set. /// Validators of this set.
@@ -114,7 +115,7 @@ pub struct ValidatorsSet {
} }
/// Validators set change as it is stored in the runtime storage. /// Validators set change as it is stored in the runtime storage.
#[derive(Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
#[cfg_attr(test, derive(Clone))] #[cfg_attr(test, derive(Clone))]
pub struct AuraScheduledChange { pub struct AuraScheduledChange {
/// Validators of this set. /// Validators of this set.
@@ -158,7 +159,7 @@ pub struct ChangeToEnact {
} }
/// Blocks range that we want to prune. /// Blocks range that we want to prune.
#[derive(Encode, Decode, Default, RuntimeDebug, Clone, PartialEq)] #[derive(Encode, Decode, Default, RuntimeDebug, Clone, PartialEq, TypeInfo)]
struct PruningRange { struct PruningRange {
/// Number of the oldest unpruned block(s). This might be the block that we do not /// Number of the oldest unpruned block(s). This might be the block that we do not
/// want to prune now (then it is equal to `oldest_block_to_keep`), or block that we /// want to prune now (then it is equal to `oldest_block_to_keep`), or block that we
@@ -478,7 +479,7 @@ pub mod pallet {
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
match *call { match *call {
Self::Call::import_unsigned_header(ref header, ref receipts) => { Self::Call::import_unsigned_header { ref header, ref receipts } => {
let accept_result = verification::accept_aura_header_into_pool( let accept_result = verification::accept_aura_header_into_pool(
&BridgeStorage::<T, I>::new(), &BridgeStorage::<T, I>::new(),
&T::AuraConfiguration::get(), &T::AuraConfiguration::get(),
+3
View File
@@ -12,6 +12,7 @@ codec = { package = "parity-scale-codec", version = "2.2.0", default-features =
finality-grandpa = { version = "0.14.0", default-features = false } finality-grandpa = { version = "0.14.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Bridge Dependencies # Bridge Dependencies
@@ -33,6 +34,7 @@ bp-test-utils = { path = "../../primitives/test-utils", default-features = false
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
[dev-dependencies] [dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
[features] [features]
@@ -47,6 +49,7 @@ std = [
"frame-system/std", "frame-system/std",
"log/std", "log/std",
"num-traits/std", "num-traits/std",
"scale-info/std",
"serde", "serde",
"sp-finality-grandpa/std", "sp-finality-grandpa/std",
"sp-runtime/std", "sp-runtime/std",
+3 -2
View File
@@ -19,10 +19,11 @@
use bp_runtime::Chain; use bp_runtime::Chain;
use frame_support::{construct_runtime, parameter_types, weights::Weight}; use frame_support::{construct_runtime, parameter_types, weights::Weight};
use sp_core::sr25519::Signature;
use sp_runtime::{ use sp_runtime::{
testing::{Header, H256}, testing::{Header, H256},
traits::{BlakeTwo256, IdentityLookup}, traits::{BlakeTwo256, IdentityLookup},
AnySignature, Perbill, Perbill,
}; };
pub type AccountId = u64; pub type AccountId = u64;
@@ -105,7 +106,7 @@ impl Chain for TestBridgedChain {
type AccountId = AccountId; type AccountId = AccountId;
type Balance = u64; type Balance = u64;
type Index = u64; type Index = u64;
type Signature = AnySignature; type Signature = Signature;
} }
pub fn run_test<T>(test: impl FnOnce() -> T) -> T { pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
+2
View File
@@ -11,6 +11,7 @@ bitvec = { version = "0.20", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -45,6 +46,7 @@ std = [
"frame-system/std", "frame-system/std",
"log/std", "log/std",
"num-traits/std", "num-traits/std",
"scale-info/std",
"serde", "serde",
"sp-core/std", "sp-core/std",
"sp-runtime/std", "sp-runtime/std",
-1
View File
@@ -652,7 +652,6 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::metadata(T::Parameter = "Parameter")]
pub enum Event<T: Config<I>, I: 'static = ()> { pub enum Event<T: Config<I>, I: 'static = ()> {
/// Pallet parameter has been updated. /// Pallet parameter has been updated.
ParameterUpdated(T::Parameter), ParameterUpdated(T::Parameter),
+5 -4
View File
@@ -37,6 +37,7 @@ use frame_support::{
parameter_types, parameter_types,
weights::{RuntimeDbWeight, Weight}, weights::{RuntimeDbWeight, Weight},
}; };
use scale_info::TypeInfo;
use sp_core::H256; use sp_core::H256;
use sp_runtime::{ use sp_runtime::{
testing::Header as SubstrateHeader, testing::Header as SubstrateHeader,
@@ -50,7 +51,7 @@ use std::{
pub type AccountId = u64; pub type AccountId = u64;
pub type Balance = u64; pub type Balance = u64;
#[derive(Decode, Encode, Clone, Debug, PartialEq, Eq)] #[derive(Decode, Encode, Clone, Debug, PartialEq, Eq, TypeInfo)]
pub struct TestPayload { pub struct TestPayload {
/// Field that may be used to identify messages. /// Field that may be used to identify messages.
pub id: u64, pub id: u64,
@@ -150,7 +151,7 @@ parameter_types! {
pub const TestBridgedChainId: bp_runtime::ChainId = *b"test"; pub const TestBridgedChainId: bp_runtime::ChainId = *b"test";
} }
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)] #[derive(Debug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
pub enum TestMessagesParameter { pub enum TestMessagesParameter {
TokenConversionRate(FixedU128), TokenConversionRate(FixedU128),
} }
@@ -226,7 +227,7 @@ pub const PAYLOAD_REJECTED_BY_TARGET_CHAIN: TestPayload = message_payload(1, 50)
pub type MessagesByLaneVec = Vec<(LaneId, ProvedLaneMessages<Message<TestMessageFee>>)>; pub type MessagesByLaneVec = Vec<(LaneId, ProvedLaneMessages<Message<TestMessageFee>>)>;
/// Test messages proof. /// Test messages proof.
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq)] #[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
pub struct TestMessagesProof { pub struct TestMessagesProof {
pub result: Result<MessagesByLaneVec, ()>, pub result: Result<MessagesByLaneVec, ()>,
} }
@@ -255,7 +256,7 @@ impl From<Result<Vec<Message<TestMessageFee>>, ()>> for TestMessagesProof {
} }
/// Messages delivery proof used in tests. /// Messages delivery proof used in tests.
#[derive(Debug, Encode, Decode, Eq, Clone, PartialEq)] #[derive(Debug, Encode, Decode, Eq, Clone, PartialEq, TypeInfo)]
pub struct TestMessagesDeliveryProof(pub Result<(LaneId, InboundLaneData<TestRelayer>), ()>); pub struct TestMessagesDeliveryProof(pub Result<(LaneId, InboundLaneData<TestRelayer>), ()>);
impl Size for TestMessagesDeliveryProof { impl Size for TestMessagesDeliveryProof {
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -28,6 +29,7 @@ std = [
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"pallet-session/std", "pallet-session/std",
"scale-info/std",
"sp-staking/std", "sp-staking/std",
"sp-std/std", "sp-std/std",
] ]
@@ -109,6 +109,7 @@ mod tests {
traits::{BlakeTwo256, ConvertInto, IdentityLookup}, traits::{BlakeTwo256, ConvertInto, IdentityLookup},
Perbill, RuntimeAppPublic, Perbill, RuntimeAppPublic,
}, },
traits::GenesisBuild,
weights::Weight, weights::Weight,
BasicExternalities, BasicExternalities,
}; };
@@ -177,7 +178,6 @@ mod tests {
type SessionManager = (); type SessionManager = ();
type SessionHandler = TestSessionHandler; type SessionHandler = TestSessionHandler;
type Keys = UintAuthorityId; type Keys = UintAuthorityId;
type DisabledValidatorsThreshold = ();
type WeightInfo = (); type WeightInfo = ();
} }
@@ -197,7 +197,7 @@ mod tests {
) { ) {
} }
fn on_disabled(_: usize) {} fn on_disabled(_: u32) {}
} }
fn new_test_ext() -> TestExternalities { fn new_test_ext() -> TestExternalities {
+2
View File
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Bridge dependencies # Bridge dependencies
@@ -46,6 +47,7 @@ std = [
"log/std", "log/std",
"pallet-bridge-dispatch/std", "pallet-bridge-dispatch/std",
"pallet-bridge-messages/std", "pallet-bridge-messages/std",
"scale-info/std",
"serde", "serde",
"sp-core/std", "sp-core/std",
"sp-io/std", "sp-io/std",
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
smallvec = "1.6" smallvec = "1.7"
# Bridge Dependencies # Bridge Dependencies
@@ -17,6 +17,7 @@ hash256-std-hasher = { version = "0.15.2", default-features = false }
impl-codec = { version = "0.5.1", default-features = false } impl-codec = { version = "0.5.1", default-features = false }
impl-serde = { version = "0.3.1", optional = true } impl-serde = { version = "0.3.1", optional = true }
parity-util-mem = { version = "0.10", default-features = false, features = ["primitive-types"] } parity-util-mem = { version = "0.10", default-features = false, features = ["primitive-types"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] }
# Substrate Based Dependencies # Substrate Based Dependencies
@@ -42,6 +43,7 @@ std = [
"impl-codec/std", "impl-codec/std",
"impl-serde", "impl-serde",
"parity-util-mem/std", "parity-util-mem/std",
"scale-info/std",
"serde", "serde",
"sp-api/std", "sp-api/std",
"sp-core/std", "sp-core/std",
+2 -1
View File
@@ -29,6 +29,7 @@ use frame_support::{
Parameter, RuntimeDebug, Parameter, RuntimeDebug,
}; };
use frame_system::limits; use frame_system::limits;
use scale_info::TypeInfo;
use sp_core::Hasher as HasherT; use sp_core::Hasher as HasherT;
use sp_runtime::{ use sp_runtime::{
traits::{Convert, IdentifyAccount, Verify}, traits::{Convert, IdentifyAccount, Verify},
@@ -174,7 +175,7 @@ impl Chain for Millau {
} }
/// Millau Hasher (Blake2-256 ++ Keccak-256) implementation. /// Millau Hasher (Blake2-256 ++ Keccak-256) implementation.
#[derive(PartialEq, Eq, Clone, Copy, RuntimeDebug)] #[derive(PartialEq, Eq, Clone, Copy, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct BlakeTwoAndKeccak256; pub struct BlakeTwoAndKeccak256;
@@ -15,6 +15,7 @@
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>. // along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use parity_util_mem::MallocSizeOf; use parity_util_mem::MallocSizeOf;
use scale_info::TypeInfo;
use sp_runtime::traits::CheckEqual; use sp_runtime::traits::CheckEqual;
// `sp_core::H512` can't be used, because it doesn't implement `CheckEqual`, which is required // `sp_core::H512` can't be used, because it doesn't implement `CheckEqual`, which is required
@@ -22,7 +23,7 @@ use sp_runtime::traits::CheckEqual;
fixed_hash::construct_fixed_hash! { fixed_hash::construct_fixed_hash! {
/// Hash type used in Millau chain. /// Hash type used in Millau chain.
#[derive(MallocSizeOf)] #[derive(MallocSizeOf, TypeInfo)]
pub struct MillauHash(64); pub struct MillauHash(64);
} }
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
smallvec = "1.6" smallvec = "1.7"
# Bridge Dependencies # Bridge Dependencies
+1 -1
View File
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
smallvec = "1.6" smallvec = "1.7"
# Bridge Dependencies # Bridge Dependencies
bp-messages = { path = "../messages", default-features = false } bp-messages = { path = "../messages", default-features = false }
+3 -1
View File
@@ -8,7 +8,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
smallvec = "1.6" scale-info = { version = "1.0", default-features = false, features = ["derive"] }
smallvec = "1.7"
# Bridge Dependencies # Bridge Dependencies
@@ -34,6 +35,7 @@ std = [
"bp-runtime/std", "bp-runtime/std",
"frame-support/std", "frame-support/std",
"parity-scale-codec/std", "parity-scale-codec/std",
"scale-info/std",
"sp-api/std", "sp-api/std",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std", "sp-std/std",
+6 -29
View File
@@ -21,10 +21,10 @@
#![allow(clippy::unnecessary_mut_passed)] #![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use bp_runtime::Chain;
use frame_support::weights::{ use frame_support::weights::{
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
}; };
use scale_info::TypeInfo;
use sp_std::prelude::*; use sp_std::prelude::*;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
@@ -51,8 +51,6 @@ impl WeightToFeePolynomial for WeightToFee {
} }
} }
pub type UncheckedExtrinsic = bp_polkadot_core::UncheckedExtrinsic<Call>;
// NOTE: This needs to be kept up to date with the Westend runtime found in the Polkadot repo. // NOTE: This needs to be kept up to date with the Westend runtime found in the Polkadot repo.
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: sp_version::create_runtime_str!("westend"), spec_name: sp_version::create_runtime_str!("westend"),
@@ -66,32 +64,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// Westend Runtime `Call` enum. /// Westend Runtime `Call` enum.
/// ///
/// The enum represents a subset of possible `Call`s we can send to Westend chain. /// We are not currently submitting any Westend transactions => it is empty.
/// Ideally this code would be auto-generated from metadata, because we want to #[derive(
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s. parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone, TypeInfo,
/// )]
/// All entries here (like pretty much in the entire file) must be kept in sync with Westend pub enum Call {}
/// `construct_runtime`, so that we maintain SCALE-compatibility.
///
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/westend/src/lib.rs)
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone)]
pub enum Call {
/// Rococo bridge pallet.
#[codec(index = 40)]
BridgeGrandpaRococo(BridgeGrandpaRococoCall),
}
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone)]
#[allow(non_camel_case_types)]
pub enum BridgeGrandpaRococoCall {
#[codec(index = 0)]
submit_finality_proof(
<PolkadotLike as Chain>::Header,
bp_header_chain::justification::GrandpaJustification<<PolkadotLike as Chain>::Header>,
),
#[codec(index = 1)]
initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>),
}
impl sp_runtime::traits::Dispatchable for Call { impl sp_runtime::traits::Dispatchable for Call {
type Origin = (); type Origin = ();
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -20,6 +21,7 @@ default = ["std"]
std = [ std = [
"codec/std", "codec/std",
"frame-support/std", "frame-support/std",
"scale-info/std",
"sp-api/std", "sp-api/std",
"sp-std/std", "sp-std/std",
] ]
@@ -22,6 +22,7 @@
use codec::{Decode, Encode, EncodeLike}; use codec::{Decode, Encode, EncodeLike};
use frame_support::{Parameter, RuntimeDebug}; use frame_support::{Parameter, RuntimeDebug};
use scale_info::TypeInfo;
use sp_api::decl_runtime_apis; use sp_api::decl_runtime_apis;
use sp_std::marker::PhantomData; use sp_std::marker::PhantomData;
@@ -48,7 +49,7 @@ pub enum Error {
pub type Result<T> = sp_std::result::Result<T, Error>; pub type Result<T> = sp_std::result::Result<T, Error>;
/// Peer blockchain lock funds transaction. /// Peer blockchain lock funds transaction.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct LockFundsTransaction<TransferId, Recipient, Amount> { pub struct LockFundsTransaction<TransferId, Recipient, Amount> {
/// Something that uniquely identifies this transfer. /// Something that uniquely identifies this transfer.
pub id: TransferId, pub id: TransferId,
@@ -63,7 +64,7 @@ pub trait MaybeLockFundsTransaction {
/// Transaction type. /// Transaction type.
type Transaction; type Transaction;
/// Identifier that uniquely identifies this transfer. /// Identifier that uniquely identifies this transfer.
type Id: Decode + Encode + EncodeLike + sp_std::fmt::Debug; type Id: Decode + Encode + TypeInfo + EncodeLike + sp_std::fmt::Debug;
/// Peer recipient type. /// Peer recipient type.
type Recipient; type Recipient;
/// Peer currency amount type. /// Peer currency amount type.
@@ -18,6 +18,7 @@ parity-bytes = { version = "0.1", default-features = false }
plain_hasher = { version = "0.2.2", default-features = false } plain_hasher = { version = "0.2.2", default-features = false }
primitive-types = { version = "0.10", default-features = false, features = ["codec", "rlp"] } primitive-types = { version = "0.10", default-features = false, features = ["codec", "rlp"] }
rlp = { version = "0.5", default-features = false } rlp = { version = "0.5", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
serde-big-array = { version = "0.2", optional = true } serde-big-array = { version = "0.2", optional = true }
triehash = { version = "0.8.2", default-features = false } triehash = { version = "0.8.2", default-features = false }
@@ -47,6 +48,7 @@ std = [
"primitive-types/std", "primitive-types/std",
"primitive-types/serde", "primitive-types/serde",
"rlp/std", "rlp/std",
"scale-info/std",
"serde/std", "serde/std",
"serde-big-array", "serde-big-array",
"sp-api/std", "sp-api/std",
+7 -6
View File
@@ -28,6 +28,7 @@ use codec::{Decode, Encode};
use ethbloom::{Bloom as EthBloom, Input as BloomInput}; use ethbloom::{Bloom as EthBloom, Input as BloomInput};
use fixed_hash::construct_fixed_hash; use fixed_hash::construct_fixed_hash;
use rlp::{Decodable, DecoderError, Rlp, RlpStream}; use rlp::{Decodable, DecoderError, Rlp, RlpStream};
use scale_info::TypeInfo;
use sp_io::hashing::keccak_256; use sp_io::hashing::keccak_256;
use sp_runtime::RuntimeDebug; use sp_runtime::RuntimeDebug;
use sp_std::prelude::*; use sp_std::prelude::*;
@@ -57,7 +58,7 @@ pub type Address = H160;
pub mod signatures; pub mod signatures;
/// Complete header id. /// Complete header id.
#[derive(Encode, Decode, Default, RuntimeDebug, PartialEq, Clone, Copy)] #[derive(Encode, Decode, Default, RuntimeDebug, PartialEq, Clone, Copy, TypeInfo)]
pub struct HeaderId { pub struct HeaderId {
/// Header number. /// Header number.
pub number: u64, pub number: u64,
@@ -66,7 +67,7 @@ pub struct HeaderId {
} }
/// An Aura header. /// An Aura header.
#[derive(Clone, Default, Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Clone, Default, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct AuraHeader { pub struct AuraHeader {
/// Parent block hash. /// Parent block hash.
@@ -129,7 +130,7 @@ pub struct UnsignedTransaction {
} }
/// Information describing execution of a transaction. /// Information describing execution of a transaction.
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
pub struct Receipt { pub struct Receipt {
/// The total gas used in the block following execution of the transaction. /// The total gas used in the block following execution of the transaction.
pub gas_used: U256, pub gas_used: U256,
@@ -142,7 +143,7 @@ pub struct Receipt {
} }
/// Transaction outcome store in the receipt. /// Transaction outcome store in the receipt.
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
pub enum TransactionOutcome { pub enum TransactionOutcome {
/// Status and state root are unknown under EIP-98 rules. /// Status and state root are unknown under EIP-98 rules.
Unknown, Unknown,
@@ -153,7 +154,7 @@ pub enum TransactionOutcome {
} }
/// A record of execution for a `LOG` operation. /// A record of execution for a `LOG` operation.
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug)] #[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
pub struct LogEntry { pub struct LogEntry {
/// The address of the contract executing at the point of the `LOG` operation. /// The address of the contract executing at the point of the `LOG` operation.
pub address: Address, pub address: Address,
@@ -164,7 +165,7 @@ pub struct LogEntry {
} }
/// Logs bloom. /// Logs bloom.
#[derive(Clone, Encode, Decode)] #[derive(Clone, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Bloom(#[cfg_attr(feature = "std", serde(with = "BigArray"))] [u8; 256]); pub struct Bloom(#[cfg_attr(feature = "std", serde(with = "BigArray"))] [u8; 256]);
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
finality-grandpa = { version = "0.14.0", default-features = false } finality-grandpa = { version = "0.14.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Substrate Dependencies # Substrate Dependencies
@@ -30,6 +31,7 @@ std = [
"finality-grandpa/std", "finality-grandpa/std",
"serde/std", "serde/std",
"frame-support/std", "frame-support/std",
"scale-info/std",
"sp-core/std", "sp-core/std",
"sp-finality-grandpa/std", "sp-finality-grandpa/std",
"sp-runtime/std", "sp-runtime/std",
@@ -22,6 +22,7 @@
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use finality_grandpa::voter_set::VoterSet; use finality_grandpa::voter_set::VoterSet;
use frame_support::RuntimeDebug; use frame_support::RuntimeDebug;
use scale_info::TypeInfo;
use sp_finality_grandpa::{AuthorityId, AuthoritySignature, SetId}; use sp_finality_grandpa::{AuthorityId, AuthoritySignature, SetId};
use sp_runtime::traits::Header as HeaderT; use sp_runtime::traits::Header as HeaderT;
use sp_std::{ use sp_std::{
@@ -34,7 +35,7 @@ use sp_std::{
/// ///
/// This particular proof is used to prove that headers on a bridged chain /// This particular proof is used to prove that headers on a bridged chain
/// (so not our chain) have been finalized correctly. /// (so not our chain) have been finalized correctly.
#[derive(Encode, Decode, RuntimeDebug, Clone, PartialEq, Eq)] #[derive(Encode, Decode, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)]
pub struct GrandpaJustification<Header: HeaderT> { pub struct GrandpaJustification<Header: HeaderT> {
/// The round (voting period) this justification is valid for. /// The round (voting period) this justification is valid for.
pub round: u64, pub round: u64,
+5 -4
View File
@@ -21,6 +21,7 @@
use codec::{Codec, Decode, Encode, EncodeLike}; use codec::{Codec, Decode, Encode, EncodeLike};
use core::{clone::Clone, cmp::Eq, default::Default, fmt::Debug}; use core::{clone::Clone, cmp::Eq, default::Default, fmt::Debug};
use scale_info::TypeInfo;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sp_finality_grandpa::{AuthorityList, ConsensusLog, SetId, GRANDPA_ENGINE_ID}; use sp_finality_grandpa::{AuthorityList, ConsensusLog, SetId, GRANDPA_ENGINE_ID};
@@ -32,11 +33,11 @@ pub mod justification;
/// A type that can be used as a parameter in a dispatchable function. /// A type that can be used as a parameter in a dispatchable function.
/// ///
/// When using `decl_module` all arguments for call functions must implement this trait. /// When using `decl_module` all arguments for call functions must implement this trait.
pub trait Parameter: Codec + EncodeLike + Clone + Eq + Debug {} pub trait Parameter: Codec + EncodeLike + Clone + Eq + Debug + TypeInfo {}
impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + Debug {} impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + Debug + TypeInfo {}
/// A GRANDPA Authority List and ID. /// A GRANDPA Authority List and ID.
#[derive(Default, Encode, Decode, RuntimeDebug, PartialEq, Clone)] #[derive(Default, Encode, Decode, RuntimeDebug, PartialEq, Clone, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct AuthoritySet { pub struct AuthoritySet {
/// List of GRANDPA authorities for the current round. /// List of GRANDPA authorities for the current round.
@@ -55,7 +56,7 @@ impl AuthoritySet {
/// Data required for initializing the bridge pallet. /// Data required for initializing the bridge pallet.
/// ///
/// The bridge needs to know where to start its sync from, and this provides that initial context. /// The bridge needs to know where to start its sync from, and this provides that initial context.
#[derive(Default, Encode, Decode, RuntimeDebug, PartialEq, Eq, Clone)] #[derive(Default, Encode, Decode, RuntimeDebug, PartialEq, Eq, Clone, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct InitializationData<H: HeaderT> { pub struct InitializationData<H: HeaderT> {
/// The header from which we should start syncing. /// The header from which we should start syncing.
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
bp-runtime = { path = "../runtime", default-features = false } bp-runtime = { path = "../runtime", default-features = false }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -21,5 +22,6 @@ std = [
"bp-runtime/std", "bp-runtime/std",
"codec/std", "codec/std",
"frame-support/std", "frame-support/std",
"scale-info/std",
"sp-std/std", "sp-std/std",
] ]
@@ -25,6 +25,7 @@ use bp_runtime::{
}; };
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::RuntimeDebug; use frame_support::RuntimeDebug;
use scale_info::TypeInfo;
use sp_std::prelude::*; use sp_std::prelude::*;
/// Message dispatch weight. /// Message dispatch weight.
@@ -71,7 +72,7 @@ pub trait MessageDispatch<AccountId, BridgeMessageId> {
/// The source chain can (and should) verify that the message can be dispatched on the target chain /// The source chain can (and should) verify that the message can be dispatched on the target chain
/// with a particular origin given the source chain's origin. This can be done with the /// with a particular origin given the source chain's origin. This can be done with the
/// `verify_message_origin()` function. /// `verify_message_origin()` function.
#[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq)] #[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
pub enum CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainSignature> { pub enum CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainSignature> {
/// Call is sent by the Root origin on the source chain. On the target chain it is dispatched /// Call is sent by the Root origin on the source chain. On the target chain it is dispatched
/// from a derived account. /// from a derived account.
@@ -111,7 +112,7 @@ pub enum CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainS
} }
/// Message payload type used by dispatch module. /// Message payload type used by dispatch module.
#[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq)] #[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
pub struct MessagePayload< pub struct MessagePayload<
SourceChainAccountId, SourceChainAccountId,
TargetChainAccountPublic, TargetChainAccountPublic,
+2
View File
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
bitvec = { version = "0.20", default-features = false, features = ["alloc"] } bitvec = { version = "0.20", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive", "bit-vec"] } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive", "bit-vec"] }
impl-trait-for-tuples = "0.2" impl-trait-for-tuples = "0.2"
scale-info = { version = "1.0", default-features = false, features = ["bit-vec", "derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -29,6 +30,7 @@ std = [
"codec/std", "codec/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"scale-info/std",
"serde", "serde",
"sp-std/std" "sp-std/std"
] ]
+10 -9
View File
@@ -26,6 +26,7 @@ use bitvec::prelude::*;
use bp_runtime::messages::DispatchFeePayment; use bp_runtime::messages::DispatchFeePayment;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::RuntimeDebug; use frame_support::RuntimeDebug;
use scale_info::TypeInfo;
use sp_std::{collections::vec_deque::VecDeque, prelude::*}; use sp_std::{collections::vec_deque::VecDeque, prelude::*};
pub mod source_chain; pub mod source_chain;
@@ -35,7 +36,7 @@ pub mod target_chain;
pub use frame_support::weights::Weight; pub use frame_support::weights::Weight;
/// Messages pallet operating mode. /// Messages pallet operating mode.
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum OperatingMode { pub enum OperatingMode {
/// Normal mode, when all operations are allowed. /// Normal mode, when all operations are allowed.
@@ -81,7 +82,7 @@ pub type BridgeMessageId = (LaneId, MessageNonce);
pub type MessagePayload = Vec<u8>; pub type MessagePayload = Vec<u8>;
/// Message key (unique message identifier) as it is stored in the storage. /// Message key (unique message identifier) as it is stored in the storage.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct MessageKey { pub struct MessageKey {
/// ID of the message lane. /// ID of the message lane.
pub lane_id: LaneId, pub lane_id: LaneId,
@@ -90,7 +91,7 @@ pub struct MessageKey {
} }
/// Message data as it is stored in the storage. /// Message data as it is stored in the storage.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct MessageData<Fee> { pub struct MessageData<Fee> {
/// Message payload. /// Message payload.
pub payload: MessagePayload, pub payload: MessagePayload,
@@ -99,7 +100,7 @@ pub struct MessageData<Fee> {
} }
/// Message as it is stored in the storage. /// Message as it is stored in the storage.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct Message<Fee> { pub struct Message<Fee> {
/// Message key. /// Message key.
pub key: MessageKey, pub key: MessageKey,
@@ -108,7 +109,7 @@ pub struct Message<Fee> {
} }
/// Inbound lane data. /// Inbound lane data.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct InboundLaneData<RelayerId> { pub struct InboundLaneData<RelayerId> {
/// Identifiers of relayers and messages that they have delivered to this lane (ordered by /// Identifiers of relayers and messages that they have delivered to this lane (ordered by
/// message nonce). /// message nonce).
@@ -198,7 +199,7 @@ pub type DispatchResultsBitVec = BitVec<Msb0, u8>;
/// ///
/// This struct represents a continuous range of messages that have been delivered by the same /// This struct represents a continuous range of messages that have been delivered by the same
/// relayer and whose confirmations are still pending. /// relayer and whose confirmations are still pending.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct UnrewardedRelayer<RelayerId> { pub struct UnrewardedRelayer<RelayerId> {
/// Identifier of the relayer. /// Identifier of the relayer.
pub relayer: RelayerId, pub relayer: RelayerId,
@@ -207,7 +208,7 @@ pub struct UnrewardedRelayer<RelayerId> {
} }
/// Delivered messages with their dispatch result. /// Delivered messages with their dispatch result.
#[derive(Clone, Default, Encode, Decode, RuntimeDebug, PartialEq, Eq)] #[derive(Clone, Default, Encode, Decode, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct DeliveredMessages { pub struct DeliveredMessages {
/// Nonce of the first message that has been delivered (inclusive). /// Nonce of the first message that has been delivered (inclusive).
pub begin: MessageNonce, pub begin: MessageNonce,
@@ -267,7 +268,7 @@ impl DeliveredMessages {
} }
/// Gist of `InboundLaneData::relayers` field used by runtime APIs. /// Gist of `InboundLaneData::relayers` field used by runtime APIs.
#[derive(Clone, Default, Encode, Decode, RuntimeDebug, PartialEq, Eq)] #[derive(Clone, Default, Encode, Decode, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct UnrewardedRelayersState { pub struct UnrewardedRelayersState {
/// Number of entries in the `InboundLaneData::relayers` set. /// Number of entries in the `InboundLaneData::relayers` set.
pub unrewarded_relayer_entries: MessageNonce, pub unrewarded_relayer_entries: MessageNonce,
@@ -279,7 +280,7 @@ pub struct UnrewardedRelayersState {
} }
/// Outbound lane data. /// Outbound lane data.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct OutboundLaneData { pub struct OutboundLaneData {
/// Nonce of the oldest message that we haven't yet pruned. May point to not-yet-generated /// Nonce of the oldest message that we haven't yet pruned. May point to not-yet-generated
/// message if all sent messages are already pruned. /// message if all sent messages are already pruned.
@@ -21,13 +21,14 @@ use crate::{LaneId, Message, MessageData, MessageKey, OutboundLaneData};
use bp_runtime::{messages::MessageDispatchResult, Size}; use bp_runtime::{messages::MessageDispatchResult, Size};
use codec::{Decode, Encode, Error as CodecError}; use codec::{Decode, Encode, Error as CodecError};
use frame_support::{weights::Weight, Parameter, RuntimeDebug}; use frame_support::{weights::Weight, Parameter, RuntimeDebug};
use scale_info::TypeInfo;
use sp_std::{collections::btree_map::BTreeMap, fmt::Debug, prelude::*}; use sp_std::{collections::btree_map::BTreeMap, fmt::Debug, prelude::*};
/// Proved messages from the source chain. /// Proved messages from the source chain.
pub type ProvedMessages<Message> = BTreeMap<LaneId, ProvedLaneMessages<Message>>; pub type ProvedMessages<Message> = BTreeMap<LaneId, ProvedLaneMessages<Message>>;
/// Proved messages from single lane of the source chain. /// Proved messages from single lane of the source chain.
#[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq)] #[derive(RuntimeDebug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
pub struct ProvedLaneMessages<Message> { pub struct ProvedLaneMessages<Message> {
/// Optional outbound lane state. /// Optional outbound lane state.
pub lane_state: Option<OutboundLaneData>, pub lane_state: Option<OutboundLaneData>,
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Bridge Dependencies # Bridge Dependencies
@@ -35,6 +36,7 @@ std = [
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"parity-scale-codec/std", "parity-scale-codec/std",
"scale-info/std",
"sp-api/std", "sp-api/std",
"sp-core/std", "sp-core/std",
"sp-runtime/std", "sp-runtime/std",
+10 -2
View File
@@ -29,6 +29,7 @@ use frame_support::{
}; };
use frame_system::limits; use frame_system::limits;
use parity_scale_codec::Compact; use parity_scale_codec::Compact;
use scale_info::{StaticTypeInfo, TypeInfo};
use sp_core::Hasher as HasherT; use sp_core::Hasher as HasherT;
use sp_runtime::{ use sp_runtime::{
generic, generic,
@@ -255,7 +256,7 @@ pub type AdditionalSigned = (u32, u32, Hash, Hash, (), (), ());
/// A simplified version of signed extensions meant for producing signed transactions /// A simplified version of signed extensions meant for producing signed transactions
/// and signed payload in the client code. /// and signed payload in the client code.
#[derive(PartialEq, Eq, Clone, RuntimeDebug)] #[derive(PartialEq, Eq, Clone, RuntimeDebug, TypeInfo)]
pub struct SignedExtensions<Call> { pub struct SignedExtensions<Call> {
encode_payload: SignedExtra, encode_payload: SignedExtra,
additional_signed: AdditionalSigned, additional_signed: AdditionalSigned,
@@ -322,7 +323,14 @@ impl<Call> SignedExtensions<Call> {
impl<Call> sp_runtime::traits::SignedExtension for SignedExtensions<Call> impl<Call> sp_runtime::traits::SignedExtension for SignedExtensions<Call>
where where
Call: parity_scale_codec::Codec + sp_std::fmt::Debug + Sync + Send + Clone + Eq + PartialEq, Call: parity_scale_codec::Codec
+ sp_std::fmt::Debug
+ Sync
+ Send
+ Clone
+ Eq
+ PartialEq
+ StaticTypeInfo,
Call: Dispatchable, Call: Dispatchable,
{ {
const IDENTIFIER: &'static str = "Not needed."; const IDENTIFIER: &'static str = "Not needed.";
+2
View File
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
hash-db = { version = "0.15.2", default-features = false } hash-db = { version = "0.15.2", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -28,6 +29,7 @@ std = [
"frame-support/std", "frame-support/std",
"hash-db/std", "hash-db/std",
"num-traits/std", "num-traits/std",
"scale-info/std",
"sp-core/std", "sp-core/std",
"sp-io/std", "sp-io/std",
"sp-runtime/std", "sp-runtime/std",
+3 -2
View File
@@ -18,9 +18,10 @@
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::{weights::Weight, RuntimeDebug}; use frame_support::{weights::Weight, RuntimeDebug};
use scale_info::TypeInfo;
/// Where message dispatch fee is paid? /// Where message dispatch fee is paid?
#[derive(Encode, Decode, RuntimeDebug, Clone, Copy, PartialEq, Eq)] #[derive(Encode, Decode, RuntimeDebug, Clone, Copy, PartialEq, Eq, TypeInfo)]
pub enum DispatchFeePayment { pub enum DispatchFeePayment {
/// The dispatch fee is paid at the source chain. /// The dispatch fee is paid at the source chain.
AtSourceChain, AtSourceChain,
@@ -34,7 +35,7 @@ pub enum DispatchFeePayment {
} }
/// Message dispatch result. /// Message dispatch result.
#[derive(Encode, Decode, RuntimeDebug, Clone, PartialEq, Eq)] #[derive(Encode, Decode, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)]
pub struct MessageDispatchResult { pub struct MessageDispatchResult {
/// Dispatch result flag. This flag is relayed back to the source chain and, generally /// Dispatch result flag. This flag is relayed back to the source chain and, generally
/// speaking, may bring any (that fits in single bit) information from the dispatcher at /// speaking, may bring any (that fits in single bit) information from the dispatcher at
+2
View File
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -20,6 +21,7 @@ default = ["std"]
std = [ std = [
"codec/std", "codec/std",
"frame-support/std", "frame-support/std",
"scale-info/std",
"sp-core/std", "sp-core/std",
"sp-std/std", "sp-std/std",
] ]
+5 -4
View File
@@ -18,11 +18,12 @@
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::{weights::Weight, RuntimeDebug}; use frame_support::{weights::Weight, RuntimeDebug};
use scale_info::TypeInfo;
use sp_core::U256; use sp_core::U256;
use sp_std::vec::Vec; use sp_std::vec::Vec;
/// Pending token swap state. /// Pending token swap state.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub enum TokenSwapState { pub enum TokenSwapState {
/// The swap has been started using the `start_claim` call, but we have no proof that it has /// The swap has been started using the `start_claim` call, but we have no proof that it has
/// happened at the Bridged chain. /// happened at the Bridged chain.
@@ -39,7 +40,7 @@ pub enum TokenSwapState {
/// ///
/// Different swap types give a different guarantees regarding possible swap /// Different swap types give a different guarantees regarding possible swap
/// replay protection. /// replay protection.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub enum TokenSwapType<ThisBlockNumber> { pub enum TokenSwapType<ThisBlockNumber> {
/// The `target_account_at_bridged_chain` is temporary and only have funds for single swap. /// The `target_account_at_bridged_chain` is temporary and only have funds for single swap.
/// ///
@@ -68,7 +69,7 @@ pub enum TokenSwapType<ThisBlockNumber> {
/// when chain changes, the meaning of This and Bridged are still used to point to the same chains. /// when chain changes, the meaning of This and Bridged are still used to point to the same chains.
/// This chain is always the chain where swap has been started. And the Bridged chain is the other /// This chain is always the chain where swap has been started. And the Bridged chain is the other
/// chain. /// chain.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct TokenSwap<ThisBlockNumber, ThisBalance, ThisAccountId, BridgedBalance, BridgedAccountId> pub struct TokenSwap<ThisBlockNumber, ThisBalance, ThisAccountId, BridgedBalance, BridgedAccountId>
{ {
/// The type of the swap. /// The type of the swap.
@@ -88,7 +89,7 @@ pub struct TokenSwap<ThisBlockNumber, ThisBalance, ThisAccountId, BridgedBalance
pub type RawBridgedTransferCall = Vec<u8>; pub type RawBridgedTransferCall = Vec<u8>;
/// Token swap creation parameters. /// Token swap creation parameters.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
pub struct TokenSwapCreation<BridgedAccountPublic, ThisChainBalance, BridgedAccountSignature> { pub struct TokenSwapCreation<BridgedAccountPublic, ThisChainBalance, BridgedAccountSignature> {
/// Public key of the `target_account_at_bridged_chain` account used to verify /// Public key of the `target_account_at_bridged_chain` account used to verify
/// `bridged_currency_transfer_signature`. /// `bridged_currency_transfer_signature`.
+16 -16
View File
@@ -50,8 +50,8 @@ pub struct RialtoPoA;
impl BridgeInstance for RialtoPoA { impl BridgeInstance for RialtoPoA {
fn build_signed_header_call(&self, headers: Vec<QueuedEthereumHeader>) -> Call { fn build_signed_header_call(&self, headers: Vec<QueuedEthereumHeader>) -> Call {
let pallet_call = rialto_runtime::BridgeEthPoACall::import_signed_headers( let pallet_call = rialto_runtime::BridgeEthPoACall::import_signed_headers {
headers headers_with_receipts: headers
.into_iter() .into_iter()
.map(|header| { .map(|header| {
( (
@@ -60,23 +60,23 @@ impl BridgeInstance for RialtoPoA {
) )
}) })
.collect(), .collect(),
); };
rialto_runtime::Call::BridgeRialtoPoa(pallet_call) rialto_runtime::Call::BridgeRialtoPoa(pallet_call)
} }
fn build_unsigned_header_call(&self, header: QueuedEthereumHeader) -> Call { fn build_unsigned_header_call(&self, header: QueuedEthereumHeader) -> Call {
let pallet_call = rialto_runtime::BridgeEthPoACall::import_unsigned_header( let pallet_call = rialto_runtime::BridgeEthPoACall::import_unsigned_header {
Box::new(into_substrate_ethereum_header(header.header())), header: Box::new(into_substrate_ethereum_header(header.header())),
into_substrate_ethereum_receipts(header.extra()), receipts: into_substrate_ethereum_receipts(header.extra()),
); };
rialto_runtime::Call::BridgeRialtoPoa(pallet_call) rialto_runtime::Call::BridgeRialtoPoa(pallet_call)
} }
fn build_currency_exchange_call(&self, proof: Proof) -> Call { fn build_currency_exchange_call(&self, proof: Proof) -> Call {
let pallet_call = let pallet_call =
rialto_runtime::BridgeCurrencyExchangeCall::import_peer_transaction(proof); rialto_runtime::BridgeCurrencyExchangeCall::import_peer_transaction { proof };
rialto_runtime::Call::BridgeRialtoCurrencyExchange(pallet_call) rialto_runtime::Call::BridgeRialtoCurrencyExchange(pallet_call)
} }
} }
@@ -87,8 +87,8 @@ pub struct Kovan;
impl BridgeInstance for Kovan { impl BridgeInstance for Kovan {
fn build_signed_header_call(&self, headers: Vec<QueuedEthereumHeader>) -> Call { fn build_signed_header_call(&self, headers: Vec<QueuedEthereumHeader>) -> Call {
let pallet_call = rialto_runtime::BridgeEthPoACall::import_signed_headers( let pallet_call = rialto_runtime::BridgeEthPoACall::import_signed_headers {
headers headers_with_receipts: headers
.into_iter() .into_iter()
.map(|header| { .map(|header| {
( (
@@ -97,23 +97,23 @@ impl BridgeInstance for Kovan {
) )
}) })
.collect(), .collect(),
); };
rialto_runtime::Call::BridgeKovan(pallet_call) rialto_runtime::Call::BridgeKovan(pallet_call)
} }
fn build_unsigned_header_call(&self, header: QueuedEthereumHeader) -> Call { fn build_unsigned_header_call(&self, header: QueuedEthereumHeader) -> Call {
let pallet_call = rialto_runtime::BridgeEthPoACall::import_unsigned_header( let pallet_call = rialto_runtime::BridgeEthPoACall::import_unsigned_header {
Box::new(into_substrate_ethereum_header(header.header())), header: Box::new(into_substrate_ethereum_header(header.header())),
into_substrate_ethereum_receipts(header.extra()), receipts: into_substrate_ethereum_receipts(header.extra()),
); };
rialto_runtime::Call::BridgeKovan(pallet_call) rialto_runtime::Call::BridgeKovan(pallet_call)
} }
fn build_currency_exchange_call(&self, proof: Proof) -> Call { fn build_currency_exchange_call(&self, proof: Proof) -> Call {
let pallet_call = let pallet_call =
rialto_runtime::BridgeCurrencyExchangeCall::import_peer_transaction(proof); rialto_runtime::BridgeCurrencyExchangeCall::import_peer_transaction { proof };
rialto_runtime::Call::BridgeKovanCurrencyExchange(pallet_call) rialto_runtime::Call::BridgeKovanCurrencyExchange(pallet_call)
} }
} }
@@ -39,18 +39,24 @@ impl CliEncodeCall for Millau {
Ok(match call { Ok(match call {
Call::Raw { data } => Decode::decode(&mut &*data.0)?, Call::Raw { data } => Decode::decode(&mut &*data.0)?,
Call::Remark { remark_payload, .. } => Call::Remark { remark_payload, .. } =>
millau_runtime::Call::System(millau_runtime::SystemCall::remark( millau_runtime::Call::System(millau_runtime::SystemCall::remark {
remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), remark: remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(),
)), }),
Call::Transfer { recipient, amount } => millau_runtime::Call::Balances( Call::Transfer { recipient, amount } =>
millau_runtime::BalancesCall::transfer(recipient.raw_id(), amount.cast()), millau_runtime::Call::Balances(millau_runtime::BalancesCall::transfer {
), dest: recipient.raw_id(),
value: amount.cast(),
}),
Call::BridgeSendMessage { lane, payload, fee, bridge_instance_index } => Call::BridgeSendMessage { lane, payload, fee, bridge_instance_index } =>
match *bridge_instance_index { match *bridge_instance_index {
bridge::MILLAU_TO_RIALTO_INDEX => { bridge::MILLAU_TO_RIALTO_INDEX => {
let payload = Decode::decode(&mut &*payload.0)?; let payload = Decode::decode(&mut &*payload.0)?;
millau_runtime::Call::BridgeRialtoMessages( millau_runtime::Call::BridgeRialtoMessages(
millau_runtime::MessagesCall::send_message(lane.0, payload, fee.cast()), millau_runtime::MessagesCall::send_message {
lane_id: lane.0,
payload,
delivery_and_dispatch_fee: fee.cast(),
},
) )
}, },
_ => anyhow::bail!( _ => anyhow::bail!(
@@ -61,10 +61,10 @@ impl SubstrateFinalitySyncPipeline for MillauFinalityToRialto {
header: MillauSyncHeader, header: MillauSyncHeader,
proof: GrandpaJustification<bp_millau::Header>, proof: GrandpaJustification<bp_millau::Header>,
) -> Bytes { ) -> Bytes {
let call = rialto_runtime::BridgeGrandpaMillauCall::submit_finality_proof( let call = rialto_runtime::BridgeGrandpaMillauCall::submit_finality_proof {
Box::new(header.into_inner()), finality_target: Box::new(header.into_inner()),
proof, justification: proof,
) }
.into(); .into();
let genesis_hash = *self.finality_pipeline.target_client.genesis_hash(); let genesis_hash = *self.finality_pipeline.target_client.genesis_hash();
@@ -95,7 +95,7 @@ impl SubstrateMessageLane for MillauMessagesToRialto {
) -> Bytes { ) -> Bytes {
let (relayers_state, proof) = proof; let (relayers_state, proof) = proof;
let call: millau_runtime::Call = let call: millau_runtime::Call =
millau_runtime::MessagesCall::receive_messages_delivery_proof(proof, relayers_state) millau_runtime::MessagesCall::receive_messages_delivery_proof { proof, relayers_state }
.into(); .into();
let call_weight = call.get_dispatch_info().weight; let call_weight = call.get_dispatch_info().weight;
let genesis_hash = *self.message_lane.source_client.genesis_hash(); let genesis_hash = *self.message_lane.source_client.genesis_hash();
@@ -130,12 +130,12 @@ impl SubstrateMessageLane for MillauMessagesToRialto {
let (dispatch_weight, proof) = proof; let (dispatch_weight, proof) = proof;
let FromBridgedChainMessagesProof { ref nonces_start, ref nonces_end, .. } = proof; let FromBridgedChainMessagesProof { ref nonces_start, ref nonces_end, .. } = proof;
let messages_count = nonces_end - nonces_start + 1; let messages_count = nonces_end - nonces_start + 1;
let call: rialto_runtime::Call = rialto_runtime::MessagesCall::receive_messages_proof( let call: rialto_runtime::Call = rialto_runtime::MessagesCall::receive_messages_proof {
self.message_lane.relayer_id_at_source.clone(), relayer_id_at_bridged_chain: self.message_lane.relayer_id_at_source.clone(),
proof, proof,
messages_count as _, messages_count: messages_count as _,
dispatch_weight, dispatch_weight,
) }
.into(); .into();
let call_weight = call.get_dispatch_info().weight; let call_weight = call.get_dispatch_info().weight;
let genesis_hash = *self.message_lane.target_client.genesis_hash(); let genesis_hash = *self.message_lane.target_client.genesis_hash();
@@ -290,11 +290,11 @@ pub(crate) async fn update_rialto_to_millau_conversion_rate(
&signer, &signer,
relay_substrate_client::TransactionEra::immortal(), relay_substrate_client::TransactionEra::immortal(),
UnsignedTransaction::new( UnsignedTransaction::new(
millau_runtime::MessagesCall::update_pallet_parameter( millau_runtime::MessagesCall::update_pallet_parameter {
millau_runtime::rialto_messages::MillauToRialtoMessagesParameter::RialtoToMillauConversionRate( parameter: millau_runtime::rialto_messages::MillauToRialtoMessagesParameter::RialtoToMillauConversionRate(
sp_runtime::FixedU128::from_float(updated_rate), sp_runtime::FixedU128::from_float(updated_rate),
), ),
) }
.into(), .into(),
transaction_nonce, transaction_nonce,
), ),
+24 -16
View File
@@ -82,7 +82,8 @@ mod tests {
fn millau_signature_is_valid_on_rialto() { fn millau_signature_is_valid_on_rialto() {
let millau_sign = relay_millau_client::SigningParams::from_string("//Dave", None).unwrap(); let millau_sign = relay_millau_client::SigningParams::from_string("//Dave", None).unwrap();
let call = rialto_runtime::Call::System(rialto_runtime::SystemCall::remark(vec![])); let call =
rialto_runtime::Call::System(rialto_runtime::SystemCall::remark { remark: vec![] });
let millau_public: bp_millau::AccountSigner = millau_sign.public().into(); let millau_public: bp_millau::AccountSigner = millau_sign.public().into();
let millau_account_id: bp_millau::AccountId = millau_public.into_account(); let millau_account_id: bp_millau::AccountId = millau_public.into_account();
@@ -104,7 +105,8 @@ mod tests {
fn rialto_signature_is_valid_on_millau() { fn rialto_signature_is_valid_on_millau() {
let rialto_sign = relay_rialto_client::SigningParams::from_string("//Dave", None).unwrap(); let rialto_sign = relay_rialto_client::SigningParams::from_string("//Dave", None).unwrap();
let call = millau_runtime::Call::System(millau_runtime::SystemCall::remark(vec![])); let call =
millau_runtime::Call::System(millau_runtime::SystemCall::remark { remark: vec![] });
let rialto_public: bp_rialto::AccountSigner = rialto_sign.public().into(); let rialto_public: bp_rialto::AccountSigner = rialto_sign.public().into();
let rialto_account_id: bp_rialto::AccountId = rialto_public.into_account(); let rialto_account_id: bp_rialto::AccountId = rialto_public.into_account();
@@ -132,7 +134,8 @@ mod tests {
); );
let call: millau_runtime::Call = let call: millau_runtime::Call =
millau_runtime::SystemCall::remark(vec![42; maximal_remark_size as _]).into(); millau_runtime::SystemCall::remark { remark: vec![42; maximal_remark_size as _] }
.into();
let payload = send_message::message_payload( let payload = send_message::message_payload(
Default::default(), Default::default(),
call.get_dispatch_info().weight, call.get_dispatch_info().weight,
@@ -143,7 +146,8 @@ mod tests {
assert_eq!(Millau::verify_message(&payload), Ok(())); assert_eq!(Millau::verify_message(&payload), Ok(()));
let call: millau_runtime::Call = let call: millau_runtime::Call =
millau_runtime::SystemCall::remark(vec![42; (maximal_remark_size + 1) as _]).into(); millau_runtime::SystemCall::remark { remark: vec![42; (maximal_remark_size + 1) as _] }
.into();
let payload = send_message::message_payload( let payload = send_message::message_payload(
Default::default(), Default::default(),
call.get_dispatch_info().weight, call.get_dispatch_info().weight,
@@ -171,7 +175,8 @@ mod tests {
let maximal_dispatch_weight = send_message::compute_maximal_message_dispatch_weight( let maximal_dispatch_weight = send_message::compute_maximal_message_dispatch_weight(
bp_millau::max_extrinsic_weight(), bp_millau::max_extrinsic_weight(),
); );
let call: millau_runtime::Call = rialto_runtime::SystemCall::remark(vec![]).into(); let call: millau_runtime::Call =
rialto_runtime::SystemCall::remark { remark: vec![] }.into();
let payload = send_message::message_payload( let payload = send_message::message_payload(
Default::default(), Default::default(),
@@ -199,7 +204,8 @@ mod tests {
let maximal_dispatch_weight = send_message::compute_maximal_message_dispatch_weight( let maximal_dispatch_weight = send_message::compute_maximal_message_dispatch_weight(
bp_rialto::max_extrinsic_weight(), bp_rialto::max_extrinsic_weight(),
); );
let call: rialto_runtime::Call = millau_runtime::SystemCall::remark(vec![]).into(); let call: rialto_runtime::Call =
millau_runtime::SystemCall::remark { remark: vec![] }.into();
let payload = send_message::message_payload( let payload = send_message::message_payload(
Default::default(), Default::default(),
@@ -222,7 +228,8 @@ mod tests {
#[test] #[test]
fn rialto_tx_extra_bytes_constant_is_correct() { fn rialto_tx_extra_bytes_constant_is_correct() {
let rialto_call = rialto_runtime::Call::System(rialto_runtime::SystemCall::remark(vec![])); let rialto_call =
rialto_runtime::Call::System(rialto_runtime::SystemCall::remark { remark: vec![] });
let rialto_tx = Rialto::sign_transaction( let rialto_tx = Rialto::sign_transaction(
Default::default(), Default::default(),
&sp_keyring::AccountKeyring::Alice.pair(), &sp_keyring::AccountKeyring::Alice.pair(),
@@ -240,7 +247,8 @@ mod tests {
#[test] #[test]
fn millau_tx_extra_bytes_constant_is_correct() { fn millau_tx_extra_bytes_constant_is_correct() {
let millau_call = millau_runtime::Call::System(millau_runtime::SystemCall::remark(vec![])); let millau_call =
millau_runtime::Call::System(millau_runtime::SystemCall::remark { remark: vec![] });
let millau_tx = Millau::sign_transaction( let millau_tx = Millau::sign_transaction(
Default::default(), Default::default(),
&sp_keyring::AccountKeyring::Alice.pair(), &sp_keyring::AccountKeyring::Alice.pair(),
@@ -288,10 +296,10 @@ mod rococo_tests {
justification.clone(), justification.clone(),
); );
let expected = let expected =
millau_runtime::BridgeGrandpaCall::<millau_runtime::Runtime>::submit_finality_proof( millau_runtime::BridgeGrandpaCall::<millau_runtime::Runtime>::submit_finality_proof {
Box::new(header), finality_target: Box::new(header),
justification, justification,
); };
// when // when
let actual_encoded = actual.encode(); let actual_encoded = actual.encode();
@@ -332,15 +340,15 @@ mod westend_tests {
votes_ancestries: vec![], votes_ancestries: vec![],
}; };
let actual = bp_westend::BridgeGrandpaRococoCall::submit_finality_proof( let actual = relay_kusama_client::runtime::BridgePolkadotGrandpaCall::submit_finality_proof(
header.clone(), Box::new(header.clone()),
justification.clone(), justification.clone(),
); );
let expected = let expected =
millau_runtime::BridgeGrandpaCall::<millau_runtime::Runtime>::submit_finality_proof( millau_runtime::BridgeGrandpaCall::<millau_runtime::Runtime>::submit_finality_proof {
Box::new(header), finality_target: Box::new(header),
justification, justification,
); };
// when // when
let actual_encoded = actual.encode(); let actual_encoded = actual.encode();
@@ -39,18 +39,24 @@ impl CliEncodeCall for Rialto {
Ok(match call { Ok(match call {
Call::Raw { data } => Decode::decode(&mut &*data.0)?, Call::Raw { data } => Decode::decode(&mut &*data.0)?,
Call::Remark { remark_payload, .. } => Call::Remark { remark_payload, .. } =>
rialto_runtime::Call::System(rialto_runtime::SystemCall::remark( rialto_runtime::Call::System(rialto_runtime::SystemCall::remark {
remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), remark: remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(),
)), }),
Call::Transfer { recipient, amount } => rialto_runtime::Call::Balances( Call::Transfer { recipient, amount } =>
rialto_runtime::BalancesCall::transfer(recipient.raw_id().into(), amount.0), rialto_runtime::Call::Balances(rialto_runtime::BalancesCall::transfer {
), dest: recipient.raw_id().into(),
value: amount.0,
}),
Call::BridgeSendMessage { lane, payload, fee, bridge_instance_index } => Call::BridgeSendMessage { lane, payload, fee, bridge_instance_index } =>
match *bridge_instance_index { match *bridge_instance_index {
bridge::RIALTO_TO_MILLAU_INDEX => { bridge::RIALTO_TO_MILLAU_INDEX => {
let payload = Decode::decode(&mut &*payload.0)?; let payload = Decode::decode(&mut &*payload.0)?;
rialto_runtime::Call::BridgeMillauMessages( rialto_runtime::Call::BridgeMillauMessages(
rialto_runtime::MessagesCall::send_message(lane.0, payload, fee.0), rialto_runtime::MessagesCall::send_message {
lane_id: lane.0,
payload,
delivery_and_dispatch_fee: fee.0,
},
) )
}, },
_ => anyhow::bail!( _ => anyhow::bail!(
@@ -69,7 +69,10 @@ impl SubstrateFinalitySyncPipeline for RialtoFinalityToMillau {
let call = millau_runtime::BridgeGrandpaCall::< let call = millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime, millau_runtime::Runtime,
millau_runtime::RialtoGrandpaInstance, millau_runtime::RialtoGrandpaInstance,
>::submit_finality_proof(Box::new(header.into_inner()), proof) >::submit_finality_proof {
finality_target: Box::new(header.into_inner()),
justification: proof,
}
.into(); .into();
let genesis_hash = *self.finality_pipeline.target_client.genesis_hash(); let genesis_hash = *self.finality_pipeline.target_client.genesis_hash();
@@ -95,7 +95,7 @@ impl SubstrateMessageLane for RialtoMessagesToMillau {
) -> Bytes { ) -> Bytes {
let (relayers_state, proof) = proof; let (relayers_state, proof) = proof;
let call: rialto_runtime::Call = let call: rialto_runtime::Call =
rialto_runtime::MessagesCall::receive_messages_delivery_proof(proof, relayers_state) rialto_runtime::MessagesCall::receive_messages_delivery_proof { proof, relayers_state }
.into(); .into();
let call_weight = call.get_dispatch_info().weight; let call_weight = call.get_dispatch_info().weight;
let genesis_hash = *self.message_lane.source_client.genesis_hash(); let genesis_hash = *self.message_lane.source_client.genesis_hash();
@@ -130,12 +130,12 @@ impl SubstrateMessageLane for RialtoMessagesToMillau {
let (dispatch_weight, proof) = proof; let (dispatch_weight, proof) = proof;
let FromBridgedChainMessagesProof { ref nonces_start, ref nonces_end, .. } = proof; let FromBridgedChainMessagesProof { ref nonces_start, ref nonces_end, .. } = proof;
let messages_count = nonces_end - nonces_start + 1; let messages_count = nonces_end - nonces_start + 1;
let call: millau_runtime::Call = millau_runtime::MessagesCall::receive_messages_proof( let call: millau_runtime::Call = millau_runtime::MessagesCall::receive_messages_proof {
self.message_lane.relayer_id_at_source.clone(), relayer_id_at_bridged_chain: self.message_lane.relayer_id_at_source.clone(),
proof, proof,
messages_count as _, messages_count: messages_count as _,
dispatch_weight, dispatch_weight,
) }
.into(); .into();
let call_weight = call.get_dispatch_info().weight; let call_weight = call.get_dispatch_info().weight;
let genesis_hash = *self.message_lane.target_client.genesis_hash(); let genesis_hash = *self.message_lane.target_client.genesis_hash();
@@ -289,11 +289,11 @@ pub(crate) async fn update_millau_to_rialto_conversion_rate(
&signer, &signer,
relay_substrate_client::TransactionEra::immortal(), relay_substrate_client::TransactionEra::immortal(),
UnsignedTransaction::new( UnsignedTransaction::new(
rialto_runtime::MessagesCall::update_pallet_parameter( rialto_runtime::MessagesCall::update_pallet_parameter {
rialto_runtime::millau_messages::RialtoToMillauMessagesParameter::MillauToRialtoConversionRate( parameter: rialto_runtime::millau_messages::RialtoToMillauMessagesParameter::MillauToRialtoConversionRate(
sp_runtime::FixedU128::from_float(updated_rate), sp_runtime::FixedU128::from_float(updated_rate),
), ),
) }
.into(), .into(),
transaction_nonce, transaction_nonce,
), ),
@@ -35,15 +35,15 @@ impl CliEncodeCall for RialtoParachain {
Ok(match call { Ok(match call {
Call::Raw { data } => Decode::decode(&mut &*data.0)?, Call::Raw { data } => Decode::decode(&mut &*data.0)?,
Call::Remark { remark_payload, .. } => rialto_parachain_runtime::Call::System( Call::Remark { remark_payload, .. } => rialto_parachain_runtime::Call::System(
rialto_parachain_runtime::SystemCall::remark( rialto_parachain_runtime::SystemCall::remark {
remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), remark: remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(),
), },
), ),
Call::Transfer { recipient, amount } => rialto_parachain_runtime::Call::Balances( Call::Transfer { recipient, amount } => rialto_parachain_runtime::Call::Balances(
rialto_parachain_runtime::BalancesCall::transfer( rialto_parachain_runtime::BalancesCall::transfer {
recipient.raw_id().into(), dest: recipient.raw_id().into(),
amount.0, value: amount.0,
), },
), ),
Call::BridgeSendMessage { .. } => Call::BridgeSendMessage { .. } =>
anyhow::bail!("Bridge messages are not (yet) supported here",), anyhow::bail!("Bridge messages are not (yet) supported here",),
@@ -77,7 +77,10 @@ impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau {
let call = millau_runtime::BridgeGrandpaCall::< let call = millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime, millau_runtime::Runtime,
millau_runtime::WestendGrandpaInstance, millau_runtime::WestendGrandpaInstance,
>::submit_finality_proof(Box::new(header.into_inner()), proof) >::submit_finality_proof {
finality_target: Box::new(header.into_inner()),
justification: proof,
}
.into(); .into();
let genesis_hash = *self.finality_pipeline.target_client.genesis_hash(); let genesis_hash = *self.finality_pipeline.target_client.genesis_hash();
@@ -60,9 +60,12 @@ macro_rules! select_bridge {
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
) -> <Target as Chain>::Call { ) -> <Target as Chain>::Call {
rialto_runtime::SudoCall::sudo(Box::new( rialto_runtime::SudoCall::sudo {
rialto_runtime::BridgeGrandpaMillauCall::initialize(init_data).into(), call: Box::new(
)) rialto_runtime::BridgeGrandpaMillauCall::initialize { init_data }
.into(),
),
}
.into() .into()
} }
@@ -78,8 +81,10 @@ macro_rules! select_bridge {
let initialize_call = millau_runtime::BridgeGrandpaCall::< let initialize_call = millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime, millau_runtime::Runtime,
millau_runtime::RialtoGrandpaInstance, millau_runtime::RialtoGrandpaInstance,
>::initialize(init_data); >::initialize {
millau_runtime::SudoCall::sudo(Box::new(initialize_call.into())).into() init_data,
};
millau_runtime::SudoCall::sudo { call: Box::new(initialize_call.into()) }.into()
} }
$generic $generic
@@ -98,7 +103,9 @@ macro_rules! select_bridge {
millau_runtime::BridgeGrandpaCall::< millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime, millau_runtime::Runtime,
millau_runtime::WestendGrandpaInstance, millau_runtime::WestendGrandpaInstance,
>::initialize(init_data) >::initialize {
init_data,
}
.into() .into()
} }
@@ -113,7 +113,8 @@ impl RegisterParachain {
// step 1: reserve a parachain id // step 1: reserve a parachain id
let relay_genesis_hash = *relay_client.genesis_hash(); let relay_genesis_hash = *relay_client.genesis_hash();
let relay_sudo_account: AccountIdOf<Relaychain> = relay_sign.public().into(); let relay_sudo_account: AccountIdOf<Relaychain> = relay_sign.public().into();
let reserve_parachain_id_call: CallOf<Relaychain> = ParaRegistrarCall::reserve().into(); let reserve_parachain_id_call: CallOf<Relaychain> =
ParaRegistrarCall::reserve {}.into();
let reserve_parachain_signer = relay_sign.clone(); let reserve_parachain_signer = relay_sign.clone();
wait_until_transaction_is_finalized::<Relaychain>( wait_until_transaction_is_finalized::<Relaychain>(
relay_client relay_client
@@ -155,11 +156,11 @@ impl RegisterParachain {
para_genesis_header.encode().len(), para_genesis_header.encode().len(),
para_code.len(), para_code.len(),
); );
let register_parathread_call: CallOf<Relaychain> = ParaRegistrarCall::register( let register_parathread_call: CallOf<Relaychain> = ParaRegistrarCall::register {
para_id, id: para_id,
ParaHeadData(para_genesis_header.encode()), genesis_head: ParaHeadData(para_genesis_header.encode()),
ParaValidationCode(para_code), validation_code: ParaValidationCode(para_code),
) }
.into(); .into();
let register_parathread_signer = relay_sign.clone(); let register_parathread_signer = relay_sign.clone();
wait_until_transaction_is_finalized::<Relaychain>( wait_until_transaction_is_finalized::<Relaychain>(
@@ -211,16 +212,18 @@ impl RegisterParachain {
lease_begin, lease_begin,
lease_end, lease_end,
); );
let force_lease_call: CallOf<Relaychain> = SudoCall::sudo(Box::new( let force_lease_call: CallOf<Relaychain> = SudoCall::sudo {
ParaSlotsCall::force_lease( call: Box::new(
para_id, ParaSlotsCall::force_lease {
relay_sudo_account.clone(), para: para_id,
para_deposit, leaser: relay_sudo_account.clone(),
lease_begin, amount: para_deposit,
lease_end, period_begin: lease_begin,
) period_count: lease_end.saturating_sub(lease_begin).saturating_add(1),
.into(), }
)) .into(),
),
}
.into(); .into();
let force_lease_signer = relay_sign.clone(); let force_lease_signer = relay_sign.clone();
relay_client relay_client
@@ -176,10 +176,10 @@ impl SwapTokens {
// //
// prepare `Currency::transfer` call that will happen at the target chain // prepare `Currency::transfer` call that will happen at the target chain
let bridged_currency_transfer: CallOf<Target> = pallet_balances::Call::transfer( let bridged_currency_transfer: CallOf<Target> = pallet_balances::Call::transfer {
accounts.source_account_at_bridged_chain.clone().into(), dest: accounts.source_account_at_bridged_chain.clone().into(),
token_swap.target_balance_at_bridged_chain, value: token_swap.target_balance_at_bridged_chain,
) }
.into(); .into();
let bridged_currency_transfer_weight = let bridged_currency_transfer_weight =
bridged_currency_transfer.get_dispatch_info().weight; bridged_currency_transfer.get_dispatch_info().weight;
@@ -218,9 +218,9 @@ impl SwapTokens {
}, },
) )
.await?; .await?;
let create_swap_call: CallOf<Source> = pallet_bridge_token_swap::Call::create_swap( let create_swap_call: CallOf<Source> = pallet_bridge_token_swap::Call::create_swap {
token_swap.clone(), swap: token_swap.clone(),
Box::new(bp_token_swap::TokenSwapCreation { swap_creation_params: Box::new(bp_token_swap::TokenSwapCreation {
target_public_at_bridged_chain, target_public_at_bridged_chain,
swap_delivery_and_dispatch_fee, swap_delivery_and_dispatch_fee,
bridged_chain_spec_version, bridged_chain_spec_version,
@@ -228,7 +228,7 @@ impl SwapTokens {
bridged_currency_transfer_weight, bridged_currency_transfer_weight,
bridged_currency_transfer_signature, bridged_currency_transfer_signature,
}), }),
) }
.into(); .into();
// start tokens swap // start tokens swap
@@ -341,7 +341,7 @@ impl SwapTokens {
// prepare `claim_swap` message that will be sent over the bridge // prepare `claim_swap` message that will be sent over the bridge
let claim_swap_call: CallOf<Source> = let claim_swap_call: CallOf<Source> =
pallet_bridge_token_swap::Call::claim_swap(token_swap).into(); pallet_bridge_token_swap::Call::claim_swap { swap: token_swap }.into();
let claim_swap_message = bp_message_dispatch::MessagePayload { let claim_swap_message = bp_message_dispatch::MessagePayload {
spec_version: SOURCE_SPEC_VERSION, spec_version: SOURCE_SPEC_VERSION,
weight: claim_swap_call.get_dispatch_info().weight, weight: claim_swap_call.get_dispatch_info().weight,
@@ -359,12 +359,13 @@ impl SwapTokens {
claim_swap_message.clone(), claim_swap_message.clone(),
) )
.await?; .await?;
let send_message_call: CallOf<Target> = pallet_bridge_messages::Call::send_message( let send_message_call: CallOf<Target> =
TARGET_TO_SOURCE_LANE_ID, pallet_bridge_messages::Call::send_message {
claim_swap_message, lane_id: TARGET_TO_SOURCE_LANE_ID,
claim_swap_delivery_and_dispatch_fee, payload: claim_swap_message,
) delivery_and_dispatch_fee: claim_swap_delivery_and_dispatch_fee,
.into(); }
.into();
// send `claim_swap` message // send `claim_swap` message
let target_genesis_hash = *target_client.genesis_hash(); let target_genesis_hash = *target_client.genesis_hash();
@@ -406,7 +407,7 @@ impl SwapTokens {
} else { } else {
log::info!(target: "bridge", "Cancelling the swap"); log::info!(target: "bridge", "Cancelling the swap");
let cancel_swap_call: CallOf<Source> = let cancel_swap_call: CallOf<Source> =
pallet_bridge_token_swap::Call::cancel_swap(token_swap.clone()).into(); pallet_bridge_token_swap::Call::cancel_swap { swap: token_swap.clone() }.into();
let _ = wait_until_transaction_is_finalized::<Source>( let _ = wait_until_transaction_is_finalized::<Source>(
source_client source_client
.submit_and_watch_signed_extrinsic( .submit_and_watch_signed_extrinsic(
+1
View File
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0" } codec = { package = "parity-scale-codec", version = "2.2.0" }
relay-substrate-client = { path = "../client-substrate" } relay-substrate-client = { path = "../client-substrate" }
relay-utils = { path = "../utils" } relay-utils = { path = "../utils" }
scale-info = { version = "1.0", features = ["derive"] }
# Bridge dependencies # Bridge dependencies
+7 -6
View File
@@ -21,6 +21,7 @@ use bp_polkadot_core::{AccountAddress, Balance, PolkadotLike};
use bp_runtime::Chain; use bp_runtime::Chain;
use codec::{Compact, Decode, Encode}; use codec::{Compact, Decode, Encode};
use frame_support::weights::Weight; use frame_support::weights::Weight;
use scale_info::TypeInfo;
use sp_runtime::FixedU128; use sp_runtime::FixedU128;
/// Unchecked Kusama extrinsic. /// Unchecked Kusama extrinsic.
@@ -61,7 +62,7 @@ where
/// ///
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/kusama/src/lib.rs) /// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/kusama/src/lib.rs)
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call { pub enum Call {
/// System pallet. /// System pallet.
#[codec(index = 0)] #[codec(index = 0)]
@@ -77,21 +78,21 @@ pub enum Call {
BridgePolkadotMessages(BridgePolkadotMessagesCall), BridgePolkadotMessages(BridgePolkadotMessagesCall),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum SystemCall { pub enum SystemCall {
#[codec(index = 1)] #[codec(index = 1)]
remark(Vec<u8>), remark(Vec<u8>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BalancesCall { pub enum BalancesCall {
#[codec(index = 0)] #[codec(index = 0)]
transfer(AccountAddress, Compact<Balance>), transfer(AccountAddress, Compact<Balance>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgePolkadotGrandpaCall { pub enum BridgePolkadotGrandpaCall {
#[codec(index = 0)] #[codec(index = 0)]
@@ -103,7 +104,7 @@ pub enum BridgePolkadotGrandpaCall {
initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>), initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgePolkadotMessagesCall { pub enum BridgePolkadotMessagesCall {
#[codec(index = 2)] #[codec(index = 2)]
@@ -135,7 +136,7 @@ pub enum BridgePolkadotMessagesCall {
), ),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum BridgePolkadotMessagesParameter { pub enum BridgePolkadotMessagesParameter {
#[codec(index = 0)] #[codec(index = 0)]
PolkadotToKusamaConversionRate(FixedU128), PolkadotToKusamaConversionRate(FixedU128),
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0" } codec = { package = "parity-scale-codec", version = "2.2.0" }
relay-substrate-client = { path = "../client-substrate" } relay-substrate-client = { path = "../client-substrate" }
relay-utils = { path = "../utils" } relay-utils = { path = "../utils" }
scale-info = { version = "1.0", features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -21,6 +21,7 @@ use bp_polkadot_core::{AccountAddress, Balance, PolkadotLike};
use bp_runtime::Chain; use bp_runtime::Chain;
use codec::{Compact, Decode, Encode}; use codec::{Compact, Decode, Encode};
use frame_support::weights::Weight; use frame_support::weights::Weight;
use scale_info::TypeInfo;
use sp_runtime::FixedU128; use sp_runtime::FixedU128;
/// Unchecked Polkadot extrinsic. /// Unchecked Polkadot extrinsic.
@@ -61,7 +62,7 @@ where
/// ///
/// See: [link](https://github.com/paritytech/kusama/blob/master/runtime/kusam/src/lib.rs) /// See: [link](https://github.com/paritytech/kusama/blob/master/runtime/kusam/src/lib.rs)
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call { pub enum Call {
/// System pallet. /// System pallet.
#[codec(index = 0)] #[codec(index = 0)]
@@ -77,21 +78,21 @@ pub enum Call {
BridgeKusamaMessages(BridgeKusamaMessagesCall), BridgeKusamaMessages(BridgeKusamaMessagesCall),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum SystemCall { pub enum SystemCall {
#[codec(index = 1)] #[codec(index = 1)]
remark(Vec<u8>), remark(Vec<u8>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BalancesCall { pub enum BalancesCall {
#[codec(index = 0)] #[codec(index = 0)]
transfer(AccountAddress, Compact<Balance>), transfer(AccountAddress, Compact<Balance>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgeKusamaGrandpaCall { pub enum BridgeKusamaGrandpaCall {
#[codec(index = 0)] #[codec(index = 0)]
@@ -103,7 +104,7 @@ pub enum BridgeKusamaGrandpaCall {
initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>), initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgeKusamaMessagesCall { pub enum BridgeKusamaMessagesCall {
#[codec(index = 2)] #[codec(index = 2)]
@@ -135,7 +136,7 @@ pub enum BridgeKusamaMessagesCall {
), ),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum BridgeKusamaMessagesParameter { pub enum BridgeKusamaMessagesParameter {
#[codec(index = 0)] #[codec(index = 0)]
KusamaToPolkadotConversionRate(FixedU128), KusamaToPolkadotConversionRate(FixedU128),
+1
View File
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0" } codec = { package = "parity-scale-codec", version = "2.2.0" }
relay-substrate-client = { path = "../client-substrate" } relay-substrate-client = { path = "../client-substrate" }
relay-utils = { path = "../utils" } relay-utils = { path = "../utils" }
scale-info = { version = "1.0", features = ["derive"] }
# Bridge dependencies # Bridge dependencies
+5 -4
View File
@@ -21,6 +21,7 @@ use bp_polkadot_core::PolkadotLike;
use bp_runtime::Chain; use bp_runtime::Chain;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::weights::Weight; use frame_support::weights::Weight;
use scale_info::TypeInfo;
/// Unchecked Rococo extrinsic. /// Unchecked Rococo extrinsic.
pub type UncheckedExtrinsic = bp_polkadot_core::UncheckedExtrinsic<Call>; pub type UncheckedExtrinsic = bp_polkadot_core::UncheckedExtrinsic<Call>;
@@ -60,7 +61,7 @@ where
/// ///
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs) /// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs)
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call { pub enum Call {
/// System pallet. /// System pallet.
#[codec(index = 0)] #[codec(index = 0)]
@@ -73,14 +74,14 @@ pub enum Call {
BridgeMessagesWococo(BridgeMessagesWococoCall), BridgeMessagesWococo(BridgeMessagesWococoCall),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum SystemCall { pub enum SystemCall {
#[codec(index = 1)] #[codec(index = 1)]
remark(Vec<u8>), remark(Vec<u8>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgeGrandpaWococoCall { pub enum BridgeGrandpaWococoCall {
#[codec(index = 0)] #[codec(index = 0)]
@@ -92,7 +93,7 @@ pub enum BridgeGrandpaWococoCall {
initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>), initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgeMessagesWococoCall { pub enum BridgeMessagesWococoCall {
#[codec(index = 3)] #[codec(index = 3)]
+1
View File
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
codec = { package = "parity-scale-codec", version = "2.2.0" } codec = { package = "parity-scale-codec", version = "2.2.0" }
relay-substrate-client = { path = "../client-substrate" } relay-substrate-client = { path = "../client-substrate" }
relay-utils = { path = "../utils" } relay-utils = { path = "../utils" }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
bridge-runtime-common = { path = "../../bin/runtime-common" } bridge-runtime-common = { path = "../../bin/runtime-common" }
+5 -4
View File
@@ -21,6 +21,7 @@ use bp_polkadot_core::PolkadotLike;
use bp_runtime::Chain; use bp_runtime::Chain;
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::weights::Weight; use frame_support::weights::Weight;
use scale_info::TypeInfo;
/// Unchecked Wococo extrinsic. /// Unchecked Wococo extrinsic.
pub type UncheckedExtrinsic = bp_polkadot_core::UncheckedExtrinsic<Call>; pub type UncheckedExtrinsic = bp_polkadot_core::UncheckedExtrinsic<Call>;
@@ -60,7 +61,7 @@ where
/// ///
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs) /// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs)
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call { pub enum Call {
/// System pallet. /// System pallet.
#[codec(index = 0)] #[codec(index = 0)]
@@ -73,14 +74,14 @@ pub enum Call {
BridgeMessagesRococo(BridgeMessagesRococoCall), BridgeMessagesRococo(BridgeMessagesRococoCall),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum SystemCall { pub enum SystemCall {
#[codec(index = 1)] #[codec(index = 1)]
remark(Vec<u8>), remark(Vec<u8>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgeGrandpaRococoCall { pub enum BridgeGrandpaRococoCall {
#[codec(index = 0)] #[codec(index = 0)]
@@ -92,7 +93,7 @@ pub enum BridgeGrandpaRococoCall {
initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>), initialize(bp_header_chain::InitializationData<<PolkadotLike as Chain>::Header>),
} }
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum BridgeMessagesRococoCall { pub enum BridgeMessagesRococoCall {
#[codec(index = 3)] #[codec(index = 3)]