mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 00:31:02 +00:00
Bugfix: trimmed metadata hash comparison fails in is_codegen_valid_for (#1306)
* cargo: Switch to workspace lints (#1299) * subxt: Remove unstable lints that cause compile warnings Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Switch to workspace lints Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Fix codec package at root level Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Move profiles to the root level Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Fix lightclient and metadata crates Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Revert "cargo: Fix codec package at root level" This reverts commit cdf9e1628d708a972673eb3a9e967b6896edbd73. * Fix complexity clippy Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Remove lints to be replaced by `cargo machete` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Remove unused dependencies (detected by machete) Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Add machete step Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Bump rust version Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Rename machete step Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Rename cargo machete step Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * test and outer enum pre compute * explicit OuterEnumHashes type * clippy * move outer enums to their own module --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
+5
-6
@@ -22,8 +22,8 @@ mod utils;
|
||||
use scale_info::{form::PortableForm, PortableRegistry, Variant};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use utils::ordered_map::OrderedMap;
|
||||
use utils::variant_index::VariantIndex;
|
||||
use utils::{ordered_map::OrderedMap, validation::outer_enum_hashes::OuterEnumHashes};
|
||||
|
||||
type ArcStr = Arc<str>;
|
||||
|
||||
@@ -163,7 +163,7 @@ impl Metadata {
|
||||
Some(crate::utils::validation::get_type_hash(
|
||||
&self.types,
|
||||
id,
|
||||
&mut HashMap::new(),
|
||||
&OuterEnumHashes::empty(),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ impl<'a> PalletMetadata<'a> {
|
||||
|
||||
/// Return a hash for the entire pallet.
|
||||
pub fn hash(&self) -> [u8; HASH_LEN] {
|
||||
crate::utils::validation::get_pallet_hash(*self)
|
||||
crate::utils::validation::get_pallet_hash(*self, &OuterEnumHashes::empty())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ impl<'a> RuntimeApiMetadata<'a> {
|
||||
|
||||
/// Return a hash for the runtime API trait.
|
||||
pub fn hash(&self) -> [u8; HASH_LEN] {
|
||||
crate::utils::validation::get_runtime_trait_hash(*self)
|
||||
crate::utils::validation::get_runtime_trait_hash(*self, &OuterEnumHashes::empty())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,8 +766,7 @@ impl<'a> CustomValueMetadata<'a> {
|
||||
|
||||
/// Calculates the hash for the CustomValueMetadata.
|
||||
pub fn hash(&self) -> [u8; HASH_LEN] {
|
||||
let mut cache = HashMap::new();
|
||||
get_custom_value_hash(self, &mut cache)
|
||||
get_custom_value_hash(self, &OuterEnumHashes::empty())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user