storage: Fix partial key storage iteration (#1298)

* storage/fix: Use partial key instead of root key for iter

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* storage: Allow partial key construction

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* storage: Allow less provided types than num of hashes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* storage: Error on more fields than types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Check partial key iteration

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* storage: Rename variable wrt partial address bytes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* storage: Identical storage key to root key if no keys are provided

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2023-12-01 15:33:33 +02:00
committed by GitHub
parent ea8735f863
commit b03679fcd9
4 changed files with 89 additions and 6 deletions
@@ -45,6 +45,9 @@ async fn storage_iter() {
let api = ctx.client();
let addr = node_runtime::storage().system().account_iter();
let addr_bytes = api.storage().address_bytes(&addr).unwrap();
assert_eq!(addr_bytes, addr.to_root_bytes());
let len = api
.storage()
.at_latest()