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

Commit

Permalink
Merge branch 'master' into ao-disputes-offences-runtime
Browse files Browse the repository at this point in the history
* master:
  Companion of paritytech/substrate#12157 (#5964)
  candidate-validation: info logs on failure (#5957)
  • Loading branch information
ordian committed Sep 2, 2022
2 parents 655fe98 + 88798fb commit 81578ff
Show file tree
Hide file tree
Showing 139 changed files with 4,137 additions and 4,132 deletions.
340 changes: 170 additions & 170 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions node/core/candidate-validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,11 @@ async fn validate_candidate_exhaustive(
let _timer = metrics.time_validate_candidate_exhaustive();

let validation_code_hash = validation_code.hash();
let para_id = candidate_receipt.descriptor.para_id.clone();
gum::debug!(
target: LOG_TARGET,
?validation_code_hash,
para_id = ?candidate_receipt.descriptor.para_id,
?para_id,
"About to validate a candidate.",
);

Expand All @@ -514,6 +515,7 @@ async fn validate_candidate_exhaustive(
&*pov,
&validation_code_hash,
) {
gum::info!(target: LOG_TARGET, ?para_id, "Invalid candidate (basic checks)");
return Ok(ValidationResult::Invalid(e))
}

Expand All @@ -523,7 +525,7 @@ async fn validate_candidate_exhaustive(
) {
Ok(code) => code,
Err(e) => {
gum::debug!(target: LOG_TARGET, err=?e, "Invalid validation code");
gum::info!(target: LOG_TARGET, ?para_id, err=?e, "Invalid candidate (validation code)");

// If the validation code is invalid, the candidate certainly is.
return Ok(ValidationResult::Invalid(InvalidCandidate::CodeDecompressionFailure))
Expand All @@ -534,7 +536,7 @@ async fn validate_candidate_exhaustive(
match sp_maybe_compressed_blob::decompress(&pov.block_data.0, POV_BOMB_LIMIT) {
Ok(block_data) => BlockData(block_data.to_vec()),
Err(e) => {
gum::debug!(target: LOG_TARGET, err=?e, "Invalid PoV code");
gum::info!(target: LOG_TARGET, ?para_id, err=?e, "Invalid candidate (PoV code)");

// If the PoV is invalid, the candidate certainly is.
return Ok(ValidationResult::Invalid(InvalidCandidate::PoVDecompressionFailure))
Expand All @@ -552,12 +554,8 @@ async fn validate_candidate_exhaustive(
.validate_candidate(raw_validation_code.to_vec(), timeout, params)
.await;

if let Err(ref e) = result {
gum::debug!(
target: LOG_TARGET,
error = ?e,
"Failed to validate candidate",
);
if let Err(ref error) = result {
gum::info!(target: LOG_TARGET, ?para_id, ?error, "Failed to validate candidate",);
}

match result {
Expand All @@ -576,6 +574,7 @@ async fn validate_candidate_exhaustive(

Ok(res) =>
if res.head_data.hash() != candidate_receipt.descriptor.para_head {
gum::info!(target: LOG_TARGET, ?para_id, "Invalid candidate (para_head)");
Ok(ValidationResult::Invalid(InvalidCandidate::ParaHeadHashMismatch))
} else {
let outputs = CandidateCommitments {
Expand All @@ -587,6 +586,12 @@ async fn validate_candidate_exhaustive(
hrmp_watermark: res.hrmp_watermark,
};
if candidate_receipt.commitments_hash != outputs.hash() {
gum::info!(
target: LOG_TARGET,
?para_id,
"Invalid candidate (commitments hash)"
);

// If validation produced a new set of commitments, we treat the candidate as invalid.
Ok(ValidationResult::Invalid(InvalidCandidate::CommitmentsHashMismatch))
} else {
Expand Down
28 changes: 14 additions & 14 deletions runtime/kusama/src/weights/frame_benchmarking_baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,52 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{RefTimeWeight, Weight}};
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `frame_benchmarking::baseline`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for WeightInfo<T> {
/// The range of component `i` is `[0, 1000000]`.
fn addition(_i: u32, ) -> Weight {
Weight::from_ref_time(123_000 as RefTimeWeight)
Weight::from_ref_time(123_000 as u64)
}
/// The range of component `i` is `[0, 1000000]`.
fn subtraction(_i: u32, ) -> Weight {
Weight::from_ref_time(110_000 as RefTimeWeight)
Weight::from_ref_time(110_000 as u64)
}
/// The range of component `i` is `[0, 1000000]`.
fn multiplication(_i: u32, ) -> Weight {
Weight::from_ref_time(124_000 as RefTimeWeight)
Weight::from_ref_time(124_000 as u64)
}
/// The range of component `i` is `[0, 1000000]`.
fn division(_i: u32, ) -> Weight {
Weight::from_ref_time(120_000 as RefTimeWeight)
Weight::from_ref_time(120_000 as u64)
}
/// The range of component `i` is `[0, 100]`.
fn hashing(_i: u32, ) -> Weight {
Weight::from_ref_time(19_606_352_000 as RefTimeWeight)
Weight::from_ref_time(19_606_352_000 as u64)
}
/// The range of component `i` is `[1, 100]`.
fn sr25519_verification(i: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 38_000
.saturating_add(Weight::from_ref_time(47_929_000 as RefTimeWeight).saturating_mul(i as RefTimeWeight))
.saturating_add(Weight::from_ref_time(47_929_000 as u64).saturating_mul(i as u64))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[0, 1000]`.
fn storage_read(i: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 4_000
.saturating_add(Weight::from_ref_time(2_101_000 as RefTimeWeight).saturating_mul(i as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
.saturating_add(Weight::from_ref_time(2_101_000 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(i as u64)))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[0, 1000]`.
fn storage_write(i: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(330_000 as RefTimeWeight).saturating_mul(i as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
.saturating_add(Weight::from_ref_time(330_000 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64)))
}
}
14 changes: 7 additions & 7 deletions runtime/kusama/src/weights/frame_election_provider_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{RefTimeWeight, Weight}};
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `frame_election_provider_support`.
Expand All @@ -48,20 +48,20 @@ impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for We
/// The range of component `t` is `[500, 1000]`.
/// The range of component `d` is `[5, 16]`.
fn phragmen(v: u32, _t: u32, d: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 87_000
.saturating_add(Weight::from_ref_time(22_196_000 as RefTimeWeight).saturating_mul(v as RefTimeWeight))
.saturating_add(Weight::from_ref_time(22_196_000 as u64).saturating_mul(v as u64))
// Standard Error: 7_520_000
.saturating_add(Weight::from_ref_time(3_555_366_000 as RefTimeWeight).saturating_mul(d as RefTimeWeight))
.saturating_add(Weight::from_ref_time(3_555_366_000 as u64).saturating_mul(d as u64))
}
/// The range of component `v` is `[1000, 2000]`.
/// The range of component `t` is `[500, 1000]`.
/// The range of component `d` is `[5, 16]`.
fn phragmms(v: u32, _t: u32, d: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 74_000
.saturating_add(Weight::from_ref_time(15_098_000 as RefTimeWeight).saturating_mul(v as RefTimeWeight))
.saturating_add(Weight::from_ref_time(15_098_000 as u64).saturating_mul(v as u64))
// Standard Error: 6_402_000
.saturating_add(Weight::from_ref_time(2_580_118_000 as RefTimeWeight).saturating_mul(d as RefTimeWeight))
.saturating_add(Weight::from_ref_time(2_580_118_000 as u64).saturating_mul(d as u64))
}
}
34 changes: 17 additions & 17 deletions runtime/kusama/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,53 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{RefTimeWeight, Weight}};
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `frame_system`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
/// The range of component `b` is `[0, 3932160]`.
fn remark(b: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).saturating_mul(b as RefTimeWeight))
.saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(b as u64))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).saturating_mul(b as RefTimeWeight))
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64))
}
// Storage: System Digest (r:1 w:1)
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
fn set_heap_pages() -> Weight {
Weight::from_ref_time(4_767_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
Weight::from_ref_time(4_767_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[1, 1000]`.
fn set_storage(i: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 1_000
.saturating_add(Weight::from_ref_time(550_000 as RefTimeWeight).saturating_mul(i as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
.saturating_add(Weight::from_ref_time(550_000 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64)))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `i` is `[1, 1000]`.
fn kill_storage(i: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 1_000
.saturating_add(Weight::from_ref_time(441_000 as RefTimeWeight).saturating_mul(i as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
.saturating_add(Weight::from_ref_time(441_000 as u64).saturating_mul(i as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(i as u64)))
}
// Storage: Skipped Metadata (r:0 w:0)
/// The range of component `p` is `[1, 1000]`.
fn kill_prefix(p: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
Weight::from_ref_time(0 as u64)
// Standard Error: 1_000
.saturating_add(Weight::from_ref_time(955_000 as RefTimeWeight).saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
.saturating_add(Weight::from_ref_time(955_000 as u64).saturating_mul(p as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64)))
}
}
20 changes: 10 additions & 10 deletions runtime/kusama/src/weights/pallet_bags_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{RefTimeWeight, Weight}};
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `pallet_bags_list`.
Expand All @@ -49,27 +49,27 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Storage: VoterList ListNodes (r:4 w:4)
// Storage: VoterList ListBags (r:1 w:1)
fn rebag_non_terminal() -> Weight {
Weight::from_ref_time(50_938_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
Weight::from_ref_time(50_938_000 as u64)
.saturating_add(T::DbWeight::get().reads(7 as u64))
.saturating_add(T::DbWeight::get().writes(5 as u64))
}
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
// Storage: VoterList ListNodes (r:3 w:3)
// Storage: VoterList ListBags (r:2 w:2)
fn rebag_terminal() -> Weight {
Weight::from_ref_time(49_843_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
Weight::from_ref_time(49_843_000 as u64)
.saturating_add(T::DbWeight::get().reads(7 as u64))
.saturating_add(T::DbWeight::get().writes(5 as u64))
}
// Storage: VoterList ListNodes (r:4 w:4)
// Storage: Staking Bonded (r:2 w:0)
// Storage: Staking Ledger (r:2 w:0)
// Storage: VoterList CounterForListNodes (r:1 w:1)
// Storage: VoterList ListBags (r:1 w:1)
fn put_in_front_of() -> Weight {
Weight::from_ref_time(51_965_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(10 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
Weight::from_ref_time(51_965_000 as u64)
.saturating_add(T::DbWeight::get().reads(10 as u64))
.saturating_add(T::DbWeight::get().writes(6 as u64))
}
}
44 changes: 22 additions & 22 deletions runtime/kusama/src/weights/pallet_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,52 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{RefTimeWeight, Weight}};
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `pallet_balances`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
Weight::from_ref_time(38_958_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
Weight::from_ref_time(38_958_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
Weight::from_ref_time(30_030_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
Weight::from_ref_time(30_030_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
Weight::from_ref_time(19_591_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
Weight::from_ref_time(19_591_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
Weight::from_ref_time(22_871_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
Weight::from_ref_time(22_871_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:2 w:2)
fn force_transfer() -> Weight {
Weight::from_ref_time(39_215_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
Weight::from_ref_time(39_215_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
// Storage: System Account (r:1 w:1)
fn transfer_all() -> Weight {
Weight::from_ref_time(34_799_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
Weight::from_ref_time(34_799_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn force_unreserve() -> Weight {
Weight::from_ref_time(17_925_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
Weight::from_ref_time(17_925_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
}
Loading

0 comments on commit 81578ff

Please sign in to comment.