mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 07:25:44 +00:00
Remove transaction-pool test-helpers feature (#10571)
* Remove transaction-pool `test-helpers` feature `test-helpers` feature is a bad idea in general, because once the feature is enabled somewhere in the workspace, it is enabled anywhere. While removing the feature, the tests were also rewritten to get rid off other "only test" related code. Contributes towards: https://github.com/paritytech/substrate/issues/9727 * Apply suggestions from code review Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Fix benches Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -23,11 +23,11 @@ use futures::{
|
||||
executor::block_on,
|
||||
future::{ready, Ready},
|
||||
};
|
||||
use sc_transaction_pool::{test_helpers::*, *};
|
||||
use sc_transaction_pool::*;
|
||||
use sp_core::blake2_256;
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::Block as BlockT,
|
||||
traits::{Block as BlockT, NumberFor},
|
||||
transaction_validity::{
|
||||
InvalidTransaction, TransactionSource, TransactionTag as Tag, TransactionValidity,
|
||||
ValidTransaction,
|
||||
@@ -63,7 +63,7 @@ impl ChainApi for TestApi {
|
||||
&self,
|
||||
at: &BlockId<Self::Block>,
|
||||
_source: TransactionSource,
|
||||
uxt: test_helpers::ExtrinsicFor<Self>,
|
||||
uxt: <Self::Block as BlockT>::Extrinsic,
|
||||
) -> Self::ValidationFuture {
|
||||
let nonce = uxt.transfer().nonce;
|
||||
let from = uxt.transfer().from.clone();
|
||||
@@ -89,7 +89,7 @@ impl ChainApi for TestApi {
|
||||
fn block_id_to_number(
|
||||
&self,
|
||||
at: &BlockId<Self::Block>,
|
||||
) -> Result<Option<test_helpers::NumberFor<Self>>, Self::Error> {
|
||||
) -> Result<Option<NumberFor<Self::Block>>, Self::Error> {
|
||||
Ok(match at {
|
||||
BlockId::Number(num) => Some(*num),
|
||||
BlockId::Hash(_) => None,
|
||||
@@ -99,14 +99,14 @@ impl ChainApi for TestApi {
|
||||
fn block_id_to_hash(
|
||||
&self,
|
||||
at: &BlockId<Self::Block>,
|
||||
) -> Result<Option<test_helpers::BlockHash<Self>>, Self::Error> {
|
||||
) -> Result<Option<<Self::Block as BlockT>::Hash>, Self::Error> {
|
||||
Ok(match at {
|
||||
BlockId::Number(num) => Some(H256::from_low_u64_be(*num)).into(),
|
||||
BlockId::Hash(_) => None,
|
||||
})
|
||||
}
|
||||
|
||||
fn hash_and_length(&self, uxt: &test_helpers::ExtrinsicFor<Self>) -> (H256, usize) {
|
||||
fn hash_and_length(&self, uxt: &<Self::Block as BlockT>::Extrinsic) -> (H256, usize) {
|
||||
let encoded = uxt.encode();
|
||||
(blake2_256(&encoded).into(), encoded.len())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user