mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
substrate-test-runtime migrated to "pure" frame runtime (#13737)
* substrate-test-runtime migrated to pure-frame based * test block builder: helpers added * simple renaming * basic_authorship test adjusted * block_building storage_proof test adjusted * babe: tests: should_panic expected added * babe: tests adjusted ConsensusLog::NextEpochData is now added by pallet_babe as pallet_babe::SameAuthoritiesForever trigger is used in runtime config. * beefy: tests adjusted test-substrate-runtime is now using frame::executive to finalize the block. during finalization the digests stored during block execution are checked against header digests: https://github.com/paritytech/substrate/blob/91bb2d29ca905599098a5b35eaf24867c4fbd60a/frame/executive/src/lib.rs#L585-L591 It makes impossible to directly manipulate header's digets, w/o depositing logs into system pallet storage `Digest<T: Config>`. Instead of this dedicated extrinsic allowing to store logs items (MmrRoot / AuthoritiesChange) is used. * grandpa: tests adjusted test-substrate-runtime is now using frame::executive to finalize the block. during finalization the digest logs stored during block execution are checked against header digest logs: https://github.com/paritytech/substrate/blob/91bb2d29ca905599098a5b35eaf24867c4fbd60a/frame/executive/src/lib.rs#L585-L591 It makes impossible to directly manipulate header's digets, w/o depositing logs into system pallet storage `Digest<T: Config>`. Instead of this dedicated extrinsic allowing to store logs items (ScheduledChange / ForcedChange and DigestItem::Other) is used. * network:bitswap: test adjusted The size of unchecked extrinsic was increased. The pattern used in test will be placed at the end of scale-encoded buffer. * runtime apis versions adjusted * storage keys used in runtime adjusted * wasm vs native tests removed * rpc tests: adjusted Transfer transaction processing was slightly improved, test was adjusted. * tests: sizes adjusted Runtime extrinsic size was increased. Size of data read during block execution was also increased due to usage of new pallets in runtime. Sizes were adjusted in tests. * cargo.lock update cargo update -p substrate-test-runtime -p substrate-test-runtime-client * warnings fixed * builders cleanup: includes / std * extrinsic validation cleanup * txpool: benches performance fixed * fmt * spelling * Apply suggestions from code review Co-authored-by: Davide Galassi <davxy@datawok.net> * Apply code review suggestions * Apply code review suggestions * get rid of 1063 const * renaming: UncheckedExtrinsic -> Extrinsic * test-utils-runtime: further step to pure-frame * basic-authorship: tests OK * CheckSubstrateCall added + tests fixes * test::Transfer call removed * priority / propagate / no sudo+root-testing * fixing warnings + format * cleanup: build2/nonce + format * final tests fixes all tests are passing * logs/comments removal * should_not_accept_old_signatures test removed * make txpool benches work again * Cargo.lock reset * format * sudo hack removed * txpool benches fix+cleanup * .gitignore reverted * rebase fixing + unsigned cleanup * Cargo.toml/Cargo.lock cleanup * force-debug feature removed * mmr tests fixed * make cargo-clippy happy * network sync test uses unsigned extrinsic * cleanup * ".git/.scripts/commands/fmt/fmt.sh" * push_storage_change signed call remove * GenesisConfig cleanup * fix * fix * GenesisConfig simplified * storage_keys_works: reworked * storage_keys_works: expected keys in vec * storage keys list moved to substrate-test-runtime * substrate-test: some sanity tests + GenesisConfigBuilder rework * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * Apply suggestions from code review * Review suggestions * fix * fix * beefy: generate_blocks_and_sync block_num sync with actaul value * Apply suggestions from code review Co-authored-by: Davide Galassi <davxy@datawok.net> * Update test-utils/runtime/src/genesismap.rs Co-authored-by: Davide Galassi <davxy@datawok.net> * cargo update -p sc-rpc -p sc-transaction-pool * Review suggestions * fix * doc added * slot_duration adjusted for Babe::slot_duration * small doc fixes * array_bytes::hex used instead of hex * tiny -> medium name fix * Apply suggestions from code review Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * TransferData::try_from_unchecked_extrinsic -> try_from * Update Cargo.lock --------- Co-authored-by: parity-processbot <> Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
This commit is contained in:
committed by
GitHub
parent
3a90728de0
commit
6a295e7c28
@@ -48,7 +48,8 @@ use substrate_test_runtime_client::{
|
||||
new_native_or_wasm_executor,
|
||||
prelude::*,
|
||||
runtime::{
|
||||
genesismap::{insert_genesis_block, GenesisConfig},
|
||||
currency::DOLLARS,
|
||||
genesismap::{insert_genesis_block, GenesisStorageBuilder},
|
||||
Block, BlockNumber, Digest, Hash, Header, RuntimeApi, Transfer,
|
||||
},
|
||||
AccountKeyring, BlockBuilderExt, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
|
||||
@@ -66,7 +67,7 @@ fn construct_block(
|
||||
state_root: Hash,
|
||||
txs: Vec<Transfer>,
|
||||
) -> (Vec<u8>, Hash) {
|
||||
let transactions = txs.into_iter().map(|tx| tx.into_signed_tx()).collect::<Vec<_>>();
|
||||
let transactions = txs.into_iter().map(|tx| tx.into_unchecked_extrinsic()).collect::<Vec<_>>();
|
||||
|
||||
let iter = transactions.iter().map(Encode::encode);
|
||||
let extrinsics_root = LayoutV0::<BlakeTwo256>::ordered_trie_root(iter).into();
|
||||
@@ -137,9 +138,9 @@ fn block1(genesis_hash: Hash, backend: &InMemoryBackend<BlakeTwo256>) -> (Vec<u8
|
||||
"25e5b37074063ab75c889326246640729b40d0c86932edc527bc80db0e04fe5c",
|
||||
),
|
||||
vec![Transfer {
|
||||
from: AccountKeyring::One.into(),
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Two.into(),
|
||||
amount: 69,
|
||||
amount: 69 * DOLLARS,
|
||||
nonce: 0,
|
||||
}],
|
||||
)
|
||||
@@ -167,14 +168,12 @@ fn finality_notification_check(
|
||||
|
||||
#[test]
|
||||
fn construct_genesis_should_work_with_native() {
|
||||
let mut storage = GenesisConfig::new(
|
||||
let mut storage = GenesisStorageBuilder::new(
|
||||
vec![Sr25519Keyring::One.public().into(), Sr25519Keyring::Two.public().into()],
|
||||
vec![AccountKeyring::One.into(), AccountKeyring::Two.into()],
|
||||
1000,
|
||||
None,
|
||||
Default::default(),
|
||||
1000 * DOLLARS,
|
||||
)
|
||||
.genesis_map();
|
||||
.build_storage();
|
||||
let genesis_hash = insert_genesis_block(&mut storage);
|
||||
|
||||
let backend = InMemoryBackend::from((storage, StateVersion::default()));
|
||||
@@ -200,14 +199,12 @@ fn construct_genesis_should_work_with_native() {
|
||||
|
||||
#[test]
|
||||
fn construct_genesis_should_work_with_wasm() {
|
||||
let mut storage = GenesisConfig::new(
|
||||
let mut storage = GenesisStorageBuilder::new(
|
||||
vec![Sr25519Keyring::One.public().into(), Sr25519Keyring::Two.public().into()],
|
||||
vec![AccountKeyring::One.into(), AccountKeyring::Two.into()],
|
||||
1000,
|
||||
None,
|
||||
Default::default(),
|
||||
1000 * DOLLARS,
|
||||
)
|
||||
.genesis_map();
|
||||
.build_storage();
|
||||
let genesis_hash = insert_genesis_block(&mut storage);
|
||||
|
||||
let backend = InMemoryBackend::from((storage, StateVersion::default()));
|
||||
@@ -231,39 +228,6 @@ fn construct_genesis_should_work_with_wasm() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn construct_genesis_with_bad_transaction_should_panic() {
|
||||
let mut storage = GenesisConfig::new(
|
||||
vec![Sr25519Keyring::One.public().into(), Sr25519Keyring::Two.public().into()],
|
||||
vec![AccountKeyring::One.into(), AccountKeyring::Two.into()],
|
||||
68,
|
||||
None,
|
||||
Default::default(),
|
||||
)
|
||||
.genesis_map();
|
||||
let genesis_hash = insert_genesis_block(&mut storage);
|
||||
|
||||
let backend = InMemoryBackend::from((storage, StateVersion::default()));
|
||||
let (b1data, _b1hash) = block1(genesis_hash, &backend);
|
||||
let backend_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(&backend);
|
||||
let runtime_code = backend_runtime_code.runtime_code().expect("Code is part of the backend");
|
||||
|
||||
let mut overlay = OverlayedChanges::default();
|
||||
|
||||
let r = StateMachine::new(
|
||||
&backend,
|
||||
&mut overlay,
|
||||
&new_native_or_wasm_executor(),
|
||||
"Core_execute_block",
|
||||
&b1data,
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
CallContext::Onchain,
|
||||
)
|
||||
.execute(ExecutionStrategy::NativeElseWasm);
|
||||
assert!(r.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn client_initializes_from_genesis_ok() {
|
||||
let client = substrate_test_runtime_client::new();
|
||||
@@ -273,14 +237,14 @@ fn client_initializes_from_genesis_ok() {
|
||||
.runtime_api()
|
||||
.balance_of(client.chain_info().best_hash, AccountKeyring::Alice.into())
|
||||
.unwrap(),
|
||||
1000
|
||||
1000 * DOLLARS
|
||||
);
|
||||
assert_eq!(
|
||||
client
|
||||
.runtime_api()
|
||||
.balance_of(client.chain_info().best_hash, AccountKeyring::Ferdie.into())
|
||||
.unwrap(),
|
||||
0
|
||||
0 * DOLLARS
|
||||
);
|
||||
}
|
||||
|
||||
@@ -305,7 +269,7 @@ fn block_builder_works_with_transactions() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 42,
|
||||
amount: 42 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -340,42 +304,43 @@ fn block_builder_works_with_transactions() {
|
||||
.runtime_api()
|
||||
.balance_of(client.chain_info().best_hash, AccountKeyring::Alice.into())
|
||||
.unwrap(),
|
||||
958
|
||||
958 * DOLLARS
|
||||
);
|
||||
assert_eq!(
|
||||
client
|
||||
.runtime_api()
|
||||
.balance_of(client.chain_info().best_hash, AccountKeyring::Ferdie.into())
|
||||
.unwrap(),
|
||||
42
|
||||
42 * DOLLARS
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_builder_does_not_include_invalid() {
|
||||
let mut client = substrate_test_runtime_client::new();
|
||||
|
||||
let mut builder = client.new_block(Default::default()).unwrap();
|
||||
|
||||
builder
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 42,
|
||||
amount: 42 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert!(builder
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Eve.into(),
|
||||
to: AccountKeyring::Alice.into(),
|
||||
amount: 42,
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 30 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.is_err());
|
||||
|
||||
let block = builder.build().unwrap().block;
|
||||
//transfer from Eve should not be included
|
||||
assert_eq!(block.extrinsics.len(), 1);
|
||||
block_on(client.import(BlockOrigin::Own, block)).unwrap();
|
||||
|
||||
let hashof0 = client
|
||||
@@ -491,7 +456,7 @@ fn uncles_with_multiple_forks() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 41,
|
||||
amount: 41 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -523,7 +488,7 @@ fn uncles_with_multiple_forks() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 1,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -537,7 +502,7 @@ fn uncles_with_multiple_forks() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -646,7 +611,7 @@ fn finality_target_on_longest_chain_with_multiple_forks() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 41,
|
||||
amount: 41 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -678,7 +643,7 @@ fn finality_target_on_longest_chain_with_multiple_forks() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 1,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -692,7 +657,7 @@ fn finality_target_on_longest_chain_with_multiple_forks() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -868,7 +833,7 @@ fn finality_target_with_best_not_on_longest_chain() {
|
||||
.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 41,
|
||||
amount: 41 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -993,7 +958,7 @@ fn importing_diverged_finalized_block_should_trigger_reorg() {
|
||||
b1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1048,7 +1013,7 @@ fn finalizing_diverged_block_should_trigger_reorg() {
|
||||
b1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1166,7 +1131,7 @@ fn finality_notifications_content() {
|
||||
c1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 2,
|
||||
amount: 2 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1178,7 +1143,7 @@ fn finality_notifications_content() {
|
||||
d3.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 2,
|
||||
amount: 2 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1252,7 +1217,7 @@ fn state_reverted_on_reorg() {
|
||||
a1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Bob.into(),
|
||||
amount: 10,
|
||||
amount: 10 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1265,7 +1230,7 @@ fn state_reverted_on_reorg() {
|
||||
b1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 50,
|
||||
amount: 50 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1273,19 +1238,19 @@ fn state_reverted_on_reorg() {
|
||||
// Reorg to B1
|
||||
block_on(client.import_as_best(BlockOrigin::Own, b1.clone())).unwrap();
|
||||
|
||||
assert_eq!(950, current_balance(&client));
|
||||
assert_eq!(950 * DOLLARS, current_balance(&client));
|
||||
let mut a2 = client.new_block_at(a1.hash(), Default::default(), false).unwrap();
|
||||
a2.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Charlie.into(),
|
||||
amount: 10,
|
||||
amount: 10 * DOLLARS,
|
||||
nonce: 1,
|
||||
})
|
||||
.unwrap();
|
||||
let a2 = a2.build().unwrap().block;
|
||||
// Re-org to A2
|
||||
block_on(client.import_as_best(BlockOrigin::Own, a2)).unwrap();
|
||||
assert_eq!(980, current_balance(&client));
|
||||
assert_eq!(980 * DOLLARS, current_balance(&client));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1342,7 +1307,7 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
b1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1386,7 +1351,7 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
c1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 2,
|
||||
amount: 2 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1579,7 +1544,7 @@ fn returns_status_for_pruned_blocks() {
|
||||
b1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
@@ -1718,8 +1683,9 @@ fn storage_keys_prefix_and_start_key_works() {
|
||||
res,
|
||||
[
|
||||
child_root.clone(),
|
||||
array_bytes::hex2bytes_unchecked("3a636f6465"),
|
||||
array_bytes::hex2bytes_unchecked("3a686561707061676573"),
|
||||
array_bytes::hex2bytes_unchecked("3a636f6465"), //":code"
|
||||
array_bytes::hex2bytes_unchecked("3a65787472696e7369635f696e646578"), //":extrinsic_index"
|
||||
array_bytes::hex2bytes_unchecked("3a686561707061676573"), //":heappages"
|
||||
]
|
||||
);
|
||||
|
||||
@@ -1732,7 +1698,13 @@ fn storage_keys_prefix_and_start_key_works() {
|
||||
.unwrap()
|
||||
.map(|x| x.0)
|
||||
.collect();
|
||||
assert_eq!(res, [array_bytes::hex2bytes_unchecked("3a686561707061676573")]);
|
||||
assert_eq!(
|
||||
res,
|
||||
[
|
||||
array_bytes::hex2bytes_unchecked("3a65787472696e7369635f696e646578"),
|
||||
array_bytes::hex2bytes_unchecked("3a686561707061676573")
|
||||
]
|
||||
);
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys(
|
||||
@@ -1762,54 +1734,32 @@ fn storage_keys_prefix_and_start_key_works() {
|
||||
|
||||
#[test]
|
||||
fn storage_keys_works() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
let expected_keys =
|
||||
substrate_test_runtime::storage_key_generator::get_expected_storage_hashed_keys();
|
||||
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
let block_hash = client.info().best_hash;
|
||||
|
||||
let prefix = StorageKey(array_bytes::hex2bytes_unchecked(""));
|
||||
|
||||
let res: Vec<_> = client
|
||||
.storage_keys(block_hash, Some(&prefix), None)
|
||||
.unwrap()
|
||||
.take(9)
|
||||
.take(19)
|
||||
.map(|x| array_bytes::bytes2hex("", &x.0))
|
||||
.collect();
|
||||
assert_eq!(
|
||||
res,
|
||||
[
|
||||
"00c232cf4e70a5e343317016dc805bf80a6a8cd8ad39958d56f99891b07851e0",
|
||||
"085b2407916e53a86efeb8b72dbe338c4b341dab135252f96b6ed8022209b6cb",
|
||||
"0befda6e1ca4ef40219d588a727f1271",
|
||||
"1a560ecfd2a62c2b8521ef149d0804eb621050e3988ed97dca55f0d7c3e6aa34",
|
||||
"1d66850d32002979d67dd29dc583af5b2ae2a1f71c1f35ad90fff122be7a3824",
|
||||
"237498b98d8803334286e9f0483ef513098dd3c1c22ca21c4dc155b4ef6cc204",
|
||||
"26aa394eea5630e07c48ae0c9558cef75e0621c4869aa60c02be9adcc98a0d1d",
|
||||
"29b9db10ec5bf7907d8f74b5e60aa8140c4fbdd8127a1ee5600cb98e5ec01729",
|
||||
"3a636f6465",
|
||||
]
|
||||
);
|
||||
|
||||
assert_eq!(res, expected_keys[0..19],);
|
||||
|
||||
// Starting at an empty key nothing gets skipped.
|
||||
let res: Vec<_> = client
|
||||
.storage_keys(block_hash, Some(&prefix), Some(&StorageKey("".into())))
|
||||
.unwrap()
|
||||
.take(9)
|
||||
.take(19)
|
||||
.map(|x| array_bytes::bytes2hex("", &x.0))
|
||||
.collect();
|
||||
assert_eq!(
|
||||
res,
|
||||
[
|
||||
"00c232cf4e70a5e343317016dc805bf80a6a8cd8ad39958d56f99891b07851e0",
|
||||
"085b2407916e53a86efeb8b72dbe338c4b341dab135252f96b6ed8022209b6cb",
|
||||
"0befda6e1ca4ef40219d588a727f1271",
|
||||
"1a560ecfd2a62c2b8521ef149d0804eb621050e3988ed97dca55f0d7c3e6aa34",
|
||||
"1d66850d32002979d67dd29dc583af5b2ae2a1f71c1f35ad90fff122be7a3824",
|
||||
"237498b98d8803334286e9f0483ef513098dd3c1c22ca21c4dc155b4ef6cc204",
|
||||
"26aa394eea5630e07c48ae0c9558cef75e0621c4869aa60c02be9adcc98a0d1d",
|
||||
"29b9db10ec5bf7907d8f74b5e60aa8140c4fbdd8127a1ee5600cb98e5ec01729",
|
||||
"3a636f6465",
|
||||
]
|
||||
);
|
||||
assert_eq!(res, expected_keys[0..19],);
|
||||
|
||||
// Starting at an incomplete key nothing gets skipped.
|
||||
let res: Vec<_> = client
|
||||
@@ -1824,16 +1774,12 @@ fn storage_keys_works() {
|
||||
.collect();
|
||||
assert_eq!(
|
||||
res,
|
||||
[
|
||||
"3a636f6465",
|
||||
"3a686561707061676573",
|
||||
"52008686cc27f6e5ed83a216929942f8bcd32a396f09664a5698f81371934b56",
|
||||
"5348d72ac6cc66e5d8cbecc27b0e0677503b845fe2382d819f83001781788fd5",
|
||||
"5c2d5fda66373dabf970e4fb13d277ce91c5233473321129d32b5a8085fa8133",
|
||||
"6644b9b8bc315888ac8e41a7968dc2b4141a5403c58acdf70b7e8f7e07bf5081",
|
||||
"66484000ed3f75c95fc7b03f39c20ca1e1011e5999278247d3b2f5e3c3273808",
|
||||
"7d5007603a7f5dd729d51d93cf695d6465789443bb967c0d1fe270e388c96eaa",
|
||||
]
|
||||
expected_keys
|
||||
.iter()
|
||||
.filter(|&i| i > &"3a636f64".to_string())
|
||||
.take(8)
|
||||
.cloned()
|
||||
.collect::<Vec<String>>()
|
||||
);
|
||||
|
||||
// Starting at a complete key the first key is skipped.
|
||||
@@ -1849,38 +1795,33 @@ fn storage_keys_works() {
|
||||
.collect();
|
||||
assert_eq!(
|
||||
res,
|
||||
[
|
||||
"3a686561707061676573",
|
||||
"52008686cc27f6e5ed83a216929942f8bcd32a396f09664a5698f81371934b56",
|
||||
"5348d72ac6cc66e5d8cbecc27b0e0677503b845fe2382d819f83001781788fd5",
|
||||
"5c2d5fda66373dabf970e4fb13d277ce91c5233473321129d32b5a8085fa8133",
|
||||
"6644b9b8bc315888ac8e41a7968dc2b4141a5403c58acdf70b7e8f7e07bf5081",
|
||||
"66484000ed3f75c95fc7b03f39c20ca1e1011e5999278247d3b2f5e3c3273808",
|
||||
"7d5007603a7f5dd729d51d93cf695d6465789443bb967c0d1fe270e388c96eaa",
|
||||
]
|
||||
expected_keys
|
||||
.iter()
|
||||
.filter(|&i| i > &"3a636f6465".to_string())
|
||||
.take(8)
|
||||
.cloned()
|
||||
.collect::<Vec<String>>()
|
||||
);
|
||||
|
||||
const SOME_BALANCE_KEY : &str = "26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9e2c1dc507e2035edbbd8776c440d870460c57f0008067cc01c5ff9eb2e2f9b3a94299a915a91198bd1021a6c55596f57";
|
||||
let res: Vec<_> = client
|
||||
.storage_keys(
|
||||
block_hash,
|
||||
Some(&prefix),
|
||||
Some(&StorageKey(array_bytes::hex2bytes_unchecked(
|
||||
"7d5007603a7f5dd729d51d93cf695d6465789443bb967c0d1fe270e388c96eaa",
|
||||
))),
|
||||
Some(&StorageKey(array_bytes::hex2bytes_unchecked(SOME_BALANCE_KEY))),
|
||||
)
|
||||
.unwrap()
|
||||
.take(5)
|
||||
.take(8)
|
||||
.map(|x| array_bytes::bytes2hex("", &x.0))
|
||||
.collect();
|
||||
assert_eq!(
|
||||
res,
|
||||
[
|
||||
"811ecfaadcf5f2ee1d67393247e2f71a1662d433e8ce7ff89fb0d4aa9561820b",
|
||||
"a93d74caa7ec34ea1b04ce1e5c090245f867d333f0f88278a451e45299654dc5",
|
||||
"a9ee1403384afbfc13f13be91ff70bfac057436212e53b9733914382ac942892",
|
||||
"cf722c0832b5231d35e29f319ff27389f5032bfc7bfc3ba5ed7839f2042fb99f",
|
||||
"e3b47b6c84c0493481f97c5197d2554f",
|
||||
]
|
||||
expected_keys
|
||||
.iter()
|
||||
.filter(|&i| i > &SOME_BALANCE_KEY.to_string())
|
||||
.take(8)
|
||||
.cloned()
|
||||
.collect::<Vec<String>>()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1999,7 +1940,7 @@ fn reorg_triggers_a_notification_even_for_sources_that_should_not_trigger_notifi
|
||||
b1.push_transfer(Transfer {
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 1,
|
||||
amount: 1 * DOLLARS,
|
||||
nonce: 0,
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user