Skip to content

Commit

Permalink
Use authorize_upgrade (#27)
Browse files Browse the repository at this point in the history
* kusama

* fmt

* polkadot

* people too
  • Loading branch information
joepetrowski authored Jun 8, 2024
1 parent 71ace55 commit 6803284
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions src/build_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
match chain.network {
Network::Kusama | Network::Polkadot => continue, // do relay chain separately
Network::KusamaAssetHub => {
use kusama_asset_hub::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use kusama_asset_hub::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}asset-hub-kusama_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -291,15 +291,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Kusama Asset Hub Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::KusamaAssetHub(
KusamaAssetHubRuntimeCall::ParachainSystem(Call::authorize_upgrade {
KusamaAssetHubRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::KusamaBridgeHub => {
use kusama_bridge_hub::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use kusama_bridge_hub::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}bridge-hub-kusama_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -309,15 +308,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Kusama Bridge Hub Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::KusamaBridgeHub(
KusamaBridgeHubRuntimeCall::ParachainSystem(Call::authorize_upgrade {
KusamaBridgeHubRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::KusamaPeople => {
use kusama_people::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use kusama_people::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}people-kusama_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -327,15 +325,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Kusama People Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::KusamaPeople(
KusamaPeopleRuntimeCall::ParachainSystem(Call::authorize_upgrade {
KusamaPeopleRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::KusamaCoretime => {
use kusama_coretime::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use kusama_coretime::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}coretime-kusama_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -345,15 +342,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Kusama Coretime Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::KusamaCoretime(
KusamaCoretimeRuntimeCall::ParachainSystem(Call::authorize_upgrade {
KusamaCoretimeRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::KusamaEncointer => {
use kusama_encointer::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use kusama_encointer::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}encointer-kusama_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -363,15 +359,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Kusama Encointer Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::KusamaEncointer(
KusamaEncointerRuntimeCall::ParachainSystem(Call::authorize_upgrade {
KusamaEncointerRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::PolkadotAssetHub => {
use polkadot_asset_hub::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use polkadot_asset_hub::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}asset-hub-polkadot_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -381,15 +376,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Polkadot Asset Hub Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::PolkadotAssetHub(
PolkadotAssetHubRuntimeCall::ParachainSystem(Call::authorize_upgrade {
PolkadotAssetHubRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::PolkadotCollectives => {
use polkadot_collectives::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use polkadot_collectives::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}collectives-polkadot_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -399,15 +393,14 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Polkadot Collectives Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::PolkadotCollectives(
CollectivesRuntimeCall::ParachainSystem(Call::authorize_upgrade {
CollectivesRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
},
Network::PolkadotBridgeHub => {
use polkadot_bridge_hub::runtime_types::cumulus_pallet_parachain_system::pallet::Call;
use polkadot_bridge_hub::runtime_types::frame_system::pallet::Call;
let path = format!(
"{}bridge-hub-polkadot_runtime-v{}.compact.compressed.wasm",
upgrade_details.directory, runtime_version
Expand All @@ -417,9 +410,8 @@ fn generate_authorize_upgrade_calls(upgrade_details: &UpgradeDetails) -> Vec<Cal
println!("Polkadot Bridge Hub Runtime Hash: 0x{}", hex::encode(runtime_hash));

let call = CallInfo::from_runtime_call(NetworkRuntimeCall::PolkadotBridgeHub(
PolkadotBridgeHubRuntimeCall::ParachainSystem(Call::authorize_upgrade {
PolkadotBridgeHubRuntimeCall::System(Call::authorize_upgrade {
code_hash: H256(runtime_hash),
check_version: true,
}),
));
authorization_calls.push(call);
Expand Down

0 comments on commit 6803284

Please sign in to comment.