diff --git a/Cargo.lock b/Cargo.lock index 5d4280d3..9e20ab81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5275,7 +5275,6 @@ dependencies = [ "cumulus-pallet-session-benchmarking", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", - "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", diff --git a/Cargo.toml b/Cargo.toml index 39c9240f..e40635b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,7 +172,6 @@ fp-dynamic-fee = { git = "https://github.com/paritytech/frontier", branch = "pol cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false, features = ["parameterized-consensus-hook"]} cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } -cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } diff --git a/node/src/service.rs b/node/src/service.rs index b5aac6a5..4ae4ad8c 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -27,14 +27,13 @@ use laos_runtime::{apis::RuntimeApi, opaque::Block, types::TransactionConverter, use cumulus_client_collator::service::CollatorService; use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; use cumulus_client_consensus_proposer::Proposer; -use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier; use cumulus_client_service::{ build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions, StartRelayChainTasksParams, }; use cumulus_primitives_core::{ - relay_chain::{CollatorPair, ValidationCode}, + relay_chain::CollatorPair, ParaId, PersistedValidationData, }; use cumulus_primitives_parachain_inherent::ParachainInherentData; @@ -46,7 +45,7 @@ use fc_rpc::{StorageOverride, StorageOverrideHandler}; use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; use futures::FutureExt; use sc_client_api::Backend; -use sc_consensus::{import_queue::BasicQueue, ImportQueue}; +use sc_consensus::ImportQueue; use sc_executor::{ HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY, }; @@ -55,10 +54,6 @@ use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; -use sp_consensus_aura::{ - sr25519::{AuthorityId as AuraId, AuthorityPair as AuraPair}, - AuraApi, -}; use sp_core::U256; use sp_keystore::KeystorePtr; use substrate_prometheus_endpoint::Registry; @@ -428,7 +423,7 @@ async fn start_node_impl( spawn_frontier_tasks( &task_manager, client.clone(), - backend.clone(), + backend, frontier_backend, filter_pool, overrides, @@ -495,7 +490,6 @@ async fn start_node_impl( if validator { start_consensus( client.clone(), - backend.clone(), block_import, prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), @@ -557,7 +551,6 @@ fn build_import_queue( #[allow(clippy::too_many_arguments)] fn start_consensus( client: Arc, - backend: Arc, block_import: ParachainBlockImport, prometheus_registry: Option<&Registry>, telemetry: Option, @@ -572,7 +565,9 @@ fn start_consensus( overseer_handle: OverseerHandle, announce_block: Arc>) + Send + Sync>, ) -> Result<(), sc_service::Error> { - use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams}; + use cumulus_client_consensus_aura::collators::basic::{ + self as basic_aura, Params as BasicAuraParams, + }; // NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant` // when starting the network. @@ -594,15 +589,11 @@ fn start_consensus( client.clone(), ); - let params = AuraParams { + let params = BasicAuraParams { create_inherent_data_providers: move |_, ()| async move { Ok(()) }, block_import, - para_client: client.clone(), - para_backend: backend.clone(), + para_client: client, relay_client: relay_chain_interface, - code_hash_provider: move |block_hash| { - client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash()) - }, sync_oracle, keystore, collator_key, @@ -612,12 +603,12 @@ fn start_consensus( proposer, collator_service, // Very limited proposal time. - authoring_duration: Duration::from_millis(1500), - reinitialize: false, + authoring_duration: Duration::from_millis(500), + collation_request_receiver: None, }; let fut = - aura::run::( + basic_aura::run::( params, ); task_manager.spawn_essential_handle().spawn("aura", None, fut); diff --git a/runtime/laos/Cargo.toml b/runtime/laos/Cargo.toml index 88c0d5b2..f9bd0b5e 100644 --- a/runtime/laos/Cargo.toml +++ b/runtime/laos/Cargo.toml @@ -87,7 +87,6 @@ cumulus-pallet-parachain-system = { workspace = true } cumulus-pallet-session-benchmarking = { workspace = true, optional = true} cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true } -cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-timestamp = { workspace = true } cumulus-primitives-utility = { workspace = true } @@ -138,7 +137,6 @@ std = [ "cumulus-pallet-parachain-system/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", "pallet-message-queue/std", "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", diff --git a/runtime/laos/src/apis.rs b/runtime/laos/src/apis.rs index a0b9893e..c3246736 100644 --- a/runtime/laos/src/apis.rs +++ b/runtime/laos/src/apis.rs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with LAOS. If not, see . -use crate::SLOT_DURATION; use fp_rpc::TransactionStatus; use frame_support::{ genesis_builder_helper::{build_state, get_preset}, @@ -34,33 +33,18 @@ use sp_runtime::{ }; use sp_std::prelude::*; use sp_version::RuntimeVersion; + // Local module imports use super::{ - AccountId, AuraId, Balance, Block, Ethereum, Executive, InherentDataExt, Nonce, + AccountId, Aura, AuraId, Balance, Block, Ethereum, Executive, InherentDataExt, Nonce, ParachainSystem, Runtime, RuntimeCall, RuntimeGenesisConfig, SessionKeys, System, TransactionPayment, UncheckedExtrinsic, EVM, VERSION, }; -/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included -/// into the relay chain. -const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; -/// How many parachain blocks are processed by the relay chain per parent. Limits the -/// number of blocks authored per slot. -const BLOCK_PROCESSING_VELOCITY: u32 = 1; -/// Relay chain slot duration, in milliseconds. -const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; - -pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< - Runtime, - RELAY_CHAIN_SLOT_DURATION_MILLIS, - BLOCK_PROCESSING_VELOCITY, - UNINCLUDED_SEGMENT_CAPACITY, ->; - impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { - sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION) + sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) } fn authorities() -> Vec { @@ -412,15 +396,6 @@ impl_runtime_apis! { } } - impl cumulus_primitives_aura::AuraUnincludedSegmentApi for Runtime { - fn can_build_upon( - included_hash: ::Hash, - slot: cumulus_primitives_aura::Slot, - ) -> bool { - ConsensusHook::can_build_upon(included_hash, slot) - } -} - #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/runtime/laos/src/configs/cumulus_parachain_system.rs b/runtime/laos/src/configs/cumulus_parachain_system.rs index 4db15ba4..5c74d7c9 100644 --- a/runtime/laos/src/configs/cumulus_parachain_system.rs +++ b/runtime/laos/src/configs/cumulus_parachain_system.rs @@ -39,7 +39,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = - cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; + cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; type ConsensusHook = ConsensusHook; type DmpQueue = frame_support::traits::EnqueueWithOrigin; type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; @@ -47,14 +47,14 @@ impl cumulus_pallet_parachain_system::Config for Runtime { /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included /// into the relay chain. -const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; +const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; /// How many parachain blocks are processed by the relay chain per parent. Limits the /// number of blocks authored per slot. const BLOCK_PROCESSING_VELOCITY: u32 = 1; /// Relay chain slot duration, in milliseconds. const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; -pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< +type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< Runtime, RELAY_CHAIN_SLOT_DURATION_MILLIS, BLOCK_PROCESSING_VELOCITY, @@ -95,4 +95,5 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { cumulus_pallet_parachain_system::register_validate_block! { Runtime = Runtime, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, + CheckInherents = CheckInherents, } diff --git a/runtime/laos/src/lib.rs b/runtime/laos/src/lib.rs index d4ec1111..de8af928 100644 --- a/runtime/laos/src/lib.rs +++ b/runtime/laos/src/lib.rs @@ -76,7 +76,6 @@ impl_opaque_keys! { /// This determines the average expected block time that we are targeting. pub const MILLISECS_PER_BLOCK: u64 = 12000; -pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; /// Version of the runtime #[sp_version::runtime_version]