mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +00:00
Port safe commits from master to polkadot-staging (#2761)
* introduce bp_messages::ChainWithMessages (#2171) * Move Chain::ID from relay-level Chain to primitives-level Chain (#2181) * move Chain::ID from relay-level Chain to primitives-level Chain * removed chain IDs from bp-runtime * add missing file header * Some code grooming (#2276) * some code grooming: enable warn(missing_docs) for all piblic crates + added missing documentation + removed obsolete clippy/deny workarounds * removed strange allow + added comment related to other allow * removed incorrect_clone_impl_on_copy_type which is unknown to CI clippy
This commit is contained in:
committed by
Bastian Köcher
parent
37bb1e7909
commit
4004742e85
@@ -40,6 +40,8 @@ pub mod rococo_parachains_to_rococo_bulletin;
|
||||
pub struct RococoBaseAsPolkadot;
|
||||
|
||||
impl bp_runtime::Chain for RococoBaseAsPolkadot {
|
||||
const ID: ChainId = relay_rococo_client::Rococo::ID;
|
||||
|
||||
type BlockNumber = BlockNumberOf<bp_rococo::Rococo>;
|
||||
type Hash = HashOf<bp_rococo::Rococo>;
|
||||
type Hasher = HasherOf<bp_rococo::Rococo>;
|
||||
@@ -78,7 +80,6 @@ impl bp_runtime::UnderlyingChainProvider for RococoAsPolkadot {
|
||||
}
|
||||
|
||||
impl relay_substrate_client::Chain for RococoAsPolkadot {
|
||||
const ID: ChainId = relay_rococo_client::Rococo::ID;
|
||||
const NAME: &'static str = relay_rococo_client::Rococo::NAME;
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
relay_polkadot_client::Polkadot::BEST_FINALIZED_HEADER_ID_METHOD;
|
||||
@@ -146,6 +147,8 @@ impl CliChain for RococoAsPolkadot {
|
||||
pub struct BaseBridgeHubRococoAsBridgeHubPolkadot;
|
||||
|
||||
impl bp_runtime::Chain for BaseBridgeHubRococoAsBridgeHubPolkadot {
|
||||
const ID: ChainId = relay_bridge_hub_rococo_client::BridgeHubRococo::ID;
|
||||
|
||||
type BlockNumber = BlockNumberOf<bp_bridge_hub_rococo::BridgeHubRococo>;
|
||||
type Hash = HashOf<bp_bridge_hub_rococo::BridgeHubRococo>;
|
||||
type Hasher = HasherOf<bp_bridge_hub_rococo::BridgeHubRococo>;
|
||||
@@ -169,6 +172,16 @@ impl bp_runtime::Parachain for BaseBridgeHubRococoAsBridgeHubPolkadot {
|
||||
const PARACHAIN_ID: u32 = bp_bridge_hub_rococo::BridgeHubRococo::PARACHAIN_ID;
|
||||
}
|
||||
|
||||
impl bp_messages::ChainWithMessages for BaseBridgeHubRococoAsBridgeHubPolkadot {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
relay_bridge_hub_polkadot_client::BridgeHubPolkadot::WITH_CHAIN_MESSAGES_PALLET_NAME;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
relay_bridge_hub_rococo_client::BridgeHubRococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
relay_bridge_hub_rococo_client::BridgeHubRococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
/// Relay `Chain` implementation of Rococo Bridge Hub, pretending to be a Polkadot Bridge Hub.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct BridgeHubRococoAsBridgeHubPolkadot;
|
||||
@@ -178,7 +191,6 @@ impl bp_runtime::UnderlyingChainProvider for BridgeHubRococoAsBridgeHubPolkadot
|
||||
}
|
||||
|
||||
impl relay_substrate_client::Chain for BridgeHubRococoAsBridgeHubPolkadot {
|
||||
const ID: ChainId = relay_bridge_hub_rococo_client::BridgeHubRococo::ID;
|
||||
const NAME: &'static str = relay_bridge_hub_rococo_client::BridgeHubRococo::NAME;
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
relay_bridge_hub_polkadot_client::BridgeHubPolkadot::BEST_FINALIZED_HEADER_ID_METHOD;
|
||||
@@ -236,8 +248,6 @@ impl relay_substrate_client::ChainWithTransactions for BridgeHubRococoAsBridgeHu
|
||||
}
|
||||
|
||||
impl relay_substrate_client::ChainWithMessages for BridgeHubRococoAsBridgeHubPolkadot {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
relay_bridge_hub_polkadot_client::BridgeHubPolkadot::WITH_CHAIN_MESSAGES_PALLET_NAME;
|
||||
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> =
|
||||
relay_bridge_hub_polkadot_client::BridgeHubPolkadot::WITH_CHAIN_RELAYERS_PALLET_NAME;
|
||||
|
||||
@@ -245,11 +255,6 @@ impl relay_substrate_client::ChainWithMessages for BridgeHubRococoAsBridgeHubPol
|
||||
relay_bridge_hub_polkadot_client::BridgeHubPolkadot::TO_CHAIN_MESSAGE_DETAILS_METHOD;
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
relay_bridge_hub_polkadot_client::BridgeHubPolkadot::FROM_CHAIN_MESSAGE_DETAILS_METHOD;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
relay_bridge_hub_rococo_client::BridgeHubRococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
relay_bridge_hub_rococo_client::BridgeHubRococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
impl CliChain for BridgeHubRococoAsBridgeHubPolkadot {
|
||||
|
||||
@@ -18,9 +18,7 @@ relay-substrate-client = { path = "../client-substrate" }
|
||||
bp-bridge-hub-kusama = { path = "../../primitives/chain-bridge-hub-kusama" }
|
||||
bp-bridge-hub-polkadot = { path = "../../primitives/chain-bridge-hub-polkadot" }
|
||||
bp-header-chain = { path = "../../primitives/header-chain" }
|
||||
bp-messages = { path = "../../primitives/messages" }
|
||||
bp-parachains = { path = "../../primitives/parachains" }
|
||||
bp-runtime = { path = "../../primitives/runtime" }
|
||||
bp-polkadot = { path = "../../primitives/chain-polkadot" }
|
||||
|
||||
bridge-runtime-common = { path = "../../bin/runtime-common" }
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
//! Types used to connect to the BridgeHub-Kusama-Substrate parachain.
|
||||
|
||||
use bp_bridge_hub_kusama::AVERAGE_BLOCK_INTERVAL;
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_polkadot::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet,
|
||||
@@ -43,7 +41,6 @@ impl UnderlyingChainProvider for BridgeHubKusama {
|
||||
}
|
||||
|
||||
impl Chain for BridgeHubKusama {
|
||||
const ID: ChainId = bp_runtime::BRIDGE_HUB_KUSAMA_CHAIN_ID;
|
||||
const NAME: &'static str = "BridgeHubKusama";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_bridge_hub_kusama::BEST_FINALIZED_BRIDGE_HUB_KUSAMA_HEADER_METHOD;
|
||||
@@ -116,8 +113,6 @@ impl ChainWithTransactions for BridgeHubKusama {
|
||||
}
|
||||
|
||||
impl ChainWithMessages for BridgeHubKusama {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_bridge_hub_kusama::WITH_BRIDGE_HUB_KUSAMA_MESSAGES_PALLET_NAME;
|
||||
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> =
|
||||
Some(bp_bridge_hub_kusama::WITH_BRIDGE_HUB_KUSAMA_RELAYERS_PALLET_NAME);
|
||||
|
||||
@@ -125,11 +120,6 @@ impl ChainWithMessages for BridgeHubKusama {
|
||||
bp_bridge_hub_kusama::TO_BRIDGE_HUB_KUSAMA_MESSAGE_DETAILS_METHOD;
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_bridge_hub_kusama::FROM_BRIDGE_HUB_KUSAMA_MESSAGE_DETAILS_METHOD;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_kusama::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_kusama::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -18,7 +18,6 @@ relay-substrate-client = { path = "../client-substrate" }
|
||||
bp-bridge-hub-kusama = { path = "../../primitives/chain-bridge-hub-kusama" }
|
||||
bp-bridge-hub-polkadot = { path = "../../primitives/chain-bridge-hub-polkadot" }
|
||||
bp-header-chain = { path = "../../primitives/header-chain" }
|
||||
bp-messages = { path = "../../primitives/messages" }
|
||||
bp-parachains = { path = "../../primitives/parachains" }
|
||||
bp-polkadot-bulletin = { path = "../../primitives/chain-polkadot-bulletin" }
|
||||
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
//! Types used to connect to the BridgeHub-Polkadot-Substrate parachain.
|
||||
|
||||
use bp_bridge_hub_polkadot::AVERAGE_BLOCK_INTERVAL;
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet,
|
||||
@@ -43,7 +41,6 @@ impl UnderlyingChainProvider for BridgeHubPolkadot {
|
||||
}
|
||||
|
||||
impl Chain for BridgeHubPolkadot {
|
||||
const ID: ChainId = bp_runtime::BRIDGE_HUB_POLKADOT_CHAIN_ID;
|
||||
const NAME: &'static str = "BridgeHubPolkadot";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_bridge_hub_polkadot::BEST_FINALIZED_BRIDGE_HUB_POLKADOT_HEADER_METHOD;
|
||||
@@ -116,8 +113,6 @@ impl ChainWithTransactions for BridgeHubPolkadot {
|
||||
}
|
||||
|
||||
impl ChainWithMessages for BridgeHubPolkadot {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_bridge_hub_polkadot::WITH_BRIDGE_HUB_POLKADOT_MESSAGES_PALLET_NAME;
|
||||
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> =
|
||||
Some(bp_bridge_hub_polkadot::WITH_BRIDGE_HUB_POLKADOT_RELAYERS_PALLET_NAME);
|
||||
|
||||
@@ -125,11 +120,6 @@ impl ChainWithMessages for BridgeHubPolkadot {
|
||||
bp_bridge_hub_polkadot::TO_BRIDGE_HUB_POLKADOT_MESSAGE_DETAILS_METHOD;
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_bridge_hub_polkadot::FROM_BRIDGE_HUB_POLKADOT_MESSAGE_DETAILS_METHOD;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_polkadot::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_polkadot::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -11,7 +11,7 @@ workspace = true
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] }
|
||||
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
|
||||
subxt = { version = "0.32.1", default-features = false, features = [] }
|
||||
subxt = { version = "0.32.1", default-features = false, features = ["native"] }
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
pub mod codegen_runtime;
|
||||
|
||||
use bp_bridge_hub_rococo::{SignedExtension, AVERAGE_BLOCK_INTERVAL};
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
calls::UtilityCall as MockUtilityCall, Chain, ChainWithBalances, ChainWithMessages,
|
||||
@@ -52,7 +50,6 @@ impl UnderlyingChainProvider for BridgeHubRococo {
|
||||
}
|
||||
|
||||
impl Chain for BridgeHubRococo {
|
||||
const ID: ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
|
||||
const NAME: &'static str = "BridgeHubRococo";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_bridge_hub_rococo::BEST_FINALIZED_BRIDGE_HUB_ROCOCO_HEADER_METHOD;
|
||||
@@ -134,8 +131,6 @@ impl ChainWithTransactions for BridgeHubRococo {
|
||||
}
|
||||
|
||||
impl ChainWithMessages for BridgeHubRococo {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME;
|
||||
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> =
|
||||
Some(bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_RELAYERS_PALLET_NAME);
|
||||
|
||||
@@ -143,11 +138,6 @@ impl ChainWithMessages for BridgeHubRococo {
|
||||
bp_bridge_hub_rococo::TO_BRIDGE_HUB_ROCOCO_MESSAGE_DETAILS_METHOD;
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_bridge_hub_rococo::FROM_BRIDGE_HUB_ROCOCO_MESSAGE_DETAILS_METHOD;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -11,18 +11,16 @@ workspace = true
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] }
|
||||
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
|
||||
subxt = { version = "0.32.1", default-features = false, features = [] }
|
||||
subxt = { version = "0.32.1", default-features = false, features = ["native"] }
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
bp-bridge-hub-rococo = { path = "../../primitives/chain-bridge-hub-rococo" }
|
||||
bp-bridge-hub-westend = { path = "../../primitives/chain-bridge-hub-westend" }
|
||||
bp-header-chain = { path = "../../primitives/header-chain" }
|
||||
bp-messages = { path = "../../primitives/messages" }
|
||||
bp-parachains = { path = "../../primitives/parachains" }
|
||||
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
|
||||
bp-rococo = { path = "../../primitives/chain-rococo" }
|
||||
bp-runtime = { path = "../../primitives/runtime" }
|
||||
|
||||
bridge-runtime-common = { path = "../../bin/runtime-common" }
|
||||
relay-substrate-client = { path = "../client-substrate" }
|
||||
@@ -34,4 +32,5 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "mas
|
||||
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
|
||||
|
||||
[dev-dependencies]
|
||||
bp-runtime = { path = "../../primitives/runtime" }
|
||||
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
//! Types used to connect to the BridgeHub-Westend-Substrate parachain.
|
||||
|
||||
use bp_bridge_hub_westend::AVERAGE_BLOCK_INTERVAL;
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet,
|
||||
@@ -43,7 +41,6 @@ impl UnderlyingChainProvider for BridgeHubWestend {
|
||||
}
|
||||
|
||||
impl Chain for BridgeHubWestend {
|
||||
const ID: ChainId = bp_runtime::BRIDGE_HUB_WESTEND_CHAIN_ID;
|
||||
const NAME: &'static str = "BridgeHubWestend";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_bridge_hub_westend::BEST_FINALIZED_BRIDGE_HUB_WESTEND_HEADER_METHOD;
|
||||
@@ -116,8 +113,6 @@ impl ChainWithTransactions for BridgeHubWestend {
|
||||
}
|
||||
|
||||
impl ChainWithMessages for BridgeHubWestend {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_bridge_hub_westend::WITH_BRIDGE_HUB_WESTEND_MESSAGES_PALLET_NAME;
|
||||
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> =
|
||||
Some(bp_bridge_hub_westend::WITH_BRIDGE_HUB_WESTEND_RELAYERS_PALLET_NAME);
|
||||
|
||||
@@ -125,11 +120,6 @@ impl ChainWithMessages for BridgeHubWestend {
|
||||
bp_bridge_hub_westend::TO_BRIDGE_HUB_WESTEND_MESSAGE_DETAILS_METHOD;
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_bridge_hub_westend::FROM_BRIDGE_HUB_WESTEND_MESSAGE_DETAILS_METHOD;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_westend::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_bridge_hub_westend::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -20,7 +20,6 @@ pub mod codegen_runtime;
|
||||
|
||||
use bp_kusama::{AccountInfoStorageMapKeyProvider, KUSAMA_SYNCED_HEADERS_GRANDPA_INFO_METHOD};
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithGrandpa, ChainWithTransactions, Error as SubstrateError,
|
||||
@@ -55,7 +54,6 @@ impl UnderlyingChainProvider for Kusama {
|
||||
}
|
||||
|
||||
impl Chain for Kusama {
|
||||
const ID: ChainId = bp_runtime::KUSAMA_CHAIN_ID;
|
||||
const NAME: &'static str = "Kusama";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_kusama::BEST_FINALIZED_KUSAMA_HEADER_METHOD;
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
|
||||
mod codegen_runtime;
|
||||
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_polkadot_bulletin::POLKADOT_BULLETIN_SYNCED_HEADERS_GRANDPA_INFO_METHOD;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithGrandpa, ChainWithMessages, ChainWithTransactions,
|
||||
@@ -65,8 +63,6 @@ impl UnderlyingChainProvider for PolkadotBulletin {
|
||||
}
|
||||
|
||||
impl Chain for PolkadotBulletin {
|
||||
const ID: ChainId = *b"pbch";
|
||||
|
||||
const NAME: &'static str = "PolkadotBulletin";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_polkadot_bulletin::BEST_FINALIZED_POLKADOT_BULLETIN_HEADER_METHOD;
|
||||
@@ -84,8 +80,6 @@ impl ChainWithGrandpa for PolkadotBulletin {
|
||||
}
|
||||
|
||||
impl ChainWithMessages for PolkadotBulletin {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_polkadot_bulletin::WITH_POLKADOT_BULLETIN_MESSAGES_PALLET_NAME;
|
||||
// this is not critical (some metrics will be missing from the storage), but probably it needs
|
||||
// to be changed when we'll polish the bridge configuration
|
||||
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = None;
|
||||
@@ -94,11 +88,6 @@ impl ChainWithMessages for PolkadotBulletin {
|
||||
bp_polkadot_bulletin::TO_POLKADOT_BULLETIN_MESSAGE_DETAILS_METHOD;
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_polkadot_bulletin::FROM_POLKADOT_BULLETIN_MESSAGE_DETAILS_METHOD;
|
||||
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_polkadot_bulletin::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_polkadot_bulletin::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
}
|
||||
|
||||
impl ChainWithBalances for PolkadotBulletin {
|
||||
|
||||
@@ -20,7 +20,6 @@ mod codegen_runtime;
|
||||
|
||||
use bp_polkadot::{AccountInfoStorageMapKeyProvider, POLKADOT_SYNCED_HEADERS_GRANDPA_INFO_METHOD};
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithGrandpa, ChainWithTransactions, Error as SubstrateError,
|
||||
@@ -55,7 +54,6 @@ impl UnderlyingChainProvider for Polkadot {
|
||||
}
|
||||
|
||||
impl Chain for Polkadot {
|
||||
const ID: ChainId = bp_runtime::POLKADOT_CHAIN_ID;
|
||||
const NAME: &'static str = "Polkadot";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_polkadot::BEST_FINALIZED_POLKADOT_HEADER_METHOD;
|
||||
|
||||
@@ -17,7 +17,6 @@ subxt = { version = "0.32.1", default-features = false, features = ["native"] }
|
||||
|
||||
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
|
||||
bp-rococo = { path = "../../primitives/chain-rococo" }
|
||||
bp-runtime = { path = "../../primitives/runtime" }
|
||||
|
||||
relay-substrate-client = { path = "../client-substrate" }
|
||||
relay-utils = { path = "../utils" }
|
||||
|
||||
@@ -20,7 +20,6 @@ pub mod codegen_runtime;
|
||||
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_rococo::ROCOCO_SYNCED_HEADERS_GRANDPA_INFO_METHOD;
|
||||
use bp_runtime::ChainId;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainWithBalances, ChainWithGrandpa, ChainWithTransactions, Error as SubstrateError,
|
||||
@@ -55,7 +54,6 @@ impl UnderlyingChainProvider for Rococo {
|
||||
}
|
||||
|
||||
impl Chain for Rococo {
|
||||
const ID: ChainId = bp_runtime::ROCOCO_CHAIN_ID;
|
||||
const NAME: &'static str = "Rococo";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_rococo::BEST_FINALIZED_ROCOCO_HEADER_METHOD;
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
use crate::calls::UtilityCall;
|
||||
|
||||
use bp_header_chain::ChainWithGrandpa as ChainWithGrandpaBase;
|
||||
use bp_messages::MessageNonce;
|
||||
use bp_messages::ChainWithMessages as ChainWithMessagesBase;
|
||||
use bp_runtime::{
|
||||
Chain as ChainBase, ChainId, EncodedOrDecodedCall, HashOf, Parachain as ParachainBase,
|
||||
TransactionEra, TransactionEraOf, UnderlyingChainProvider,
|
||||
Chain as ChainBase, EncodedOrDecodedCall, HashOf, Parachain as ParachainBase, TransactionEra,
|
||||
TransactionEraOf, UnderlyingChainProvider,
|
||||
};
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use jsonrpsee::core::{DeserializeOwned, Serialize};
|
||||
@@ -37,8 +37,6 @@ use std::{fmt::Debug, time::Duration};
|
||||
|
||||
/// Substrate-based chain from minimal relay-client point of view.
|
||||
pub trait Chain: ChainBase + Clone {
|
||||
/// Chain id.
|
||||
const ID: ChainId;
|
||||
/// Chain name.
|
||||
const NAME: &'static str;
|
||||
/// Name of the runtime API method that is returning best known finalized header number
|
||||
@@ -91,14 +89,7 @@ pub trait Parachain: Chain + ParachainBase {}
|
||||
impl<T> Parachain for T where T: UnderlyingChainProvider + Chain + ParachainBase {}
|
||||
|
||||
/// Substrate-based chain with messaging support from minimal relay-client point of view.
|
||||
pub trait ChainWithMessages: Chain {
|
||||
/// Name of the bridge messages pallet (used in `construct_runtime` macro call) that is deployed
|
||||
/// at some other chain to bridge with this `ChainWithMessages`.
|
||||
///
|
||||
/// We assume that all chains that are bridging with this `ChainWithMessages` are using
|
||||
/// the same name.
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str;
|
||||
|
||||
pub trait ChainWithMessages: Chain + ChainWithMessagesBase {
|
||||
// TODO (https://github.com/paritytech/parity-bridges-common/issues/1692): check all the names
|
||||
// after the issue is fixed - all names must be changed
|
||||
|
||||
@@ -116,13 +107,6 @@ pub trait ChainWithMessages: Chain {
|
||||
/// Name of the `From<ChainWithMessages>InboundLaneApi::message_details` runtime API method.
|
||||
/// The method is provided by the runtime that is bridged with this `ChainWithMessages`.
|
||||
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str;
|
||||
|
||||
/// Maximal number of unrewarded relayers in a single confirmation transaction at this
|
||||
/// `ChainWithMessages`.
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce;
|
||||
/// Maximal number of unconfirmed messages in a single confirmation transaction at this
|
||||
/// `ChainWithMessages`.
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce;
|
||||
}
|
||||
|
||||
/// Call type used by the chain.
|
||||
|
||||
@@ -31,6 +31,8 @@ use std::time::Duration;
|
||||
pub struct TestChain;
|
||||
|
||||
impl bp_runtime::Chain for TestChain {
|
||||
const ID: ChainId = *b"test";
|
||||
|
||||
type BlockNumber = u32;
|
||||
type Hash = sp_core::H256;
|
||||
type Hasher = sp_runtime::traits::BlakeTwo256;
|
||||
@@ -51,7 +53,6 @@ impl bp_runtime::Chain for TestChain {
|
||||
}
|
||||
|
||||
impl Chain for TestChain {
|
||||
const ID: ChainId = *b"test";
|
||||
const NAME: &'static str = "Test";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = "TestMethod";
|
||||
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_millis(0);
|
||||
@@ -73,6 +74,8 @@ impl ChainWithBalances for TestChain {
|
||||
pub struct TestParachainBase;
|
||||
|
||||
impl bp_runtime::Chain for TestParachainBase {
|
||||
const ID: ChainId = *b"tstp";
|
||||
|
||||
type BlockNumber = u32;
|
||||
type Hash = sp_core::H256;
|
||||
type Hasher = sp_runtime::traits::BlakeTwo256;
|
||||
@@ -105,7 +108,6 @@ impl bp_runtime::UnderlyingChainProvider for TestParachain {
|
||||
}
|
||||
|
||||
impl Chain for TestParachain {
|
||||
const ID: ChainId = *b"test";
|
||||
const NAME: &'static str = "TestParachain";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = "TestParachainMethod";
|
||||
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_millis(0);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
pub mod codegen_runtime;
|
||||
|
||||
use bp_polkadot_core::SuffixedCommonSignedExtensionExt;
|
||||
use bp_runtime::ChainId;
|
||||
use bp_westend::WESTEND_SYNCED_HEADERS_GRANDPA_INFO_METHOD;
|
||||
use codec::Encode;
|
||||
use relay_substrate_client::{
|
||||
@@ -55,7 +54,6 @@ impl UnderlyingChainProvider for Westend {
|
||||
}
|
||||
|
||||
impl Chain for Westend {
|
||||
const ID: ChainId = bp_runtime::WESTEND_CHAIN_ID;
|
||||
const NAME: &'static str = "Westend";
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_westend::BEST_FINALIZED_WESTEND_HEADER_METHOD;
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use async_std::sync::Arc;
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_messages::{ChainWithMessages as _, LaneId, MessageNonce};
|
||||
use bp_runtime::{
|
||||
AccountIdOf, Chain as _, EncodedOrDecodedCall, HeaderIdOf, TransactionEra, WeightExtraOps,
|
||||
};
|
||||
|
||||
@@ -32,8 +32,8 @@ use async_std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use bp_messages::{
|
||||
storage_keys::{operating_mode_key, outbound_lane_data_key},
|
||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, MessagesOperatingMode,
|
||||
OutboundLaneData, OutboundMessageDetails,
|
||||
ChainWithMessages as _, InboundMessageDetails, LaneId, MessageNonce, MessagePayload,
|
||||
MessagesOperatingMode, OutboundLaneData, OutboundMessageDetails,
|
||||
};
|
||||
use bp_runtime::{BasicOperatingMode, HeaderIdProvider};
|
||||
use bridge_runtime_common::messages::target::FromBridgedChainMessagesProof;
|
||||
|
||||
@@ -31,8 +31,8 @@ use crate::{
|
||||
use async_std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use bp_messages::{
|
||||
storage_keys::inbound_lane_data_key, InboundLaneData, LaneId, MessageNonce,
|
||||
UnrewardedRelayersState,
|
||||
storage_keys::inbound_lane_data_key, ChainWithMessages as _, InboundLaneData, LaneId,
|
||||
MessageNonce, UnrewardedRelayersState,
|
||||
};
|
||||
use bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof;
|
||||
use messages_relay::{
|
||||
@@ -40,8 +40,8 @@ use messages_relay::{
|
||||
message_lane_loop::{NoncesSubmitArtifacts, TargetClient, TargetClientState},
|
||||
};
|
||||
use relay_substrate_client::{
|
||||
AccountIdOf, AccountKeyPairOf, BalanceOf, CallOf, ChainWithMessages, Client,
|
||||
Error as SubstrateError, HashOf, TransactionEra, TransactionTracker, UnsignedTransaction,
|
||||
AccountIdOf, AccountKeyPairOf, BalanceOf, CallOf, Client, Error as SubstrateError, HashOf,
|
||||
TransactionEra, TransactionTracker, UnsignedTransaction,
|
||||
};
|
||||
use relay_utils::relay_loop::Client as RelayClient;
|
||||
use sp_core::Pair;
|
||||
|
||||
@@ -164,6 +164,6 @@ where
|
||||
})?;
|
||||
let parachain_head_hash = parachain_head.hash();
|
||||
|
||||
Ok((ParaHeadsProof(parachain_heads_proof), parachain_head_hash))
|
||||
Ok((ParaHeadsProof { storage_proof: parachain_heads_proof }, parachain_head_hash))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,7 +648,8 @@ mod tests {
|
||||
_at_block: HeaderIdOf<TestChain>,
|
||||
) -> Result<(ParaHeadsProof, ParaHash), TestError> {
|
||||
let head = *self.data.lock().await.source_head.clone()?.as_available().unwrap();
|
||||
let proof = (ParaHeadsProof(vec![head.hash().encode()]), head.hash());
|
||||
let storage_proof = vec![head.hash().encode()];
|
||||
let proof = (ParaHeadsProof { storage_proof }, head.hash());
|
||||
self.data.lock().await.source_proof.clone().map(|_| proof)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user