Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit c48aa45

Browse files
author
Andronik
committed
Merge branch 'master' into ao-disputes-offences-runtime
* master: Companion for Weight v1.5 Follow Up (#5949) [Feature] Make XCM benchmarks more reusable and remove a redundant bench (#5936) companion `try-state` (#5907) Don't store available data on disputes (#5950)
2 parents 9223d71 + de9e147 commit c48aa45

File tree

140 files changed

+1027
-1125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1027
-1125
lines changed

Cargo.lock

Lines changed: 175 additions & 170 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/core/dispute-coordinator/src/initialized.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,11 +890,7 @@ impl Initialized {
890890
.queue_participation(
891891
ctx,
892892
priority,
893-
ParticipationRequest::new(
894-
new_state.candidate_receipt().clone(),
895-
session,
896-
env.validators().len(),
897-
),
893+
ParticipationRequest::new(new_state.candidate_receipt().clone(), session),
898894
)
899895
.await;
900896
log_error(r)?;

node/core/dispute-coordinator/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ impl DisputeCoordinatorSubsystem {
304304
Some(info) => info.validators.clone(),
305305
};
306306

307-
let n_validators = validators.len();
308307
let voted_indices = votes.voted_indices();
309308

310309
// Determine if there are any missing local statements for this dispute. Validators are
@@ -335,11 +334,7 @@ impl DisputeCoordinatorSubsystem {
335334
if missing_local_statement {
336335
participation_requests.push((
337336
ParticipationPriority::with_priority_if(is_included),
338-
ParticipationRequest::new(
339-
votes.candidate_receipt.clone(),
340-
session,
341-
n_validators,
342-
),
337+
ParticipationRequest::new(votes.candidate_receipt.clone(), session),
343338
));
344339
}
345340
}

node/core/dispute-coordinator/src/participation/mod.rs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use futures_timer::Delay;
2727

2828
use polkadot_node_primitives::{ValidationResult, APPROVAL_EXECUTION_TIMEOUT};
2929
use polkadot_node_subsystem::{
30-
messages::{AvailabilityRecoveryMessage, AvailabilityStoreMessage, CandidateValidationMessage},
30+
messages::{AvailabilityRecoveryMessage, CandidateValidationMessage},
3131
overseer, ActiveLeavesUpdate, RecoveryError,
3232
};
3333
use polkadot_node_subsystem_util::runtime::get_validation_code_by_hash;
@@ -319,38 +319,6 @@ async fn participate(
319319
},
320320
};
321321

322-
// we dispatch a request to store the available data for the candidate. We
323-
// want to maximize data availability for other potential checkers involved
324-
// in the dispute
325-
let (store_available_data_tx, store_available_data_rx) = oneshot::channel();
326-
sender
327-
.send_message(AvailabilityStoreMessage::StoreAvailableData {
328-
candidate_hash: *req.candidate_hash(),
329-
n_validators: req.n_validators() as u32,
330-
available_data: available_data.clone(),
331-
tx: store_available_data_tx,
332-
})
333-
.await;
334-
335-
match store_available_data_rx.await {
336-
Err(oneshot::Canceled) => {
337-
gum::warn!(
338-
target: LOG_TARGET,
339-
"`Oneshot` got cancelled when storing available data {:?}",
340-
req.candidate_hash(),
341-
);
342-
},
343-
Ok(Err(err)) => {
344-
gum::warn!(
345-
target: LOG_TARGET,
346-
?err,
347-
"Failed to store available data for candidate {:?}",
348-
req.candidate_hash(),
349-
);
350-
},
351-
Ok(Ok(())) => {},
352-
}
353-
354322
// Issue a request to validate the candidate with the provided exhaustive
355323
// parameters
356324
//

node/core/dispute-coordinator/src/participation/queues/mod.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub struct ParticipationRequest {
7878
candidate_hash: CandidateHash,
7979
candidate_receipt: CandidateReceipt,
8080
session: SessionIndex,
81-
n_validators: usize,
8281
}
8382

8483
/// Whether a `ParticipationRequest` should be put on best-effort or the priority queue.
@@ -122,12 +121,8 @@ pub enum QueueError {
122121

123122
impl ParticipationRequest {
124123
/// Create a new `ParticipationRequest` to be queued.
125-
pub fn new(
126-
candidate_receipt: CandidateReceipt,
127-
session: SessionIndex,
128-
n_validators: usize,
129-
) -> Self {
130-
Self { candidate_hash: candidate_receipt.hash(), candidate_receipt, session, n_validators }
124+
pub fn new(candidate_receipt: CandidateReceipt, session: SessionIndex) -> Self {
125+
Self { candidate_hash: candidate_receipt.hash(), candidate_receipt, session }
131126
}
132127

133128
pub fn candidate_receipt(&'_ self) -> &'_ CandidateReceipt {
@@ -139,9 +134,6 @@ impl ParticipationRequest {
139134
pub fn session(&self) -> SessionIndex {
140135
self.session
141136
}
142-
pub fn n_validators(&self) -> usize {
143-
self.n_validators
144-
}
145137
pub fn into_candidate_info(self) -> (CandidateHash, CandidateReceipt) {
146138
let Self { candidate_hash, candidate_receipt, .. } = self;
147139
(candidate_hash, candidate_receipt)

node/core/dispute-coordinator/src/participation/queues/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn make_participation_request(hash: Hash) -> ParticipationRequest {
2525
let mut receipt = dummy_candidate_receipt(dummy_hash());
2626
// make it differ:
2727
receipt.commitments_hash = hash;
28-
ParticipationRequest::new(receipt, 1, 100)
28+
ParticipationRequest::new(receipt, 1)
2929
}
3030

3131
/// Make dummy comparator for request, based on the given block number.

node/core/dispute-coordinator/src/participation/tests.rs

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ use parity_scale_codec::Encode;
2929
use polkadot_node_primitives::{AvailableData, BlockData, InvalidCandidate, PoV};
3030
use polkadot_node_subsystem::{
3131
jaeger,
32-
messages::{
33-
AllMessages, DisputeCoordinatorMessage, RuntimeApiMessage, RuntimeApiRequest,
34-
ValidationFailed,
35-
},
32+
messages::{AllMessages, DisputeCoordinatorMessage, RuntimeApiMessage, RuntimeApiRequest},
3633
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue,
3734
};
3835
use polkadot_node_subsystem_test_helpers::{
@@ -71,9 +68,8 @@ async fn participate_with_commitments_hash<Context>(
7168
receipt
7269
};
7370
let session = 1;
74-
let n_validators = 10;
7571

76-
let req = ParticipationRequest::new(candidate_receipt, session, n_validators);
72+
let req = ParticipationRequest::new(candidate_receipt, session);
7773

7874
participation
7975
.queue_participation(ctx, ParticipationPriority::BestEffort, req)
@@ -116,7 +112,6 @@ pub async fn participation_full_happy_path(
116112
) {
117113
recover_available_data(ctx_handle).await;
118114
fetch_validation_code(ctx_handle).await;
119-
store_available_data(ctx_handle, true).await;
120115

121116
assert_matches!(
122117
ctx_handle.recv().await,
@@ -185,20 +180,6 @@ async fn fetch_validation_code(virtual_overseer: &mut VirtualOverseer) -> Hash {
185180
)
186181
}
187182

188-
async fn store_available_data(virtual_overseer: &mut VirtualOverseer, success: bool) {
189-
assert_matches!(
190-
virtual_overseer.recv().await,
191-
AllMessages::AvailabilityStore(AvailabilityStoreMessage::StoreAvailableData { tx, .. }) => {
192-
if success {
193-
tx.send(Ok(())).unwrap();
194-
} else {
195-
tx.send(Err(())).unwrap();
196-
}
197-
},
198-
"overseer did not receive store available data request",
199-
);
200-
}
201-
202183
#[test]
203184
fn same_req_wont_get_queued_if_participation_is_already_running() {
204185
futures::executor::block_on(async {
@@ -423,7 +404,6 @@ fn cast_invalid_vote_if_validation_fails_or_is_invalid() {
423404
fetch_validation_code(&mut ctx_handle).await,
424405
participation.recent_block.unwrap().1
425406
);
426-
store_available_data(&mut ctx_handle, true).await;
427407

428408
assert_matches!(
429409
ctx_handle.recv().await,
@@ -461,7 +441,6 @@ fn cast_invalid_vote_if_commitments_dont_match() {
461441
fetch_validation_code(&mut ctx_handle).await,
462442
participation.recent_block.unwrap().1
463443
);
464-
store_available_data(&mut ctx_handle, true).await;
465444

466445
assert_matches!(
467446
ctx_handle.recv().await,
@@ -499,7 +478,6 @@ fn cast_valid_vote_if_validation_passes() {
499478
fetch_validation_code(&mut ctx_handle).await,
500479
participation.recent_block.unwrap().1
501480
);
502-
store_available_data(&mut ctx_handle, true).await;
503481

504482
assert_matches!(
505483
ctx_handle.recv().await,
@@ -521,42 +499,3 @@ fn cast_valid_vote_if_validation_passes() {
521499
);
522500
})
523501
}
524-
525-
#[test]
526-
fn failure_to_store_available_data_does_not_preclude_participation() {
527-
futures::executor::block_on(async {
528-
let (mut ctx, mut ctx_handle) = make_our_subsystem_context(TaskExecutor::new());
529-
530-
let (sender, mut worker_receiver) = mpsc::channel(1);
531-
let mut participation = Participation::new(sender);
532-
activate_leaf(&mut ctx, &mut participation, 10).await.unwrap();
533-
participate(&mut ctx, &mut participation).await.unwrap();
534-
535-
recover_available_data(&mut ctx_handle).await;
536-
assert_eq!(
537-
fetch_validation_code(&mut ctx_handle).await,
538-
participation.recent_block.unwrap().1
539-
);
540-
// the store available data request should fail:
541-
store_available_data(&mut ctx_handle, false).await;
542-
543-
assert_matches!(
544-
ctx_handle.recv().await,
545-
AllMessages::CandidateValidation(
546-
CandidateValidationMessage::ValidateFromExhaustive(_, _, _, _, timeout, tx)
547-
) if timeout == APPROVAL_EXECUTION_TIMEOUT => {
548-
tx.send(Err(ValidationFailed("fail".to_string()))).unwrap();
549-
},
550-
"overseer did not receive candidate validation message",
551-
);
552-
553-
let result = participation
554-
.get_participation_result(&mut ctx, worker_receiver.next().await.unwrap())
555-
.await
556-
.unwrap();
557-
assert_matches!(
558-
result.outcome,
559-
ParticipationOutcome::Invalid => {}
560-
);
561-
})
562-
}

runtime/common/src/crowdloan/migration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub mod crowdloan_index_migration {
9090
/// This migration converts crowdloans to use a crowdloan index rather than the parachain id as a
9191
/// unique identifier. This makes it easier to swap two crowdloans between parachains.
9292
pub fn migrate<T: Config>() -> frame_support::weights::Weight {
93-
let mut weight = Weight::new();
93+
let mut weight = Weight::zero();
9494

9595
// First migrate `NextTrieIndex` counter to `NextFundIndex`.
9696

runtime/common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1);
6969
/// by Operational extrinsics.
7070
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
7171
/// We allow for 2 seconds of compute with a 6 second average block time.
72-
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.scalar_saturating_mul(2);
72+
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_mul(2);
7373

7474
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
7575

runtime/common/src/slots/migration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub mod slots_crowdloan_index_migration {
5151
}
5252

5353
pub fn migrate<T: Config + crowdloan::Config>() -> frame_support::weights::Weight {
54-
let mut weight = Weight::new();
54+
let mut weight = Weight::zero();
5555

5656
for (para_id, mut leases) in Leases::<T>::iter() {
5757
weight = weight.saturating_add(T::DbWeight::get().reads(2));

0 commit comments

Comments
 (0)