Skip to content

Commit

Permalink
Incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Niederb committed Aug 4, 2023
1 parent 9099103 commit c3cb75e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 4 additions & 5 deletions examples/examples/runtime_update_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
Expand Down Expand Up @@ -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);
}
8 changes: 3 additions & 5 deletions examples/examples/runtime_update_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c3cb75e

Please sign in to comment.