diff --git a/Cargo.lock b/Cargo.lock index 318d2252b..b37f0b968 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -883,6 +883,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-offchain", "sp-runtime", "sp-session", "sp-staking", @@ -1002,6 +1003,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-offchain", "sp-runtime", "sp-session", "sp-staking", diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 4d6229b06..7dc8c42f2 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -14,15 +14,6 @@ pub struct RunCmd { #[clap(flatten)] pub base: sc_cli::RunCmd, - /// Enable DDC validation (disabled by default). Works only on validator nodes with enabled - /// offchain workers. - #[arg(long, requires = "dac_url")] - pub enable_ddc_validation: bool, - - /// DAC DataModel HTTP endpoint to retrieve DDC activity data for validation. - #[arg(long, requires = "enable_ddc_validation", value_parser = url::Url::parse)] - pub dac_url: Option, - /// Force using Cere Dev runtime. #[arg(long = "force-cere-dev")] pub force_cere_dev: bool, diff --git a/cli/src/command.rs b/cli/src/command.rs index 06de8607f..e327ff1df 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -245,14 +245,9 @@ pub fn run() -> sc_cli::Result<()> { None => { let runner = cli.create_runner(&cli.run.base)?; runner.run_node_until_exit(|config| async move { - cere_service::build_full( - config, - cli.run.no_hardware_benchmarks, - cli.run.enable_ddc_validation, - cli.run.dac_url, - ) - .map(|full| full.task_manager) - .map_err(Error::Service) + cere_service::build_full(config, cli.run.no_hardware_benchmarks) + .map(|full| full.task_manager) + .map_err(Error::Service) }) }, } diff --git a/node/client/src/lib.rs b/node/client/src/lib.rs index 06d980174..240894e91 100644 --- a/node/client/src/lib.rs +++ b/node/client/src/lib.rs @@ -497,6 +497,7 @@ pub trait RuntimeApiCollection: + frame_system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi + sp_api::Metadata + + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi where @@ -514,6 +515,7 @@ where + frame_system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi + sp_api::Metadata + + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi, >::StateBackend: sp_api::StateBackend, diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 0242c0d7e..a8d6c24f3 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -7,7 +7,7 @@ pub use cere_dev_runtime; #[cfg(feature = "cere-native")] pub use cere_runtime; use futures::prelude::*; -use sc_client_api::{Backend, BlockBackend}; +use sc_client_api::BlockBackend; use sc_consensus_babe::{self, SlotProportion}; pub use sc_executor::NativeExecutionDispatch; use sc_network::Event; @@ -269,16 +269,12 @@ where pub fn build_full( config: Configuration, disable_hardware_benchmarks: bool, - enable_ddc_validation: bool, - dac_url: Option, ) -> Result, ServiceError> { #[cfg(feature = "cere-dev-native")] if config.chain_spec.is_cere_dev() { return new_full::( config, disable_hardware_benchmarks, - enable_ddc_validation, - dac_url, |_, _| (), ) .map(|full| full.with_client(Client::CereDev)) @@ -289,8 +285,6 @@ pub fn build_full( new_full::( config, disable_hardware_benchmarks, - enable_ddc_validation, - dac_url, |_, _| (), ) .map(|full| full.with_client(Client::Cere)) @@ -324,8 +318,6 @@ impl NewFull { pub fn new_full( mut config: Configuration, disable_hardware_benchmarks: bool, - enable_ddc_validation: bool, - dac_url: Option, with_startup_data: impl FnOnce( &sc_consensus_babe::BabeBlockImport< Block, diff --git a/runtime/cere-dev/Cargo.toml b/runtime/cere-dev/Cargo.toml index e66728dbd..b94ee9991 100644 --- a/runtime/cere-dev/Cargo.toml +++ b/runtime/cere-dev/Cargo.toml @@ -28,6 +28,7 @@ sp-consensus-babe = { default-features = false, git = "https://github.com/parity sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-session = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-staking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 46f96b2be..1654bf1d4 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -1577,6 +1577,12 @@ impl_runtime_apis! { } } + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + impl fg_primitives::GrandpaApi for Runtime { fn grandpa_authorities() -> GrandpaAuthorityList { Grandpa::grandpa_authorities() diff --git a/runtime/cere/Cargo.toml b/runtime/cere/Cargo.toml index 13ab6cd04..d65c16600 100644 --- a/runtime/cere/Cargo.toml +++ b/runtime/cere/Cargo.toml @@ -28,6 +28,7 @@ sp-consensus-babe = { default-features = false, git = "https://github.com/parity sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-session = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } sp-staking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.31" } diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index ffa2503c5..72df483e3 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -1484,6 +1484,12 @@ impl_runtime_apis! { } } + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + impl fg_primitives::GrandpaApi for Runtime { fn grandpa_authorities() -> GrandpaAuthorityList { Grandpa::grandpa_authorities() diff --git a/zombienet/0001-ddc-validation/ddc-validation.toml b/zombienet/0001-ddc-validation/ddc-validation.toml index e5d7ae40a..77b82c4ea 100644 --- a/zombienet/0001-ddc-validation/ddc-validation.toml +++ b/zombienet/0001-ddc-validation/ddc-validation.toml @@ -1,6 +1,6 @@ [relaychain] default_command = "./target/release/cere" -default_args = ["--enable-ddc-validation --dac-url {{DAC_URL}}"] +default_args = [""] chain = "local" [[relaychain.nodes]]