mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 02:07:56 +00:00
Minor cleanup in native_executor.rs (#3218)
* Minor cleanup in native_executor.rs * Fix tests
This commit is contained in:
committed by
Bastian Köcher
parent
06268b9dba
commit
ba55d31d44
@@ -41,7 +41,7 @@ pub fn construct_genesis_block<
|
||||
mod tests {
|
||||
use super::*;
|
||||
use parity_codec::{Encode, Decode, Joiner};
|
||||
use executor::{NativeExecutionDispatch, native_executor_instance};
|
||||
use executor::native_executor_instance;
|
||||
use state_machine::{self, OverlayedChanges, ExecutionStrategy, InMemoryChangesTrieStorage};
|
||||
use state_machine::backend::InMemory;
|
||||
use test_client::{
|
||||
@@ -61,7 +61,7 @@ mod tests {
|
||||
);
|
||||
|
||||
fn executor() -> executor::NativeExecutor<Executor> {
|
||||
NativeExecutionDispatch::new(None)
|
||||
executor::NativeExecutor::new(None)
|
||||
}
|
||||
|
||||
fn construct_block(
|
||||
@@ -226,7 +226,7 @@ mod tests {
|
||||
Some(&InMemoryChangesTrieStorage::<_, u64>::new()),
|
||||
state_machine::NeverOffchainExt::new(),
|
||||
&mut overlay,
|
||||
&Executor::new(None),
|
||||
&executor(),
|
||||
"Core_execute_block",
|
||||
&b1data,
|
||||
).execute(
|
||||
|
||||
@@ -481,7 +481,7 @@ pub fn check_execution_proof<Header, E, H>(
|
||||
mod tests {
|
||||
use consensus::BlockOrigin;
|
||||
use test_client::{self, runtime::Header, ClientExt, TestClient};
|
||||
use executor::NativeExecutionDispatch;
|
||||
use executor::NativeExecutor;
|
||||
use crate::backend::{Backend, NewBlockState};
|
||||
use crate::in_mem::Backend as InMemBackend;
|
||||
use crate::light::fetcher::tests::OkCallFetcher;
|
||||
@@ -502,7 +502,7 @@ mod tests {
|
||||
).unwrap();
|
||||
|
||||
// check remote execution proof locally
|
||||
let local_executor = test_client::LocalExecutor::new(None);
|
||||
let local_executor = NativeExecutor::<test_client::LocalExecutor>::new(None);
|
||||
let local_result = check_execution_proof(&local_executor, &RemoteCallRequest {
|
||||
block: test_client::runtime::Hash::default(),
|
||||
header: test_client::runtime::Header {
|
||||
|
||||
@@ -488,7 +488,7 @@ pub mod tests {
|
||||
use parking_lot::Mutex;
|
||||
use parity_codec::Decode;
|
||||
use crate::client::tests::prepare_client_with_key_changes;
|
||||
use executor::{self, NativeExecutionDispatch};
|
||||
use executor::{self, NativeExecutor};
|
||||
use crate::error::Error as ClientError;
|
||||
use test_client::{
|
||||
self, ClientExt, blockchain::HeaderBackend, AccountKeyring,
|
||||
@@ -578,7 +578,7 @@ pub mod tests {
|
||||
None,
|
||||
crate::backend::NewBlockState::Final,
|
||||
).unwrap();
|
||||
let local_executor = test_client::LocalExecutor::new(None);
|
||||
let local_executor = NativeExecutor::<test_client::LocalExecutor>::new(None);
|
||||
let local_checker = LightDataChecker::new(Arc::new(DummyBlockchain::new(DummyStorage::new())), local_executor);
|
||||
(local_checker, remote_block_header, remote_read_proof, heap_pages)
|
||||
}
|
||||
@@ -604,7 +604,7 @@ pub mod tests {
|
||||
if insert_cht {
|
||||
local_storage.insert_cht_root(1, local_cht_root);
|
||||
}
|
||||
let local_executor = test_client::LocalExecutor::new(None);
|
||||
let local_executor = NativeExecutor::<test_client::LocalExecutor>::new(None);
|
||||
let local_checker = LightDataChecker::new(Arc::new(DummyBlockchain::new(DummyStorage::new())), local_executor);
|
||||
(local_checker, local_cht_root, remote_block_header, remote_header_proof)
|
||||
}
|
||||
@@ -665,7 +665,7 @@ pub mod tests {
|
||||
let (remote_client, local_roots, test_cases) = prepare_client_with_key_changes();
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
let local_checker = &local_checker as &dyn FetchChecker<Block>;
|
||||
let max = remote_client.info().chain.best_number;
|
||||
@@ -733,7 +733,7 @@ pub mod tests {
|
||||
local_storage.changes_tries_cht_roots.insert(0, local_cht_root);
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(local_storage)),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
|
||||
// check proof on local client
|
||||
@@ -761,7 +761,7 @@ pub mod tests {
|
||||
let (remote_client, local_roots, test_cases) = prepare_client_with_key_changes();
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
let local_checker = &local_checker as &dyn FetchChecker<Block>;
|
||||
let max = remote_client.info().chain.best_number;
|
||||
@@ -842,7 +842,7 @@ pub mod tests {
|
||||
// fails when changes trie CHT is missing from the local db
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
assert!(local_checker.check_changes_tries_proof(4, &remote_proof.roots,
|
||||
remote_proof.roots_proof.clone()).is_err());
|
||||
@@ -852,7 +852,7 @@ pub mod tests {
|
||||
local_storage.changes_tries_cht_roots.insert(0, local_cht_root);
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(local_storage)),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
assert!(local_checker.check_changes_tries_proof(4, &remote_proof.roots, vec![]).is_err());
|
||||
}
|
||||
@@ -866,7 +866,7 @@ pub mod tests {
|
||||
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
|
||||
let body_request = RemoteBodyRequest {
|
||||
@@ -889,7 +889,7 @@ pub mod tests {
|
||||
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
test_client::LocalExecutor::new(None)
|
||||
NativeExecutor::<test_client::LocalExecutor>::new(None)
|
||||
);
|
||||
|
||||
let body_request = RemoteBodyRequest {
|
||||
|
||||
Reference in New Issue
Block a user