Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
34ea521
recover tx pool on light client
svyatonik Oct 14, 2019
4b6b1c9
Merge branch 'master' into light_tx_pool3
svyatonik Oct 16, 2019
5b207b9
revert local tests fix
svyatonik Oct 16, 2019
28b0388
removed import renamings
svyatonik Oct 22, 2019
736cabe
futures03::Future -> std::future::Future
svyatonik Oct 22, 2019
2d485e7
Update core/transaction-pool/graph/src/error.rs
svyatonik Oct 22, 2019
eecb819
replace remove_from_ready with remove_invalid
svyatonik Oct 22, 2019
b5cdc4e
avoid excess hashing
svyatonik Oct 22, 2019
184420b
Merge branch 'light_tx_pool3' of https://github.com/paritytech/substr…
svyatonik Oct 22, 2019
bf9d91b
debug -> warn
svyatonik Oct 22, 2019
e9f0d33
TransactionPool + BasicTransactionPool
svyatonik Oct 23, 2019
fc5406e
pause future tx reject when resubmitting
svyatonik Oct 23, 2019
a349d20
bump impl_version to make CI happy
svyatonik Oct 23, 2019
7e6712a
Merge branch 'master' into light_tx_pool3
svyatonik Oct 23, 2019
30c2a05
and revert back local test fixes
svyatonik Oct 23, 2019
b1340ab
alter doc to restart CI
svyatonik Oct 23, 2019
b283fc3
Transaction::clone() -> Transaction::duplicate()
svyatonik Oct 24, 2019
92c4eea
transactions -> updated_tranasctions
svyatonik Oct 24, 2019
1faa209
remove explicit consensus-common ref
svyatonik Oct 24, 2019
a8318ba
::std:: -> std::
svyatonik Oct 24, 2019
3a220bf
manual set/unset flag -> calling clusore with given flag value
svyatonik Oct 24, 2019
1c2f75e
removed comments
svyatonik Oct 24, 2019
f645a41
removed force argument
svyatonik Oct 24, 2019
441a771
BestIterator -> Box<Iterator>
svyatonik Oct 24, 2019
8d67a59
separate crate for TxPool + Maintainer trait
svyatonik Oct 25, 2019
3db29ec
long line fix
svyatonik Oct 25, 2019
a3e4662
Merge branch 'master' into light_tx_pool3
svyatonik Oct 25, 2019
b21f3ca
Merge branch 'master' into light_tx_pool3
svyatonik Nov 12, 2019
0edc893
pos-merge fix
svyatonik Nov 12, 2019
3a26f36
fix benches compilation
svyatonik Nov 12, 2019
50e99f2
Rename txpoolapi to txpool_api
tomusdrw Nov 22, 2019
a014b9f
Merge branch 'master' into light_tx_pool3
tomusdrw Nov 22, 2019
d7e67a5
Clean up.
tomusdrw Nov 22, 2019
deaedd2
Finalize merge.
tomusdrw Nov 23, 2019
6660f98
Merge branch 'master' into light_tx_pool3
svyatonik Nov 25, 2019
b6b4473
post-merge fix
svyatonik Nov 25, 2019
d36edbc
Move transaction pool api to primitives directly.
tomusdrw Nov 25, 2019
53b86fc
Consistent naming for txpool-runtime-api
tomusdrw Nov 25, 2019
2ce206b
Warn about missing docs.
tomusdrw Nov 25, 2019
446647d
Move abstraction for offchain calls to tx-pool-api.
tomusdrw Nov 25, 2019
1bd6c28
Merge RPC instantiation.
tomusdrw Nov 25, 2019
6e5d0cd
Merge branch 'master' into light_tx_pool3
tomusdrw Nov 26, 2019
f141a45
Update cargo.lock
tomusdrw Nov 26, 2019
416f609
Merge branch 'master' into light_tx_pool3
tomusdrw Nov 27, 2019
aa37301
Post merge fixes.
tomusdrw Nov 27, 2019
564d1f0
Avoid depending on client.
tomusdrw Nov 27, 2019
159a3a4
Merge branch 'master' into light_tx_pool3
gavofyork Nov 27, 2019
a90a7cd
Fix build
gavofyork Nov 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
separate crate for TxPool + Maintainer trait
  • Loading branch information
svyatonik committed Oct 25, 2019
commit 8d67a59de56cfbe628922969ca3ed39bb79fee53
27 changes: 24 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ members = [
"core/test-runtime",
"core/test-runtime/client",
"core/transaction-pool",
"core/transaction-pool/api",
"core/transaction-pool/graph",
"core/trie",
"core/utils/fork-tree",
Expand Down
3 changes: 2 additions & 1 deletion core/basic-authorship/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ client = { package = "substrate-client", path = "../../core/client" }
consensus_common = { package = "substrate-consensus-common", path = "../../core/consensus/common" }
inherents = { package = "substrate-inherents", path = "../inherents" }
substrate-telemetry = { path = "../telemetry" }
transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
txpoolapi = { package = "substrate-transaction-pool-api", path = "../../core/transaction-pool/api" }

[dev-dependencies]
test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" }
txpool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
24 changes: 13 additions & 11 deletions core/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use sr_primitives::{
},
generic::BlockId,
};
use transaction_pool::TransactionPool;
use txpoolapi::{TransactionPool, InPoolTransaction};
use substrate_telemetry::{telemetry, CONSENSUS_INFO};

/// Proposer factory.
Expand Down Expand Up @@ -160,21 +160,23 @@ impl<Block, B, E, RA, A> Proposer<Block, SubstrateClient<B, E, Block, RA>, A> wh
let pending_iterator = self.transaction_pool.ready();

debug!("Attempting to push transactions from the pool.");
for pending in pending_iterator {
for pending_tx in pending_iterator {
if (self.now)() > deadline {
debug!("Consensus deadline reached when pushing block transactions, proceeding with proposing.");
break;
}

trace!("[{:?}] Pushing to the block.", pending.hash);
match client::block_builder::BlockBuilder::push(&mut block_builder, pending.data.clone()) {
let pending_tx_data = pending_tx.data().clone();
let pending_tx_hash = pending_tx.hash().clone();
trace!("[{:?}] Pushing to the block.", pending_tx_hash);
match client::block_builder::BlockBuilder::push(&mut block_builder, pending_tx_data) {
Ok(()) => {
debug!("[{:?}] Pushed to the block.", pending.hash);
debug!("[{:?}] Pushed to the block.", pending_tx_hash);
}
Err(error::Error::ApplyExtrinsicFailed(e)) if e.exhausted_resources() => {
if is_first {
debug!("[{:?}] Invalid transaction: FullBlock on empty block", pending.hash);
unqueue_invalid.push(pending.hash.clone());
debug!("[{:?}] Invalid transaction: FullBlock on empty block", pending_tx_hash);
unqueue_invalid.push(pending_tx_hash);
} else if skipped < MAX_SKIPPED_TRANSACTIONS {
skipped += 1;
debug!(
Expand All @@ -187,8 +189,8 @@ impl<Block, B, E, RA, A> Proposer<Block, SubstrateClient<B, E, Block, RA>, A> wh
}
}
Err(e) => {
debug!("[{:?}] Invalid transaction: {}", pending.hash, e);
unqueue_invalid.push(pending.hash.clone());
debug!("[{:?}] Invalid transaction: {}", pending_tx_hash, e);
unqueue_invalid.push(pending_tx_hash);
}
}

Expand Down Expand Up @@ -233,7 +235,7 @@ mod tests {
use std::cell::RefCell;
use consensus_common::{Environment, Proposer};
use test_client::{self, runtime::{Extrinsic, Transfer}, AccountKeyring};
use transaction_pool::BasicTransactionPool;
use txpool::{BasicPool, FullChainApi};

fn extrinsic(nonce: u64) -> Extrinsic {
Transfer {
Expand All @@ -248,7 +250,7 @@ mod tests {
fn should_cease_building_block_when_deadline_is_reached() {
// given
let client = Arc::new(test_client::new());
let txpool = Arc::new(BasicTransactionPool::default_full(Default::default(), client.clone()));
let txpool = Arc::new(BasicPool::new(Default::default(), FullChainApi::new(client.clone())));

futures::executor::block_on(
txpool.submit_at(&BlockId::number(0), vec![extrinsic(0), extrinsic(1)])
Expand Down
3 changes: 2 additions & 1 deletion core/offchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ parking_lot = "0.9.0"
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
rand = "0.7.2"
sr-primitives = { path = "../../core/sr-primitives" }
transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
txpoolapi = { package = "substrate-transaction-pool-api", path = "../../core/transaction-pool/api" }
network = { package = "substrate-network", path = "../../core/network" }
keystore = { package = "substrate-keystore", path = "../keystore" }

Expand All @@ -33,6 +33,7 @@ env_logger = "0.7.0"
client-db = { package = "substrate-client-db", path = "../../core/client/db/", default-features = true }
test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" }
tokio = "0.1.22"
txpool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }

[features]
default = []
6 changes: 3 additions & 3 deletions core/offchain/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use primitives::offchain::{
OpaqueNetworkState, OpaquePeerId, OpaqueMultiaddr, StorageKind,
};
use sr_primitives::{generic::BlockId, traits::{self, Extrinsic}};
use transaction_pool::TransactionPool;
use txpoolapi::TransactionPool;

mod http;
mod timestamp;
Expand Down Expand Up @@ -335,7 +335,7 @@ mod tests {
use client_db::offchain::LocalStorage;
use network::PeerId;
use test_client::runtime::Block;
use transaction_pool::BasicTransactionPool;
use txpool::{BasicPool, FullChainApi};

struct MockNetworkStateInfo();

Expand All @@ -353,7 +353,7 @@ mod tests {
let _ = env_logger::try_init();
let db = LocalStorage::new_test();
let client = Arc::new(test_client::new());
let pool = Arc::new(BasicTransactionPool::default_full(Default::default(), client.clone()));
let pool = Arc::new(BasicPool::new(Default::default(), FullChainApi::new(client.clone())));

let mock = Arc::new(MockNetworkStateInfo());
AsyncApi::new(
Expand Down
7 changes: 4 additions & 3 deletions core/offchain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use log::{debug, warn};
use network::NetworkStateInfo;
use primitives::{offchain, ExecutionContext};
use sr_primitives::{generic::BlockId, traits::{self, ProvideRuntimeApi}};
use transaction_pool::TransactionPool;
use txpoolapi::TransactionPool;

mod api;

Expand Down Expand Up @@ -156,7 +156,8 @@ impl<Client, Storage, Block> OffchainWorkers<
mod tests {
use super::*;
use network::{Multiaddr, PeerId};
use transaction_pool::BasicTransactionPool;
use txpool::{BasicPool, FullChainApi};
use txpoolapi::InPoolTransaction;

struct MockNetworkStateInfo();

Expand All @@ -175,7 +176,7 @@ mod tests {
// given
let _ = env_logger::try_init();
let client = Arc::new(test_client::new());
let pool = Arc::new(BasicTransactionPool::default_full(Default::default(), client.clone()));
let pool = Arc::new(BasicPool::new(Default::default(), FullChainApi::new(client.clone())));
let db = client_db::offchain::LocalStorage::new_test();
let network_state = Arc::new(MockNetworkStateInfo());

Expand Down
3 changes: 2 additions & 1 deletion core/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rpc-primitives = { package = "substrate-rpc-primitives", path = "primitives" }
state_machine = { package = "substrate-state-machine", path = "../state-machine" }
substrate-executor = { path = "../executor" }
substrate-keystore = { path = "../keystore" }
transaction_pool = { package = "substrate-transaction-pool", path = "../transaction-pool" }
txpoolapi = { package = "substrate-transaction-pool-api", path = "../transaction-pool/api" }
hash-db = { version = "0.15.2", default-features = false }
parking_lot = { version = "0.9.0" }

Expand All @@ -33,3 +33,4 @@ rustc-hex = "2.0.1"
sr-io = { path = "../sr-io" }
test-client = { package = "substrate-test-runtime-client", path = "../test-runtime/client" }
tokio = "0.1.22"
txpool = { package = "substrate-transaction-pool", path = "../transaction-pool" }
2 changes: 1 addition & 1 deletion core/rpc/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ primitives = { package = "substrate-primitives", path = "../../primitives" }
runtime_version = { package = "sr-version", path = "../../sr-version" }
serde = { version = "1.0.101", features = ["derive"] }
serde_json = "1.0.41"
txpool = { package = "substrate-transaction-graph", path = "../../transaction-pool/graph" }
txpoolapi = { package = "substrate-transaction-pool-api", path = "../../transaction-pool/api" }
rpc-primitives = { package = "substrate-rpc-primitives", path = "../../rpc/primitives" }
4 changes: 2 additions & 2 deletions core/rpc/api/src/author/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum Error {
Client(Box<dyn std::error::Error + Send>),
/// Transaction pool error,
#[display(fmt="Transaction pool error: {}", _0)]
Pool(txpool::error::Error),
Pool(txpoolapi::error::Error),
/// Verification error
#[display(fmt="Extrinsic verification error: {}", _0)]
Verification(Box<dyn std::error::Error + Send>),
Expand Down Expand Up @@ -91,7 +91,7 @@ const UNSUPPORTED_KEY_TYPE: i64 = POOL_INVALID_TX + 7;

impl From<Error> for rpc::Error {
fn from(e: Error) -> Self {
use txpool::error::{Error as PoolError};
use txpoolapi::error::{Error as PoolError};

match e {
Error::BadFormat(e) => rpc::Error {
Expand Down
8 changes: 3 additions & 5 deletions core/rpc/api/src/author/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ pub mod hash;

use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use primitives::{
Bytes
};
use primitives::Bytes;
use txpoolapi::TransactionStatus;
use self::error::{FutureResult, Result};
use txpool::watcher::Status;

pub use self::gen_client::Client as AuthorClient;

Expand Down Expand Up @@ -69,7 +67,7 @@ pub trait AuthorApi<Hash, BlockHash> {
)]
fn watch_extrinsic(&self,
metadata: Self::Metadata,
subscriber: Subscriber<Status<Hash, BlockHash>>,
subscriber: Subscriber<TransactionStatus<Hash, BlockHash>>,
bytes: Bytes
);

Expand Down
Loading