Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
WIP
Forked at: 606c56d
Parent branch: origin/master
  • Loading branch information
cecton committed Jun 25, 2020
commit c63d5d2a1e0882797e4de4c6ff7bdffcd92c7975
12 changes: 6 additions & 6 deletions client/finality-grandpa/src/light_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ pub mod tests {
NumberFor<Block>: finality_grandpa::BlockNumberOps,
DigestFor<Block>: Encode,
BE: Backend<Block> + 'static,
for <'a > &'a Client:
Client:
HeaderBackend<Block>
+ BlockImport<Block, Error = ConsensusError, Transaction = TransactionFor<BE, Block>>
+ Finalizer<Block, BE>
Expand Down Expand Up @@ -646,7 +646,7 @@ pub mod tests {
NumberFor<Block>: finality_grandpa::BlockNumberOps,
BE: Backend<Block> + 'static,
DigestFor<Block>: Encode,
for <'a > &'a Client:
Client:
HeaderBackend<Block>
+ BlockImport<Block, Error = ConsensusError, Transaction = TransactionFor<BE, Block>>
+ Finalizer<Block, BE>
Expand Down Expand Up @@ -689,7 +689,7 @@ pub mod tests {
justification: Option<Justification>,
) -> (
ImportResult,
substrate_test_runtime_client::client::Client<substrate_test_runtime_client::LightBackend, substrate_test_runtime_client::LightExecutor, Block, substrate_test_runtime_client::runtime::RuntimeApi>,
Arc<substrate_test_runtime_client::client::Client<substrate_test_runtime_client::LightBackend, substrate_test_runtime_client::LightExecutor, Block, substrate_test_runtime_client::runtime::RuntimeApi>>,
Arc<substrate_test_runtime_client::LightBackend>,
) {
let (client, backend) = substrate_test_runtime_client::new_light();
Expand All @@ -713,7 +713,7 @@ pub mod tests {

(
do_import_block::<_, _, _, TestJustification>(
&client,
client.clone(),
&mut import_data,
block,
new_cache,
Expand Down Expand Up @@ -849,7 +849,7 @@ pub mod tests {

// import finality proof
do_import_finality_proof::<_, _, _, TestJustification>(
&client,
client.clone(),
backend,
&ClosureAuthoritySetForFinalityChecker(
|_, _, _| Ok(updated_set.clone())
Expand All @@ -872,7 +872,7 @@ pub mod tests {
).unwrap();

// verify that new authorities set has been saved to the aux storage
let data = load_aux_import_data(Default::default(), &client, &TestApi::new(initial_set)).unwrap();
let data = load_aux_import_data(Default::default(), &*client, &TestApi::new(initial_set)).unwrap();
assert_eq!(data.authority_set.authorities(), updated_set);
}
}
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl TestNetFactory for GrandpaTestNet {
(
BlockImportAdapter::new_light(import),
None,
Some(proof_import),
Some(proof_import.clone()),
Some(finality_proof_req_builder),
Mutex::new(None),
)
Expand Down
3 changes: 1 addition & 2 deletions client/network/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,7 @@ pub trait TestNetFactory: Sized {

/// Add a light peer.
fn add_light_peer(&mut self) {
let (c, backend) = substrate_test_runtime_client::new_light();
let client = Arc::new(c);
let (client, backend) = substrate_test_runtime_client::new_light();
let (
block_import,
justification_import,
Expand Down
2 changes: 1 addition & 1 deletion client/transaction-pool/src/testing/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ fn should_not_accept_old_signatures() {

#[test]
fn import_notification_to_pool_maintain_works() {
let:client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());

let pool = Arc::new(
BasicPool::new_test(Arc::new(FullChainApi::new(client.clone()))).0
Expand Down
4 changes: 1 addition & 3 deletions primitives/consensus/common/src/block_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,8 @@ impl<B: BlockT, Transaction> BlockImport<B> for crate::import_queue::BoxBlockImp
}
}

/*
impl<B: BlockT, T, E: std::error::Error + Send + 'static, Transaction> BlockImport<B> for Arc<T>
where for<'r> &'r T: BlockImport<B, Error = E, Transaction = Transaction>
where T: BlockImport<B, Error = E, Transaction = Transaction>
{
type Error = E;
type Transaction = Transaction;
Expand All @@ -329,7 +328,6 @@ impl<B: BlockT, T, E: std::error::Error + Send + 'static, Transaction> BlockImpo
(&**self).import_block(block, cache)
}
}
*/

/// Justification import trait
pub trait JustificationImport<B: BlockT> {
Expand Down
4 changes: 3 additions & 1 deletion test-utils/client/src/client_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ impl<B, E, RA, Block> ClientExt<Block> for Client<B, E, Block, RA>
}

/// This implementation is required, because of the weird api requirements around `BlockImport`.
/*
impl<Block: BlockT, T, Transaction> ClientBlockImportExt<Block> for std::sync::Arc<T>
where for<'r> &'r T: BlockImport<Block, Error = ConsensusError, Transaction = Transaction>
where T: BlockImport<Block, Error = ConsensusError, Transaction = Transaction>
{
fn import(&self, origin: BlockOrigin, block: Block) -> Result<(), ConsensusError> {
let (header, extrinsics) = block.deconstruct();
Expand Down Expand Up @@ -130,6 +131,7 @@ impl<Block: BlockT, T, Transaction> ClientBlockImportExt<Block> for std::sync::A
BlockImport::import_block(self, import, HashMap::new()).map(|_| ())
}
}
*/

impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block, RA>
where
Expand Down
6 changes: 3 additions & 3 deletions test-utils/runtime/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pub fn new() -> Client<Backend> {

/// Creates new light client instance used for tests.
pub fn new_light() -> (
client::Client<LightBackend, LightExecutor, substrate_test_runtime::Block, substrate_test_runtime::RuntimeApi>,
Arc<client::Client<LightBackend, LightExecutor, substrate_test_runtime::Block, substrate_test_runtime::RuntimeApi>>,
Arc<LightBackend>,
) {

Expand All @@ -357,9 +357,9 @@ pub fn new_light() -> (
);

(
TestClientBuilder::with_backend(backend.clone())
Arc::new(TestClientBuilder::with_backend(backend.clone())
.build_with_executor(call_executor)
.0,
.0),
backend,
)
}
Expand Down