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

feat: update dependencies to Substrate v0.9.18 #336

Merged
merged 11 commits into from
Aug 1, 2022
1,408 changes: 838 additions & 570 deletions Cargo.lock

Large diffs are not rendered by default.

104 changes: 52 additions & 52 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,75 @@ repository = 'https://github.com/debionetwork/debio-node'
targets = ['x86_64-unknown-linux-gnu']

[build-dependencies]
substrate-build-script-utils = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.13' }
substrate-build-script-utils = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }

[dependencies]
# External Dependencies
codec = { package = 'parity-scale-codec', version = '2.0.0' }
serde = { version = '1.0.130', features = ['derive'] }
codec = { package = 'parity-scale-codec', version = '3.0.0' }
serde = { version = '1.0.136', features = ['derive'] }
clap = { version = '3.0', features = ['derive'] }
hex-literal = { version = '0.3.4' }
structopt = { version = '0.3.25' }
jsonrpc-core = { version = '18.0.0' }

# Substrate Dependencies
## Substrate Primitive Dependencies
beefy-primitives = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-block-builder = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-consensus-babe = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-core = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-finality-grandpa = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-runtime = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-timestamp = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sp-transaction-storage-proof = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
beefy-primitives = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-block-builder = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-consensus-babe = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-core = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-finality-grandpa = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-runtime = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-timestamp = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sp-transaction-storage-proof = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }

## Substrate Client Dependencies
sc-basic-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-chain-spec = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-cli = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13', features = ['wasmtime'] }
sc-client-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-consensus-babe = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-consensus-babe-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-consensus-epochs = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-consensus-slots = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-consensus-uncles = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-executor = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13', features = ['wasmtime'] }
sc-finality-grandpa = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-finality-grandpa-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-network = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-rpc-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-service = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13', features = ['wasmtime'] }
sc-sync-state-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-telemetry = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-transaction-pool-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
sc-basic-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-chain-spec = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-cli = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18', features = ['wasmtime'] }
sc-client-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-consensus-babe = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-consensus-babe-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-consensus-epochs = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-consensus-slots = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-consensus-uncles = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-executor = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18', features = ['wasmtime'] }
sc-finality-grandpa = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-finality-grandpa-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-network = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-rpc-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-service = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18', features = ['wasmtime'] }
sc-sync-state-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-telemetry = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
sc-transaction-pool-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }

## Substrate Frame Dependencies
frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
frame-benchmarking-cli = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
frame-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
frame-system-rpc-runtime-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
substrate-frame-rpc-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
frame-benchmarking-cli = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
frame-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
frame-system-benchmarking = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
substrate-frame-rpc-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }

## Substrate Pallet Dependencies
pallet-im-online = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
pallet-mmr-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
pallet-transaction-payment = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
pallet-transaction-payment-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
beefy-gadget = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
beefy-gadget-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.13' }
pallet-im-online = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
pallet-mmr-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
pallet-transaction-payment = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
pallet-transaction-payment-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
beefy-gadget = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
beefy-gadget-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }

# Octopus Dependencies
## Octopus Pallet Dependencies
pallet-octopus-appchain = { git = 'https://github.com/octopus-network/octopus-pallets.git', branch = 'release-v0.9.13' }
pallet-octopus-lpos = { git = 'https://github.com/octopus-network/octopus-pallets.git', branch = 'release-v0.9.13' }
pallet-octopus-appchain = { git = 'https://github.com/octopus-network/octopus-pallets.git', branch = 'release-v0.9.18' }
pallet-octopus-lpos = { git = 'https://github.com/octopus-network/octopus-pallets.git', branch = 'release-v0.9.18' }

# Local Dependencies
# DeBio Runtime Dependencies
Expand Down
30 changes: 17 additions & 13 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use sp_finality_grandpa::AuthorityId as GrandpaId;
use sp_runtime::traits::{IdentifyAccount, Verify};

use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_octopus_appchain::AuthorityId as OctopusId;
use pallet_octopus_appchain::sr25519::AuthorityId as OctopusId;

use debio_runtime::{
currency::{OCTS, UNITS as DBIO},
Expand Down Expand Up @@ -87,12 +87,12 @@ pub fn session_keys(

/// Helper function to generate appchain config
pub fn appchain_config(
relay_contract: &str,
asset_id_by_name: &str,
anchor_contract: &str,
asset_id_by_token_id: &str,
premined_amount: Balance,
era_payout: Balance,
) -> (String, String, Balance, Balance) {
(relay_contract.to_string(), asset_id_by_name.to_string(), premined_amount, era_payout)
(anchor_contract.to_string(), asset_id_by_token_id.to_string(), premined_amount, era_payout)
}

/// Helper function to generate an properties
Expand Down Expand Up @@ -229,6 +229,7 @@ pub fn staging_testnet_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
Some("debio-staging-testnet"),
None,
// Properties
Some(properties),
// Extensions
Expand Down Expand Up @@ -352,6 +353,7 @@ pub fn development_testnet_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
Some("debio-development-testnet"),
None,
// Properties
Some(properties),
// Extensions
Expand Down Expand Up @@ -425,6 +427,7 @@ pub fn local_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
Some("debio-local"),
None,
// Properties
Some(properties),
// Extensions
Expand Down Expand Up @@ -487,6 +490,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
Some("debio-development"),
None,
// Properties
Some(properties),
// Extensions
Expand Down Expand Up @@ -544,24 +548,24 @@ fn genesis(
im_online: Default::default(),
octopus_appchain: OctopusAppchainConfig {
anchor_contract: appchain_config.0,
asset_id_by_name: vec![(appchain_config.1, 0)],
asset_id_by_token_id: vec![(appchain_config.1, 0)],
premined_amount: appchain_config.2,
validators: initial_authorities.iter().map(|x| (x.0.clone(), x.6)).collect(),
},
octopus_lpos: OctopusLposConfig { era_payout: appchain_config.3, ..Default::default() },
octopus_assets: Default::default(),
sudo: SudoConfig { key: root_key },
labs: LabsConfig { lab_verifier_key: api_admin_key.clone() },
orders: OrdersConfig { escrow_key: api_admin_key.clone() },
sudo: SudoConfig { key: Some(root_key) },
labs: LabsConfig { lab_verifier_key: Some(api_admin_key.clone()) },
orders: OrdersConfig { escrow_key: Some(api_admin_key.clone()) },
rewards: RewardsConfig { rewarder_key: api_admin_key.clone() },
genetic_analysts: GeneticAnalystsConfig {
genetic_analyst_verifier_key: api_admin_key.clone(),
genetic_analyst_verifier_key: Some(api_admin_key.clone()),
},
genetic_analysis_orders: GeneticAnalysisOrdersConfig {
escrow_key: api_admin_key.clone(),
treasury_key,
escrow_key: Some(api_admin_key.clone()),
treasury_key: Some(treasury_key),
},
service_request: ServiceRequestConfig { admin_key: api_admin_key.clone() },
user_profile: UserProfileConfig { admin_key: api_admin_key },
service_request: ServiceRequestConfig { admin_key: Some(api_admin_key.clone()) },
user_profile: UserProfileConfig { admin_key: Some(api_admin_key) },
}
}
63 changes: 43 additions & 20 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,48 +1,71 @@
use sc_cli::{
BuildSpecCmd, CheckBlockCmd, ExportBlocksCmd, ExportStateCmd, ImportBlocksCmd, KeySubcommand,
PurgeChainCmd, RevertCmd, RunCmd,
};
#[allow(missing_docs)]
#[derive(Debug, clap::Parser)]
pub struct RunCmd {
#[allow(missing_docs)]
#[clap(flatten)]
pub base: sc_cli::RunCmd,

use frame_benchmarking_cli::BenchmarkCmd;
#[clap(long)]
pub enable_dev_signer: bool,

use structopt::StructOpt;
/// Maximum number of logs in a query.
#[clap(long, default_value = "10000")]
pub max_past_logs: u32,

#[derive(Debug, StructOpt)]
/// Maximum fee history cache size.
#[clap(long, default_value = "2048")]
pub fee_history_limit: u64,

/// The dynamic-fee pallet target gas price set by block author
#[clap(long, default_value = "1")]
pub target_gas_price: u64,
}

#[derive(Debug, clap::Parser)]
pub struct Cli {
#[structopt(subcommand)]
#[clap(subcommand)]
pub subcommand: Option<Subcommand>,

#[structopt(flatten)]
#[clap(flatten)]
pub run: RunCmd,
}

#[derive(Debug, StructOpt)]
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management cli utilities
Key(KeySubcommand),
#[clap(subcommand)]
Key(sc_cli::KeySubcommand),

/// Build a chain specification.
BuildSpec(BuildSpecCmd),
BuildSpec(sc_cli::BuildSpecCmd),

/// Validate blocks.
CheckBlock(CheckBlockCmd),
CheckBlock(sc_cli::CheckBlockCmd),

/// Export blocks.
ExportBlocks(ExportBlocksCmd),
ExportBlocks(sc_cli::ExportBlocksCmd),

/// Export the state of a given block into a chain spec.
ExportState(ExportStateCmd),
ExportState(sc_cli::ExportStateCmd),

/// Import blocks.
ImportBlocks(ImportBlocksCmd),
ImportBlocks(sc_cli::ImportBlocksCmd),

/// Remove the whole chain.
PurgeChain(PurgeChainCmd),
PurgeChain(sc_cli::PurgeChainCmd),

/// Revert the chain to a previous state.
Revert(RevertCmd),
Revert(sc_cli::RevertCmd),

/// The custom benchmark subcommand benchmarking runtime pallets.
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(BenchmarkCmd),
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some command against runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Try some command against runtime state. Note: `try-runtime` feature must be enabled.
#[cfg(not(feature = "try-runtime"))]
TryRuntime,
}
25 changes: 20 additions & 5 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use crate::{

use std::path::PathBuf;

use sc_cli::{
ChainSpec, Error::Service as CliErrorService, Result as CliResult, RuntimeVersion, SubstrateCli,
};
use sc_cli::{ChainSpec, Result as CliResult, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;

use debio_runtime::{Block, VERSION};
Expand Down Expand Up @@ -118,10 +116,27 @@ pub fn run() -> CliResult<()> {
`--features runtime-benchmarks`."
.into())
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
// we don't need any of the components of new_partial, just a runtime, or a task
// manager to do `async_run`.
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
Ok((cmd.run::<Block, service::ExecutorDispatch>(config), task_manager))
})
},
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
.into()),
None => {
let runner = cli.create_runner(&cli.run)?;
let runner = cli.create_runner(&cli.run.base)?;
runner.run_node_until_exit(|config| async move {
service::new_full(config).map_err(CliErrorService)
service::new_full(config).map_err(sc_cli::Error::Service)
})
},
}
Expand Down
3 changes: 3 additions & 0 deletions node/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod chain_spec;
pub mod rpc;
pub mod service;
Loading