mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 17:31:03 +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 Rococo-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 Rococo {
|
||||
type Balance = bp_rococo::Balance;
|
||||
type Index = bp_rococo::Nonce;
|
||||
type Signature = bp_rococo::Signature;
|
||||
|
||||
fn max_extrinsic_size() -> u32 {
|
||||
bp_rococo::Rococo::max_extrinsic_size()
|
||||
}
|
||||
|
||||
fn max_extrinsic_weight() -> Weight {
|
||||
bp_rococo::Rococo::max_extrinsic_weight()
|
||||
}
|
||||
}
|
||||
|
||||
impl Chain for Rococo {
|
||||
const NAME: &'static str = "Rococo";
|
||||
const TOKEN_ID: Option<&'static str> = None;
|
||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||
bp_rococo::BEST_FINALIZED_ROCOCO_HEADER_METHOD;
|
||||
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(6);
|
||||
@@ -62,6 +73,30 @@ impl Chain for Rococo {
|
||||
type WeightToFee = bp_rococo::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithMessages for Rococo {
|
||||
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
|
||||
bp_rococo::WITH_ROCOCO_MESSAGES_PALLET_NAME;
|
||||
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
|
||||
bp_rococo::TO_ROCOCO_MESSAGE_DETAILS_METHOD;
|
||||
const TO_CHAIN_LATEST_GENERATED_NONCE_METHOD: &'static str =
|
||||
bp_rococo::TO_ROCOCO_LATEST_GENERATED_NONCE_METHOD;
|
||||
const TO_CHAIN_LATEST_RECEIVED_NONCE_METHOD: &'static str =
|
||||
bp_rococo::TO_ROCOCO_LATEST_RECEIVED_NONCE_METHOD;
|
||||
const FROM_CHAIN_LATEST_RECEIVED_NONCE_METHOD: &'static str =
|
||||
bp_rococo::FROM_ROCOCO_LATEST_RECEIVED_NONCE_METHOD;
|
||||
const FROM_CHAIN_LATEST_CONFIRMED_NONCE_METHOD: &'static str =
|
||||
bp_rococo::FROM_ROCOCO_LATEST_CONFIRMED_NONCE_METHOD;
|
||||
const FROM_CHAIN_UNREWARDED_RELAYERS_STATE: &'static str =
|
||||
bp_rococo::FROM_ROCOCO_UNREWARDED_RELAYERS_STATE;
|
||||
const PAY_INBOUND_DISPATCH_FEE_WEIGHT_AT_CHAIN: Weight =
|
||||
bp_rococo::PAY_INBOUND_DISPATCH_FEE_WEIGHT;
|
||||
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl ChainWithBalances for Rococo {
|
||||
fn account_info_storage_key(account_id: &Self::AccountId) -> StorageKey {
|
||||
StorageKey(bp_rococo::account_info_storage_key(account_id))
|
||||
|
||||
Reference in New Issue
Block a user