mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 16:51: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
@@ -26,7 +26,7 @@ use polkadot_runtime_common::{
|
||||
paras_registrar::Call as ParaRegistrarCall, slots::Call as ParaSlotsCall,
|
||||
};
|
||||
use polkadot_runtime_parachains::paras::ParaLifecycle;
|
||||
use relay_substrate_client::{AccountIdOf, CallOf, Chain, Client, SignParam, UnsignedTransaction};
|
||||
use relay_substrate_client::{AccountIdOf, CallOf, Chain, Client, UnsignedTransaction};
|
||||
use relay_utils::{TrackedTransactionStatus, TransactionTracker};
|
||||
use rialto_runtime::SudoCall;
|
||||
use sp_core::{
|
||||
@@ -108,28 +108,16 @@ impl RegisterParachain {
|
||||
log::info!(target: "bridge", "Going to reserve parachain id: {:?}", para_id);
|
||||
|
||||
// step 1: reserve a parachain id
|
||||
let relay_genesis_hash = *relay_client.genesis_hash();
|
||||
let relay_sudo_account: AccountIdOf<Relaychain> = relay_sign.public().into();
|
||||
let reserve_parachain_id_call: CallOf<Relaychain> =
|
||||
ParaRegistrarCall::reserve {}.into();
|
||||
let reserve_parachain_signer = relay_sign.clone();
|
||||
let (spec_version, transaction_version) = relay_client.simple_runtime_version().await?;
|
||||
let reserve_result = relay_client
|
||||
.submit_and_watch_signed_extrinsic(
|
||||
relay_sudo_account.clone(),
|
||||
SignParam::<Relaychain> {
|
||||
spec_version,
|
||||
transaction_version,
|
||||
genesis_hash: relay_genesis_hash,
|
||||
signer: reserve_parachain_signer,
|
||||
},
|
||||
move |_, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(
|
||||
reserve_parachain_id_call.into(),
|
||||
transaction_nonce,
|
||||
))
|
||||
},
|
||||
)
|
||||
.submit_and_watch_signed_extrinsic(&relay_sign, move |_, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(
|
||||
reserve_parachain_id_call.into(),
|
||||
transaction_nonce,
|
||||
))
|
||||
})
|
||||
.await?
|
||||
.wait()
|
||||
.await;
|
||||
@@ -162,23 +150,10 @@ impl RegisterParachain {
|
||||
validation_code: ParaValidationCode(para_code),
|
||||
}
|
||||
.into();
|
||||
let register_parathread_signer = relay_sign.clone();
|
||||
let register_result = relay_client
|
||||
.submit_and_watch_signed_extrinsic(
|
||||
relay_sudo_account.clone(),
|
||||
SignParam::<Relaychain> {
|
||||
spec_version,
|
||||
transaction_version,
|
||||
genesis_hash: relay_genesis_hash,
|
||||
signer: register_parathread_signer,
|
||||
},
|
||||
move |_, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(
|
||||
register_parathread_call.into(),
|
||||
transaction_nonce,
|
||||
))
|
||||
},
|
||||
)
|
||||
.submit_and_watch_signed_extrinsic(&relay_sign, move |_, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(register_parathread_call.into(), transaction_nonce))
|
||||
})
|
||||
.await?
|
||||
.wait()
|
||||
.await;
|
||||
@@ -227,20 +202,10 @@ impl RegisterParachain {
|
||||
),
|
||||
}
|
||||
.into();
|
||||
let force_lease_signer = relay_sign.clone();
|
||||
relay_client
|
||||
.submit_signed_extrinsic(
|
||||
relay_sudo_account,
|
||||
SignParam::<Relaychain> {
|
||||
spec_version,
|
||||
transaction_version,
|
||||
genesis_hash: relay_genesis_hash,
|
||||
signer: force_lease_signer,
|
||||
},
|
||||
move |_, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(force_lease_call.into(), transaction_nonce))
|
||||
},
|
||||
)
|
||||
.submit_signed_extrinsic(&relay_sign, move |_, transaction_nonce| {
|
||||
Ok(UnsignedTransaction::new(force_lease_call.into(), transaction_nonce))
|
||||
})
|
||||
.await?;
|
||||
log::info!(target: "bridge", "Registered parachain leases: {:?}. Waiting for onboarding", para_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user