mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
Merge commit '392447f5c8f986ded2559a78457f4cd87942f393' into update-bridges-subtree-r/w
This commit is contained in:
@@ -7,16 +7,21 @@ edition = "2018"
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[dependencies]
|
||||
parity-scale-codec = { version = "2.0.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"] }
|
||||
smallvec = "1.7"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-header-chain = { path = "../header-chain", default-features = false }
|
||||
bp-messages = { path = "../messages", default-features = false }
|
||||
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
||||
bp-runtime = { path = "../runtime", default-features = false }
|
||||
|
||||
# Substrate Based Dependencies
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" , default-features = false }
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -28,7 +33,9 @@ std = [
|
||||
"bp-messages/std",
|
||||
"bp-polkadot-core/std",
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
"parity-scale-codec/std",
|
||||
"scale-info/std",
|
||||
"sp-api/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
|
||||
use bp_runtime::Chain;
|
||||
use frame_support::weights::{
|
||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_std::prelude::*;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
@@ -30,7 +33,23 @@ pub use bp_polkadot_core::*;
|
||||
/// Westend Chain
|
||||
pub type Westend = PolkadotLike;
|
||||
|
||||
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.
|
||||
pub struct WeightToFee;
|
||||
impl WeightToFeePolynomial for WeightToFee {
|
||||
type Balance = Balance;
|
||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
||||
const CENTS: Balance = 1_000_000_000_000 / 1_000;
|
||||
// in Westend, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
||||
let p = CENTS;
|
||||
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
|
||||
smallvec::smallvec![WeightToFeeCoefficient {
|
||||
degree: 1,
|
||||
negative: false,
|
||||
coeff_frac: Perbill::from_rational(p % q, q),
|
||||
coeff_integer: p / q,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: This needs to be kept up to date with the Westend runtime found in the Polkadot repo.
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
@@ -45,32 +64,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
|
||||
/// Westend Runtime `Call` enum.
|
||||
///
|
||||
/// The enum represents a subset of possible `Call`s we can send to Westend chain.
|
||||
/// Ideally this code would be auto-generated from Metadata, because we want to
|
||||
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s.
|
||||
///
|
||||
/// All entries here (like pretty much in the entire file) must be kept in sync with Westend
|
||||
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
||||
///
|
||||
/// See: 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>),
|
||||
}
|
||||
/// We are not currently submitting any Westend transactions => it is empty.
|
||||
#[derive(
|
||||
parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone, TypeInfo,
|
||||
)]
|
||||
pub enum Call {}
|
||||
|
||||
impl sp_runtime::traits::Dispatchable for Call {
|
||||
type Origin = ();
|
||||
@@ -95,25 +93,31 @@ pub const BEST_FINALIZED_WESTEND_HEADER_METHOD: &str = "WestendFinalityApi_best_
|
||||
/// Name of the `WestendFinalityApi::is_known_header` runtime method.
|
||||
pub const IS_KNOWN_WESTEND_HEADER_METHOD: &str = "WestendFinalityApi_is_known_header";
|
||||
|
||||
/// Name of the `ToWestendOutboundLaneApi::estimate_message_delivery_and_dispatch_fee` runtime method.
|
||||
/// Name of the `ToWestendOutboundLaneApi::estimate_message_delivery_and_dispatch_fee` runtime
|
||||
/// method.
|
||||
pub const TO_WESTEND_ESTIMATE_MESSAGE_FEE_METHOD: &str =
|
||||
"ToWestendOutboundLaneApi_estimate_message_delivery_and_dispatch_fee";
|
||||
/// Name of the `ToWestendOutboundLaneApi::message_details` runtime method.
|
||||
pub const TO_WESTEND_MESSAGE_DETAILS_METHOD: &str = "ToWestendOutboundLaneApi_message_details";
|
||||
/// Name of the `ToWestendOutboundLaneApi::latest_generated_nonce` runtime method.
|
||||
pub const TO_WESTEND_LATEST_GENERATED_NONCE_METHOD: &str = "ToWestendOutboundLaneApi_latest_generated_nonce";
|
||||
pub const TO_WESTEND_LATEST_GENERATED_NONCE_METHOD: &str =
|
||||
"ToWestendOutboundLaneApi_latest_generated_nonce";
|
||||
/// Name of the `ToWestendOutboundLaneApi::latest_received_nonce` runtime method.
|
||||
pub const TO_WESTEND_LATEST_RECEIVED_NONCE_METHOD: &str = "ToWestendOutboundLaneApi_latest_received_nonce";
|
||||
pub const TO_WESTEND_LATEST_RECEIVED_NONCE_METHOD: &str =
|
||||
"ToWestendOutboundLaneApi_latest_received_nonce";
|
||||
|
||||
/// Name of the `FromWestendInboundLaneApi::latest_received_nonce` runtime method.
|
||||
pub const FROM_WESTEND_LATEST_RECEIVED_NONCE_METHOD: &str = "FromWestendInboundLaneApi_latest_received_nonce";
|
||||
pub const FROM_WESTEND_LATEST_RECEIVED_NONCE_METHOD: &str =
|
||||
"FromWestendInboundLaneApi_latest_received_nonce";
|
||||
/// Name of the `FromWestendInboundLaneApi::latest_onfirmed_nonce` runtime method.
|
||||
pub const FROM_WESTEND_LATEST_CONFIRMED_NONCE_METHOD: &str = "FromWestendInboundLaneApi_latest_confirmed_nonce";
|
||||
pub const FROM_WESTEND_LATEST_CONFIRMED_NONCE_METHOD: &str =
|
||||
"FromWestendInboundLaneApi_latest_confirmed_nonce";
|
||||
/// Name of the `FromWestendInboundLaneApi::unrewarded_relayers_state` runtime method.
|
||||
pub const FROM_WESTEND_UNREWARDED_RELAYERS_STATE: &str = "FromWestendInboundLaneApi_unrewarded_relayers_state";
|
||||
pub const FROM_WESTEND_UNREWARDED_RELAYERS_STATE: &str =
|
||||
"FromWestendInboundLaneApi_unrewarded_relayers_state";
|
||||
|
||||
/// The target length of a session (how often authorities change) on Westend measured in of number of
|
||||
/// blocks.
|
||||
/// The target length of a session (how often authorities change) on Westend measured in of number
|
||||
/// of blocks.
|
||||
///
|
||||
/// Note that since this is a target sessions may change before/after this time depending on network
|
||||
/// conditions.
|
||||
|
||||
Reference in New Issue
Block a user