mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 16:05:43 +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
@@ -234,3 +234,31 @@ impl<Block: BlockT> BlockWithJustification<Block::Header> for SignedBlock<Block>
|
||||
self.justifications.as_ref().and_then(|j| j.get(engine_id))
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait that provides functionality defined inside `pallet-utility`
|
||||
pub trait UtilityPallet<C: Chain> {
|
||||
/// Create batch call from given calls vector.
|
||||
fn build_batch_call(calls: Vec<C::Call>) -> C::Call;
|
||||
}
|
||||
|
||||
/// Structure that implements `UtilityPalletProvider` based on a full runtime.
|
||||
pub struct FullRuntimeUtilityPallet<R> {
|
||||
_phantom: std::marker::PhantomData<R>,
|
||||
}
|
||||
|
||||
impl<C, R> UtilityPallet<C> for FullRuntimeUtilityPallet<R>
|
||||
where
|
||||
C: Chain,
|
||||
R: pallet_utility::Config<RuntimeCall = C::Call>,
|
||||
<R as pallet_utility::Config>::RuntimeCall: From<pallet_utility::Call<R>>,
|
||||
{
|
||||
fn build_batch_call(calls: Vec<C::Call>) -> C::Call {
|
||||
pallet_utility::Call::batch_all { calls }.into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Substrate-based chain that uses `pallet-utility`.
|
||||
pub trait ChainWithUtilityPallet: Chain {
|
||||
/// The utility pallet provider.
|
||||
type UtilityPallet: UtilityPallet<Self>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user