Skip to content

Commit

Permalink
only use batch when needed (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
joepetrowski authored May 2, 2024
1 parent 7614190 commit c6ebdc4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/build_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,13 @@ async fn construct_kusama_batch(
if let Some(rc) = relay_call {
batch_calls.push(rc.get_kusama_call().expect("kusama call"));
}
CallInfo::from_runtime_call(NetworkRuntimeCall::Kusama(KusamaRuntimeCall::Utility(
UtilityCall::force_batch { calls: batch_calls },
)))
match &batch_calls.len() {
0 => panic!("no calls"),
1 => CallInfo::from_runtime_call(NetworkRuntimeCall::Kusama(batch_calls[0].clone())),
_ => CallInfo::from_runtime_call(NetworkRuntimeCall::Kusama(KusamaRuntimeCall::Utility(
UtilityCall::force_batch { calls: batch_calls },
))),
}
}

// Construct the batch needed on Polkadot.
Expand All @@ -530,9 +534,13 @@ async fn construct_polkadot_batch(
if let Some(rc) = relay_call {
batch_calls.push(rc.get_polkadot_call().expect("polkadot call"));
}
CallInfo::from_runtime_call(NetworkRuntimeCall::Polkadot(PolkadotRuntimeCall::Utility(
UtilityCall::force_batch { calls: batch_calls },
)))
match &batch_calls.len() {
0 => panic!("no calls"),
1 => CallInfo::from_runtime_call(NetworkRuntimeCall::Polkadot(batch_calls[0].clone())),
_ => CallInfo::from_runtime_call(NetworkRuntimeCall::Polkadot(
PolkadotRuntimeCall::Utility(UtilityCall::force_batch { calls: batch_calls }),
)),
}
}

// Take a call, which includes its intended destination, and wrap it in XCM instructions to `send`
Expand Down

0 comments on commit c6ebdc4

Please sign in to comment.