mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Refactor message relay helpers (#1234)
* refactor message relay helpers * single standalone_metrics function * fixed tests * clippy + fmt * removed commented code * add calls tracing * fix spelling * cargo fmt * -commented code * fix build again * post-merge build fix * clippy + fmt
This commit is contained in:
committed by
Bastian Köcher
parent
90f2b3c365
commit
4cdd959057
@@ -16,10 +16,12 @@
|
||||
|
||||
//! Types used to connect to the Wococo-Substrate chain.
|
||||
|
||||
use bp_messages::MessageNonce;
|
||||
use codec::Encode;
|
||||
use frame_support::weights::Weight;
|
||||
use relay_substrate_client::{
|
||||
Chain, ChainBase, ChainWithBalances, TransactionEraOf, TransactionSignScheme,
|
||||
UnsignedTransaction,
|
||||
Chain, ChainBase, ChainWithBalances, ChainWithMessages, TransactionEraOf,
|
||||
TransactionSignScheme, UnsignedTransaction,
|
||||
};
|
||||
use sp_core::{storage::StorageKey, Pair};
|
||||
use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount};
|
||||
@@ -47,10 +49,19 @@ impl ChainBase for Wococo {
|
||||
type Balance = bp_wococo::Balance;
|
||||
type Index = bp_wococo::Nonce;
|
||||
type Signature = bp_wococo::Signature;
|
||||
|
||||
fn max_extrinsic_size() -> u32 {
|
||||
bp_wococo::Wococo::max_extrinsic_size()
|
||||
}
|
||||
|
||||
fn max_extrinsic_weight() -> Weight {
|
||||
bp_wococo::Wococo::max_extrinsic_weight()
|
||||
}
|
||||
}
|
||||
|
||||
impl Chain for Wococo {
|
||||
const NAME: &'static str = "Wococo";
|
||||
const TOKEN_ID: Option<&'static str> = None;
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_wococo::BEST_FINALIZED_WOCOCO_HEADER_METHOD;
|
||||
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(6);
|
||||
@@ -62,6 +73,30 @@ impl Chain for Wococo {
|
||||
type WeightToFee = bp_wococo::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithMessages for Wococo {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_wococo::WITH_WOCOCO_MESSAGES_PALLET_NAME;
|
||||
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_wococo::TO_WOCOCO_MESSAGE_DETAILS_METHOD;
|
||||
const TO_CHAIN_LATEST_GENERATED_NONCE_METHOD: &'static str =
|
||||
bp_wococo::TO_WOCOCO_LATEST_GENERATED_NONCE_METHOD;
|
||||
const TO_CHAIN_LATEST_RECEIVED_NONCE_METHOD: &'static str =
|
||||
bp_wococo::TO_WOCOCO_LATEST_RECEIVED_NONCE_METHOD;
|
||||
const FROM_CHAIN_LATEST_RECEIVED_NONCE_METHOD: &'static str =
|
||||
bp_wococo::FROM_WOCOCO_LATEST_RECEIVED_NONCE_METHOD;
|
||||
const FROM_CHAIN_LATEST_CONFIRMED_NONCE_METHOD: &'static str =
|
||||
bp_wococo::FROM_WOCOCO_LATEST_CONFIRMED_NONCE_METHOD;
|
||||
const FROM_CHAIN_UNREWARDED_RELAYERS_STATE: &'static str =
|
||||
bp_wococo::FROM_WOCOCO_UNREWARDED_RELAYERS_STATE;
|
||||
const PAY_INBOUND_DISPATCH_FEE_WEIGHT_AT_CHAIN: Weight =
|
||||
bp_wococo::PAY_INBOUND_DISPATCH_FEE_WEIGHT;
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl ChainWithBalances for Wococo {
|
||||
fn account_info_storage_key(account_id: &Self::AccountId) -> StorageKey {
|
||||
StorageKey(bp_wococo::account_info_storage_key(account_id))
|
||||
|
||||
Reference in New Issue
Block a user