mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Name all the tasks! (#6726)
* Remove any implementation of `Spawn` or `Executor` from our task executors * Fix compilation * Rename `SpawnBlockingExecutor` * Update primitives/core/src/traits.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fix tests Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -37,9 +37,9 @@ use substrate_test_runtime_client::{
|
||||
runtime::{Hash, Block, Header}, TestClient, ClientBlockImportExt,
|
||||
};
|
||||
use sp_api::{InitializeBlock, StorageTransactionCache, ProofRecorder, OffchainOverlayedChanges};
|
||||
use sp_consensus::{BlockOrigin};
|
||||
use sp_consensus::BlockOrigin;
|
||||
use sc_executor::{NativeExecutor, WasmExecutionMethod, RuntimeVersion, NativeVersion};
|
||||
use sp_core::{H256, tasks::executor as tasks_executor, NativeOrEncoded};
|
||||
use sp_core::{H256, NativeOrEncoded, testing::TaskExecutor};
|
||||
use sc_client_api::{
|
||||
blockchain::Info, backend::NewBlockState, Backend as ClientBackend, ProofProvider,
|
||||
in_mem::{Backend as InMemBackend, Blockchain as InMemoryBlockchain},
|
||||
@@ -317,7 +317,7 @@ fn execution_proof_is_generated_and_checked() {
|
||||
// check remote execution proof locally
|
||||
let local_result = check_execution_proof::<_, _, BlakeTwo256>(
|
||||
&local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
&RemoteCallRequest {
|
||||
block: substrate_test_runtime_client::runtime::Hash::default(),
|
||||
header: remote_header,
|
||||
@@ -345,7 +345,7 @@ fn execution_proof_is_generated_and_checked() {
|
||||
// check remote execution proof locally
|
||||
let execution_result = check_execution_proof_with_make_header::<_, _, BlakeTwo256, _>(
|
||||
&local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
&RemoteCallRequest {
|
||||
block: substrate_test_runtime_client::runtime::Hash::default(),
|
||||
header: remote_header,
|
||||
@@ -479,7 +479,7 @@ fn prepare_for_read_proof_check() -> (TestChecker, Header, StorageProof, u32) {
|
||||
let local_checker = LightDataChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
(local_checker, remote_block_header, remote_read_proof, heap_pages)
|
||||
}
|
||||
@@ -527,7 +527,7 @@ fn prepare_for_read_child_proof_check() -> (TestChecker, Header, StorageProof, V
|
||||
let local_checker = LightDataChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
(local_checker, remote_block_header, remote_read_proof, child_value)
|
||||
}
|
||||
@@ -558,7 +558,7 @@ fn prepare_for_header_proof_check(insert_cht: bool) -> (TestChecker, Hash, Heade
|
||||
let local_checker = LightDataChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
(local_checker, local_cht_root, remote_block_header, remote_header_proof)
|
||||
}
|
||||
@@ -642,7 +642,7 @@ fn changes_proof_is_generated_and_checked_when_headers_are_not_pruned() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
let local_checker = &local_checker as &dyn FetchChecker<Block>;
|
||||
let max = remote_client.chain_info().best_number;
|
||||
@@ -717,7 +717,7 @@ fn changes_proof_is_generated_and_checked_when_headers_are_pruned() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(local_storage)),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
|
||||
// check proof on local client
|
||||
@@ -752,7 +752,7 @@ fn check_changes_proof_fails_if_proof_is_wrong() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
let local_checker = &local_checker as &dyn FetchChecker<Block>;
|
||||
let max = remote_client.chain_info().best_number;
|
||||
@@ -840,7 +840,7 @@ fn check_changes_tries_proof_fails_if_proof_is_wrong() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
assert!(local_checker.check_changes_tries_proof(4, &remote_proof.roots,
|
||||
remote_proof.roots_proof.clone()).is_err());
|
||||
@@ -851,7 +851,7 @@ fn check_changes_tries_proof_fails_if_proof_is_wrong() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(local_storage)),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
let result = local_checker.check_changes_tries_proof(
|
||||
4, &remote_proof.roots, StorageProof::empty()
|
||||
@@ -869,7 +869,7 @@ fn check_body_proof_faulty() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
|
||||
let body_request = RemoteBodyRequest {
|
||||
@@ -893,7 +893,7 @@ fn check_body_proof_of_same_data_should_succeed() {
|
||||
let local_checker = TestChecker::new(
|
||||
Arc::new(DummyBlockchain::new(DummyStorage::new())),
|
||||
local_executor(),
|
||||
tasks_executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
);
|
||||
|
||||
let body_request = RemoteBodyRequest {
|
||||
|
||||
@@ -40,8 +40,7 @@ use sp_runtime::traits::{
|
||||
use substrate_test_runtime::TestAPI;
|
||||
use sp_state_machine::backend::Backend as _;
|
||||
use sp_api::{ProvideRuntimeApi, OffchainOverlayedChanges};
|
||||
use sp_core::tasks::executor as tasks_executor;
|
||||
use sp_core::{H256, ChangesTrieConfiguration, blake2_256};
|
||||
use sp_core::{H256, ChangesTrieConfiguration, blake2_256, testing::TaskExecutor};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
use sp_consensus::{
|
||||
@@ -165,6 +164,7 @@ fn construct_block(
|
||||
let mut offchain_overlay = OffchainOverlayedChanges::default();
|
||||
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 task_executor = Box::new(TaskExecutor::new());
|
||||
|
||||
StateMachine::new(
|
||||
backend,
|
||||
@@ -176,7 +176,7 @@ fn construct_block(
|
||||
&header.encode(),
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
tasks_executor(),
|
||||
task_executor.clone() as Box<_>,
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
).unwrap();
|
||||
@@ -192,7 +192,7 @@ fn construct_block(
|
||||
&tx.encode(),
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
tasks_executor(),
|
||||
task_executor.clone() as Box<_>,
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
).unwrap();
|
||||
@@ -208,7 +208,7 @@ fn construct_block(
|
||||
&[],
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
tasks_executor(),
|
||||
task_executor.clone() as Box<_>,
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
).unwrap();
|
||||
@@ -262,7 +262,7 @@ fn construct_genesis_should_work_with_native() {
|
||||
&b1data,
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
tasks_executor(),
|
||||
TaskExecutor::new(),
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
).unwrap();
|
||||
@@ -298,7 +298,7 @@ fn construct_genesis_should_work_with_wasm() {
|
||||
&b1data,
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
tasks_executor(),
|
||||
TaskExecutor::new(),
|
||||
).execute(
|
||||
ExecutionStrategy::AlwaysWasm,
|
||||
).unwrap();
|
||||
@@ -334,7 +334,7 @@ fn construct_genesis_with_bad_transaction_should_panic() {
|
||||
&b1data,
|
||||
Default::default(),
|
||||
&runtime_code,
|
||||
tasks_executor(),
|
||||
TaskExecutor::new(),
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
);
|
||||
@@ -1743,7 +1743,7 @@ fn cleans_up_closed_notification_sinks_on_block_import() {
|
||||
&substrate_test_runtime_client::GenesisParameters::default().genesis_storage(),
|
||||
None,
|
||||
None,
|
||||
sp_core::tasks::executor(),
|
||||
Box::new(TaskExecutor::new()),
|
||||
Default::default(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user