diff --git a/src/build_upgrade.rs b/src/build_upgrade.rs index 9867b1f..494e02a 100644 --- a/src/build_upgrade.rs +++ b/src/build_upgrade.rs @@ -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); }, @@ -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); },