From aafb4092cb32bd935c58799a1b4fc9667df311bf Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 19 Jun 2024 14:11:08 +0200 Subject: [PATCH 1/7] Add debug output --- testing/async/examples/state_tests.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index b1051de80..dae7fc9c1 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -20,6 +20,7 @@ use pallet_balances::AccountData as GenericAccountData; use pallet_staking::Exposure; use sp_core::{crypto::Ss58Codec, sr25519}; use sp_keyring::AccountKeyring; +use sp_runtime::print; use sp_staking::EraIndex; use substrate_api_client::{ ac_primitives::{AssetRuntimeConfig, Config}, @@ -57,11 +58,22 @@ async fn main() { .unwrap(); let _account_info: AccountData = api.get_storage_map("System", "Account", &alice, None).await.unwrap().unwrap(); - let _era_stakers: ErasStakers = api - .get_storage_double_map("Staking", "ErasStakers", EraIndex::default(), alice_stash, None) + + let storage_double_map_key_prefix = api + .get_storage_double_map_key_prefix("Staking", "ErasStakers", 0) + .await + .unwrap(); + let double_map_storage_keys = api + .get_storage_keys_paged(Some(storage_double_map_key_prefix), 3, None, None) + .await + .unwrap(); + println!("Could fetch storage_keys: {:?}", double_map_storage_keys); + let era_stakers: ErasStakers = api + .get_storage_double_map("Staking", "ErasStakers", EraIndex::default(), "", None) .await .unwrap() .unwrap(); + println!("{:?}", era_stakers); // Ensure the prefix matches the actual storage key: let storage_key_prefix = api.get_storage_map_key_prefix("System", "Account").await.unwrap(); From 66c61372bac555b5284eadaa79fbe5d1b666545a Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 19 Jun 2024 15:39:51 +0200 Subject: [PATCH 2/7] Fix logs and test --- testing/async/examples/state_tests.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index dae7fc9c1..d5542b7e4 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -20,7 +20,6 @@ use pallet_balances::AccountData as GenericAccountData; use pallet_staking::Exposure; use sp_core::{crypto::Ss58Codec, sr25519}; use sp_keyring::AccountKeyring; -use sp_runtime::print; use sp_staking::EraIndex; use substrate_api_client::{ ac_primitives::{AssetRuntimeConfig, Config}, @@ -69,11 +68,11 @@ async fn main() { .unwrap(); println!("Could fetch storage_keys: {:?}", double_map_storage_keys); let era_stakers: ErasStakers = api - .get_storage_double_map("Staking", "ErasStakers", EraIndex::default(), "", None) + .get_storage_double_map("Staking", "ErasStakers", EraIndex::default(), alice_stash, None) .await .unwrap() .unwrap(); - println!("{:?}", era_stakers); + println!("ErasStakers: {:?}", era_stakers); // Ensure the prefix matches the actual storage key: let storage_key_prefix = api.get_storage_map_key_prefix("System", "Account").await.unwrap(); From 2a6c99016326e79ce531a0b72a45d7194626bdcb Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 26 Jun 2024 16:19:00 +0200 Subject: [PATCH 3/7] Use ErasStakersOverview instead of ErasStakers --- testing/async/examples/state_tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index d5542b7e4..3bace0f9c 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -59,7 +59,7 @@ async fn main() { api.get_storage_map("System", "Account", &alice, None).await.unwrap().unwrap(); let storage_double_map_key_prefix = api - .get_storage_double_map_key_prefix("Staking", "ErasStakers", 0) + .get_storage_double_map_key_prefix("Staking", "ErasStakersOverview", 0) .await .unwrap(); let double_map_storage_keys = api @@ -68,7 +68,7 @@ async fn main() { .unwrap(); println!("Could fetch storage_keys: {:?}", double_map_storage_keys); let era_stakers: ErasStakers = api - .get_storage_double_map("Staking", "ErasStakers", EraIndex::default(), alice_stash, None) + .get_storage_double_map("Staking", "ErasStakersOverview", EraIndex::default(), alice_stash, None) .await .unwrap() .unwrap(); From 55d054e472031dbdec6533179b2d59a26f91ebac Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 26 Jun 2024 16:20:01 +0200 Subject: [PATCH 4/7] Use newer docker image --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c64682a4..2379ca409 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -216,7 +216,7 @@ jobs: - name: Run latest node run: | - docker run -p 9944:9944 -p 9933:9933 -p 30333:30333 paritypr/substrate:master-1cd6acdf --dev --rpc-external & + docker run -p 9944:9944 -p 9933:9933 -p 30333:30333 paritypr/substrate:master-c7bd8804 --dev --rpc-external & - name: Wait until node has started run: sleep 20s From c8f207b9a819a7eca37333c4e5ed005e9b61c98b Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Thu, 27 Jun 2024 10:14:06 +0200 Subject: [PATCH 5/7] Fix code formatting --- testing/async/examples/state_tests.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index 3bace0f9c..86bcecc40 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -68,7 +68,13 @@ async fn main() { .unwrap(); println!("Could fetch storage_keys: {:?}", double_map_storage_keys); let era_stakers: ErasStakers = api - .get_storage_double_map("Staking", "ErasStakersOverview", EraIndex::default(), alice_stash, None) + .get_storage_double_map( + "Staking", + "ErasStakersOverview", + EraIndex::default(), + alice_stash, + None, + ) .await .unwrap() .unwrap(); From ec9f641d5cb9d06a9edc46c39f4d2030d0509362 Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Thu, 27 Jun 2024 11:42:54 +0200 Subject: [PATCH 6/7] Remove debugging code --- testing/async/examples/state_tests.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index 86bcecc40..5fc266ebc 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -58,15 +58,6 @@ async fn main() { let _account_info: AccountData = api.get_storage_map("System", "Account", &alice, None).await.unwrap().unwrap(); - let storage_double_map_key_prefix = api - .get_storage_double_map_key_prefix("Staking", "ErasStakersOverview", 0) - .await - .unwrap(); - let double_map_storage_keys = api - .get_storage_keys_paged(Some(storage_double_map_key_prefix), 3, None, None) - .await - .unwrap(); - println!("Could fetch storage_keys: {:?}", double_map_storage_keys); let era_stakers: ErasStakers = api .get_storage_double_map( "Staking", From 23860204dd82657e8fbc5c8729924b5e1399c196 Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Mon, 1 Jul 2024 08:30:37 +0200 Subject: [PATCH 7/7] Remove println --- testing/async/examples/state_tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index 5fc266ebc..98d287941 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -69,7 +69,6 @@ async fn main() { .await .unwrap() .unwrap(); - println!("ErasStakers: {:?}", era_stakers); // Ensure the prefix matches the actual storage key: let storage_key_prefix = api.get_storage_map_key_prefix("System", "Account").await.unwrap();