diff --git a/Cargo.lock b/Cargo.lock index f9769ef690ffc878a07323ebde53bc8c2001f2af..c65651a7ba7d1ff90411daa0d0d442568b9e8b24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1962,6 +1962,7 @@ dependencies = [ "portpicker", "serde_json", "sp-keyring", + "sp-runtime", "subxt", "tokio", ] @@ -1971,9 +1972,10 @@ name = "duniter-live-tests" version = "3.0.0" dependencies = [ "anyhow", - "hex-literal 0.3.4", + "hex-literal", "parity-scale-codec", "sp-core", + "sp-runtime", "subxt", "tokio", ] @@ -2913,7 +2915,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.4.1", + "hex-literal", "log", "pallet-atomic-swap", "pallet-authority-discovery", @@ -2980,7 +2982,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.4.1", + "hex-literal", "log", "pallet-atomic-swap", "pallet-authority-discovery", @@ -3281,7 +3283,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.4.1", + "hex-literal", "log", "pallet-atomic-swap", "pallet-authority-discovery", @@ -3448,12 +3450,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - [[package]] name = "hex-literal" version = "0.4.1" @@ -9917,6 +9913,7 @@ dependencies = [ "getrandom 0.2.10", "hex", "impl-serde", + "jsonrpsee", "parity-scale-codec", "parking_lot 0.12.1", "primitive-types", diff --git a/live-tests/Cargo.toml b/live-tests/Cargo.toml index 5a90f4984e69f629c1600a1dec414877ae8820ec..9882e6e1a31f47c82ba178803a0867b6029dc14f 100644 --- a/live-tests/Cargo.toml +++ b/live-tests/Cargo.toml @@ -10,8 +10,9 @@ version = '3.0.0' [dev-dependencies] anyhow = "1.0" -hex-literal = "0.3" -parity-scale-codec = "3.1.5" +hex-literal = "0.4" +parity-scale-codec = "3.4.0" sp-core = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } -subxt = { git = 'https://github.com/duniter/subxt', branch = 'duniter-substrate-v0.9.42', default-features = false } -tokio = { version = "1.24.2", features = ["macros"], default-features = false } +subxt = { git = 'https://github.com/duniter/subxt', branch = 'duniter-substrate-v0.9.42', default-features = false, features = ["jsonrpsee-ws"] } +tokio = { version = "1.28", features = ["macros", "time", "rt-multi-thread"], default-features = false } +sp-runtime = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false , features = ["std"] } # https://github.com/paritytech/subxt/issues/437 \ No newline at end of file diff --git a/live-tests/tests/sanity_gdev.rs b/live-tests/tests/sanity_gdev.rs index b460968046efc7330c33e0098d01a0cddda32df9..e0df612c599d09579998176ee9282369c5eb8046 100644 --- a/live-tests/tests/sanity_gdev.rs +++ b/live-tests/tests/sanity_gdev.rs @@ -72,18 +72,17 @@ async fn main() -> anyhow::Result<()> { sanity_tests_at(client, maybe_block_hash).await } -async fn sanity_tests_at(client: Client, maybe_block_hash: Option<H256>) -> anyhow::Result<()> { +async fn sanity_tests_at(client: Client, _maybe_block_hash: Option<H256>) -> anyhow::Result<()> { // ===== Collect storage ===== // // Collect accounts - let mut accounts = HashMap::new(); + let mut accounts: HashMap<AccountId32, AccountInfo> = HashMap::new(); let mut account_iter = client .storage() - .iter( - gdev::storage().system().account_root(), - 100, - maybe_block_hash, - ) + .at_latest() + .await + .unwrap() + .iter(gdev::storage().system().account_root(), 100) .await?; while let Some((key, account_info)) = account_iter.next().await? { let mut account_id_bytes = [0u8; 32]; @@ -93,31 +92,37 @@ async fn sanity_tests_at(client: Client, maybe_block_hash: Option<H256>) -> anyh println!("accounts: {}.", accounts.len()); // Collect identities - let mut identities = HashMap::new(); + let mut identities: HashMap<IdtyIndex, IdtyValue> = HashMap::new(); let mut idty_iter = client .storage() - .iter( - gdev::storage().identity().identities_root(), - 100, - maybe_block_hash, - ) + .at_latest() + .await + .unwrap() + .iter(gdev::storage().identity().identities_root(), 100) .await?; while let Some((key, idty_value)) = idty_iter.next().await? { let mut idty_index_bytes = [0u8; 4]; idty_index_bytes.copy_from_slice(&key.0[40..]); - identities.insert(IdtyIndex::from_le_bytes(idty_index_bytes), idty_value); + let idty_val = IdtyValue { + data: idty_value.data, + next_creatable_identity_on: idty_value.next_creatable_identity_on, + old_owner_key: None, // Not used in the live test, skip the conversion + owner_key: AccountId32::from(idty_value.owner_key.0), + removable_on: idty_value.removable_on, + status: idty_value.status, + }; + identities.insert(IdtyIndex::from_le_bytes(idty_index_bytes), idty_val); } println!("identities: {}.", identities.len()); // Collect identity_index_of - let mut identity_index_of = HashMap::new(); + let mut identity_index_of: HashMap<[u8; 16], IdtyIndex> = HashMap::new(); let mut idty_index_of_iter = client .storage() - .iter( - gdev::storage().identity().identity_index_of_root(), - 100, - maybe_block_hash, - ) + .at_latest() + .await + .unwrap() + .iter(gdev::storage().identity().identity_index_of_root(), 100) .await?; while let Some((key, idty_index)) = idty_index_of_iter.next().await? { let mut blake2_128_bytes = [0u8; 16]; diff --git a/resources/metadata.scale b/resources/metadata.scale index c7614a61bc7018f92ec836d272de42f7dc6fb4eb..3621bf8083e15cbad37c7fee45dc8cdc99d24ebc 100644 Binary files a/resources/metadata.scale and b/resources/metadata.scale differ