mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Remove BlockNumber <-> u64 conversions from light-client related code (#2666)
* Remove As usage from CHT * Remove As usage from CHT (continue) * Restrict BN <-> int conversions in CT * more BN <-> u64 conversions removed * upd spec_version * Apply suggestions from code review Co-Authored-By: Gavin Wood <github@gavwood.com> * Apply suggestions from code review Co-Authored-By: Gavin Wood <github@gavwood.com> * more grumbles * fix last grumbles + compilation * too long lines * too long lines
This commit is contained in:
committed by
Gavin Wood
parent
25b88f1a1f
commit
549d9e1da1
@@ -33,7 +33,7 @@ mod tests {
|
||||
use parity_codec::{Encode, Decode, Joiner};
|
||||
use keyring::{AuthorityKeyring, AccountKeyring};
|
||||
use runtime_support::{Hashable, StorageValue, StorageMap, traits::Currency};
|
||||
use state_machine::{CodeExecutor, Externalities, TestExternalities};
|
||||
use state_machine::{CodeExecutor, Externalities, TestExternalities as CoreTestExternalities};
|
||||
use primitives::{twox_128, blake2_256, Blake2Hasher, ChangesTrieConfiguration, NeverNativeValue,
|
||||
NativeOrEncoded};
|
||||
use node_primitives::{Hash, BlockNumber, AccountId};
|
||||
@@ -52,6 +52,8 @@ mod tests {
|
||||
const COMPACT_CODE: &[u8] = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm");
|
||||
const GENESIS_HASH: [u8; 32] = [69u8; 32];
|
||||
|
||||
type TestExternalities<H> = CoreTestExternalities<H, u64>;
|
||||
|
||||
fn alice() -> AccountId {
|
||||
AccountKeyring::Alice.into()
|
||||
}
|
||||
@@ -258,7 +260,7 @@ mod tests {
|
||||
|
||||
fn new_test_ext(code: &[u8], support_changes_trie: bool) -> TestExternalities<Blake2Hasher> {
|
||||
let three = AccountId::from_raw([3u8; 32]);
|
||||
TestExternalities::new_with_code(code, GenesisConfig {
|
||||
let mut ext = TestExternalities::new_with_code(code, GenesisConfig {
|
||||
consensus: Some(Default::default()),
|
||||
system: Some(SystemConfig {
|
||||
changes_trie_config: if support_changes_trie { Some(ChangesTrieConfiguration {
|
||||
@@ -322,7 +324,9 @@ mod tests {
|
||||
grandpa: Some(GrandpaConfig {
|
||||
authorities: vec![],
|
||||
}),
|
||||
}.build_storage().unwrap().0)
|
||||
}.build_storage().unwrap().0);
|
||||
ext.changes_trie_storage().insert(0, GENESIS_HASH.into(), Default::default());
|
||||
ext
|
||||
}
|
||||
|
||||
fn construct_block(
|
||||
@@ -879,7 +883,7 @@ mod tests {
|
||||
None,
|
||||
).0.unwrap();
|
||||
|
||||
assert!(t.storage_changes_root(Default::default(), 0).is_some());
|
||||
assert!(t.storage_changes_root(GENESIS_HASH.into()).unwrap().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -889,7 +893,7 @@ mod tests {
|
||||
let mut t = new_test_ext(COMPACT_CODE, true);
|
||||
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block1.0).unwrap();
|
||||
|
||||
assert!(t.storage_changes_root(Default::default(), 0).is_some());
|
||||
assert!(t.storage_changes_root(GENESIS_HASH.into()).unwrap().is_some());
|
||||
}
|
||||
|
||||
#[cfg(feature = "benchmarks")]
|
||||
|
||||
Reference in New Issue
Block a user