mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
storage_type: Strip key proper hash and entry bytes (32 instead of 16) (#1522)
* storage_type: Strip key proper hash and entry bytes (32 instead of 16) Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * storage_type: Fix typo Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * storage/tests: Check keys decode properly and don't cause errors Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update testing/integration-tests/src/full_client/storage/mod.rs Co-authored-by: James Wilson <james@jsdw.me> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: James Wilson <james@jsdw.me>
This commit is contained in:
@@ -255,7 +255,7 @@ where
|
||||
|
||||
let key_bytes = kv.key;
|
||||
let cursor = &mut &key_bytes[..];
|
||||
strip_storage_addess_root_bytes(cursor)?;
|
||||
strip_storage_address_root_bytes(cursor)?;
|
||||
|
||||
let keys = <Address::Keys as StorageKey>::decode_storage_key(
|
||||
cursor,
|
||||
@@ -314,10 +314,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Strips the first 16 bytes (8 for the pallet hash, 8 for the entry hash) off some storage address bytes.
|
||||
fn strip_storage_addess_root_bytes(address_bytes: &mut &[u8]) -> Result<(), StorageAddressError> {
|
||||
if address_bytes.len() >= 16 {
|
||||
*address_bytes = &address_bytes[16..];
|
||||
/// Strips the first 32 bytes (16 for the pallet hash, 16 for the entry hash) off some storage address bytes.
|
||||
fn strip_storage_address_root_bytes(address_bytes: &mut &[u8]) -> Result<(), StorageAddressError> {
|
||||
if address_bytes.len() >= 32 {
|
||||
*address_bytes = &address_bytes[32..];
|
||||
Ok(())
|
||||
} else {
|
||||
Err(StorageAddressError::UnexpectedAddressBytes)
|
||||
|
||||
Reference in New Issue
Block a user