Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
6,681 changes: 4,817 additions & 1,864 deletions Cargo.lock

Large diffs are not rendered by default.

153 changes: 28 additions & 125 deletions Cargo.toml

Large diffs are not rendered by default.

134 changes: 68 additions & 66 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,88 +20,90 @@ clap = { features = ["derive"], workspace = true }
futures = { features = ["thread-pool"], workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

sc-chain-spec = { workspace = true }
frame-support = { workspace = true, optional = true }
frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
pallet-transaction-payment = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-consensus = { workspace = true }
sc-consensus-babe = { workspace = true }
sc-consensus-babe-rpc = { workspace = true }
sc-consensus-grandpa = { workspace = true }
sp-consensus-grandpa = { workspace = true }
sc-consensus-grandpa-rpc = { workspace = true }
sc-executor = { workspace = true }
sc-network = { workspace = true }
sc-offchain = { workspace = true }
sc-rpc = { workspace = true }
sc-service = { workspace = true }
sc-sync-state-rpc = { workspace = true }
sc-telemetry = { workspace = true }
sc-transaction-pool = { workspace = true }
sc-transaction-pool-api = { workspace = true }
sp-consensus = { workspace = true }
sp-consensus-babe = { workspace = true }
sp-core = { workspace = true }
sp-inherents = { workspace = true }
sp-io = { workspace = true }
sp-keystore = { workspace = true }
sp-runtime = { workspace = true }
sp-timestamp = { workspace = true }
sp-transaction-storage-proof = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
sp-session = { workspace = true }
sp-offchain = { workspace = true }

# These dependencies are used for the node's RPCs
jsonrpsee = { features = ["server"], workspace = true }
sc-basic-authorship = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-blockchain = { workspace = true }
sp-genesis-builder = { workspace = true }
sp-weights = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
polkadot-primitives = { workspace = true }
substrate-frame-rpc-system = { workspace = true }

# These dependencies are used for runtime benchmarking
frame-benchmarking-cli = { workspace = true }
frame-benchmarking = { optional = true, workspace = true, default-features = true }
# Polkadot SDK umbrella crate - using specific features instead of "node" to avoid
# pulling in unnecessary crates like assets-common which has runtime-benchmarks issues
polkadot-sdk = { workspace = true, features = [
# Benchmarking
"frame-benchmarking",
"frame-benchmarking-cli",
# Frame
"frame-support",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
# Pallets
"pallet-transaction-payment",
"pallet-transaction-payment-rpc",
# Polkadot
"polkadot-primitives",
# Substrate client
"sc-basic-authorship",
"sc-chain-spec",
"sc-cli",
"sc-client-api",
"sc-consensus",
"sc-consensus-babe",
"sc-consensus-babe-rpc",
"sc-consensus-grandpa",
"sc-consensus-grandpa-rpc",
"sc-executor",
"sc-network",
"sc-offchain",
"sc-rpc",
"sc-service",
"sc-sync-state-rpc",
"sc-telemetry",
"sc-transaction-pool",
"sc-transaction-pool-api",
# Substrate primitives
"sp-api",
"sp-block-builder",
"sp-blockchain",
"sp-consensus",
"sp-consensus-babe",
"sp-consensus-grandpa",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keystore",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-timestamp",
"sp-transaction-pool",
"sp-transaction-storage-proof",
"sp-version",
"sp-weights",
# RPC
"substrate-frame-rpc-system",
] }

# Local Dependencies
bulletin-polkadot-runtime = { workspace = true }

# TODO: remove when bulletin-polkadot is upgraded live with TX storage runtime API
pallet-transaction-storage = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true }
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }

[features]
# Dependencies that are only required if runtime benchmarking should be built.
default = ["std"]
std = [
"serde/std",
"tracing/std",
"bulletin-polkadot-runtime/std",
"pallet-transaction-storage/std",
"polkadot-sdk/std",
]
runtime-benchmarks = [
"bulletin-polkadot-runtime/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks",
"pallet-transaction-storage/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"polkadot-sdk/runtime-benchmarks",
]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
try-runtime = [
"bulletin-polkadot-runtime/try-runtime",
"frame-support/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-transaction-storage/try-runtime",
"sp-runtime/try-runtime",
"polkadot-sdk/try-runtime",
]
2 changes: 1 addition & 1 deletion node/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
use polkadot_sdk::substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
Expand Down
8 changes: 5 additions & 3 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use sc_cli::Result;
use sp_inherents::{InherentData, InherentDataProvider};
use crate::{
sc_cli::Result,
sp_inherents::{InherentData, InherentDataProvider},
};
use std::time::Duration;

/// Generates inherent data for the `benchmark overhead` command.
Expand All @@ -9,7 +11,7 @@ use std::time::Duration;
pub fn inherent_benchmark_data() -> Result<InherentData> {
let mut inherent_data = InherentData::new();
let d = Duration::from_millis(0);
let timestamp = sp_timestamp::InherentDataProvider::new(d.into());
let timestamp = crate::sp_timestamp::InherentDataProvider::new(d.into());

futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data))
.map_err(|e| format!("creating inherent data: {e:?}"))?;
Expand Down
16 changes: 9 additions & 7 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use sc_chain_spec::ChainSpecExtension;
use sc_service::ChainType;
use sp_runtime::{Deserialize, Serialize};
use crate::{
sc_chain_spec::ChainSpecExtension,
sc_service::ChainType,
sp_runtime::{Deserialize, Serialize},
};

const PROTOCOL_ID: &str = "dot-bulletin";

Expand All @@ -14,11 +16,11 @@ pub struct Extensions {
/// The light sync state.
///
/// This value will be set by the `sync-state rpc` implementation.
pub light_sync_state: sc_sync_state_rpc::LightSyncStateExtension,
pub light_sync_state: crate::sc_sync_state_rpc::LightSyncStateExtension,
}

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
pub type ChainSpec = crate::sc_service::GenericChainSpec<Extensions>;

pub fn bulletin_polkadot_development_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(
Expand All @@ -30,7 +32,7 @@ pub fn bulletin_polkadot_development_config() -> Result<ChainSpec, String> {
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_protocol_id(PROTOCOL_ID)
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.with_genesis_config_preset_name(crate::sp_genesis_builder::DEV_RUNTIME_PRESET)
.build())
}

Expand All @@ -44,7 +46,7 @@ pub fn bulletin_polkadot_local_testnet_config() -> Result<ChainSpec, String> {
.with_id("local_testnet")
.with_chain_type(ChainType::Local)
.with_protocol_id(PROTOCOL_ID)
.with_genesis_config_preset_name(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET)
.with_genesis_config_preset_name(crate::sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET)
.build())
}

Expand Down
22 changes: 11 additions & 11 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sc_cli::RunCmd;
use crate::sc_cli::RunCmd;

#[derive(Debug, clap::Parser)]
pub struct Cli {
Expand All @@ -14,33 +14,33 @@ pub struct Cli {
pub enum Subcommand {
/// Key management cli utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
Key(crate::sc_cli::KeySubcommand),

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

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

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

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

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

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

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

/// Sub-commands concerned with benchmarking.
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
Benchmark(crate::frame_benchmarking_cli::BenchmarkCmd),

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
ChainInfo(crate::sc_cli::ChainInfoCmd),
}
28 changes: 14 additions & 14 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use crate::{
benchmarking::inherent_benchmark_data,
chain_spec,
cli::{Cli, Subcommand},
frame_benchmarking_cli::{
BenchmarkCmd, ExtrinsicFactory, SubstrateRemarkBuilder, SUBSTRATE_REFERENCE_HARDWARE,
},
node_primitives::Block,
sc_cli::SubstrateCli,
sc_network::config::NetworkBackendType,
sc_service::PartialComponents,
service,
};
use frame_benchmarking_cli::{
BenchmarkCmd, ExtrinsicFactory, SubstrateRemarkBuilder, SUBSTRATE_REFERENCE_HARDWARE,
};
use sc_cli::SubstrateCli;
use sc_network::config::NetworkBackendType;
use sc_service::PartialComponents;
use std::{sync::Arc, time::Duration};

/// Log target for this file.
Expand Down Expand Up @@ -41,7 +41,7 @@ impl SubstrateCli for Cli {
2017
}

fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
fn load_spec(&self, id: &str) -> Result<Box<dyn crate::sc_service::ChainSpec>, String> {
Ok(match id {
"dev" | "polkadot-dev" | "bulletin-polkadot-dev" => Box::new(chain_spec::bulletin_polkadot_development_config()?),
"local" | "polkadot-local" | "bulletin-polkadot-local" => Box::new(chain_spec::bulletin_polkadot_local_testnet_config()?),
Expand All @@ -60,7 +60,7 @@ impl SubstrateCli for Cli {

/// Parse and run command line arguments
#[allow(clippy::result_large_err)]
pub fn run() -> sc_cli::Result<()> {
pub fn run() -> crate::sc_cli::Result<()> {
let cli = Cli::from_args();

match &cli.subcommand {
Expand Down Expand Up @@ -109,8 +109,8 @@ pub fn run() -> sc_cli::Result<()> {
let PartialComponents { client, task_manager, backend, .. } =
service::new_partial(&config)?;
let aux_revert = Box::new(|client: Arc<service::FullClient>, backend, blocks| {
sc_consensus_babe::revert(client.clone(), backend, blocks)?;
sc_consensus_grandpa::revert(client, blocks)?;
crate::sc_consensus_babe::revert(client.clone(), backend, blocks)?;
crate::sc_consensus_grandpa::revert(client, blocks)?;
Ok(())
});
Ok((cmd.run(client, backend, Some(aux_revert)), task_manager))
Expand All @@ -132,7 +132,7 @@ pub fn run() -> sc_cli::Result<()> {
)
}

cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
cmd.run_with_spec::<crate::sp_runtime::traits::HashingFor<Block>, ()>(Some(
config.chain_spec,
))
},
Expand All @@ -157,7 +157,7 @@ pub fn run() -> sc_cli::Result<()> {
},
BenchmarkCmd::Overhead(cmd) => {
if cmd.params.runtime.is_some() {
return Err(sc_cli::Error::Input(
return Err(crate::sc_cli::Error::Input(
"Bulletin binary does not support `--runtime` flag for `benchmark overhead`. Please provide a chain spec or use the `frame-omni-bencher`."
.into(),
))
Expand Down Expand Up @@ -218,8 +218,8 @@ pub fn run() -> sc_cli::Result<()> {
}
}

service::new_full::<sc_network::Litep2pNetworkBackend>(config)
.map_err(sc_cli::Error::Service)
service::new_full::<crate::sc_network::Litep2pNetworkBackend>(config)
.map_err(crate::sc_cli::Error::Service)
})
},
}
Expand Down
Loading
Loading