Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to beyond alpha.7 #244

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
597b0c6
Dupe code from kitchen node
JoshOrndorff Apr 23, 2020
20708db
Seperate crate for sha3pow
JoshOrndorff Apr 23, 2020
0753545
Something compiles.
JoshOrndorff Apr 23, 2020
b85b6a2
Create a new runtime so this thing actually runs.
JoshOrndorff Apr 23, 2020
2c7f6b2
Remove commented babe code
JoshOrndorff Apr 23, 2020
de33a7f
Wire existing basic-pow node to newly-separated sha3pow crate.
JoshOrndorff Apr 23, 2020
e924938
Bring in complete sha3pow from utxo workshop, and adapt nodes to use it.
JoshOrndorff Apr 23, 2020
079b7de
Remove unnecessary trait bounds on Sha3Algorithm
JoshOrndorff Apr 23, 2020
72111c9
Writeups for basic-pow and sha3-pow-consensus
JoshOrndorff Apr 23, 2020
e9fbf0a
Merge branch 'master' into joshy-hybrid-consensus
JoshOrndorff Apr 24, 2020
850c48a
Minor fix & visible WIP note :)
jimmychu0807 Apr 24, 2020
ef169bf
update to custom Substrate branch to support justification import.
JoshOrndorff Apr 24, 2020
03593ec
standardize super runtime TODO How to remove the session key stuff fr…
JoshOrndorff May 2, 2020
f8f7cd5
Preserve babe-grandpa node and runtime. This will be a reipe about gr…
JoshOrndorff May 2, 2020
b462e71
standardize basic-pow node and prune pow-runtime
JoshOrndorff May 2, 2020
035eedb
Standardize weight-fee-runtime.
JoshOrndorff May 2, 2020
8062554
Move sum-storage to super-runtime and prune api-runtime
JoshOrndorff May 4, 2020
10fa739
Convert kitchen node to instant seal
JoshOrndorff May 4, 2020
54d756d
Add comment with hint about light client problem
JoshOrndorff May 4, 2020
3613fc2
Merge branch 'master' into joshy-standardize-runtimes
JoshOrndorff May 4, 2020
8305406
Fix minor type aggregation issue
JoshOrndorff May 4, 2020
86bc846
Convert rpc-node to instant seal
JoshOrndorff May 4, 2020
8871130
Only kitchen node supports ocw-runtime
JoshOrndorff May 4, 2020
2d91bde
Properly prune session keys from runtime
JoshOrndorff May 4, 2020
00002f0
Standardize ocw-runtime
JoshOrndorff May 4, 2020
383b0f1
Restore api-runtime
JoshOrndorff May 4, 2020
3037691
Standardize API Runtime
JoshOrndorff May 4, 2020
099484c
rename sum-storage-runtime-api It isn't _necessarily_ related to the rpc
JoshOrndorff May 4, 2020
021037b
Update runtime API writeup to reflect refactorings.
JoshOrndorff May 4, 2020
36a3382
Update nodes/babe-grandpa-node/Cargo.toml
JoshOrndorff May 7, 2020
9083d0c
Update runtimes/super-runtime/src/lib.rs
JoshOrndorff May 7, 2020
cc01394
Update nodes/babe-grandpa-node/Cargo.toml
JoshOrndorff May 7, 2020
45bde8a
Kitchen node compiles with light client. Also converted api-runtime a…
JoshOrndorff May 8, 2020
edcfee2
Add fixme annotation to light clients.
JoshOrndorff May 8, 2020
e174e67
Merge branch 'joshy-standardize-runtimes' of github.com:substrate-dev…
JoshOrndorff May 8, 2020
2c459ee
Clean kitchen node Cargo.toml
JoshOrndorff May 8, 2020
9d5f61a
Strip instant seal code from manual seal node
JoshOrndorff May 8, 2020
9e2ba3d
Update manual seal writeup
JoshOrndorff May 8, 2020
ebffaeb
Write up kitchen node
JoshOrndorff May 8, 2020
6bcfa86
Clarify language in api-runtime writeup
JoshOrndorff May 8, 2020
087f441
typo: because -> became
JoshOrndorff May 8, 2020
a8522cb
Replace TODO with comment in babe-grandpa node Cargo.toml
JoshOrndorff May 8, 2020
285d2ff
Remove some TODOs
JoshOrndorff May 8, 2020
b467961
bump deps, LongestChain, default weights
JoshOrndorff May 8, 2020
c6e0e84
changed append api
JoshOrndorff May 8, 2020
a2be10c
API Runtime Compiles
JoshOrndorff May 8, 2020
8f4c61a
Start working on OCW runtime and pallet
JoshOrndorff May 8, 2020
227388d
Super runtime compiles
JoshOrndorff May 8, 2020
9ee61df
Weight fee runtime and weight pallet compile. Both will eed another l…
JoshOrndorff May 8, 2020
81fa2b5
Babe-grandpa-untime compiles
JoshOrndorff May 8, 2020
9f1e87d
Merge branch 'master' into alpha.7
JoshOrndorff May 8, 2020
0f31fdc
re-apply dependency bumps (not sure where that work went)
JoshOrndorff May 8, 2020
464d2aa
Babe-grandpa-node compiles
JoshOrndorff May 8, 2020
7ec98f5
basic-pow compiles
JoshOrndorff May 8, 2020
df0b923
updated for alpha.7
jimmychu0807 May 10, 2020
3b048a5
it compiles!
jimmychu0807 May 10, 2020
5be531d
[wip] Fixing kitchen node compiler error
jimmychu0807 May 10, 2020
75f4a47
Upstream fix merged
JoshOrndorff May 11, 2020
00a4c11
Merge branch 'manual-seal-light-client' into alpha.7
JoshOrndorff May 11, 2020
ff3a7fe
minor fix to kitchen node text
JoshOrndorff May 11, 2020
fd823dd
bump dependencies and standardize format in all pallets' Cargo.toml f…
JoshOrndorff May 11, 2020
ee3baec
Bump deps in all runtimes TODO Babe grandpa runtime doesn't compile
JoshOrndorff May 11, 2020
8d33a16
Make Babe Grandpa Runtime Compile
JoshOrndorff May 11, 2020
1c187f3
Bump deps in all nodes and make them compile
JoshOrndorff May 11, 2020
af5b86d
Start updating tests
JoshOrndorff May 11, 2020
29f3732
fix charity tests
JoshOrndorff May 11, 2020
4093d17
Most tests are updated
JoshOrndorff May 11, 2020
04aa682
prune accidentally committed notes file
JoshOrndorff May 11, 2020
57a0b29
Start working on offchain-demo tests
JoshOrndorff May 11, 2020
e3f213c
Merge alpha.7 and start updating
JoshOrndorff May 11, 2020
3719d76
Rename to optional-grandpa-runtime, update deps, make compile
JoshOrndorff May 11, 2020
bb14b69
update optional-grandpa genesis
JoshOrndorff May 11, 2020
17efcb6
rename back to minimal grandpa runtime
JoshOrndorff May 11, 2020
17cc878
writeup hybrid consensus
JoshOrndorff May 12, 2020
e21793d
hybrid consensus is no longer wip
JoshOrndorff May 12, 2020
1ceb2a9
offchain-demo tests pass
jimmychu0807 May 12, 2020
5a19187
Merge branch 'master' into alpha.7
JoshOrndorff May 13, 2020
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
1,488 changes: 750 additions & 738 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ members = [
"runtimes/api-runtime",
"runtimes/babe-grandpa-runtime",
"runtimes/ocw-runtime",
"runtimes/minimal-grandpa-runtime",
"runtimes/super-runtime",
"runtimes/weight-fee-runtime",
"nodes/babe-grandpa-node",
"nodes/basic-pow",
"nodes/hybrid-consensus",
"nodes/kitchen-node",
"nodes/manual-seal",
"nodes/rpc-node",
"consensus/sha3pow",
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ The Substrate Recipes are [GPL 3.0 Licensed](LICENSE) It is open source and [ope

## Using Recipes in External Projects

The pallets and runtimes provided here are tested and ready to be used in other Substrate-based blockchains. The big caveat is that you must use the same upstream Substrate version throughout the project. The recipes currently use Substrate@`v2.0.0-alpha.6`.
The pallets and runtimes provided here are tested and ready to be used in other Substrate-based blockchains. The big caveat is that you must use the same upstream Substrate version throughout the project. The recipes currently use Substrate@`v2.0.0-alpha.7`.
18 changes: 18 additions & 0 deletions consensus/sha3pow/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
authors = ['Joshy Orndorff, Wei Tang']
edition = '2018'
homepage = 'https://substrate.dev/recipes'
name = 'sha3pow'
repository = 'https://github.com/substrate-developer-hub/recipes'
version = "2.0.0-alpha.7"
description = 'Sha3-based Proof of Work algorithms for Substrate'

[dependencies]
parity-scale-codec = '1.3.0'
sha3 = "0.8"
rand = { version = "0.7", features = ["small_rng"] }
sc-consensus-pow = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-api = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-consensus-pow = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-core = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-runtime = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
132 changes: 123 additions & 9 deletions nodes/basic-pow/src/pow.rs → consensus/sha3pow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ use sp_runtime::generic::BlockId;
use sp_runtime::traits::Block as BlockT;
use parity_scale_codec::{Encode, Decode};
use sc_consensus_pow::{PowAlgorithm, Error};
use sp_consensus_pow::Seal as RawSeal;
use sp_consensus_pow::{Seal as RawSeal, DifficultyApi};
use sha3::{Sha3_256, Digest};
use rand::{thread_rng, SeedableRng, rngs::SmallRng};

/// A concrete PoW Algorithm that uses Sha3 hashing.
#[derive(Clone)]
pub struct Sha3Algorithm;
use std::sync::Arc;
use sp_api::ProvideRuntimeApi;

/// Determine whether the given hash satisfies the given difficulty.
/// The test is done by multiplying the two together. If the product
Expand Down Expand Up @@ -52,14 +50,18 @@ impl Compute {
}
}

/// A minimal PoW algorithm that uses Sha3 hashing.
/// Difficulty is fixed at 1_000_000
#[derive(Clone)]
pub struct MinimalSha3Algorithm;

// Here we implement the general PowAlgorithm trait for our concrete Sha3Algorithm
impl<B: BlockT<Hash=H256>> PowAlgorithm<B> for Sha3Algorithm {
impl<B: BlockT<Hash=H256>> PowAlgorithm<B> for MinimalSha3Algorithm {
type Difficulty = U256;

fn difficulty(&self, _parent: B::Hash) -> Result<Self::Difficulty, Error<B>> {
// This basic PoW uses a fixed difficulty.
// Raising this difficulty will make the block time slower.
Ok(U256::from(1000_000))
// Fixed difficulty hardcoded here
Ok(U256::from(1_000_000))
}

fn verify(
Expand Down Expand Up @@ -129,3 +131,115 @@ impl<B: BlockT<Hash=H256>> PowAlgorithm<B> for Sha3Algorithm {
Ok(None)
}
}



/// A complete PoW Algorithm that uses Sha3 hashing.
/// Needs a reference to the client so it can grab the difficulty from the runtime.
pub struct Sha3Algorithm<C> {
client: Arc<C>,
}

impl<C> Sha3Algorithm<C> {
pub fn new(client: Arc<C>) -> Self {
Self { client }
}
}

// Manually implement clone. Deriving doesn't work because
// it'll derive impl<C: Clone> Clone for Sha3Algorithm<C>. But C in practice isn't Clone.
impl<C> Clone for Sha3Algorithm<C> {
fn clone(&self) -> Self {
Self::new(self.client.clone())
}
}

// Here we implement the general PowAlgorithm trait for our concrete Sha3Algorithm
impl<B: BlockT<Hash=H256>, C> PowAlgorithm<B> for Sha3Algorithm<C> where
C: ProvideRuntimeApi<B>,
C::Api: DifficultyApi<B, U256>,
{
type Difficulty = U256;

fn difficulty(&self, parent: B::Hash) -> Result<Self::Difficulty, Error<B>> {
let parent_id = BlockId::<B>::hash(parent);
self.client.runtime_api().difficulty(&parent_id)
.map_err(|e| sc_consensus_pow::Error::Environment(
format!("Fetching difficulty from runtime failed: {:?}", e)
))
}

fn verify(
&self,
_parent: &BlockId<B>,
pre_hash: &H256,
seal: &RawSeal,
difficulty: Self::Difficulty
) -> Result<bool, Error<B>> {
// Try to construct a seal object by decoding the raw seal given
let seal = match Seal::decode(&mut &seal[..]) {
Ok(seal) => seal,
Err(_) => return Ok(false),
};

// See whether the hash meets the difficulty requirement. If not, fail fast.
if !hash_meets_difficulty(&seal.work, difficulty) {
return Ok(false)
}

// Make sure the provided work actually comes from the correct pre_hash
let compute = Compute {
difficulty,
pre_hash: *pre_hash,
nonce: seal.nonce,
};

if compute.compute() != seal {
return Ok(false)
}

Ok(true)
}

fn mine(
&self,
_parent: &BlockId<B>,
pre_hash: &H256,
difficulty: Self::Difficulty,
round: u32 // The number of nonces to try during this call
) -> Result<Option<RawSeal>, Error<B>> {
// Get a randomness source from the environment; fail if one isn't available
let mut rng = SmallRng::from_rng(&mut thread_rng())
.map_err(|e| Error::Environment(format!("Initialize RNG failed for mining: {:?}", e)))?;

// Loop the specified number of times
for _ in 0..round {

// Choose a new nonce
let nonce = H256::random_using(&mut rng);

// Calculate the seal
let compute = Compute {
difficulty,
pre_hash: *pre_hash,
nonce,
};
let seal = compute.compute();

// If we solved the PoW then return, otherwise loop again
if hash_meets_difficulty(&seal.work, difficulty) {
return Ok(Some(seal.encode()))
}
}

// Tried the specified number of rounds and never found a solution
Ok(None)
}
}

#[test]
fn clone_works() {
let client = Arc::new(());
let algo1 = Sha3Algorithm::<()>::new(client);
let algo2 = algo1.clone();
}
50 changes: 26 additions & 24 deletions nodes/babe-grandpa-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "babe-grandpa-node"
version = "2.0.0-alpha.6"
version = "2.0.0-alpha.7"
edition = "2018"
authors = ['Joshy Orndorff', '4meta5', 'Jimmy Chu']
homepage = 'https://substrate.dev/recipes'
Expand All @@ -23,39 +23,41 @@ tokio = "0.1.22"
exit-future = "0.2.0"
parking_lot = "0.9.0"
trie-root = "0.15.2"
sp-io = '2.0.0-alpha.6'
sc-cli = '0.8.0-alpha.6'
sc-client-api = '2.0.0-alpha.6'
sp-core = '2.0.0-alpha.6'
sp-runtime = '2.0.0-alpha.6'
sc-executor = '0.8.0-alpha.6'
sc-service = '0.8.0-alpha.6'
sp-inherents = '2.0.0-alpha.6'
sc-transaction-pool = '2.0.0-alpha.6'
sp-transaction-pool = '2.0.0-alpha.6'
sc-network = '0.8.0-alpha.6'
sc-consensus-babe = '0.8.0-alpha.6'
sp-consensus-babe = '0.8.0-alpha.6'
sc-finality-grandpa = '0.8.0-alpha.6'
sp-finality-grandpa = '2.0.0-alpha.6'
sc-client = '0.8.0-alpha.6'
sc-basic-authorship = '0.8.0-alpha.6'
sp-consensus = '0.8.0-alpha.6'
sp-io = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-cli = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-client-api = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-consensus = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-core = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-runtime = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-executor = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-service = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-inherents = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-transaction-pool = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-transaction-pool = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-network = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-consensus-babe = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-consensus-babe = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-finality-grandpa = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-finality-grandpa = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sc-basic-authorship = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }
sp-consensus = { version = '0.8.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }

# This node only works with runtimes that can provide babe and grandpa authorities.
# No other runtimes that come with the recipes provide these APIs, but the substrate demonstration
# runtime does.
runtime = { package = "babe-grandpa-runtime", path = "../../runtimes/babe-grandpa-runtime" }

# In theory the main Substrate node's runtime should work, but it is not published on crates.io
# so a git dependency is necessary which leads to:
# `perhaps two different versions of crate `sp_runtime` are being used?`
# runtime = { package = "node-runtime", git = "https://github.com/paritytech/substrate/", tag = "v2.0.0-alpha.6" }
# In theory the main Substrate node's runtime is compatible, but there are several practical limitations
# 1. It isn't published on crates.io so a git dependency is needed which leads to
# `perhaps two different versions of crate `sp_runtime` are being used?`
# 2. That runtime doesn't have an `opaque` module
# 3. That runtime doesn't have a genesis module
# runtime = { package = "node-runtime", git = "https://github.com/paritytech/substrate/", rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }


[build-dependencies]
vergen = "3.0.4"
substrate-build-script-utils = '2.0.0-alpha.6'
substrate-build-script-utils = { version = '2.0.0-alpha.7', git = 'https://github.com/paritytech/substrate', rev = '7f73312aa0bf4a4107860141f085e9770ec01b72' }

[features]
ocw = []
26 changes: 18 additions & 8 deletions nodes/babe-grandpa-node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::sync::Arc;
use std::time::Duration;
use sc_client::LongestChain;
use sc_consensus::LongestChain;
use sc_client_api::ExecutorProvider;
use runtime::{self, opaque::Block, RuntimeApi};
use sc_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder};
Expand Down Expand Up @@ -36,13 +36,17 @@ macro_rules! new_full_start {
runtime::opaque::Block, runtime::RuntimeApi, crate::service::Executor
>($config)?
.with_select_chain(|_config, backend| {
Ok(sc_client::LongestChain::new(backend.clone()))
Ok(sc_consensus::LongestChain::new(backend.clone()))
})?
.with_transaction_pool(|config, client, _fetcher| {
.with_transaction_pool(|config, client, _fetcher, prometheus_registry| {
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api)))
Ok(sc_transaction_pool::BasicPool::new(
config,
std::sync::Arc::new(pool_api),
prometheus_registry,
))
})?
.with_import_queue(|_config, client, mut select_chain, _transaction_pool| {
.with_import_queue(|_config, client, mut select_chain, _transaction_pool, spawn_task_handle| {
let select_chain = select_chain.take()
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
let (grandpa_block_import, grandpa_link) =
Expand All @@ -64,6 +68,7 @@ macro_rules! new_full_start {
None,
client,
inherent_data_providers.clone(),
spawn_task_handle,
)?;

import_setup = Some((babe_block_import, grandpa_link, babe_link));
Expand Down Expand Up @@ -160,6 +165,7 @@ pub fn new_full(config: Configuration)
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry: service.prometheus_registry(),
shared_voter_state: sc_finality_grandpa::SharedVoterState::empty(),
};

// the GRANDPA voter task is considered infallible, i.e.
Expand Down Expand Up @@ -189,16 +195,19 @@ pub fn new_light(config: Configuration)
.with_select_chain(|_config, backend| {
Ok(LongestChain::new(backend.clone()))
})?
.with_transaction_pool(|config, client, fetcher| {
.with_transaction_pool(|config, client, fetcher, prometheus_registry| {
let fetcher = fetcher
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
let pool_api = sc_transaction_pool::LightChainApi::new(client.clone(), fetcher.clone());
let pool = sc_transaction_pool::BasicPool::with_revalidation_type(
config, Arc::new(pool_api), sc_transaction_pool::RevalidationType::Light,
config,
Arc::new(pool_api),
prometheus_registry,
sc_transaction_pool::RevalidationType::Light,
);
Ok(pool)
})?
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool, spawn_task_handle| {
let fetch_checker = fetcher
.map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
Expand All @@ -223,6 +232,7 @@ pub fn new_light(config: Configuration)
Some(Box::new(finality_proof_import)),
client.clone(),
inherent_data_providers.clone(),
spawn_task_handle,
)?;

Ok((import_queue, finality_proof_request_builder))
Expand Down
Loading