mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Fixes for Polkadot Integration (#586)
* Add AccountIdConverter impl to Kusama and Polkadot primitives * Add missing message lane config constants * Add more consts * Add another missing const * Move consts in primitives so that they're consistent across files * Move types and consts to more intuitive locations * Downgrade hyper from v0.13.8 to v0.13.6 This conflicts with a requirement on the Polkadot side which requires that hyper is =v0.13.6 * Update hyper to v0.13.9 * Update async-io to v1.3.1 * Update socket2 from v0.3.15 to v0.3.18 * Update message weight/size constants * Make BlockWeights/Length parameter types Allows us to re-use these types from both the runtime and the message lane config files without creating a new instance of them. * Remove uneccesary weight constants These can be found in the `runtime-common` crate used by Polkadot/Kusama. The constants there will also be the most up-to-date versions.
This commit is contained in:
committed by
Bastian Köcher
parent
5cafbaa0ad
commit
a6c3de51d3
@@ -16,6 +16,7 @@ bp-runtime = { path = "../runtime", default-features = false }
|
||||
# Substrate Based Dependencies
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "master" , default-features = false }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
|
||||
@@ -27,6 +28,7 @@ std = [
|
||||
"bp-message-lane/std",
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"sp-api/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -31,6 +31,18 @@ use sp_runtime::{
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
// TODO: may need to be updated after https://github.com/paritytech/parity-bridges-common/issues/78
|
||||
/// Maximal number of messages in single delivery transaction.
|
||||
pub const MAX_MESSAGES_IN_DELIVERY_TRANSACTION: MessageNonce = 128;
|
||||
|
||||
/// Maximal number of unrewarded relayer entries at inbound lane.
|
||||
pub const MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE: MessageNonce = 128;
|
||||
|
||||
// TODO: should be selected keeping in mind:
|
||||
// finality delay on both chains + reward payout cost + messages throughput.
|
||||
/// Maximal number of unconfirmed messages at inbound lane.
|
||||
pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 8192;
|
||||
|
||||
/// Block number type used in Polkadot.
|
||||
pub type BlockNumber = u32;
|
||||
|
||||
@@ -75,6 +87,15 @@ impl Chain for Polkadot {
|
||||
type Header = Header;
|
||||
}
|
||||
|
||||
/// Convert a 256-bit hash into an AccountId.
|
||||
pub struct AccountIdConverter;
|
||||
|
||||
impl sp_runtime::traits::Convert<sp_core::H256, AccountId> for AccountIdConverter {
|
||||
fn convert(hash: sp_core::H256) -> AccountId {
|
||||
hash.to_fixed_bytes().into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Name of the `PolkadotHeaderApi::best_blocks` runtime method.
|
||||
pub const BEST_POLKADOT_BLOCKS_METHOD: &str = "PolkadotHeaderApi_best_blocks";
|
||||
/// Name of the `PolkadotHeaderApi::finalized_block` runtime method.
|
||||
@@ -84,13 +105,6 @@ pub const IS_KNOWN_POLKADOT_BLOCK_METHOD: &str = "PolkadotHeaderApi_is_known_blo
|
||||
/// Name of the `PolkadotHeaderApi::incomplete_headers` runtime method.
|
||||
pub const INCOMPLETE_POLKADOT_HEADERS_METHOD: &str = "PolkadotHeaderApi_incomplete_headers";
|
||||
|
||||
/// Maximal weight of single Polkadot extrinsic.
|
||||
pub const MAXIMUM_EXTRINSIC_WEIGHT: Weight = 725_000_000_000;
|
||||
|
||||
// TODO: should be selected keeping in mind: finality delay on both chains + reward payout cost + messages throughput.
|
||||
/// Maximal number of unconfirmed messages at inbound lane.
|
||||
pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 8192;
|
||||
|
||||
sp_api::decl_runtime_apis! {
|
||||
/// API for querying information about Polkadot headers from the Bridge Pallet instance.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user