mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 09:37:55 +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:
@@ -23,14 +23,17 @@ use std::{
|
||||
};
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use sp_core::{convert_hash, NativeOrEncoded, traits::CodeExecutor, offchain::storage::OffchainOverlayedChanges};
|
||||
use sp_core::{
|
||||
convert_hash, NativeOrEncoded, traits::{CodeExecutor, SpawnNamed},
|
||||
offchain::storage::OffchainOverlayedChanges,
|
||||
};
|
||||
use sp_runtime::{
|
||||
generic::BlockId, traits::{One, Block as BlockT, Header as HeaderT, HashFor},
|
||||
};
|
||||
use sp_externalities::Extensions;
|
||||
use sp_state_machine::{
|
||||
self, Backend as StateBackend, OverlayedChanges, ExecutionStrategy, create_proof_check_backend,
|
||||
execution_proof_check_on_trie_backend, ExecutionManager, StorageProof, CloneableSpawn,
|
||||
execution_proof_check_on_trie_backend, ExecutionManager, StorageProof,
|
||||
};
|
||||
use hash_db::Hasher;
|
||||
|
||||
@@ -220,7 +223,7 @@ pub fn prove_execution<Block, S, E>(
|
||||
/// Proof should include both environment preparation proof and method execution proof.
|
||||
pub fn check_execution_proof<Header, E, H>(
|
||||
executor: &E,
|
||||
spawn_handle: Box<dyn CloneableSpawn>,
|
||||
spawn_handle: Box<dyn SpawnNamed>,
|
||||
request: &RemoteCallRequest<Header>,
|
||||
remote_proof: StorageProof,
|
||||
) -> ClientResult<Vec<u8>>
|
||||
@@ -251,7 +254,7 @@ pub fn check_execution_proof<Header, E, H>(
|
||||
/// Proof should include both environment preparation proof and method execution proof.
|
||||
pub fn check_execution_proof_with_make_header<Header, E, H, MakeNextHeader>(
|
||||
executor: &E,
|
||||
spawn_handle: Box<dyn CloneableSpawn>,
|
||||
spawn_handle: Box<dyn SpawnNamed>,
|
||||
request: &RemoteCallRequest<Header>,
|
||||
remote_proof: StorageProof,
|
||||
make_next_header: MakeNextHeader,
|
||||
@@ -275,7 +278,7 @@ pub fn check_execution_proof_with_make_header<Header, E, H, MakeNextHeader>(
|
||||
let backend_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(&trie_backend);
|
||||
let runtime_code = backend_runtime_code.runtime_code()?;
|
||||
|
||||
execution_proof_check_on_trie_backend::<H, Header::Number, _>(
|
||||
execution_proof_check_on_trie_backend::<H, Header::Number, _, _>(
|
||||
&trie_backend,
|
||||
&mut changes,
|
||||
executor,
|
||||
@@ -286,7 +289,7 @@ pub fn check_execution_proof_with_make_header<Header, E, H, MakeNextHeader>(
|
||||
)?;
|
||||
|
||||
// execute method
|
||||
execution_proof_check_on_trie_backend::<H, Header::Number, _>(
|
||||
execution_proof_check_on_trie_backend::<H, Header::Number, _, _>(
|
||||
&trie_backend,
|
||||
&mut changes,
|
||||
executor,
|
||||
|
||||
@@ -24,8 +24,7 @@ use std::marker::PhantomData;
|
||||
|
||||
use hash_db::{HashDB, Hasher, EMPTY_PREFIX};
|
||||
use codec::{Decode, Encode};
|
||||
use sp_core::{convert_hash, traits::CodeExecutor};
|
||||
use sp_core::storage::{ChildInfo, ChildType};
|
||||
use sp_core::{convert_hash, traits::{CodeExecutor, SpawnNamed}, storage::{ChildInfo, ChildType}};
|
||||
use sp_runtime::traits::{
|
||||
Block as BlockT, Header as HeaderT, Hash, HashFor, NumberFor,
|
||||
AtLeast32Bit, CheckedConversion,
|
||||
@@ -33,7 +32,7 @@ use sp_runtime::traits::{
|
||||
use sp_state_machine::{
|
||||
ChangesTrieRootsStorage, ChangesTrieAnchorBlockId, ChangesTrieConfigurationRange,
|
||||
InMemoryChangesTrieStorage, TrieBackend, read_proof_check, key_changes_proof_check_with_db,
|
||||
read_child_proof_check, CloneableSpawn,
|
||||
read_child_proof_check,
|
||||
};
|
||||
pub use sp_state_machine::StorageProof;
|
||||
use sp_blockchain::{Error as ClientError, Result as ClientResult};
|
||||
@@ -46,20 +45,23 @@ pub use sc_client_api::{
|
||||
},
|
||||
cht,
|
||||
};
|
||||
use crate::blockchain::Blockchain;
|
||||
use crate::call_executor::check_execution_proof;
|
||||
use crate::{blockchain::Blockchain, call_executor::check_execution_proof};
|
||||
|
||||
/// Remote data checker.
|
||||
pub struct LightDataChecker<E, H, B: BlockT, S: BlockchainStorage<B>> {
|
||||
blockchain: Arc<Blockchain<S>>,
|
||||
executor: E,
|
||||
spawn_handle: Box<dyn CloneableSpawn>,
|
||||
spawn_handle: Box<dyn SpawnNamed>,
|
||||
_hasher: PhantomData<(B, H)>,
|
||||
}
|
||||
|
||||
impl<E, H, B: BlockT, S: BlockchainStorage<B>> LightDataChecker<E, H, B, S> {
|
||||
/// Create new light data checker.
|
||||
pub fn new(blockchain: Arc<Blockchain<S>>, executor: E, spawn_handle: Box<dyn CloneableSpawn>) -> Self {
|
||||
pub fn new(
|
||||
blockchain: Arc<Blockchain<S>>,
|
||||
executor: E,
|
||||
spawn_handle: Box<dyn SpawnNamed>,
|
||||
) -> Self {
|
||||
Self {
|
||||
blockchain, executor, spawn_handle, _hasher: PhantomData
|
||||
}
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
//! Light client components.
|
||||
|
||||
use sp_runtime::traits::{Block as BlockT, HashFor};
|
||||
use sc_client_api::CloneableSpawn;
|
||||
use std::sync::Arc;
|
||||
use sp_core::traits::CodeExecutor;
|
||||
use sp_core::traits::{CodeExecutor, SpawnNamed};
|
||||
|
||||
pub mod backend;
|
||||
pub mod blockchain;
|
||||
@@ -34,7 +33,7 @@ pub use {backend::*, blockchain::*, call_executor::*, fetcher::*};
|
||||
pub fn new_fetch_checker<E, B: BlockT, S: BlockchainStorage<B>>(
|
||||
blockchain: Arc<Blockchain<S>>,
|
||||
executor: E,
|
||||
spawn_handle: Box<dyn CloneableSpawn>,
|
||||
spawn_handle: Box<dyn SpawnNamed>,
|
||||
) -> LightDataChecker<E, HashFor<B>, B, S>
|
||||
where
|
||||
E: CodeExecutor,
|
||||
|
||||
Reference in New Issue
Block a user