Skip to content

Commit a217fca

Browse files
authored
Revert "Update tick collator for async backing (#1497)"
This reverts commit 50811d6.
1 parent c29b74d commit a217fca

4 files changed

Lines changed: 29 additions & 55 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system
5252
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
5353
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
5454
cumulus-ping = { path = "../../../pallets/ping", default-features = false }
55-
cumulus-primitives-aura = { path = "../../../../primitives/aura", default-features = false }
5655
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
5756
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
5857
parachains-common = { path = "../../../common", default-features = false }
@@ -71,7 +70,6 @@ std = [
7170
"cumulus-pallet-xcm/std",
7271
"cumulus-pallet-xcmp-queue/std",
7372
"cumulus-ping/std",
74-
"cumulus-primitives-aura/std",
7573
"cumulus-primitives-core/std",
7674
"cumulus-primitives-utility/std",
7775
"frame-benchmarking?/std",

cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
#[cfg(feature = "std")]
2323
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
2424

25-
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
25+
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
2626
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
2727
use sp_api::impl_runtime_apis;
2828
use sp_core::OpaqueMetadata;
2929
use sp_runtime::{
3030
create_runtime_str, generic, impl_opaque_keys,
31-
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Hash as HashT},
31+
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
3232
transaction_validity::{TransactionSource, TransactionValidity},
3333
ApplyExtrinsicResult,
3434
};
@@ -113,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
113113
state_version: 0,
114114
};
115115

116-
pub const MILLISECS_PER_BLOCK: u64 = 6000;
116+
pub const MILLISECS_PER_BLOCK: u64 = 12000;
117117

118118
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
119119

@@ -143,18 +143,18 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
143143
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used
144144
/// by Operational extrinsics.
145145
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
146-
/// We allow for 2 seconds of compute with a 6 second average block time.
146+
/// We allow for .5 seconds of compute with a 12 second average block time.
147147
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
148-
WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
148+
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
149149
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
150150
);
151151

152152
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
153153
/// into the relay chain.
154-
const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
154+
const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
155155
/// How many parachain blocks are processed by the relay chain per parent. Limits the
156156
/// number of blocks authored per slot.
157-
const BLOCK_PROCESSING_VELOCITY: u32 = 2;
157+
const BLOCK_PROCESSING_VELOCITY: u32 = 1;
158158
/// Relay chain slot duration, in milliseconds.
159159
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
160160

@@ -277,13 +277,6 @@ parameter_types! {
277277
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
278278
}
279279

280-
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
281-
Runtime,
282-
RELAY_CHAIN_SLOT_DURATION_MILLIS,
283-
BLOCK_PROCESSING_VELOCITY,
284-
UNINCLUDED_SEGMENT_CAPACITY,
285-
>;
286-
287280
impl cumulus_pallet_parachain_system::Config for Runtime {
288281
type WeightInfo = ();
289282
type RuntimeEvent = RuntimeEvent;
@@ -294,8 +287,13 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
294287
type ReservedDmpWeight = ReservedDmpWeight;
295288
type XcmpMessageHandler = XcmpQueue;
296289
type ReservedXcmpWeight = ReservedXcmpWeight;
297-
type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
298-
type ConsensusHook = ConsensusHook;
290+
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
291+
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
292+
Runtime,
293+
RELAY_CHAIN_SLOT_DURATION_MILLIS,
294+
BLOCK_PROCESSING_VELOCITY,
295+
UNINCLUDED_SEGMENT_CAPACITY,
296+
>;
299297
}
300298

301299
impl parachain_info::Config for Runtime {}
@@ -586,9 +584,9 @@ impl pallet_aura::Config for Runtime {
586584
type AuthorityId = AuraId;
587585
type DisabledValidators = ();
588586
type MaxAuthorities = ConstU32<100_000>;
589-
type AllowMultipleBlocksPerSlot = ConstBool<true>;
587+
type AllowMultipleBlocksPerSlot = ConstBool<false>;
590588
#[cfg(feature = "experimental")]
591-
type SlotDuration = ConstU64<SLOT_DURATION>;
589+
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;
592590
}
593591

594592
construct_runtime! {
@@ -626,7 +624,7 @@ pub type Balance = u128;
626624
/// Index of a transaction in the chain.
627625
pub type Nonce = u32;
628626
/// A hash of some data used by the chain.
629-
pub type Hash = <BlakeTwo256 as HashT>::Output;
627+
pub type Hash = sp_core::H256;
630628
/// An index to a block.
631629
pub type BlockNumber = u32;
632630
/// The address format for describing accounts.
@@ -753,7 +751,7 @@ impl_runtime_apis! {
753751

754752
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
755753
fn slot_duration() -> sp_consensus_aura::SlotDuration {
756-
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
754+
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
757755
}
758756

759757
fn authorities() -> Vec<AuraId> {
@@ -826,15 +824,6 @@ impl_runtime_apis! {
826824
build_config::<RuntimeGenesisConfig>(config)
827825
}
828826
}
829-
830-
impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
831-
fn can_build_upon(
832-
included_hash: <Block as BlockT>::Hash,
833-
slot: cumulus_primitives_aura::Slot,
834-
) -> bool {
835-
ConsensusHook::can_build_upon(included_hash, slot)
836-
}
837-
}
838827
}
839828

840829
cumulus_pallet_parachain_system::register_validate_block! {

cumulus/polkadot-parachain/src/service.rs

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ where
590590
CollatorPair,
591591
OverseerHandle,
592592
Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
593-
Arc<ParachainBackend>,
594593
) -> Result<(), sc_service::Error>,
595594
{
596595
let parachain_config = prepare_node_config(parachain_config);
@@ -724,7 +723,6 @@ where
724723
collator_key.expect("Command line arguments do not allow this. qed"),
725724
overseer_handle,
726725
announce_block,
727-
backend.clone(),
728726
)?;
729727
}
730728

@@ -985,8 +983,7 @@ pub async fn start_rococo_parachain_node(
985983
para_id,
986984
collator_key,
987985
overseer_handle,
988-
announce_block,
989-
backend| {
986+
announce_block| {
990987
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
991988

992989
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
@@ -1005,15 +1002,11 @@ pub async fn start_rococo_parachain_node(
10051002
client.clone(),
10061003
);
10071004

1008-
let params = AuraParams {
1005+
let params = BasicAuraParams {
10091006
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
10101007
block_import,
1011-
para_client: client.clone(),
1012-
para_backend: backend.clone(),
1008+
para_client: client,
10131009
relay_client: relay_chain_interface,
1014-
code_hash_provider: move |block_hash| {
1015-
client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash())
1016-
},
10171010
sync_oracle,
10181011
keystore,
10191012
collator_key,
@@ -1023,10 +1016,12 @@ pub async fn start_rococo_parachain_node(
10231016
relay_chain_slot_duration,
10241017
proposer,
10251018
collator_service,
1026-
authoring_duration: Duration::from_millis(1500),
1019+
// Very limited proposal time.
1020+
authoring_duration: Duration::from_millis(500),
1021+
collation_request_receiver: None,
10271022
};
10281023

1029-
let fut = aura::run::<
1024+
let fut = basic_aura::run::<
10301025
Block,
10311026
sp_consensus_aura::sr25519::AuthorityPair,
10321027
_,
@@ -1036,8 +1031,6 @@ pub async fn start_rococo_parachain_node(
10361031
_,
10371032
_,
10381033
_,
1039-
_,
1040-
_,
10411034
>(params);
10421035
task_manager.spawn_essential_handle().spawn("aura", None, fut);
10431036

@@ -1383,8 +1376,7 @@ where
13831376
para_id,
13841377
collator_key,
13851378
overseer_handle,
1386-
announce_block,
1387-
_backend| {
1379+
announce_block| {
13881380
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
13891381

13901382
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
@@ -1479,8 +1471,7 @@ where
14791471
para_id,
14801472
collator_key,
14811473
overseer_handle,
1482-
announce_block,
1483-
_backend| {
1474+
announce_block| {
14841475
let relay_chain_interface2 = relay_chain_interface.clone();
14851476

14861477
let collator_service = CollatorService::new(
@@ -1651,7 +1642,7 @@ where
16511642
para_backend: backend.clone(),
16521643
relay_client: relay_chain_interface,
16531644
code_hash_provider: move |block_hash| {
1654-
client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash())
1645+
client.code_at(block_hash).ok().map(ValidationCode).map(|c| c.hash())
16551646
},
16561647
sync_oracle,
16571648
keystore,
@@ -1722,7 +1713,6 @@ where
17221713
CollatorPair,
17231714
OverseerHandle,
17241715
Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
1725-
Arc<ParachainBackend>,
17261716
) -> Result<(), sc_service::Error>,
17271717
{
17281718
let parachain_config = prepare_node_config(parachain_config);
@@ -1855,7 +1845,6 @@ where
18551845
collator_key.expect("Command line arguments do not allow this. qed"),
18561846
overseer_handle,
18571847
announce_block,
1858-
backend.clone(),
18591848
)?;
18601849
}
18611850

@@ -1934,8 +1923,7 @@ pub async fn start_contracts_rococo_node(
19341923
para_id,
19351924
collator_key,
19361925
overseer_handle,
1937-
announce_block,
1938-
_backend| {
1926+
announce_block| {
19391927
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
19401928

19411929
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(

0 commit comments

Comments
 (0)