Metadata V16: Be more dynamic over which hasher is used. (#1974)

* Use DynamicHasher256 to support Blake2 or Keccack depending on chain

* remove Config::Hash associated type, replace with HashFor<Config> alias

* Fix doc links

* fix wasm tests

* Don't strip system pallet associated types. check System.Hashing, not Hash. Rename BlockHash trait to Hash

* Tweak comment

* fmt

* fix merge

* Fix typo
This commit is contained in:
James Wilson
2025-04-23 10:12:48 +01:00
committed by GitHub
parent a8ae55a61b
commit 21b3f52191
43 changed files with 573 additions and 371 deletions
@@ -16,7 +16,6 @@ use subxt::{
client::OnlineClient,
config::{Config, Hasher},
utils::AccountId32,
SubstrateConfig,
};
use subxt_rpcs::methods::chain_head::{
ArchiveStorageEventItem, Bytes, StorageQuery, StorageQueryType,
@@ -178,6 +177,7 @@ async fn archive_v1_storage() {
let ctx = test_context().await;
let rpc = ctx.chainhead_rpc_methods().await;
let api = ctx.client();
let hasher = api.hasher();
let mut blocks = fetch_finalized_blocks(&ctx, 3).await;
while let Some(block) = blocks.next().await {
@@ -236,9 +236,7 @@ async fn archive_v1_storage() {
ArchiveStorageEventItem {
key: Bytes(account_info_addr),
value: None,
hash: Some(<SubstrateConfig as Config>::Hasher::hash(
&subxt_account_info
)),
hash: Some(hasher.hash(&subxt_account_info)),
closest_descendant_merkle_value: None,
child_trie_key: None
}