From c3cb75e7bbef62c638040fe70f252c0d9cbe7e68 Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Fri, 4 Aug 2023 07:24:21 +0200 Subject: [PATCH] Incorporate review feedback --- examples/examples/runtime_update_async.rs | 9 ++++----- examples/examples/runtime_update_sync.rs | 8 +++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/examples/runtime_update_async.rs b/examples/examples/runtime_update_async.rs index 658bfbe76..814a73575 100644 --- a/examples/examples/runtime_update_async.rs +++ b/examples/examples/runtime_update_async.rs @@ -16,9 +16,7 @@ use sp_keyring::AccountKeyring; use sp_weights::Weight; use substrate_api_client::{ ac_compose_macros::{compose_call, compose_extrinsic}, - ac_primitives::{ - AssetRuntimeConfig, Config, ExtrinsicSigner as GenericExtrinsicSigner, UncheckedExtrinsicV4, - }, + ac_primitives::{AssetRuntimeConfig, Config, ExtrinsicSigner as GenericExtrinsicSigner}, api_client::UpdateRuntime, rpc::JsonrpseeClient, rpc_api::RuntimeUpdateDetector, @@ -45,8 +43,7 @@ pub async fn send_code_update_extrinsic( // this call can only be called by sudo let call = compose_call!(api.metadata(), "System", "set_code", new_wasm.to_vec()); let weight: Weight = 0.into(); - let xt: UncheckedExtrinsicV4<_, _, _, _> = - compose_extrinsic!(&api, "Sudo", "sudo_unchecked_weight", call, weight); + let xt = compose_extrinsic!(&api, "Sudo", "sudo_unchecked_weight", call, weight); // send and watch extrinsic until finalized println!("Sending extrinsic to trigger runtime update"); @@ -103,4 +100,6 @@ async fn main() { }; println!("Detected runtime update: {runtime_update_detected}"); println!("New spec_version: {}", api.spec_version()); + assert!(api.spec_version() == 1268); + assert!(runtime_update_detected); } diff --git a/examples/examples/runtime_update_sync.rs b/examples/examples/runtime_update_sync.rs index b9198941c..b9b26285b 100644 --- a/examples/examples/runtime_update_sync.rs +++ b/examples/examples/runtime_update_sync.rs @@ -21,9 +21,7 @@ use sp_weights::Weight; use std::{sync::Arc, thread}; use substrate_api_client::{ ac_compose_macros::{compose_call, compose_extrinsic}, - ac_primitives::{ - AssetRuntimeConfig, Config, ExtrinsicSigner as GenericExtrinsicSigner, UncheckedExtrinsicV4, - }, + ac_primitives::{AssetRuntimeConfig, Config, ExtrinsicSigner as GenericExtrinsicSigner}, api_client::UpdateRuntime, rpc::JsonrpseeClient, rpc_api::RuntimeUpdateDetector, @@ -47,8 +45,7 @@ pub fn send_code_update_extrinsic( // Create a sudo `set_code` call. let call = compose_call!(api.metadata(), "System", "set_code", new_wasm.to_vec()); let weight: Weight = 0.into(); - let xt: UncheckedExtrinsicV4<_, _, _, _> = - compose_extrinsic!(&api, "Sudo", "sudo_unchecked_weight", call, weight); + let xt = compose_extrinsic!(&api, "Sudo", "sudo_unchecked_weight", call, weight); println!("Sending extrinsic to trigger runtime update"); let block_hash = api @@ -81,6 +78,7 @@ async fn main() { // Wait for potential runtime update events let runtime_update_detected = update_detector.detect_runtime_update().unwrap(); println!("Detected runtime update: {runtime_update_detected}"); + assert!(runtime_update_detected); }); // Execute an actual runtime update