mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 14:31:02 +00:00
Replace BATCH_CALL_SUPPORTED (#1733)
* Simplify submit_and_watch_signed_extrinsic The way submit_and_watch_signed_extrinsic is used now, we can always derive the SignParam from other params. If in the future we need more customization possibilities, we can define a new method. * Simplify submit_signed_extrinsic * Send maybe_batch_tx as a parameter Send `maybe_batch_tx` as a parameter to `submit_proof()`. This way we can deduplicate the logic that submits the extrinsic for `messages_source and `messages_target` and we can simplify the logic in the race loop a bit. * Define BatchProofTransaction Deduplicate BatchConfirmationTransaction and BatchDeliveryTransaction by replacing both of them with BatchProofTransaction * Define ChainWithUtilityPallet and BatchCallBuilderConstructor - Define `ChainWithUtilityPallet` in order to be able to associate the batching functionality with chains - Defining `BatchCallBuilderConstructor` in order to have a more reliable way of checking whether an end of a messages pipeline supports batching or no. `BatchCallBuilderConstructor::new_builder()` returns an `Option<BatchCallBuilder>`.This is a bit safer because each time a caller tries to start creating a batch call, it will call `new_builder()` and will be required to handle the returned `Option`. Before we only had a bool `BATCH_CALL_SUPPORTED` the caller could have forgetten to check.
This commit is contained in:
committed by
Bastian Köcher
parent
df1aed01c4
commit
e47f1e42e0
@@ -33,7 +33,7 @@ use parachains_relay::{
|
||||
};
|
||||
use relay_substrate_client::{
|
||||
AccountIdOf, AccountKeyPairOf, BlockNumberOf, Chain, Client, Error as SubstrateError, HashOf,
|
||||
HeaderIdOf, RelayChain, SignParam, TransactionEra, TransactionTracker, UnsignedTransaction,
|
||||
HeaderIdOf, RelayChain, TransactionEra, TransactionTracker, UnsignedTransaction,
|
||||
};
|
||||
use relay_utils::{relay_loop::Client as RelayClient, HeaderId};
|
||||
use sp_core::{Bytes, Pair};
|
||||
@@ -172,9 +172,7 @@ where
|
||||
updated_parachains: Vec<(ParaId, ParaHash)>,
|
||||
proof: ParaHeadsProof,
|
||||
) -> Result<Self::TransactionTracker, Self::Error> {
|
||||
let genesis_hash = *self.client.genesis_hash();
|
||||
let transaction_params = self.transaction_params.clone();
|
||||
let (spec_version, transaction_version) = self.client.simple_runtime_version().await?;
|
||||
let call = P::SubmitParachainHeadsCallBuilder::build_submit_parachain_heads_call(
|
||||
at_relay_block,
|
||||
updated_parachains,
|
||||
@@ -182,13 +180,7 @@ where
|
||||
);
|
||||
self.client
|
||||
.submit_and_watch_signed_extrinsic(
|
||||
self.transaction_params.signer.public().into(),
|
||||
SignParam::<P::TargetChain> {
|
||||
spec_version,
|
||||
transaction_version,
|
||||
genesis_hash,
|
||||
signer: transaction_params.signer,
|
||||
},
|
||||
&transaction_params.signer,
|
||||
move |best_block_id, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(call.into(), transaction_nonce)
|
||||
.era(TransactionEra::new(best_block_id, transaction_params.mortality)))
|
||||
|
||||
Reference in New Issue
Block a user