mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
BlockId removal: &Hash to Hash (#12626)
It changes &Block::Hash argument to Block::Hash. This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
This commit is contained in:
committed by
GitHub
parent
7c4bfc9749
commit
1ed70004e7
@@ -25,7 +25,7 @@ use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
/// Export the raw state at the given `block`. If `block` is `None`, the
|
||||
/// best block will be used.
|
||||
pub fn export_raw_state<B, BA, C>(client: Arc<C>, hash: &B::Hash) -> Result<Storage, Error>
|
||||
pub fn export_raw_state<B, BA, C>(client: Arc<C>, hash: B::Hash) -> Result<Storage, Error>
|
||||
where
|
||||
C: UsageProvider<B> + StorageProvider<B, BA>,
|
||||
B: BlockT,
|
||||
|
||||
@@ -148,7 +148,7 @@ where
|
||||
) -> sp_blockchain::Result<Vec<u8>> {
|
||||
let mut changes = OverlayedChanges::default();
|
||||
let at_hash = self.backend.blockchain().expect_block_hash_from_id(at)?;
|
||||
let state = self.backend.state_at(&at_hash)?;
|
||||
let state = self.backend.state_at(at_hash)?;
|
||||
let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(&state);
|
||||
let runtime_code =
|
||||
state_runtime_code.runtime_code().map_err(sp_blockchain::Error::RuntimeCode)?;
|
||||
@@ -193,7 +193,7 @@ where
|
||||
let mut storage_transaction_cache = storage_transaction_cache.map(|c| c.borrow_mut());
|
||||
|
||||
let at_hash = self.backend.blockchain().expect_block_hash_from_id(at)?;
|
||||
let state = self.backend.state_at(&at_hash)?;
|
||||
let state = self.backend.state_at(at_hash)?;
|
||||
|
||||
let changes = &mut *changes.borrow_mut();
|
||||
|
||||
@@ -251,7 +251,7 @@ where
|
||||
let mut overlay = OverlayedChanges::default();
|
||||
|
||||
let at_hash = self.backend.blockchain().expect_block_hash_from_id(id)?;
|
||||
let state = self.backend.state_at(&at_hash)?;
|
||||
let state = self.backend.state_at(at_hash)?;
|
||||
let mut cache = StorageTransactionCache::<Block, B::State>::default();
|
||||
let mut ext = Ext::new(&mut overlay, &mut cache, &state, None);
|
||||
let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(&state);
|
||||
@@ -269,7 +269,7 @@ where
|
||||
call_data: &[u8],
|
||||
) -> sp_blockchain::Result<(Vec<u8>, StorageProof)> {
|
||||
let at_hash = self.backend.blockchain().expect_block_hash_from_id(at)?;
|
||||
let state = self.backend.state_at(&at_hash)?;
|
||||
let state = self.backend.state_at(at_hash)?;
|
||||
|
||||
let trie_backend = state.as_trie_backend();
|
||||
|
||||
|
||||
@@ -414,14 +414,14 @@ where
|
||||
}
|
||||
|
||||
/// Get a reference to the state at a given block.
|
||||
pub fn state_at(&self, hash: &Block::Hash) -> sp_blockchain::Result<B::State> {
|
||||
pub fn state_at(&self, hash: Block::Hash) -> sp_blockchain::Result<B::State> {
|
||||
self.backend.state_at(hash)
|
||||
}
|
||||
|
||||
/// Get the code at a given block.
|
||||
pub fn code_at(&self, id: &BlockId<Block>) -> sp_blockchain::Result<Vec<u8>> {
|
||||
let hash = self.backend.blockchain().expect_block_hash_from_id(id)?;
|
||||
Ok(StorageProvider::storage(self, &hash, &StorageKey(well_known_keys::CODE.to_vec()))?
|
||||
Ok(StorageProvider::storage(self, hash, &StorageKey(well_known_keys::CODE.to_vec()))?
|
||||
.expect(
|
||||
"None is returned if there's no value stored for the given key;\
|
||||
':code' key is always defined; qed",
|
||||
@@ -586,7 +586,7 @@ where
|
||||
Some(storage_changes) => {
|
||||
let storage_changes = match storage_changes {
|
||||
sc_consensus::StorageChanges::Changes(storage_changes) => {
|
||||
self.backend.begin_state_operation(&mut operation.op, &parent_hash)?;
|
||||
self.backend.begin_state_operation(&mut operation.op, parent_hash)?;
|
||||
let (main_sc, child_sc, offchain_sc, tx, _, tx_index) =
|
||||
storage_changes.into_inner();
|
||||
|
||||
@@ -813,7 +813,7 @@ where
|
||||
Block::new(import_block.header.clone(), body.clone()),
|
||||
)?;
|
||||
|
||||
let state = self.backend.state_at(parent_hash)?;
|
||||
let state = self.backend.state_at(*parent_hash)?;
|
||||
let gen_storage_changes = runtime_api
|
||||
.into_storage_changes(&state, *parent_hash)
|
||||
.map_err(sp_blockchain::Error::Storage)?;
|
||||
@@ -877,17 +877,17 @@ where
|
||||
// plugable we cannot make a better choice here. usages that need
|
||||
// an accurate "best" block need to go through `SelectChain`
|
||||
// instead.
|
||||
operation.op.mark_head(&block)?;
|
||||
operation.op.mark_head(block)?;
|
||||
}
|
||||
|
||||
let enacted = route_from_finalized.enacted();
|
||||
assert!(enacted.len() > 0);
|
||||
for finalize_new in &enacted[..enacted.len() - 1] {
|
||||
operation.op.mark_finalized(&finalize_new.hash, None)?;
|
||||
operation.op.mark_finalized(finalize_new.hash, None)?;
|
||||
}
|
||||
|
||||
assert_eq!(enacted.last().map(|e| e.hash), Some(block));
|
||||
operation.op.mark_finalized(&block, justification)?;
|
||||
operation.op.mark_finalized(block, justification)?;
|
||||
|
||||
if notify {
|
||||
let finalized =
|
||||
@@ -1033,7 +1033,7 @@ where
|
||||
};
|
||||
match hash_and_number {
|
||||
Some((hash, number)) =>
|
||||
if self.backend.have_state_at(&hash, number) {
|
||||
if self.backend.have_state_at(hash, number) {
|
||||
Ok(BlockStatus::InChainWithState)
|
||||
} else {
|
||||
Ok(BlockStatus::InChainPruned)
|
||||
@@ -1053,7 +1053,7 @@ where
|
||||
/// Get block body by id.
|
||||
pub fn body(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
) -> sp_blockchain::Result<Option<Vec<<Block as BlockT>::Extrinsic>>> {
|
||||
self.backend.blockchain().body(hash)
|
||||
}
|
||||
@@ -1151,7 +1151,7 @@ where
|
||||
{
|
||||
fn read_proof(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
keys: &mut dyn Iterator<Item = &[u8]>,
|
||||
) -> sp_blockchain::Result<StorageProof> {
|
||||
self.state_at(hash)
|
||||
@@ -1160,7 +1160,7 @@ where
|
||||
|
||||
fn read_child_proof(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
child_info: &ChildInfo,
|
||||
keys: &mut dyn Iterator<Item = &[u8]>,
|
||||
) -> sp_blockchain::Result<StorageProof> {
|
||||
@@ -1170,16 +1170,16 @@ where
|
||||
|
||||
fn execution_proof(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
) -> sp_blockchain::Result<(Vec<u8>, StorageProof)> {
|
||||
self.executor.prove_execution(&BlockId::Hash(*hash), method, call_data)
|
||||
self.executor.prove_execution(&BlockId::Hash(hash), method, call_data)
|
||||
}
|
||||
|
||||
fn read_proof_collection(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
start_key: &[Vec<u8>],
|
||||
size_limit: usize,
|
||||
) -> sp_blockchain::Result<(CompactProof, u32)> {
|
||||
@@ -1198,14 +1198,14 @@ where
|
||||
|
||||
fn storage_collection(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
start_key: &[Vec<u8>],
|
||||
size_limit: usize,
|
||||
) -> sp_blockchain::Result<Vec<(KeyValueStorageLevel, bool)>> {
|
||||
if start_key.len() > MAX_NESTED_TRIE_DEPTH {
|
||||
return Err(Error::Backend("Invalid start key.".to_string()))
|
||||
}
|
||||
let state = self.state_at(&hash)?;
|
||||
let state = self.state_at(hash)?;
|
||||
let child_info = |storage_key: &Vec<u8>| -> sp_blockchain::Result<ChildInfo> {
|
||||
let storage_key = PrefixedStorageKey::new_ref(storage_key);
|
||||
match ChildType::from_prefixed_key(storage_key) {
|
||||
@@ -1398,7 +1398,7 @@ where
|
||||
{
|
||||
fn storage_keys(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
key_prefix: &StorageKey,
|
||||
) -> sp_blockchain::Result<Vec<StorageKey>> {
|
||||
let keys = self.state_at(hash)?.keys(&key_prefix.0).into_iter().map(StorageKey).collect();
|
||||
@@ -1407,7 +1407,7 @@ where
|
||||
|
||||
fn storage_pairs(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
key_prefix: &StorageKey,
|
||||
) -> sp_blockchain::Result<Vec<(StorageKey, StorageData)>> {
|
||||
let state = self.state_at(hash)?;
|
||||
@@ -1424,7 +1424,7 @@ where
|
||||
|
||||
fn storage_keys_iter<'a>(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
prefix: Option<&'a StorageKey>,
|
||||
start_key: Option<&StorageKey>,
|
||||
) -> sp_blockchain::Result<KeyIterator<'a, B::State, Block>> {
|
||||
@@ -1435,7 +1435,7 @@ where
|
||||
|
||||
fn child_storage_keys_iter<'a>(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
child_info: ChildInfo,
|
||||
prefix: Option<&'a StorageKey>,
|
||||
start_key: Option<&StorageKey>,
|
||||
@@ -1447,7 +1447,7 @@ where
|
||||
|
||||
fn storage(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
key: &StorageKey,
|
||||
) -> sp_blockchain::Result<Option<StorageData>> {
|
||||
Ok(self
|
||||
@@ -1459,7 +1459,7 @@ where
|
||||
|
||||
fn storage_hash(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
key: &StorageKey,
|
||||
) -> sp_blockchain::Result<Option<Block::Hash>> {
|
||||
self.state_at(hash)?
|
||||
@@ -1469,7 +1469,7 @@ where
|
||||
|
||||
fn child_storage_keys(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
child_info: &ChildInfo,
|
||||
key_prefix: &StorageKey,
|
||||
) -> sp_blockchain::Result<Vec<StorageKey>> {
|
||||
@@ -1484,7 +1484,7 @@ where
|
||||
|
||||
fn child_storage(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
child_info: &ChildInfo,
|
||||
key: &StorageKey,
|
||||
) -> sp_blockchain::Result<Option<StorageData>> {
|
||||
@@ -1497,7 +1497,7 @@ where
|
||||
|
||||
fn child_storage_hash(
|
||||
&self,
|
||||
hash: &<Block as BlockT>::Hash,
|
||||
hash: <Block as BlockT>::Hash,
|
||||
child_info: &ChildInfo,
|
||||
key: &StorageKey,
|
||||
) -> sp_blockchain::Result<Option<Block::Hash>> {
|
||||
@@ -1683,7 +1683,7 @@ where
|
||||
|
||||
fn state_at(&self, at: &BlockId<Block>) -> Result<Self::StateBackend, sp_api::ApiError> {
|
||||
let hash = self.backend.blockchain().expect_block_hash_from_id(at)?;
|
||||
self.state_at(&hash).map_err(Into::into)
|
||||
self.state_at(hash).map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1844,17 +1844,17 @@ where
|
||||
fn apply_finality(
|
||||
&self,
|
||||
operation: &mut ClientImportOperation<Block, B>,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
justification: Option<Justification>,
|
||||
notify: bool,
|
||||
) -> sp_blockchain::Result<()> {
|
||||
let last_best = self.backend.blockchain().info().best_hash;
|
||||
self.apply_finality_with_block_hash(operation, *hash, justification, last_best, notify)
|
||||
self.apply_finality_with_block_hash(operation, hash, justification, last_best, notify)
|
||||
}
|
||||
|
||||
fn finalize_block(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
justification: Option<Justification>,
|
||||
notify: bool,
|
||||
) -> sp_blockchain::Result<()> {
|
||||
@@ -1873,7 +1873,7 @@ where
|
||||
fn apply_finality(
|
||||
&self,
|
||||
operation: &mut ClientImportOperation<Block, B>,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
justification: Option<Justification>,
|
||||
notify: bool,
|
||||
) -> sp_blockchain::Result<()> {
|
||||
@@ -1882,7 +1882,7 @@ where
|
||||
|
||||
fn finalize_block(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
justification: Option<Justification>,
|
||||
notify: bool,
|
||||
) -> sp_blockchain::Result<()> {
|
||||
@@ -1939,7 +1939,7 @@ where
|
||||
{
|
||||
fn block_body(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
hash: Block::Hash,
|
||||
) -> sp_blockchain::Result<Option<Vec<<Block as BlockT>::Extrinsic>>> {
|
||||
self.body(hash)
|
||||
}
|
||||
@@ -1948,7 +1948,7 @@ where
|
||||
Ok(match self.header(id)? {
|
||||
Some(header) => {
|
||||
let hash = header.hash();
|
||||
match (self.body(&hash)?, self.justifications(&hash)?) {
|
||||
match (self.body(hash)?, self.justifications(hash)?) {
|
||||
(Some(extrinsics), justifications) =>
|
||||
Some(SignedBlock { block: Block::new(header, extrinsics), justifications }),
|
||||
_ => None,
|
||||
@@ -1962,7 +1962,7 @@ where
|
||||
Client::block_status(self, id)
|
||||
}
|
||||
|
||||
fn justifications(&self, hash: &Block::Hash) -> sp_blockchain::Result<Option<Justifications>> {
|
||||
fn justifications(&self, hash: Block::Hash) -> sp_blockchain::Result<Option<Justifications>> {
|
||||
self.backend.blockchain().justifications(hash)
|
||||
}
|
||||
|
||||
@@ -1970,18 +1970,15 @@ where
|
||||
self.backend.blockchain().hash(number)
|
||||
}
|
||||
|
||||
fn indexed_transaction(&self, hash: &Block::Hash) -> sp_blockchain::Result<Option<Vec<u8>>> {
|
||||
fn indexed_transaction(&self, hash: Block::Hash) -> sp_blockchain::Result<Option<Vec<u8>>> {
|
||||
self.backend.blockchain().indexed_transaction(hash)
|
||||
}
|
||||
|
||||
fn has_indexed_transaction(&self, hash: &Block::Hash) -> sp_blockchain::Result<bool> {
|
||||
fn has_indexed_transaction(&self, hash: Block::Hash) -> sp_blockchain::Result<bool> {
|
||||
self.backend.blockchain().has_indexed_transaction(hash)
|
||||
}
|
||||
|
||||
fn block_indexed_body(
|
||||
&self,
|
||||
hash: &Block::Hash,
|
||||
) -> sp_blockchain::Result<Option<Vec<Vec<u8>>>> {
|
||||
fn block_indexed_body(&self, hash: Block::Hash) -> sp_blockchain::Result<Option<Vec<Vec<u8>>>> {
|
||||
self.backend.blockchain().block_indexed_body(hash)
|
||||
}
|
||||
|
||||
@@ -2085,7 +2082,7 @@ where
|
||||
|
||||
self.backend
|
||||
.blockchain()
|
||||
.block_indexed_body(&hash)
|
||||
.block_indexed_body(hash)
|
||||
.map_err(|e| sp_transaction_storage_proof::Error::Application(Box::new(e)))
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ fn block_builder_works_with_transactions() {
|
||||
.expect("block 1 was just imported. qed");
|
||||
|
||||
assert_eq!(client.chain_info().best_number, 1);
|
||||
assert_ne!(client.state_at(&hash1).unwrap().pairs(), client.state_at(&hash0).unwrap().pairs());
|
||||
assert_ne!(client.state_at(hash1).unwrap().pairs(), client.state_at(hash0).unwrap().pairs());
|
||||
assert_eq!(
|
||||
client
|
||||
.runtime_api()
|
||||
@@ -405,10 +405,10 @@ fn block_builder_does_not_include_invalid() {
|
||||
|
||||
assert_eq!(client.chain_info().best_number, 1);
|
||||
assert_ne!(
|
||||
client.state_at(&hashof1).unwrap().pairs(),
|
||||
client.state_at(&hashof0).unwrap().pairs()
|
||||
client.state_at(hashof1).unwrap().pairs(),
|
||||
client.state_at(hashof0).unwrap().pairs()
|
||||
);
|
||||
assert_eq!(client.body(&hashof1).unwrap().unwrap().len(), 1)
|
||||
assert_eq!(client.body(hashof1).unwrap().unwrap().len(), 1)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -870,7 +870,7 @@ fn import_with_justification() {
|
||||
.unwrap()
|
||||
.block;
|
||||
block_on(client.import(BlockOrigin::Own, a2.clone())).unwrap();
|
||||
client.finalize_block(&a2.hash(), None).unwrap();
|
||||
client.finalize_block(a2.hash(), None).unwrap();
|
||||
|
||||
// A2 -> A3
|
||||
let justification = Justifications::from((TEST_ENGINE_ID, vec![1, 2, 3]));
|
||||
@@ -884,11 +884,11 @@ fn import_with_justification() {
|
||||
|
||||
assert_eq!(client.chain_info().finalized_hash, a3.hash());
|
||||
|
||||
assert_eq!(client.justifications(&a3.hash()).unwrap(), Some(justification));
|
||||
assert_eq!(client.justifications(a3.hash()).unwrap(), Some(justification));
|
||||
|
||||
assert_eq!(client.justifications(&a1.hash()).unwrap(), None);
|
||||
assert_eq!(client.justifications(a1.hash()).unwrap(), None);
|
||||
|
||||
assert_eq!(client.justifications(&a2.hash()).unwrap(), None);
|
||||
assert_eq!(client.justifications(a2.hash()).unwrap(), None);
|
||||
|
||||
finality_notification_check(&mut finality_notifications, &[a1.hash(), a2.hash()], &[]);
|
||||
finality_notification_check(&mut finality_notifications, &[a3.hash()], &[]);
|
||||
@@ -999,7 +999,7 @@ fn finalizing_diverged_block_should_trigger_reorg() {
|
||||
|
||||
// we finalize block B1 which is on a different branch from current best
|
||||
// which should trigger a re-org.
|
||||
ClientExt::finalize_block(&client, &b1.hash(), None).unwrap();
|
||||
ClientExt::finalize_block(&client, b1.hash(), None).unwrap();
|
||||
|
||||
// B1 should now be the latest finalized
|
||||
assert_eq!(client.chain_info().finalized_hash, b1.hash());
|
||||
@@ -1023,7 +1023,7 @@ fn finalizing_diverged_block_should_trigger_reorg() {
|
||||
|
||||
assert_eq!(client.chain_info().best_hash, b3.hash());
|
||||
|
||||
ClientExt::finalize_block(&client, &b3.hash(), None).unwrap();
|
||||
ClientExt::finalize_block(&client, b3.hash(), None).unwrap();
|
||||
|
||||
finality_notification_check(&mut finality_notifications, &[b1.hash()], &[]);
|
||||
finality_notification_check(&mut finality_notifications, &[b2.hash(), b3.hash()], &[a2.hash()]);
|
||||
@@ -1121,7 +1121,7 @@ fn finality_notifications_content() {
|
||||
|
||||
// Postpone import to test behavior of import of finalized block.
|
||||
|
||||
ClientExt::finalize_block(&client, &a2.hash(), None).unwrap();
|
||||
ClientExt::finalize_block(&client, a2.hash(), None).unwrap();
|
||||
|
||||
// Import and finalize D4
|
||||
block_on(client.import_as_final(BlockOrigin::Own, d4.clone())).unwrap();
|
||||
@@ -1285,7 +1285,7 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
|
||||
// we will finalize A2 which should make it impossible to import a new
|
||||
// B3 at the same height but that doesn't include it
|
||||
ClientExt::finalize_block(&client, &a2.hash(), None).unwrap();
|
||||
ClientExt::finalize_block(&client, a2.hash(), None).unwrap();
|
||||
|
||||
let import_err = block_on(client.import(BlockOrigin::Own, b3)).err().unwrap();
|
||||
let expected_err =
|
||||
@@ -1320,7 +1320,7 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
.unwrap()
|
||||
.block;
|
||||
block_on(client.import(BlockOrigin::Own, a3.clone())).unwrap();
|
||||
ClientExt::finalize_block(&client, &a3.hash(), None).unwrap();
|
||||
ClientExt::finalize_block(&client, a3.hash(), None).unwrap();
|
||||
|
||||
finality_notification_check(&mut finality_notifications, &[a1.hash(), a2.hash()], &[]);
|
||||
|
||||
@@ -1620,7 +1620,7 @@ fn storage_keys_iter_prefix_and_start_key_works() {
|
||||
let child_prefix = StorageKey(b"sec".to_vec());
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys_iter(&block_hash, Some(&prefix), None)
|
||||
.storage_keys_iter(block_hash, Some(&prefix), None)
|
||||
.unwrap()
|
||||
.map(|x| x.0)
|
||||
.collect();
|
||||
@@ -1635,7 +1635,7 @@ fn storage_keys_iter_prefix_and_start_key_works() {
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys_iter(
|
||||
&block_hash,
|
||||
block_hash,
|
||||
Some(&prefix),
|
||||
Some(&StorageKey(array_bytes::hex2bytes_unchecked("3a636f6465"))),
|
||||
)
|
||||
@@ -1646,7 +1646,7 @@ fn storage_keys_iter_prefix_and_start_key_works() {
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys_iter(
|
||||
&block_hash,
|
||||
block_hash,
|
||||
Some(&prefix),
|
||||
Some(&StorageKey(array_bytes::hex2bytes_unchecked("3a686561707061676573"))),
|
||||
)
|
||||
@@ -1656,7 +1656,7 @@ fn storage_keys_iter_prefix_and_start_key_works() {
|
||||
assert_eq!(res, Vec::<Vec<u8>>::new());
|
||||
|
||||
let res: Vec<_> = client
|
||||
.child_storage_keys_iter(&block_hash, child_info.clone(), Some(&child_prefix), None)
|
||||
.child_storage_keys_iter(block_hash, child_info.clone(), Some(&child_prefix), None)
|
||||
.unwrap()
|
||||
.map(|x| x.0)
|
||||
.collect();
|
||||
@@ -1664,7 +1664,7 @@ fn storage_keys_iter_prefix_and_start_key_works() {
|
||||
|
||||
let res: Vec<_> = client
|
||||
.child_storage_keys_iter(
|
||||
&block_hash,
|
||||
block_hash,
|
||||
child_info,
|
||||
None,
|
||||
Some(&StorageKey(b"second".to_vec())),
|
||||
@@ -1684,7 +1684,7 @@ fn storage_keys_iter_works() {
|
||||
let prefix = StorageKey(array_bytes::hex2bytes_unchecked(""));
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys_iter(&block_hash, Some(&prefix), None)
|
||||
.storage_keys_iter(block_hash, Some(&prefix), None)
|
||||
.unwrap()
|
||||
.take(9)
|
||||
.map(|x| array_bytes::bytes2hex("", &x.0))
|
||||
@@ -1706,7 +1706,7 @@ fn storage_keys_iter_works() {
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys_iter(
|
||||
&block_hash,
|
||||
block_hash,
|
||||
Some(&prefix),
|
||||
Some(&StorageKey(array_bytes::hex2bytes_unchecked("3a636f6465"))),
|
||||
)
|
||||
@@ -1729,7 +1729,7 @@ fn storage_keys_iter_works() {
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys_iter(
|
||||
&block_hash,
|
||||
block_hash,
|
||||
Some(&prefix),
|
||||
Some(&StorageKey(array_bytes::hex2bytes_unchecked(
|
||||
"7d5007603a7f5dd729d51d93cf695d6465789443bb967c0d1fe270e388c96eaa",
|
||||
|
||||
Reference in New Issue
Block a user