Skip to content

Commit

Permalink
better batching
Browse files Browse the repository at this point in the history
  • Loading branch information
joepetrowski committed Apr 15, 2024
1 parent 15096dd commit 6bd9a12
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/build_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,24 +453,21 @@ async fn construct_kusama_batch(
let mut batch_calls = Vec::new();
for auth in para_calls {
match auth.network {
// Relays. This iterator should only have parachain calls.
Network::Kusama | Network::Polkadot =>
panic!("para calls should not contain relay calls"),

// Polkadot parachains
Network::PolkadotAssetHub
| Network::PolkadotCollectives
| Network::PolkadotBridgeHub => panic!("not kusama parachains"),
Network::KusamaAssetHub => {
let send_auth = send_as_superuser_from_kusama(&auth).await;
batch_calls.push(send_auth);
},
Network::KusamaBridgeHub => {
let send_auth = send_as_superuser_from_kusama(&auth).await;
batch_calls.push(send_auth);
},
Network::KusamaCoretime => {
let send_auth = send_as_superuser_from_kusama(&auth).await;
batch_calls.push(send_auth);
},
Network::KusamaEncointer => {

// The rest. We could `_` it but we match explicitly to avoid footguns when adding new
// chains to a network.
Network::KusamaAssetHub
| Network::KusamaBridgeHub
| Network::KusamaCoretime
| Network::KusamaEncointer => {
let send_auth = send_as_superuser_from_kusama(&auth).await;
batch_calls.push(send_auth);
},
Expand Down Expand Up @@ -499,21 +496,21 @@ async fn construct_polkadot_batch(
let mut batch_calls = Vec::new();
for auth in para_calls {
match auth.network {
// Relays. This iterator should only have parachain calls.
Network::Kusama | Network::Polkadot =>
panic!("para calls should not contain relay calls"),

// Kusama parachains
Network::KusamaAssetHub
| Network::KusamaBridgeHub
| Network::KusamaCoretime
| Network::KusamaEncointer => panic!("not polkadot parachains"),
Network::PolkadotAssetHub => {
let send_auth = send_as_superuser_from_polkadot(&auth).await;
batch_calls.push(send_auth);
},
Network::PolkadotCollectives => {
let send_auth = send_as_superuser_from_polkadot(&auth).await;
batch_calls.push(send_auth);
},
Network::PolkadotBridgeHub => {

// The rest. We could `_` it but we match explicitly to avoid footguns when adding new
// chains to a network.
Network::PolkadotAssetHub
| Network::PolkadotCollectives
| Network::PolkadotBridgeHub => {
let send_auth = send_as_superuser_from_polkadot(&auth).await;
batch_calls.push(send_auth);
},
Expand Down

0 comments on commit 6bd9a12

Please sign in to comment.