sc-transcation-pool refactor (#9228)

* Use TransactionPool trait

* sc-transaction-pool-primitives

* sc-transaction-pool-api

* TP

* bye sc_transaction_graph

* fix line widths

* fix import errors

* fix import errors

* fix import errors 🤦🏾‍♂️

* fix import errors 🤦🏾‍♂️🤦🏾‍♂️🤦🏾‍♂️

* remove sp-keyring
This commit is contained in:
Seun Lanlege
2021-07-08 14:33:34 +01:00
committed by GitHub
parent 721a3b9e9c
commit 2ae9d36758
65 changed files with 384 additions and 388 deletions
@@ -17,7 +17,7 @@ parking_lot = "0.11.1"
codec = { package = "parity-scale-codec", version = "2.0.0" }
sp-blockchain = { version = "3.0.0", path = "../../../primitives/blockchain" }
sp-runtime = { version = "3.0.0", path = "../../../primitives/runtime" }
sp-transaction-pool = { version = "3.0.0", path = "../../../primitives/transaction-pool" }
sc-transaction-graph = { version = "3.0.0", path = "../../../client/transaction-pool/graph" }
sc-transaction-pool = { version = "3.0.0", path = "../../../client/transaction-pool", features = ["test-helpers"] }
sc-transaction-pool-api = { version = "3.0.0", path = "../../../client/transaction-pool/api" }
futures = { version = "0.3.1", features = ["compat"] }
derive_more = "0.99.2"
@@ -39,10 +39,10 @@ use futures::future::ready;
/// Error type used by [`TestApi`].
#[derive(Debug, derive_more::From, derive_more::Display)]
pub struct Error(sp_transaction_pool::error::Error);
pub struct Error(sc_transaction_pool_api::error::Error);
impl sp_transaction_pool::error::IntoPoolError for Error {
fn into_pool_error(self) -> Result<sp_transaction_pool::error::Error, Self> {
impl sc_transaction_pool_api::error::IntoPoolError for Error {
fn into_pool_error(self) -> Result<sc_transaction_pool_api::error::Error, Self> {
Ok(self.0)
}
}
@@ -226,7 +226,7 @@ impl TestApi {
}
}
impl sc_transaction_graph::ChainApi for TestApi {
impl sc_transaction_pool::test_helpers::ChainApi for TestApi {
type Block = Block;
type Error = Error;
type ValidationFuture = futures::future::Ready<Result<TransactionValidity, Error>>;
@@ -236,7 +236,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
&self,
at: &BlockId<Self::Block>,
_source: TransactionSource,
uxt: sc_transaction_graph::ExtrinsicFor<Self>,
uxt: sc_transaction_pool::test_helpers::ExtrinsicFor<Self>,
) -> Self::ValidationFuture {
self.validation_requests.write().push(uxt.clone());
@@ -300,7 +300,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
fn block_id_to_number(
&self,
at: &BlockId<Self::Block>,
) -> Result<Option<sc_transaction_graph::NumberFor<Self>>, Error> {
) -> Result<Option<sc_transaction_pool::test_helpers::NumberFor<Self>>, Error> {
Ok(match at {
generic::BlockId::Hash(x) => self.chain
.read()
@@ -314,7 +314,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
fn block_id_to_hash(
&self,
at: &BlockId<Self::Block>,
) -> Result<Option<sc_transaction_graph::BlockHash<Self>>, Error> {
) -> Result<Option<sc_transaction_pool::test_helpers::BlockHash<Self>>, Error> {
Ok(match at {
generic::BlockId::Hash(x) => Some(x.clone()),
generic::BlockId::Number(num) => self.chain
@@ -327,7 +327,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
fn hash_and_length(
&self,
ex: &sc_transaction_graph::ExtrinsicFor<Self>,
ex: &sc_transaction_pool::test_helpers::ExtrinsicFor<Self>,
) -> (Hash, usize) {
Self::hash_and_length_inner(ex)
}
+1 -1
View File
@@ -15,7 +15,7 @@ sc-cli = { version = "0.9.0", path = "../../client/cli" }
sc-basic-authorship = { version = "0.9.0", path = "../../client/basic-authorship" }
sc-rpc = { version = "3.0.0", path = "../../client/rpc" }
sc-transaction-pool = { version = "3.0.0", path = "../../client/transaction-pool" }
sc-transaction-graph = { version = "3.0.0", path = "../../client/transaction-pool/graph" }
sc-transaction-pool-api = { version = "3.0.0", path = "../../client/transaction-pool/api" }
sc-client-api = { version = "3.0.0", path = "../../client/api" }
sc-rpc-server = { version = "3.0.0", path = "../../client/rpc-servers" }
manual-seal = { package = "sc-consensus-manual-seal", version = "0.9.0", path = "../../client/consensus/manual-seal" }
+3 -3
View File
@@ -41,7 +41,7 @@ use sp_runtime::{generic::UncheckedExtrinsic, traits::NumberFor};
use sp_session::SessionKeys;
use sp_state_machine::Ext;
use sp_transaction_pool::runtime_api::TaggedTransactionQueue;
use sp_transaction_pool::TransactionPool;
use sc_transaction_pool_api::TransactionPool;
use crate::{ChainInfo, utils::logger};
use log::LevelFilter;
@@ -66,7 +66,7 @@ pub struct Node<T: ChainInfo> {
Block = T::Block,
Hash = <T::Block as BlockT>::Hash,
Error = sc_transaction_pool::error::Error,
InPoolTransaction = sc_transaction_graph::base_pool::Transaction<
InPoolTransaction = sc_transaction_pool::Transaction<
<T::Block as BlockT>::Hash,
<T::Block as BlockT>::Extrinsic,
>,
@@ -193,7 +193,7 @@ impl<T: ChainInfo> Node<T> {
block_import,
env,
client: client.clone(),
pool: transaction_pool.pool().clone(),
pool: transaction_pool.clone(),
commands_stream,
select_chain,
consensus_data_provider,