Skip to content

Commit dd1d9a8

Browse files
committed
fix runtime upgrade examples
1 parent 260ef93 commit dd1d9a8

9 files changed

+7
-17
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,9 @@ jobs:
208208
compose_extrinsic,
209209
custom_nonce,
210210
check_extrinsic_events,
211-
get_account_identity,
212211
get_blocks,
213212
get_storage,
214213
print_metadata,
215-
staking_batch_payout,
216214
subscribe_events,
217215
sudo,
218216
new_json_rpc_api_calls,
Binary file not shown.
Binary file not shown.

examples/async/examples/runtime_update_async.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ async fn main() {
7070
};
7171
println!("Detected runtime update: {runtime_update_detected}");
7272
println!("New spec_version: {}", api.spec_version());
73-
assert!(api.spec_version() == 1268);
73+
assert!(api.spec_version() == 111111111);
7474
assert!(runtime_update_detected);
7575
}
7676

7777
pub async fn send_code_update_extrinsic(
7878
api: &substrate_api_client::Api<WestendRuntimeConfig, JsonrpseeClient>,
7979
) {
80-
let new_wasm: &[u8] = include_bytes!("kitchensink_runtime.compact.compressed.wasm");
80+
let new_wasm: &[u8] = include_bytes!("minimal_template_runtime.compact.compressed.wasm");
8181

8282
// this call can only be called by sudo
8383
let call = compose_call!(api.metadata(), "System", "set_code", new_wasm.to_vec()).unwrap();

examples/async/examples/staking_batch_payout.rs renamed to examples/async/examples/staking_batch_payout_untested.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ use substrate_api_client::{
2424

2525
const MAX_BATCHED_TRANSACTION: u32 = 9;
2626

27-
// To test this example with CI we run it against the Substrate kitchensink node, which uses the asset pallet.
28-
// Therefore, we need to use the `AssetRuntimeConfig` in this example.
29-
// ! However, most Substrate runtimes do not use the asset pallet at all. So if you run an example against your own node
30-
// you most likely should use `WestendRuntimeConfig` instead.
27+
// This example is currently not tested because the polkadot chain (rococo runtime) we run our example against
28+
// does not include the staking pallet. But it still provides a good example for possible stake payouts.
3129

3230
pub type EraIndex = u32;
3331

@@ -68,17 +66,14 @@ async fn main() {
6866
println!("{:?}", active_era);
6967
let current_era_index = active_era.index;
7068

71-
// Test if payout staker extrinsic works. Careful: In CI, this extrinsic will fail to be executed, because
69+
// Test if payout staker extrinsic works. Careful: If tested with CI, this extrinsic will fail to be executed, because
7270
// one can not payout the current era (= 0 on the freshly started node). But this is okay, because we know if this
7371
// error is returned from the node, the extrinsic has been created correctly.
7472
// Sidenote: We could theoretically force a new era with sudo, but this takes at least 10 minutes ( = 1 epoch) in the
7573
// kitchensink rutime. We don't want to wait that long.
7674
let payout_staker_xt = api.payout_stakers(0, validator_stash).await.unwrap();
7775
let result = api.submit_and_watch_extrinsic_until(payout_staker_xt, XtStatus::InBlock).await;
78-
assert!(result.is_err());
79-
assert!(format!("{result:?}").contains("InvalidEraToReward"));
8076

81-
// From here on, this is not CI tested, but it serves as a nice example nonetheless.
8277
if let Some(mut last_reward_received_at_era) =
8378
get_last_reward_received_for(&validator_account, current_era_index, &api).await
8479
{
Binary file not shown.
Binary file not shown.

examples/sync/examples/runtime_update_sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ fn main() {
6969
handler.join().unwrap();
7070
api.update_runtime().unwrap();
7171
println!("New spec_version: {}", api.spec_version());
72-
assert!(api.spec_version() == 1268);
72+
assert!(api.spec_version() == 111111111);
7373
}
7474

7575
pub fn send_code_update_extrinsic(
7676
api: &substrate_api_client::Api<WestendRuntimeConfig, TungsteniteRpcClient>,
7777
) {
78-
let new_wasm: &[u8] = include_bytes!("kitchensink_runtime.compact.compressed.wasm");
78+
let new_wasm: &[u8] = include_bytes!("minimal_template_runtime.compact.compressed.wasm");
7979

8080
// Create a sudo `set_code` call.
8181
let call = compose_call!(api.metadata(), "System", "set_code", new_wasm.to_vec()).unwrap();

testing/async/examples/author_tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ fn assert_associated_events_match_expected(events: Vec<RawEventDetails<Hash>>) {
187187
assert_eq!(events[2].pallet_name(), "Balances");
188188
assert_eq!(events[2].variant_name(), "Deposit");
189189

190-
assert_eq!(events[3].pallet_name(), "Treasury");
191-
assert_eq!(events[3].variant_name(), "Deposit");
192-
193190
assert_eq!(events[4].pallet_name(), "Balances");
194191
assert_eq!(events[4].variant_name(), "Deposit");
195192

0 commit comments

Comments
 (0)