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 alpha.7 #242

Merged
merged 41 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
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
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
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,064 changes: 540 additions & 524 deletions Cargo.lock

Large diffs are not rendered by default.

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`.
42 changes: 21 additions & 21 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,24 +23,24 @@ 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 = '2.0.0-alpha.7'
sc-cli = '0.8.0-alpha.7'
sc-client-api = '2.0.0-alpha.7'
sc-consensus = '0.8.0-alpha.7'
sp-core = '2.0.0-alpha.7'
sp-runtime = '2.0.0-alpha.7'
sc-executor = '0.8.0-alpha.7'
sc-service = '0.8.0-alpha.7'
sp-inherents = '2.0.0-alpha.7'
sc-transaction-pool = '2.0.0-alpha.7'
sp-transaction-pool = '2.0.0-alpha.7'
sc-network = '0.8.0-alpha.7'
sc-consensus-babe = '0.8.0-alpha.7'
sp-consensus-babe = '0.8.0-alpha.7'
sc-finality-grandpa = '0.8.0-alpha.7'
sp-finality-grandpa = '2.0.0-alpha.7'
sc-basic-authorship = '0.8.0-alpha.7'
sp-consensus = '0.8.0-alpha.7'

# 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
Expand All @@ -50,12 +50,12 @@ runtime = { package = "babe-grandpa-runtime", path = "../../runtimes/babe-grandp
# 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" }
# runtime = { package = "node-runtime", git = "https://github.com/paritytech/substrate/", tag = "v2.0.0-alpha.7" }


[build-dependencies]
vergen = "3.0.4"
substrate-build-script-utils = '2.0.0-alpha.6'
substrate-build-script-utils = '2.0.0-alpha.7'

[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
42 changes: 21 additions & 21 deletions nodes/basic-pow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = '2018'
homepage = 'https://substrate.dev/recipes'
name = 'basic-pow'
repository = 'https://github.com/substrate-developer-hub/recipes'
version = "2.0.0-alpha.6"
version = "2.0.0-alpha.7"
description = 'A Substrate node that demonstrates minimal proof of work consensus'
license = "GPL-3.0-or-later"

Expand All @@ -19,36 +19,36 @@ structopt = '0.3.8'
parity-scale-codec = '1.3.0'
sha3 = "0.8"
rand = { version = "0.7", features = ["small_rng"] }
sc-consensus-pow = { version = '0.8.0-alpha.6' }
sp-consensus-pow = { version = '0.8.0-alpha.6' }
sc-client-api = { version = '2.0.0-alpha.6' }
sp-blockchain = { version = '2.0.0-alpha.6' }
sp-timestamp = '2.0.0-alpha.6'
sc-basic-authorship = '0.8.0-alpha.6'
sc-cli = '0.8.0-alpha.6'
sc-client = '0.8.0-alpha.6'
sc-executor = '0.8.0-alpha.6'
sc-network = '0.8.0-alpha.6'
sc-service = '0.8.0-alpha.6'
sc-transaction-pool = '2.0.0-alpha.6'
sp-consensus = '0.8.0-alpha.6'
sp-core = '2.0.0-alpha.6'
sp-inherents = '2.0.0-alpha.6'
sp-runtime = '2.0.0-alpha.6'
sp-transaction-pool = '2.0.0-alpha.6'
sc-consensus = '0.8.0-alpha.7'
sc-consensus-pow = '0.8.0-alpha.7'
sp-consensus-pow = '0.8.0-alpha.7'
sc-client-api = '2.0.0-alpha.7'
sp-blockchain = '2.0.0-alpha.7'
sp-timestamp = '2.0.0-alpha.7'
sc-basic-authorship = '0.8.0-alpha.7'
sc-cli = '0.8.0-alpha.7'
sc-executor = '0.8.0-alpha.7'
sc-network = '0.8.0-alpha.7'
sc-service = '0.8.0-alpha.7'
sc-transaction-pool = '2.0.0-alpha.7'
sp-consensus = '0.8.0-alpha.7'
sp-core = '2.0.0-alpha.7'
sp-inherents = '2.0.0-alpha.7'
sp-runtime = '2.0.0-alpha.7'
sp-transaction-pool = '2.0.0-alpha.7'

# This node is compatible with any of the runtimes below
# ---
# Common runtime configured with most Recipes pallets.
runtime = { package = "super-runtime", path = "../../runtimes/super-runtime" }
# runtime = { package = "super-runtime", path = "../../runtimes/super-runtime" }

# Runtime with custom weight and fee calculation.
# runtime = { package = "weight-fee-runtime", path = "../../runtimes/weight-fee-runtime"}
runtime = { package = "weight-fee-runtime", path = "../../runtimes/weight-fee-runtime"}

# Runtime with custom runtime-api (custom API only used in rpc-node)
# runtime = { package = "api-runtime", path = "../../runtimes/api-runtime" }
# ---

[build-dependencies]
vergen = '3.0.4'
substrate-build-script-utils = '2.0.0-alpha.6'
substrate-build-script-utils = '2.0.0-alpha.7'
29 changes: 21 additions & 8 deletions nodes/basic-pow/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.

use std::sync::Arc;
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 @@ -42,13 +42,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, select_chain, _transaction_pool| {
.with_import_queue(|_config, client, select_chain, _transaction_pool, spawn_task_handle| {

let pow_block_import = sc_consensus_pow::PowBlockImport::new(
client.clone(),
Expand All @@ -61,8 +65,11 @@ macro_rules! new_full_start {

let import_queue = sc_consensus_pow::import_queue(
Box::new(pow_block_import.clone()),
None,
None,
crate::pow::Sha3Algorithm,
inherent_data_providers.clone(),
spawn_task_handle,
)?;

import_setup = Some(pow_block_import);
Expand Down Expand Up @@ -137,17 +144,20 @@ 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 finality_proof_request_builder =
Box::new(DummyFinalityProofRequestBuilder::default()) as Box<_>;

Expand All @@ -162,8 +172,11 @@ pub fn new_light(config: Configuration)

let import_queue = sc_consensus_pow::import_queue(
Box::new(pow_block_import),
None,
None,
Sha3Algorithm,
build_inherent_data_providers()?,
spawn_task_handle,
)?;

Ok((import_queue, finality_proof_request_builder))
Expand Down
35 changes: 17 additions & 18 deletions nodes/kitchen-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kitchen-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,22 +23,21 @@ tokio = "0.1.22"
exit-future = "0.2.0"
parking_lot = "0.9.0"
trie-root = "0.15.2"
sc-basic-authorship = '0.8.0-alpha.6'
sc-cli = '0.8.0-alpha.6'
sc-client = '0.8.0-alpha.6'
sc-client-db = '0.8.0-alpha.6' # This became necessary when converting to instant seal
sp-consensus = '0.8.0-alpha.6'
sc-consensus-manual-seal = '0.8.0-alpha.6'
sc-executor = '0.8.0-alpha.6'
sc-network = '0.8.0-alpha.6'
sc-service = '0.8.0-alpha.6'
sc-transaction-pool = '2.0.0-alpha.6'
sp-core = '2.0.0-alpha.6'
sp-inherents = '2.0.0-alpha.6'
sp-io = '2.0.0-alpha.6'
sp-runtime = '2.0.0-alpha.6'
sp-timestamp = '2.0.0-alpha.6'
sp-transaction-pool = '2.0.0-alpha.6'
sc-basic-authorship = '0.8.0-alpha.7'
sc-cli = '0.8.0-alpha.7'
sc-client-db = '0.8.0-alpha.7' # This became necessary when converting to instant seal
sp-consensus = '0.8.0-alpha.7'
sc-consensus-manual-seal = '0.8.0-alpha.7'
sc-executor = '0.8.0-alpha.7'
sc-network = '0.8.0-alpha.7'
sc-service = '0.8.0-alpha.7'
sc-transaction-pool = '2.0.0-alpha.7'
sp-core = '2.0.0-alpha.7'
sp-inherents = '2.0.0-alpha.7'
sp-io = '2.0.0-alpha.7'
sp-runtime = '2.0.0-alpha.7'
sp-timestamp = '2.0.0-alpha.7'
sp-transaction-pool = '2.0.0-alpha.7'

# This node is compatible with any of the runtimes below
# ---
Expand All @@ -59,7 +58,7 @@ runtime = { package = "super-runtime", path = "../../runtimes/super-runtime" }

[build-dependencies]
vergen = "3.0.4"
substrate-build-script-utils = '2.0.0-alpha.6'
substrate-build-script-utils = '2.0.0-alpha.7'

[features]
ocw = []
4 changes: 2 additions & 2 deletions nodes/kitchen-node/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.

// use std::sync::Arc;
// use sc_client::LongestChain;
// use sc_consensus::LongestChain;
// use sc_client_api::ExecutorProvider;
use sc_service::{error::{Error as ServiceError}, AbstractService, Configuration};
use sp_inherents::InherentDataProviders;
Expand All @@ -26,7 +26,7 @@ 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| {
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
Expand Down
Loading