mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Fix spelling mistakes across the whole repository (#3808)
**Update:** Pushed additional changes based on the review comments. **This pull request fixes various spelling mistakes in this repository.** Most of the changes are contained in the first **3** commits: - `Fix spelling mistakes in comments and docs` - `Fix spelling mistakes in test names` - `Fix spelling mistakes in error messages, panic messages, logs and tracing` Other source code spelling mistakes are separated into individual commits for easier reviewing: - `Fix the spelling of 'authority'` - `Fix the spelling of 'REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY'` - `Fix the spelling of 'prev_enqueud_messages'` - `Fix the spelling of 'endpoint'` - `Fix the spelling of 'children'` - `Fix the spelling of 'PenpalSiblingSovereignAccount'` - `Fix the spelling of 'PenpalSudoAccount'` - `Fix the spelling of 'insufficient'` - `Fix the spelling of 'PalletXcmExtrinsicsBenchmark'` - `Fix the spelling of 'subtracted'` - `Fix the spelling of 'CandidatePendingAvailability'` - `Fix the spelling of 'exclusive'` - `Fix the spelling of 'until'` - `Fix the spelling of 'discriminator'` - `Fix the spelling of 'nonexistent'` - `Fix the spelling of 'subsystem'` - `Fix the spelling of 'indices'` - `Fix the spelling of 'committed'` - `Fix the spelling of 'topology'` - `Fix the spelling of 'response'` - `Fix the spelling of 'beneficiary'` - `Fix the spelling of 'formatted'` - `Fix the spelling of 'UNKNOWN_PROOF_REQUEST'` - `Fix the spelling of 'succeeded'` - `Fix the spelling of 'reopened'` - `Fix the spelling of 'proposer'` - `Fix the spelling of 'InstantiationNonce'` - `Fix the spelling of 'depositor'` - `Fix the spelling of 'expiration'` - `Fix the spelling of 'phantom'` - `Fix the spelling of 'AggregatedKeyValue'` - `Fix the spelling of 'randomness'` - `Fix the spelling of 'defendant'` - `Fix the spelling of 'AquaticMammal'` - `Fix the spelling of 'transactions'` - `Fix the spelling of 'PassingTracingSubscriber'` - `Fix the spelling of 'TxSignaturePayload'` - `Fix the spelling of 'versioning'` - `Fix the spelling of 'descendant'` - `Fix the spelling of 'overridden'` - `Fix the spelling of 'network'` Let me know if this structure is adequate. **Note:** The usage of the words `Merkle`, `Merkelize`, `Merklization`, `Merkelization`, `Merkleization`, is somewhat inconsistent but I left it as it is. ~~**Note:** In some places the term `Receival` is used to refer to message reception, IMO `Reception` is the correct word here, but I left it as it is.~~ ~~**Note:** In some places the term `Overlayed` is used instead of the more acceptable version `Overlaid` but I also left it as it is.~~ ~~**Note:** In some places the term `Applyable` is used instead of the correct version `Applicable` but I also left it as it is.~~ **Note:** Some usage of British vs American english e.g. `judgement` vs `judgment`, `initialise` vs `initialize`, `optimise` vs `optimize` etc. are both present in different places, but I suppose that's understandable given the number of contributors. ~~**Note:** There is a spelling mistake in `.github/CODEOWNERS` but it triggers errors in CI when I make changes to it, so I left it as it is.~~
This commit is contained in:
@@ -254,7 +254,7 @@ fn canonicalize_works() {
|
||||
// -> B1 -> C1 -> D1
|
||||
// A -> B2 -> C2 -> D2
|
||||
//
|
||||
// We'll canonicalize C1. Everytning except D1 should disappear.
|
||||
// We'll canonicalize C1. Everything except D1 should disappear.
|
||||
//
|
||||
// Candidates:
|
||||
// Cand1 in B2
|
||||
|
||||
@@ -79,7 +79,7 @@ pub fn v1_to_latest(db: Arc<dyn Database>, config: Config) -> Result<()> {
|
||||
block.candidates().iter().enumerate()
|
||||
{
|
||||
// Loading the candidate will also perform the conversion to the updated format and
|
||||
// return that represantation.
|
||||
// return that representation.
|
||||
if let Some(candidate_entry) = backend
|
||||
.load_candidate_entry_v1(&candidate_hash, candidate_index as CandidateIndex)
|
||||
.map_err(|e| Error::InternalError(e))?
|
||||
|
||||
@@ -269,7 +269,7 @@ fn canonicalize_works() {
|
||||
// -> B1 -> C1 -> D1
|
||||
// A -> B2 -> C2 -> D2
|
||||
//
|
||||
// We'll canonicalize C1. Everytning except D1 should disappear.
|
||||
// We'll canonicalize C1. Everything except D1 should disappear.
|
||||
//
|
||||
// Candidates:
|
||||
// Cand1 in B2
|
||||
|
||||
@@ -60,7 +60,7 @@ pub fn v2_to_latest(db: Arc<dyn Database>, config: Config) -> Result<()> {
|
||||
block.candidates().iter().enumerate()
|
||||
{
|
||||
// Loading the candidate will also perform the conversion to the updated format and
|
||||
// return that represantation.
|
||||
// return that representation.
|
||||
if let Some(candidate_entry) = backend
|
||||
.load_candidate_entry_v2(&candidate_hash, candidate_index as CandidateIndex)
|
||||
.map_err(|e| Error::InternalError(e))?
|
||||
@@ -104,7 +104,7 @@ pub fn v1_to_latest_sanity_check(
|
||||
for block in all_blocks {
|
||||
for (_core_index, candidate_hash) in block.candidates() {
|
||||
// Loading the candidate will also perform the conversion to the updated format and
|
||||
// return that represantation.
|
||||
// return that representation.
|
||||
if let Some(candidate_entry) = backend.load_candidate_entry(&candidate_hash).unwrap() {
|
||||
candidates.insert(candidate_entry.candidate.hash());
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ fn canonicalize_works() {
|
||||
// -> B1 -> C1 -> D1
|
||||
// A -> B2 -> C2 -> D2
|
||||
//
|
||||
// We'll canonicalize C1. Everytning except D1 should disappear.
|
||||
// We'll canonicalize C1. Everything except D1 should disappear.
|
||||
//
|
||||
// Candidates:
|
||||
// Cand1 in B2
|
||||
|
||||
@@ -148,7 +148,7 @@ fn relay_vrf_modulo_cores(
|
||||
generate_samples(rand_chacha, num_samples as usize, max_cores as usize)
|
||||
}
|
||||
|
||||
/// Generates `num_sumples` randomly from (0..max_cores) range
|
||||
/// Generates `num_samples` randomly from (0..max_cores) range
|
||||
///
|
||||
/// Note! The algorithm can't change because validators on the other
|
||||
/// side won't be able to check the assignments until they update.
|
||||
|
||||
@@ -91,7 +91,7 @@ enum ImportedBlockInfoError {
|
||||
#[error(transparent)]
|
||||
RuntimeError(RuntimeApiError),
|
||||
|
||||
#[error("future cancalled while requesting {0}")]
|
||||
#[error("future cancelled while requesting {0}")]
|
||||
FutureCancelled(&'static str, futures::channel::oneshot::Canceled),
|
||||
|
||||
#[error(transparent)]
|
||||
|
||||
@@ -1850,7 +1850,7 @@ async fn get_approval_signatures_for_candidate<Context>(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?candidate_hash,
|
||||
"Spawning task for fetching sinatures from approval-distribution"
|
||||
"Spawning task for fetching signatures from approval-distribution"
|
||||
);
|
||||
ctx.spawn("get-approval-signatures", Box::pin(get_approvals))
|
||||
}
|
||||
|
||||
@@ -3154,7 +3154,7 @@ where
|
||||
// starting configuration. The relevant ticks (all scheduled wakeups) are printed after no further
|
||||
// ticks are scheduled. To create a valid test, a prefix of the relevant ticks should be included
|
||||
// in the final test configuration, ending at the tick with the desired inputs to
|
||||
// should_trigger_assignemnt.
|
||||
// should_trigger_assignment.
|
||||
async fn step_until_done(clock: &MockClock) {
|
||||
let mut relevant_ticks = Vec::new();
|
||||
loop {
|
||||
@@ -3837,7 +3837,7 @@ fn test_approval_is_sent_on_max_approval_coalesce_count() {
|
||||
|
||||
async fn handle_approval_on_max_coalesce_count(
|
||||
virtual_overseer: &mut VirtualOverseer,
|
||||
candidate_indicies: Vec<CandidateIndex>,
|
||||
candidate_indices: Vec<CandidateIndex>,
|
||||
) {
|
||||
assert_matches!(
|
||||
overseer_recv(virtual_overseer).await,
|
||||
@@ -3845,16 +3845,16 @@ async fn handle_approval_on_max_coalesce_count(
|
||||
_,
|
||||
c_indices,
|
||||
)) => {
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies.clone()).unwrap(), c_indices);
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices.clone()).unwrap(), c_indices);
|
||||
}
|
||||
);
|
||||
|
||||
for _ in &candidate_indicies {
|
||||
for _ in &candidate_indices {
|
||||
recover_available_data(virtual_overseer).await;
|
||||
fetch_validation_code(virtual_overseer).await;
|
||||
}
|
||||
|
||||
for _ in &candidate_indicies {
|
||||
for _ in &candidate_indices {
|
||||
assert_matches!(
|
||||
overseer_recv(virtual_overseer).await,
|
||||
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive{exec_kind, response_sender, ..}) if exec_kind == PvfExecKind::Approval => {
|
||||
@@ -3885,7 +3885,7 @@ async fn handle_approval_on_max_coalesce_count(
|
||||
assert_matches!(
|
||||
overseer_recv(virtual_overseer).await,
|
||||
AllMessages::ApprovalDistribution(ApprovalDistributionMessage::DistributeApproval(vote)) => {
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies).unwrap(), vote.candidate_indices);
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices).unwrap(), vote.candidate_indices);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -3895,7 +3895,7 @@ async fn handle_approval_on_max_coalesce_count(
|
||||
|
||||
async fn handle_approval_on_max_wait_time(
|
||||
virtual_overseer: &mut VirtualOverseer,
|
||||
candidate_indicies: Vec<CandidateIndex>,
|
||||
candidate_indices: Vec<CandidateIndex>,
|
||||
clock: Box<MockClock>,
|
||||
) {
|
||||
const TICK_NOW_BEGIN: u64 = 1;
|
||||
@@ -3909,16 +3909,16 @@ async fn handle_approval_on_max_wait_time(
|
||||
_,
|
||||
c_indices,
|
||||
)) => {
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies.clone()).unwrap(), c_indices);
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices.clone()).unwrap(), c_indices);
|
||||
}
|
||||
);
|
||||
|
||||
for _ in &candidate_indicies {
|
||||
for _ in &candidate_indices {
|
||||
recover_available_data(virtual_overseer).await;
|
||||
fetch_validation_code(virtual_overseer).await;
|
||||
}
|
||||
|
||||
for _ in &candidate_indicies {
|
||||
for _ in &candidate_indices {
|
||||
assert_matches!(
|
||||
overseer_recv(virtual_overseer).await,
|
||||
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive{exec_kind, response_sender, ..}) if exec_kind == PvfExecKind::Approval => {
|
||||
@@ -3978,7 +3978,7 @@ async fn handle_approval_on_max_wait_time(
|
||||
assert_matches!(
|
||||
overseer_recv(virtual_overseer).await,
|
||||
AllMessages::ApprovalDistribution(ApprovalDistributionMessage::DistributeApproval(vote)) => {
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies).unwrap(), vote.candidate_indices);
|
||||
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices).unwrap(), vote.candidate_indices);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4319,7 +4319,7 @@ fn subsystem_relaunches_approval_work_on_restart() {
|
||||
virtual_overseer
|
||||
});
|
||||
|
||||
// Restart a new approval voting subsystem with the same database and major syncing true untill
|
||||
// Restart a new approval voting subsystem with the same database and major syncing true until
|
||||
// the last leaf.
|
||||
let config = HarnessConfigBuilder::default().backend(store_clone).major_syncing(true).build();
|
||||
|
||||
|
||||
@@ -126,13 +126,13 @@ impl DelayedApprovalTimer {
|
||||
/// no additional timer is started.
|
||||
pub(crate) fn maybe_arm_timer(
|
||||
&mut self,
|
||||
wait_untill: Tick,
|
||||
wait_until: Tick,
|
||||
clock: &dyn Clock,
|
||||
block_hash: Hash,
|
||||
validator_index: ValidatorIndex,
|
||||
) {
|
||||
if self.blocks.insert(block_hash) {
|
||||
let clock_wait = clock.wait(wait_untill);
|
||||
let clock_wait = clock.wait(wait_until);
|
||||
self.timers.push(Box::pin(async move {
|
||||
clock_wait.await;
|
||||
(block_hash, validator_index)
|
||||
|
||||
@@ -1218,7 +1218,7 @@ fn process_message(
|
||||
// tx channel is dropped and that error is caught by the caller subsystem.
|
||||
//
|
||||
// We bubble up the specific error here so `av-store` logs still tell what
|
||||
// happend.
|
||||
// happened.
|
||||
return Err(e.into())
|
||||
},
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ struct State {
|
||||
/// Cache the per-session Validator->Group mapping.
|
||||
validator_to_group_cache:
|
||||
LruMap<SessionIndex, Arc<IndexedVec<ValidatorIndex, Option<GroupIndex>>>>,
|
||||
/// A cloneable sender which is dispatched to background candidate validation tasks to inform
|
||||
/// A clonable sender which is dispatched to background candidate validation tasks to inform
|
||||
/// the main task of the result.
|
||||
background_validation_tx: mpsc::Sender<(Hash, ValidatedCandidateCommand)>,
|
||||
/// The handle to the keystore used for signing.
|
||||
|
||||
@@ -617,7 +617,7 @@ async fn validate_candidate_exhaustive(
|
||||
Err(e) => {
|
||||
gum::info!(target: LOG_TARGET, ?para_id, err=?e, "Invalid candidate (validation code)");
|
||||
|
||||
// Code already passed pre-checking, if decompression fails now this most likley means
|
||||
// Code already passed pre-checking, if decompression fails now this most likely means
|
||||
// some local corruption happened.
|
||||
return Err(ValidationFailed("Code decompression failed".to_string()))
|
||||
},
|
||||
|
||||
@@ -51,7 +51,7 @@ type Timestamp = u64;
|
||||
// If a block isn't approved in 120 seconds, nodes will abandon it
|
||||
// and begin building on another chain.
|
||||
const STAGNANT_TIMEOUT: Timestamp = 120;
|
||||
// Delay prunning of the stagnant keys in prune only mode by 25 hours to avoid interception with the
|
||||
// Delay pruning of the stagnant keys in prune only mode by 25 hours to avoid interception with the
|
||||
// finality
|
||||
const STAGNANT_PRUNE_DELAY: Timestamp = 25 * 60 * 60;
|
||||
// Maximum number of stagnant entries cleaned during one `STAGNANT_TIMEOUT` iteration
|
||||
@@ -237,7 +237,7 @@ impl Clock for SystemClock {
|
||||
//
|
||||
// The exact time that a block becomes stagnant in the local node is always expected
|
||||
// to differ from other nodes due to network asynchrony and delays in block propagation.
|
||||
// Non-monotonicity exarcerbates that somewhat, but not meaningfully.
|
||||
// Non-monotonicity exacerbates that somewhat, but not meaningfully.
|
||||
|
||||
match SystemTime::now().duration_since(UNIX_EPOCH) {
|
||||
Ok(d) => d.as_secs(),
|
||||
|
||||
@@ -406,7 +406,7 @@ async fn import_chains_into_empty(
|
||||
// some pre-blocks may need to be supplied to answer ancestry requests
|
||||
// that gather batches beyond the beginning of the new chain.
|
||||
// pre-blocks are those already known by the subsystem, however,
|
||||
// the subsystem has no way of knowin that until requesting ancestry.
|
||||
// the subsystem has no way of knowing that until requesting ancestry.
|
||||
async fn import_all_blocks_into(
|
||||
virtual_overseer: &mut VirtualOverseer,
|
||||
backend: &TestBackend,
|
||||
@@ -1300,7 +1300,7 @@ fn finalize_erases_unviable_from_one_but_not_all_reverts() {
|
||||
// F <- A1 <- A2 <- A3
|
||||
//
|
||||
// A3 reverts A2 and A1.
|
||||
// Finalize A1. A2 is stil unviable.
|
||||
// Finalize A1. A2 is still unviable.
|
||||
|
||||
let (a3_hash, chain_a) =
|
||||
construct_chain_on_base(vec![1, 2, 3], finalized_number, finalized_hash, |h| {
|
||||
|
||||
@@ -341,7 +341,7 @@ pub(crate) fn note_earliest_session(
|
||||
let lower_bound = (new_earliest_session, CandidateHash(Hash::repeat_byte(0x00)));
|
||||
|
||||
let new_recent_disputes = recent_disputes.split_off(&lower_bound);
|
||||
// Any remanining disputes are considered ancient and must be pruned.
|
||||
// Any remaining disputes are considered ancient and must be pruned.
|
||||
let pruned_disputes = recent_disputes;
|
||||
|
||||
if pruned_disputes.len() != 0 {
|
||||
|
||||
@@ -462,7 +462,7 @@ async fn wait_for_first_leaf<Context>(ctx: &mut Context) -> Result<Option<Activa
|
||||
}
|
||||
}
|
||||
|
||||
/// Check wheter a dispute for the given candidate could be spam.
|
||||
/// Check whether a dispute for the given candidate could be spam.
|
||||
///
|
||||
/// That is the candidate could be made up.
|
||||
pub fn is_potential_spam(
|
||||
|
||||
@@ -39,7 +39,7 @@ impl RefCountedCandidates {
|
||||
|
||||
// If a `CandidateHash` with reference count equals to 1 is about to be removed - the
|
||||
// candidate is dropped from the container too.
|
||||
// If a `CandidateHash` with reference count biger than 1 is about to be removed - the
|
||||
// If a `CandidateHash` with reference count bigger than 1 is about to be removed - the
|
||||
// reference count is decreased and the candidate remains in the container.
|
||||
pub fn remove(&mut self, candidate: &CandidateHash) {
|
||||
match self.candidates.get_mut(candidate) {
|
||||
|
||||
@@ -121,7 +121,7 @@ impl Inclusions {
|
||||
Entry::Vacant(_) => {
|
||||
// Rare case where same candidate was present on multiple heights, but all are
|
||||
// pruned at the same time. This candidate was already pruned in the previous
|
||||
// occurence so it is skipped now.
|
||||
// occurrence so it is skipped now.
|
||||
},
|
||||
Entry::Occupied(mut e) => {
|
||||
let mut blocks_including = std::mem::take(e.get_mut());
|
||||
|
||||
@@ -542,8 +542,8 @@ fn scraper_handles_backed_but_not_included_candidate() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scraper_handles_the_same_candidate_incuded_in_two_different_block_heights() {
|
||||
// Same candidate will be inclued in these two leaves
|
||||
fn scraper_handles_the_same_candidate_included_in_two_different_block_heights() {
|
||||
// Same candidate will be included in these two leaves
|
||||
let test_targets = vec![2, 3];
|
||||
|
||||
// How many blocks should we skip before sending a leaf update.
|
||||
|
||||
@@ -2226,7 +2226,7 @@ fn resume_dispute_without_local_statement() {
|
||||
test_state
|
||||
})
|
||||
})
|
||||
// Alice should send a DisputeParticiationMessage::Participate on restart since she has no
|
||||
// Alice should send a DisputeParticipationMessage::Participate on restart since she has no
|
||||
// local statement for the active dispute.
|
||||
.resume(|mut test_state, mut virtual_overseer| {
|
||||
Box::pin(async move {
|
||||
@@ -2390,7 +2390,7 @@ fn resume_dispute_with_local_statement() {
|
||||
test_state
|
||||
})
|
||||
})
|
||||
// Alice should not send a DisputeParticiationMessage::Participate on restart since she has a
|
||||
// Alice should not send a DisputeParticipationMessage::Participate on restart since she has a
|
||||
// local statement for the active dispute, instead she should try to (re-)send her vote.
|
||||
.resume(|mut test_state, mut virtual_overseer| {
|
||||
let candidate_receipt = make_valid_candidate_receipt();
|
||||
@@ -2495,7 +2495,7 @@ fn resume_dispute_without_local_statement_or_local_key() {
|
||||
test_state
|
||||
})
|
||||
})
|
||||
// Two should not send a DisputeParticiationMessage::Participate on restart since she is no
|
||||
// Two should not send a DisputeParticipationMessage::Participate on restart since she is no
|
||||
// validator in that dispute.
|
||||
.resume(|mut test_state, mut virtual_overseer| {
|
||||
Box::pin(async move {
|
||||
|
||||
@@ -52,7 +52,7 @@ pub const MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME: usize = 200;
|
||||
/// `dispute-coordinator`.
|
||||
///
|
||||
/// This value should be less than `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME`. Increase it in case
|
||||
/// `provisioner` sends too many `QueryCandidateVotes` messages to `dispite-coordinator`.
|
||||
/// `provisioner` sends too many `QueryCandidateVotes` messages to `dispute-coordinator`.
|
||||
#[cfg(not(test))]
|
||||
const VOTES_SELECTION_BATCH_SIZE: usize = 1_100;
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -39,8 +39,8 @@ use std::{collections::HashMap, sync::Arc, time::Duration};
|
||||
|
||||
type VirtualOverseer = TestSubsystemContextHandle<PvfCheckerMessage>;
|
||||
|
||||
fn dummy_validation_code_hash(descriminator: u8) -> ValidationCodeHash {
|
||||
ValidationCode(vec![descriminator]).hash()
|
||||
fn dummy_validation_code_hash(discriminator: u8) -> ValidationCodeHash {
|
||||
ValidationCode(vec![discriminator]).hash()
|
||||
}
|
||||
|
||||
struct StartsNewSession {
|
||||
@@ -511,7 +511,7 @@ fn reactivating_pvf_leads_to_second_check() {
|
||||
.reply(PreCheckOutcome::Valid);
|
||||
test_state.expect_submit_vote(&mut handle).await.reply_ok();
|
||||
|
||||
// Now activate a descdedant leaf, where the PVF is not present.
|
||||
// Now activate a descendant leaf, where the PVF is not present.
|
||||
test_state
|
||||
.active_leaves_update(
|
||||
&mut handle,
|
||||
|
||||
@@ -85,9 +85,9 @@ impl PvfPrepData {
|
||||
/// Creates a structure for tests.
|
||||
#[cfg(feature = "test-utils")]
|
||||
pub fn from_discriminator_and_timeout(num: u32, timeout: Duration) -> Self {
|
||||
let descriminator_buf = num.to_le_bytes().to_vec();
|
||||
let discriminator_buf = num.to_le_bytes().to_vec();
|
||||
Self::from_code(
|
||||
descriminator_buf,
|
||||
discriminator_buf,
|
||||
ExecutorParams::default(),
|
||||
timeout,
|
||||
PrepareJobKind::Compilation,
|
||||
|
||||
@@ -917,7 +917,7 @@ async fn sweeper_task(mut sweeper_rx: mpsc::Receiver<PathBuf>) {
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?result,
|
||||
"Sweeped the artifact file {}",
|
||||
"Swept the artifact file {}",
|
||||
condemned.display(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -29,7 +29,7 @@ pub enum Priority {
|
||||
}
|
||||
|
||||
impl Priority {
|
||||
/// Returns `true` if `self` is `Crticial`
|
||||
/// Returns `true` if `self` is `Critical`
|
||||
pub fn is_critical(self) -> bool {
|
||||
self == Priority::Critical
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ where
|
||||
fn make_tmppath(prefix: &str, dir: &Path) -> PathBuf {
|
||||
use rand::distributions::Alphanumeric;
|
||||
|
||||
const DESCRIMINATOR_LEN: usize = 10;
|
||||
const DISCRIMINATOR_LEN: usize = 10;
|
||||
|
||||
let mut buf = Vec::with_capacity(prefix.len() + DESCRIMINATOR_LEN);
|
||||
let mut buf = Vec::with_capacity(prefix.len() + DISCRIMINATOR_LEN);
|
||||
buf.extend(prefix.as_bytes());
|
||||
buf.extend(rand::thread_rng().sample_iter(&Alphanumeric).take(DESCRIMINATOR_LEN));
|
||||
buf.extend(rand::thread_rng().sample_iter(&Alphanumeric).take(DISCRIMINATOR_LEN));
|
||||
|
||||
let s = std::str::from_utf8(&buf)
|
||||
.expect("the string is collected from a valid utf-8 sequence; qed");
|
||||
|
||||
@@ -543,9 +543,9 @@ async fn all_security_features_work() {
|
||||
// artifacts cache existing.
|
||||
#[cfg(all(feature = "ci-only-tests", target_os = "linux"))]
|
||||
#[tokio::test]
|
||||
async fn nonexistant_cache_dir() {
|
||||
async fn nonexistent_cache_dir() {
|
||||
let host = TestHost::new_with_config(|cfg| {
|
||||
cfg.cache_path = cfg.cache_path.join("nonexistant_cache_dir");
|
||||
cfg.cache_path = cfg.cache_path.join("nonexistent_cache_dir");
|
||||
})
|
||||
.await;
|
||||
|
||||
|
||||
@@ -299,12 +299,12 @@ impl RuntimeApiSubsystemClient for MockSubsystemClient {
|
||||
#[test]
|
||||
fn requests_authorities() {
|
||||
let (ctx, mut ctx_handle) = make_subsystem_context(TaskExecutor::new());
|
||||
let substem_client = Arc::new(MockSubsystemClient::default());
|
||||
let subsystem_client = Arc::new(MockSubsystemClient::default());
|
||||
let relay_parent = [1; 32].into();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
let subsystem =
|
||||
RuntimeApiSubsystem::new(substem_client.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
RuntimeApiSubsystem::new(subsystem_client.clone(), Metrics(None), SpawnGlue(spawner));
|
||||
let subsystem_task = run(ctx, subsystem).map(|x| x.unwrap());
|
||||
let test_task = async move {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
@@ -315,7 +315,7 @@ fn requests_authorities() {
|
||||
})
|
||||
.await;
|
||||
|
||||
assert_eq!(rx.await.unwrap().unwrap(), substem_client.authorities);
|
||||
assert_eq!(rx.await.unwrap().unwrap(), subsystem_client.authorities);
|
||||
|
||||
ctx_handle.send(FromOrchestra::Signal(OverseerSignal::Conclude)).await;
|
||||
};
|
||||
@@ -1042,7 +1042,7 @@ fn requests_submit_pvf_check_statement() {
|
||||
let _ = rx.await.unwrap().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
&*subsystem_client.submitted_pvf_check_statement.lock().expect("poisened mutex"),
|
||||
&*subsystem_client.submitted_pvf_check_statement.lock().expect("poisoned mutex"),
|
||||
&[(stmt.clone(), sig.clone()), (stmt.clone(), sig.clone())]
|
||||
);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
//! let root_span =
|
||||
//! jaeger::Span::new(relay_parent, "root_of_aaall_spans");
|
||||
//!
|
||||
//! // the prefered way of adding additional delayed information:
|
||||
//! // the preferred way of adding additional delayed information:
|
||||
//! let span = root_span.child("inner");
|
||||
//!
|
||||
//! // ... more operations ...
|
||||
|
||||
@@ -18,7 +18,7 @@ defined in the [(DSL[(**D**omain **S**pecific **L**anguage)]) doc](https://parit
|
||||
|
||||
## Usage
|
||||
|
||||
> Assumes you already gained permissiones, ping in element `@javier:matrix.parity.io` to get access.
|
||||
> Assumes you already gained permissions, ping in element `@javier:matrix.parity.io` to get access.
|
||||
> and you have cloned the [zombienet][zombienet] repo.
|
||||
|
||||
To launch a test case in the development cluster use (e.g. for the ./node/malus/integrationtests/0001-dispute-valid-block.toml):
|
||||
|
||||
@@ -230,7 +230,7 @@ impl ApprovalEntry {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Get the assignment certiticate and claimed candidates.
|
||||
// Get the assignment certificate and claimed candidates.
|
||||
pub fn assignment(&self) -> (IndirectAssignmentCertV2, CandidateBitfield) {
|
||||
(self.assignment.clone(), self.assignment_claimed_candidates.clone())
|
||||
}
|
||||
@@ -404,7 +404,7 @@ impl Knowledge {
|
||||
},
|
||||
};
|
||||
|
||||
// In case of succesful insertion of multiple candidate assignments create additional
|
||||
// In case of successful insertion of multiple candidate assignments create additional
|
||||
// entries for each assigned candidate. This fakes knowledge of individual assignments, but
|
||||
// we need to share the same `MessageSubject` with the followup approval candidate index.
|
||||
if kind == MessageKind::Assignment && success && message.1.count_ones() > 1 {
|
||||
@@ -1897,10 +1897,10 @@ impl State {
|
||||
_ => break,
|
||||
};
|
||||
|
||||
// Any peer which is in the `known_by` see and we know its peer_id authorithy id
|
||||
// Any peer which is in the `known_by` see and we know its peer_id authority id
|
||||
// mapping has already been sent all messages it's meant to get for that block and
|
||||
// all in-scope prior blocks. In case, we just learnt about its peer_id
|
||||
// authorithy-id mapping we have to retry sending the messages that should be sent
|
||||
// authority-id mapping we have to retry sending the messages that should be sent
|
||||
// to it for all un-finalized blocks.
|
||||
if entry.known_by.contains_key(&peer_id) && !retry_known_blocks {
|
||||
break
|
||||
@@ -2199,7 +2199,7 @@ impl State {
|
||||
sanitized_assignments
|
||||
}
|
||||
|
||||
// Filter out obviously invalid candidate indicies.
|
||||
// Filter out obviously invalid candidate indices.
|
||||
async fn sanitize_v1_approvals(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
@@ -2226,7 +2226,7 @@ impl State {
|
||||
sanitized_approvals
|
||||
}
|
||||
|
||||
// Filter out obviously invalid candidate indicies.
|
||||
// Filter out obviously invalid candidate indices.
|
||||
async fn sanitize_v2_approvals(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
@@ -2260,7 +2260,7 @@ impl State {
|
||||
// The modifier accepts as inputs the current required-routing state, whether
|
||||
// the message is locally originating, and the validator index of the message issuer.
|
||||
//
|
||||
// Then, if the topology is known, this progates messages to all peers in the required
|
||||
// Then, if the topology is known, this propagates messages to all peers in the required
|
||||
// routing set which are aware of the block. Peers which are unaware of the block
|
||||
// will have the message sent when it enters their view in `unify_with_peer`.
|
||||
//
|
||||
@@ -2440,7 +2440,7 @@ impl ApprovalDistribution {
|
||||
gum::trace!(target: LOG_TARGET, "active leaves signal (ignored)");
|
||||
// the relay chain blocks relevant to the approval subsystems
|
||||
// are those that are available, but not finalized yet
|
||||
// actived and deactivated heads hence are irrelevant to this subsystem, other than
|
||||
// activated and deactivated heads hence are irrelevant to this subsystem, other than
|
||||
// for tracing purposes.
|
||||
if let Some(activated) = update.activated {
|
||||
let head = activated.hash;
|
||||
|
||||
@@ -299,7 +299,7 @@ impl MetricsTrait for Metrics {
|
||||
prometheus::CounterVec::new(
|
||||
prometheus::Opts::new(
|
||||
"polkadot_parachain_assignments_received_result",
|
||||
"Result of a processed assignement",
|
||||
"Result of a processed assignment",
|
||||
),
|
||||
&["status"]
|
||||
)?,
|
||||
|
||||
@@ -394,7 +394,7 @@ fn try_import_the_same_assignment() {
|
||||
setup_peer_with_view(overseer, &peer_b, view![hash], ValidationVersion::V1).await;
|
||||
setup_peer_with_view(overseer, &peer_c, view![hash], ValidationVersion::V1).await;
|
||||
|
||||
// Set up a gossip topology, where a, b, c and d are topology neighboors to the node under
|
||||
// Set up a gossip topology, where a, b, c and d are topology neighbors to the node under
|
||||
// testing.
|
||||
let peers_with_optional_peer_id = peers
|
||||
.iter()
|
||||
@@ -491,7 +491,7 @@ fn try_import_the_same_assignment_v2() {
|
||||
setup_peer_with_view(overseer, &peer_b, view![hash], ValidationVersion::V3).await;
|
||||
setup_peer_with_view(overseer, &peer_c, view![hash], ValidationVersion::V3).await;
|
||||
|
||||
// Set up a gossip topology, where a, b, c and d are topology neighboors to the node under
|
||||
// Set up a gossip topology, where a, b, c and d are topology neighbors to the node under
|
||||
// testing.
|
||||
let peers_with_optional_peer_id = peers
|
||||
.iter()
|
||||
@@ -744,7 +744,7 @@ fn peer_sending_us_the_same_we_just_sent_them_is_ok() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Setup a topology where peer_a is neigboor to current node.
|
||||
// Setup a topology where peer_a is neighbor to current node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0], &[2], 1),
|
||||
@@ -850,7 +850,7 @@ fn import_approval_happy_path_v1_v2_peers() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Set up a gossip topology, where a, b, and c are topology neighboors to the node.
|
||||
// Set up a gossip topology, where a, b, and c are topology neighbors to the node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0, 1], &[2, 4], 3),
|
||||
@@ -972,7 +972,7 @@ fn import_approval_happy_path_v2() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Set up a gossip topology, where a, b, and c are topology neighboors to the node.
|
||||
// Set up a gossip topology, where a, b, and c are topology neighbors to the node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0, 1], &[2, 4], 3),
|
||||
@@ -1083,7 +1083,7 @@ fn multiple_assignments_covered_with_one_approval_vote() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Set up a gossip topology, where a, b, and c, d are topology neighboors to the node.
|
||||
// Set up a gossip topology, where a, b, and c, d are topology neighbors to the node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0, 1], &[2, 4], 3),
|
||||
@@ -1273,7 +1273,7 @@ fn unify_with_peer_multiple_assignments_covered_with_one_approval_vote() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Set up a gossip topology, where a, b, and c, d are topology neighboors to the node.
|
||||
// Set up a gossip topology, where a, b, and c, d are topology neighbors to the node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0, 1], &[2, 4], 3),
|
||||
@@ -1631,7 +1631,7 @@ fn update_peer_view() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Setup a topology where peer_a is neigboor to current node.
|
||||
// Setup a topology where peer_a is neighbor to current node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0], &[2], 1),
|
||||
@@ -1758,7 +1758,7 @@ fn update_peer_view() {
|
||||
assert!(state.blocks.get(&hash_c).unwrap().known_by.get(peer).is_none());
|
||||
}
|
||||
|
||||
// Tests that updating the known peer_id for a given authorithy updates the topology
|
||||
// Tests that updating the known peer_id for a given authority updates the topology
|
||||
// and sends the required messages
|
||||
#[test]
|
||||
fn update_peer_authority_id() {
|
||||
@@ -1770,9 +1770,9 @@ fn update_peer_authority_id() {
|
||||
let neighbour_x_index = 0;
|
||||
let neighbour_y_index = 2;
|
||||
let local_index = 1;
|
||||
// X neighbour, we simulate that PeerId is not known in the beginining.
|
||||
// X neighbour, we simulate that PeerId is not known in the beginning.
|
||||
let neighbour_x = peers.get(neighbour_x_index).unwrap().0;
|
||||
// Y neighbour, we simulate that PeerId is not known in the beginining.
|
||||
// Y neighbour, we simulate that PeerId is not known in the beginning.
|
||||
let neighbour_y = peers.get(neighbour_y_index).unwrap().0;
|
||||
|
||||
let _state = test_harness(State::default(), |mut virtual_overseer| async move {
|
||||
@@ -1814,7 +1814,7 @@ fn update_peer_authority_id() {
|
||||
})
|
||||
.collect_vec();
|
||||
|
||||
// Setup a topology where peer_a is neigboor to current node.
|
||||
// Setup a topology where peer_a is neighbor to current node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(
|
||||
@@ -2053,7 +2053,7 @@ fn sends_assignments_even_when_state_is_approved() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Setup a topology where peer_a is neigboor to current node.
|
||||
// Setup a topology where peer_a is neighbor to current node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0], &[2], 1),
|
||||
@@ -2125,7 +2125,7 @@ fn sends_assignments_even_when_state_is_approved() {
|
||||
}
|
||||
|
||||
/// Same as `sends_assignments_even_when_state_is_approved_v2` but with `VRFModuloCompact`
|
||||
/// assignemnts.
|
||||
/// assignments.
|
||||
#[test]
|
||||
fn sends_assignments_even_when_state_is_approved_v2() {
|
||||
let peers = make_peers_and_authority_ids(8);
|
||||
@@ -2153,7 +2153,7 @@ fn sends_assignments_even_when_state_is_approved_v2() {
|
||||
.iter()
|
||||
.map(|(peer_id, authority)| (Some(*peer_id), authority.clone()))
|
||||
.collect_vec();
|
||||
// Setup a topology where peer_a is neigboor to current node.
|
||||
// Setup a topology where peer_a is neighbor to current node.
|
||||
setup_gossip_topology(
|
||||
overseer,
|
||||
make_gossip_topology(1, &peers_with_optional_peer_id, &[0], &[2], 1),
|
||||
@@ -3509,7 +3509,7 @@ fn import_versioned_approval() {
|
||||
setup_peer_with_view(overseer, &peer_b, view![hash], ValidationVersion::V1).await;
|
||||
setup_peer_with_view(overseer, &peer_c, view![hash], ValidationVersion::V2).await;
|
||||
|
||||
// Set up a gossip topology, where a, b, c and d are topology neighboors to the node under
|
||||
// Set up a gossip topology, where a, b, c and d are topology neighbors to the node under
|
||||
// testing.
|
||||
let peers_with_optional_peer_id = peers
|
||||
.iter()
|
||||
|
||||
@@ -348,7 +348,7 @@ impl RunningTask {
|
||||
async fn do_request(
|
||||
&mut self,
|
||||
validator: &AuthorityDiscoveryId,
|
||||
nerwork_error_freq: &mut gum::Freq,
|
||||
network_error_freq: &mut gum::Freq,
|
||||
canceled_freq: &mut gum::Freq,
|
||||
) -> std::result::Result<ChunkFetchingResponse, TaskError> {
|
||||
gum::trace!(
|
||||
@@ -395,7 +395,7 @@ impl RunningTask {
|
||||
},
|
||||
Err(RequestError::NetworkError(err)) => {
|
||||
gum::warn_if_frequent!(
|
||||
freq: nerwork_error_freq,
|
||||
freq: network_error_freq,
|
||||
max_rate: gum::Times::PerHour(100),
|
||||
target: LOG_TARGET,
|
||||
origin = ?validator,
|
||||
|
||||
@@ -408,7 +408,7 @@ async fn handle_recover<Context>(
|
||||
) -> error::Result<()> {
|
||||
let candidate_hash = receipt.hash();
|
||||
|
||||
let span = jaeger::Span::new(candidate_hash, "availbility-recovery")
|
||||
let span = jaeger::Span::new(candidate_hash, "availability-recovery")
|
||||
.with_stage(jaeger::Stage::AvailabilityRecovery);
|
||||
|
||||
if let Some(result) =
|
||||
|
||||
@@ -31,7 +31,7 @@ struct MetricsInner {
|
||||
chunk_requests_issued: Counter<U64>,
|
||||
/// Total number of bytes recovered
|
||||
///
|
||||
/// Gets incremented on each succesful recovery
|
||||
/// Gets incremented on each successful recovery
|
||||
recovered_bytes_total: Counter<U64>,
|
||||
/// A counter for finished chunk requests.
|
||||
///
|
||||
@@ -232,7 +232,7 @@ impl metrics::Metrics for Metrics {
|
||||
)?,
|
||||
full_recoveries_started: prometheus::register(
|
||||
Counter::new(
|
||||
"polkadot_parachain_availability_recovery_recovieries_started",
|
||||
"polkadot_parachain_availability_recovery_recoveries_started",
|
||||
"Total number of started recoveries.",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -69,14 +69,14 @@ impl MetricsTrait for Metrics {
|
||||
let metrics = MetricsInner {
|
||||
sent_own_availability_bitfields: prometheus::register(
|
||||
prometheus::Counter::new(
|
||||
"polkadot_parachain_sent_own_availabilty_bitfields_total",
|
||||
"polkadot_parachain_sent_own_availability_bitfields_total",
|
||||
"Number of own availability bitfields sent to other peers.",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
received_availability_bitfields: prometheus::register(
|
||||
prometheus::Counter::new(
|
||||
"polkadot_parachain_received_availabilty_bitfields_total",
|
||||
"polkadot_parachain_received_availability_bitfields_total",
|
||||
"Number of valid availability bitfields received from other peers.",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -150,7 +150,7 @@ fn receive_invalid_signature() {
|
||||
|
||||
let signing_context = SigningContext { session_index: 1, parent_hash: hash_a };
|
||||
|
||||
// another validator not part of the validatorset
|
||||
// another validator not part of the validator set
|
||||
let keystore: KeystorePtr = Arc::new(MemoryKeystore::new());
|
||||
let malicious = Keystore::sr25519_generate_new(&*keystore, ValidatorId::ID, None)
|
||||
.expect("Malicious key created");
|
||||
|
||||
@@ -76,7 +76,7 @@ pub struct DisputeSender<M> {
|
||||
/// Value is the hash that was used for the query.
|
||||
active_sessions: HashMap<SessionIndex, Hash>,
|
||||
|
||||
/// All ongoing dispute sendings this subsystem is aware of.
|
||||
/// All ongoing dispute sending this subsystem is aware of.
|
||||
///
|
||||
/// Using an `IndexMap` so items can be iterated in the order of insertion.
|
||||
disputes: IndexMap<CandidateHash, SendTask<M>>,
|
||||
@@ -105,7 +105,7 @@ struct WaitForActiveDisputesState {
|
||||
|
||||
#[overseer::contextbounds(DisputeDistribution, prefix = self::overseer)]
|
||||
impl<M: 'static + Send + Sync> DisputeSender<M> {
|
||||
/// Create a new `DisputeSender` which can be used to start dispute sendings.
|
||||
/// Create a new `DisputeSender` which can be used to start dispute sending.
|
||||
pub fn new(tx: NestingSender<M, DisputeSenderMessage>, metrics: Metrics) -> Self {
|
||||
Self {
|
||||
active_heads: Vec::new(),
|
||||
@@ -362,7 +362,7 @@ async fn get_active_session_indices<Context>(
|
||||
runtime: &mut RuntimeInfo,
|
||||
active_heads: &Vec<Hash>,
|
||||
) -> Result<HashMap<SessionIndex, Hash>> {
|
||||
let mut indeces = HashMap::new();
|
||||
let mut indices = HashMap::new();
|
||||
// Iterate all heads we track as active and fetch the child' session indices.
|
||||
for head in active_heads {
|
||||
let session_index = runtime.get_session_index_for_child(ctx.sender(), *head).await?;
|
||||
@@ -372,9 +372,9 @@ async fn get_active_session_indices<Context>(
|
||||
{
|
||||
gum::debug!(target: LOG_TARGET, ?err, ?session_index, "Can't cache SessionInfo");
|
||||
}
|
||||
indeces.insert(session_index, *head);
|
||||
indices.insert(session_index, *head);
|
||||
}
|
||||
Ok(indeces)
|
||||
Ok(indices)
|
||||
}
|
||||
|
||||
/// Retrieve Set of active disputes from the dispute coordinator.
|
||||
|
||||
@@ -163,7 +163,7 @@ pub fn make_dispute_message(
|
||||
let invalid_vote =
|
||||
make_explicit_signed(MOCK_VALIDATORS[invalid_validator.0 as usize], candidate_hash, false);
|
||||
gum::trace!(
|
||||
"Passed time for invald vote: {:#?}",
|
||||
"Passed time for invalid vote: {:#?}",
|
||||
Instant::now().saturating_duration_since(before_request)
|
||||
);
|
||||
DisputeMessage::from_signed_statements(
|
||||
|
||||
@@ -122,7 +122,7 @@ impl MockAuthorityDiscovery {
|
||||
self.authorities.lock().clone()
|
||||
}
|
||||
|
||||
fn add_more_authorties(
|
||||
fn add_more_authorities(
|
||||
&self,
|
||||
new_known: Vec<AuthorityDiscoveryId>,
|
||||
) -> HashMap<PeerId, HashSet<AuthorityDiscoveryId>> {
|
||||
@@ -720,7 +720,7 @@ fn issues_update_authorities_after_session() {
|
||||
|
||||
assert!(overseer.recv().timeout(TIMEOUT).await.is_none());
|
||||
// 4. Connect more authorities except one
|
||||
let newly_added = authority_discovery_mock.add_more_authorties(unknown_at_session);
|
||||
let newly_added = authority_discovery_mock.add_more_authorities(unknown_at_session);
|
||||
let mut newly_added_iter = newly_added.iter();
|
||||
let unconnected_at_last_retry = newly_added_iter
|
||||
.next()
|
||||
|
||||
@@ -89,7 +89,7 @@ impl SessionGridTopology {
|
||||
SessionGridTopology { shuffled_indices, canonical_shuffling, peer_ids }
|
||||
}
|
||||
|
||||
/// Updates the known peer ids for the passed authorithies ids.
|
||||
/// Updates the known peer ids for the passed authorities ids.
|
||||
pub fn update_authority_ids(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
@@ -313,7 +313,7 @@ impl SessionGridTopologyEntry {
|
||||
self.topology.is_validator(peer)
|
||||
}
|
||||
|
||||
/// Updates the known peer ids for the passed authorithies ids.
|
||||
/// Updates the known peer ids for the passed authorities ids.
|
||||
pub fn update_authority_ids(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
@@ -345,7 +345,7 @@ impl SessionGridTopologies {
|
||||
self.inner.get(&session).and_then(|val| val.0.as_ref())
|
||||
}
|
||||
|
||||
/// Updates the known peer ids for the passed authorithies ids.
|
||||
/// Updates the known peer ids for the passed authorities ids.
|
||||
pub fn update_authority_ids(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
|
||||
@@ -871,7 +871,7 @@ pub mod v2 {
|
||||
}
|
||||
|
||||
/// v3 network protocol types.
|
||||
/// Purpose is for chaning ApprovalDistributionMessage to
|
||||
/// Purpose is for changing ApprovalDistributionMessage to
|
||||
/// include more than one assignment and approval in a message.
|
||||
pub mod v3 {
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
|
||||
@@ -234,7 +234,7 @@ pub enum ValidationVersion {
|
||||
/// The second version.
|
||||
V2 = 2,
|
||||
/// The third version where changes to ApprovalDistributionMessage had been made.
|
||||
/// The changes are translatable to V2 format untill assignments v2 and approvals
|
||||
/// The changes are translatable to V2 format until assignments v2 and approvals
|
||||
/// coalescing is enabled through a runtime upgrade.
|
||||
V3 = 3,
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ where
|
||||
Req: IsRequest + Decode + Encode,
|
||||
Req::Response: Encode,
|
||||
{
|
||||
/// Create configuration for `NetworkConfiguration::request_response_porotocols` and a
|
||||
/// Create configuration for `NetworkConfiguration::request_response_protocols` and a
|
||||
/// corresponding typed receiver.
|
||||
///
|
||||
/// This Register that config with substrate networking and receive incoming requests via the
|
||||
|
||||
@@ -287,7 +287,7 @@ impl Protocol {
|
||||
match self {
|
||||
// Hundreds of validators will start requesting their chunks once they see a candidate
|
||||
// awaiting availability on chain. Given that they will see that block at different
|
||||
// times (due to network delays), 100 seems big enough to accomodate for "bursts",
|
||||
// times (due to network delays), 100 seems big enough to accommodate for "bursts",
|
||||
// assuming we can service requests relatively quickly, which would need to be measured
|
||||
// as well.
|
||||
Protocol::ChunkFetchingV1 => 100,
|
||||
|
||||
@@ -183,7 +183,7 @@ impl IsRequest for AvailableDataFetchingRequest {
|
||||
pub struct StatementFetchingRequest {
|
||||
/// Data needed to locate and identify the needed statement.
|
||||
pub relay_parent: Hash,
|
||||
/// Hash of candidate that was used create the `CommitedCandidateRecept`.
|
||||
/// Hash of candidate that was used create the `CommittedCandidateReceipt`.
|
||||
pub candidate_hash: CandidateHash,
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ pub async fn respond(
|
||||
// late, as each requester having the data will help distributing it.
|
||||
// 2. If we take too long, the requests timing out will not yet have had any data sent, thus
|
||||
// we wasted no bandwidth.
|
||||
// 3. If the queue is full, requestes will get an immediate error instead of running in a
|
||||
// 3. If the queue is full, requests will get an immediate error instead of running in a
|
||||
// timeout, thus requesters can immediately try another peer and be faster.
|
||||
//
|
||||
// From this perspective we would not want parallel response sending at all, but we don't
|
||||
|
||||
@@ -1494,7 +1494,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
Err(()) => {}
|
||||
);
|
||||
|
||||
// And now the succeding request from peer_b:
|
||||
// And now the succeeding request from peer_b:
|
||||
let (pending_response, response_rx) = oneshot::channel();
|
||||
let inner_req = StatementFetchingRequest {
|
||||
relay_parent: metadata.relay_parent,
|
||||
|
||||
@@ -430,8 +430,8 @@ impl ClusterTracker {
|
||||
///
|
||||
/// Normally we should not have pending statements to validators in our cluster,
|
||||
/// but if we do for all validators in our cluster, then we don't participate
|
||||
/// in backing. Ocasional pending statements are expected if two authorities
|
||||
/// can't detect each otehr or after restart, where it takes a while to discover
|
||||
/// in backing. Occasional pending statements are expected if two authorities
|
||||
/// can't detect each other or after restart, where it takes a while to discover
|
||||
/// the whole network.
|
||||
|
||||
pub fn warn_if_too_many_pending_statements(&self, parent_hash: Hash) {
|
||||
|
||||
@@ -112,7 +112,7 @@ const COST_EXCESSIVE_SECONDED: Rep = Rep::CostMinor("Sent Excessive `Seconded` S
|
||||
const COST_DISABLED_VALIDATOR: Rep = Rep::CostMinor("Sent a statement from a disabled validator");
|
||||
|
||||
const COST_UNEXPECTED_MANIFEST_MISSING_KNOWLEDGE: Rep =
|
||||
Rep::CostMinor("Unexpected Manifest, missing knowlege for relay parent");
|
||||
Rep::CostMinor("Unexpected Manifest, missing knowledge for relay parent");
|
||||
const COST_UNEXPECTED_MANIFEST_DISALLOWED: Rep =
|
||||
Rep::CostMinor("Unexpected Manifest, Peer Disallowed");
|
||||
const COST_UNEXPECTED_MANIFEST_PEER_UNKNOWN: Rep =
|
||||
@@ -628,8 +628,8 @@ pub(crate) async fn handle_active_leaves_update<Context>(
|
||||
request_min_backing_votes(new_relay_parent, session_index, ctx.sender()).await?;
|
||||
let mut per_session_state =
|
||||
PerSessionState::new(session_info, &state.keystore, minimum_backing_votes);
|
||||
if let Some(toplogy) = state.unused_topologies.remove(&session_index) {
|
||||
per_session_state.supply_topology(&toplogy.topology, toplogy.local_index);
|
||||
if let Some(topology) = state.unused_topologies.remove(&session_index) {
|
||||
per_session_state.supply_topology(&topology.topology, topology.local_index);
|
||||
}
|
||||
state.per_session.insert(session_index, per_session_state);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ impl RequestManager {
|
||||
// need for the current node to limit itself to the same amount the
|
||||
// requests, because the requests are going to different nodes anyways.
|
||||
// While looking at https://github.com/paritytech/polkadot-sdk/issues/3314,
|
||||
// found out that this requests take around 100ms to fullfill, so it
|
||||
// found out that this requests take around 100ms to fulfill, so it
|
||||
// would make sense to try to request things as early as we can, given
|
||||
// we would need to request it for each candidate, around 25 right now
|
||||
// on kusama.
|
||||
|
||||
@@ -871,7 +871,7 @@ where
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
relay_parent = ?hash,
|
||||
"Leaf got activated, notifying exterinal listeners"
|
||||
"Leaf got activated, notifying external listeners"
|
||||
);
|
||||
for listener in listeners {
|
||||
// it's fine if the listener is no longer interested
|
||||
|
||||
@@ -382,7 +382,7 @@ pub mod v2 {
|
||||
/// The core index chosen in this cert.
|
||||
core_index: CoreIndex,
|
||||
},
|
||||
/// Deprectated assignment. Soon to be removed.
|
||||
/// Deprecated assignment. Soon to be removed.
|
||||
/// An assignment story based on the VRF that authorized the relay-chain block where the
|
||||
/// candidate was included combined with a sample number.
|
||||
///
|
||||
|
||||
@@ -84,7 +84,7 @@ impl CandidateVotes {
|
||||
#[derive(Debug, Clone)]
|
||||
/// Valid candidate votes.
|
||||
///
|
||||
/// Prefere backing votes over other votes.
|
||||
/// Prefer backing votes over other votes.
|
||||
pub struct ValidCandidateVotes {
|
||||
votes: BTreeMap<ValidatorIndex, (ValidDisputeStatementKind, ValidatorSignature)>,
|
||||
}
|
||||
@@ -133,7 +133,7 @@ impl ValidCandidateVotes {
|
||||
self.votes.retain(f)
|
||||
}
|
||||
|
||||
/// Get all the validator indeces we have votes for.
|
||||
/// Get all the validator indices we have votes for.
|
||||
pub fn keys(
|
||||
&self,
|
||||
) -> Bkeys<'_, ValidatorIndex, (ValidDisputeStatementKind, ValidatorSignature)> {
|
||||
|
||||
@@ -74,7 +74,7 @@ pub const VALIDATION_CODE_BOMB_LIMIT: usize = (MAX_CODE_SIZE * 4u32) as usize;
|
||||
pub const POV_BOMB_LIMIT: usize = (MAX_POV_SIZE * 4u32) as usize;
|
||||
|
||||
/// How many blocks after finalization an information about backed/included candidate should be
|
||||
/// pre-loaded (when scraoing onchain votes) and kept locally (when pruning).
|
||||
/// pre-loaded (when scraping onchain votes) and kept locally (when pruning).
|
||||
///
|
||||
/// We don't want to remove scraped candidates on finalization because we want to
|
||||
/// be sure that disputes will conclude on abandoned forks.
|
||||
|
||||
@@ -77,7 +77,7 @@ pub struct OverseerGenArgs<'a, Spawner, RuntimeClient>
|
||||
where
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
{
|
||||
/// Runtime client generic, providing the `ProvieRuntimeApi` trait besides others.
|
||||
/// Runtime client generic, providing the `ProvideRuntimeApi` trait besides others.
|
||||
pub runtime_client: Arc<RuntimeClient>,
|
||||
/// Underlying network service implementation.
|
||||
pub network_service: Arc<sc_network::NetworkService<Block, Hash>>,
|
||||
|
||||
@@ -115,7 +115,7 @@ pub(crate) fn try_upgrade_db_to_next_version(
|
||||
Some(CURRENT_VERSION) => CURRENT_VERSION,
|
||||
// This is an arbitrary future version, we don't handle it.
|
||||
Some(v) => return Err(Error::FutureVersion { current: CURRENT_VERSION, got: v }),
|
||||
// No version file. For `RocksDB` we dont need to do anything.
|
||||
// No version file. For `RocksDB` we don't need to do anything.
|
||||
None if db_kind == DatabaseKind::RocksDB => CURRENT_VERSION,
|
||||
// No version file. `ParityDB` did not previously have a version defined.
|
||||
// We handle this as a `0 -> 1` migration.
|
||||
@@ -183,7 +183,7 @@ fn migrate_from_version_1_to_2(path: &Path, db_kind: DatabaseKind) -> Result<Ver
|
||||
})
|
||||
}
|
||||
|
||||
// Migrade approval voting database.
|
||||
// Migrate approval voting database.
|
||||
// In 4 `OurAssignment` has been changed to support the v2 assignments.
|
||||
// In 5, `BlockEntry` has been changed to store the number of delayed approvals.
|
||||
// As these are backwards compatible, we'll convert the old entries in the new format.
|
||||
|
||||
@@ -472,7 +472,7 @@ where
|
||||
let lag = initial_leaf_number.saturating_sub(subchain_number);
|
||||
self.metrics.note_approval_checking_finality_lag(lag);
|
||||
|
||||
// Messages sent to `approval-distrbution` are known to have high `ToF`, we need to spawn a
|
||||
// Messages sent to `approval-distribution` are known to have high `ToF`, we need to spawn a
|
||||
// task for sending the message to not block here and delay finality.
|
||||
if let Some(spawn_handle) = &self.spawn_handle {
|
||||
let mut overseer_handle = self.overseer.clone();
|
||||
@@ -524,7 +524,7 @@ where
|
||||
// and not push it up the stack to cause additional issues in GRANDPA/BABE.
|
||||
let (lag, subchain_head) =
|
||||
match rx.await.map_err(Error::DetermineUndisputedChainCanceled) {
|
||||
// If request succeded we will receive (block number, block hash).
|
||||
// If request succeeded we will receive (block number, block hash).
|
||||
Ok((subchain_number, subchain_head)) => {
|
||||
// The total lag accounting for disputes.
|
||||
let lag_disputes = initial_leaf_number.saturating_sub(subchain_number);
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
"editorMode": "code",
|
||||
"expr": "subsystem_benchmark_n_validators{}",
|
||||
"instant": false,
|
||||
"legendFormat": "n_vaidators",
|
||||
"legendFormat": "n_validators",
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
},
|
||||
@@ -1046,7 +1046,7 @@
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Availability subystem metrics",
|
||||
"title": "Availability subsystem metrics",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
@@ -1397,7 +1397,7 @@
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"title": "Recovery throughtput",
|
||||
"title": "Recovery throughput",
|
||||
"transformations": [],
|
||||
"type": "timeseries"
|
||||
},
|
||||
|
||||
@@ -74,8 +74,8 @@ pub struct PeerMessagesGenerator {
|
||||
pub validator_index: ValidatorIndex,
|
||||
/// An array of pre-generated random samplings, that is used to determine, which nodes would
|
||||
/// send a given assignment, to the node under test because of the random samplings.
|
||||
/// As an optimization we generate this sampling at the begining of the test and just pick
|
||||
/// one randomly, because always taking the samples would be too expensive for benchamrk.
|
||||
/// As an optimization we generate this sampling at the beginning of the test and just pick
|
||||
/// one randomly, because always taking the samples would be too expensive for benchmark.
|
||||
pub random_samplings: Vec<Vec<ValidatorIndex>>,
|
||||
/// Channel for sending the generated messages to the aggregator
|
||||
pub tx_messages: futures::channel::mpsc::UnboundedSender<(Hash, Vec<MessagesBundle>)>,
|
||||
@@ -234,7 +234,7 @@ impl PeerMessagesGenerator {
|
||||
let all_messages = all_messages
|
||||
.into_iter()
|
||||
.flat_map(|(_, mut messages)| {
|
||||
// Shuffle the messages inside the same tick, so that we don't priorites messages
|
||||
// Shuffle the messages inside the same tick, so that we don't priorities messages
|
||||
// for older nodes. we try to simulate the same behaviour as in real world.
|
||||
messages.shuffle(&mut rand_chacha);
|
||||
messages
|
||||
@@ -560,12 +560,12 @@ struct TestSignInfo {
|
||||
candidate_index: CandidateIndex,
|
||||
/// The validator sending the assignments
|
||||
validator_index: ValidatorIndex,
|
||||
/// The assignments convering this candidate
|
||||
/// The assignments covering this candidate
|
||||
assignment: TestMessageInfo,
|
||||
}
|
||||
|
||||
impl TestSignInfo {
|
||||
/// Helper function to create a signture for all candidates in `to_sign` parameter.
|
||||
/// Helper function to create a signature for all candidates in `to_sign` parameter.
|
||||
/// Returns a TestMessage
|
||||
fn sign_candidates(
|
||||
to_sign: &mut Vec<TestSignInfo>,
|
||||
|
||||
@@ -115,7 +115,7 @@ pub struct ApprovalsOptions {
|
||||
#[clap(short, long, default_value_t = 1.0)]
|
||||
/// Max candidate to be signed in a single approval.
|
||||
pub coalesce_std_dev: f32,
|
||||
/// The maximum tranche diff between approvals coalesced toghther.
|
||||
/// The maximum tranche diff between approvals coalesced together.
|
||||
pub coalesce_tranche_diff: u32,
|
||||
#[clap(short, long, default_value_t = false)]
|
||||
/// Enable assignments v2.
|
||||
@@ -170,7 +170,7 @@ struct BlockTestData {
|
||||
total_candidates_before: u64,
|
||||
/// The votes we sent.
|
||||
/// votes[validator_index][candidate_index] tells if validator sent vote for candidate.
|
||||
/// We use this to mark the test as succesfull if GetApprovalSignatures returns all the votes
|
||||
/// We use this to mark the test as successful if GetApprovalSignatures returns all the votes
|
||||
/// from here.
|
||||
votes: Arc<Vec<Vec<AtomicBool>>>,
|
||||
}
|
||||
@@ -237,7 +237,7 @@ struct GeneratedState {
|
||||
}
|
||||
|
||||
/// Approval test state used by all mock subsystems to be able to answer messages emitted
|
||||
/// by the approval-voting and approval-distribution-subystems.
|
||||
/// by the approval-voting and approval-distribution-subsystems.
|
||||
///
|
||||
/// This gets cloned across all mock subsystems, so if there is any information that gets
|
||||
/// updated between subsystems, they would have to be wrapped in Arc's.
|
||||
@@ -498,7 +498,7 @@ struct PeerMessageProducer {
|
||||
|
||||
impl PeerMessageProducer {
|
||||
/// Generates messages by spawning a blocking task in the background which begins creating
|
||||
/// the assignments/approvals and peer view changes at the begining of each block.
|
||||
/// the assignments/approvals and peer view changes at the beginning of each block.
|
||||
fn produce_messages(
|
||||
mut self,
|
||||
env: &TestEnvironment,
|
||||
@@ -740,7 +740,7 @@ impl PeerMessageProducer {
|
||||
}
|
||||
}
|
||||
|
||||
// Initializes the candidates test data. This is used for bookeeping if more assignments and
|
||||
// Initializes the candidates test data. This is used for bookkeeping if more assignments and
|
||||
// approvals would be needed.
|
||||
fn initialize_candidates_test_data(
|
||||
&self,
|
||||
@@ -767,7 +767,7 @@ impl PeerMessageProducer {
|
||||
}
|
||||
|
||||
/// Helper function to build an overseer with the real implementation for `ApprovalDistribution` and
|
||||
/// `ApprovalVoting` subystems and mock subsytems for all others.
|
||||
/// `ApprovalVoting` subsystems and mock subsystems for all others.
|
||||
fn build_overseer(
|
||||
state: &ApprovalTestState,
|
||||
network: &NetworkEmulatorHandle,
|
||||
@@ -936,7 +936,7 @@ pub async fn bench_approvals_run(
|
||||
for block_num in 0..env.config().num_blocks {
|
||||
let mut current_slot = tick_to_slot_number(SLOT_DURATION_MILLIS, system_clock.tick_now());
|
||||
|
||||
// Wait untill the time arrieves at the first slot under test.
|
||||
// Wait until the time arrives at the first slot under test.
|
||||
while current_slot < state.generated_state.initial_slot {
|
||||
sleep(Duration::from_millis(5)).await;
|
||||
current_slot = tick_to_slot_number(SLOT_DURATION_MILLIS, system_clock.tick_now());
|
||||
@@ -961,7 +961,7 @@ pub async fn bench_approvals_run(
|
||||
}
|
||||
|
||||
// Wait for all blocks to be approved before exiting.
|
||||
// This is an invariant of the benchmark, if this does not happen something went teribbly wrong.
|
||||
// This is an invariant of the benchmark, if this does not happen something went terribly wrong.
|
||||
while state.last_approved_block.load(std::sync::atomic::Ordering::SeqCst) <
|
||||
env.config().num_blocks as u32
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ pub struct TestMessageInfo {
|
||||
pub msg: protocol_v3::ApprovalDistributionMessage,
|
||||
/// The list of peers that would sends this message in a real topology.
|
||||
/// It includes both the peers that would send the message because of the topology
|
||||
/// or because of randomly chosing so.
|
||||
/// or because of randomly choosing so.
|
||||
pub sent_by: Vec<ValidatorIndex>,
|
||||
/// The tranche at which this message should be sent.
|
||||
pub tranche: u32,
|
||||
@@ -90,7 +90,7 @@ impl MessagesBundle {
|
||||
|
||||
/// Tells if the bundle is needed for sending.
|
||||
/// We either send it because we need more assignments and approvals to approve the candidates
|
||||
/// or because we configured the test to send messages untill a given tranche.
|
||||
/// or because we configured the test to send messages until a given tranche.
|
||||
pub fn should_send(
|
||||
&self,
|
||||
candidates_test_data: &HashMap<(Hash, CandidateIndex), CandidateTestData>,
|
||||
@@ -174,24 +174,24 @@ impl TestMessageInfo {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a list of candidates indicies in this message
|
||||
/// Returns a list of candidates indices in this message
|
||||
pub fn candidate_indices(&self) -> HashSet<usize> {
|
||||
let mut unique_candidate_indicies = HashSet::new();
|
||||
let mut unique_candidate_indices = HashSet::new();
|
||||
match &self.msg {
|
||||
protocol_v3::ApprovalDistributionMessage::Assignments(assignments) =>
|
||||
for (_assignment, candidate_indices) in assignments {
|
||||
for candidate_index in candidate_indices.iter_ones() {
|
||||
unique_candidate_indicies.insert(candidate_index);
|
||||
unique_candidate_indices.insert(candidate_index);
|
||||
}
|
||||
},
|
||||
protocol_v3::ApprovalDistributionMessage::Approvals(approvals) =>
|
||||
for approval in approvals {
|
||||
for candidate_index in approval.candidate_indices.iter_ones() {
|
||||
unique_candidate_indicies.insert(candidate_index);
|
||||
unique_candidate_indices.insert(candidate_index);
|
||||
}
|
||||
},
|
||||
}
|
||||
unique_candidate_indicies
|
||||
unique_candidate_indices
|
||||
}
|
||||
|
||||
/// Marks this message as no-shows if the number of configured no-shows is above the registered
|
||||
|
||||
@@ -69,7 +69,7 @@ const LOG_TARGET: &str = "subsystem-bench::availability";
|
||||
pub struct DataAvailabilityReadOptions {
|
||||
#[clap(short, long, default_value_t = false)]
|
||||
/// Turbo boost AD Read by fetching the full availability datafrom backers first. Saves CPU as
|
||||
/// we don't need to re-construct from chunks. Tipically this is only faster if nodes have
|
||||
/// we don't need to re-construct from chunks. Typically this is only faster if nodes have
|
||||
/// enough bandwidth.
|
||||
pub fetch_from_backers: bool,
|
||||
}
|
||||
@@ -404,7 +404,7 @@ pub async fn benchmark_availability_write(
|
||||
let network = env.network().clone();
|
||||
let authorities = env.authorities().clone();
|
||||
|
||||
// Spawn a task that will generate `n_validator` - 1 signed bitfiends and
|
||||
// Spawn a task that will generate `n_validator` - 1 signed bitfields and
|
||||
// send them from the emulated peers to the subsystem.
|
||||
// TODO: Implement topology.
|
||||
let messages = state.signed_bitfields.get(&relay_block_hash).expect("pregenerated").clone();
|
||||
@@ -425,7 +425,7 @@ pub async fn benchmark_availability_write(
|
||||
|
||||
// Wait for all bitfields to be processed.
|
||||
env.wait_until_metric(
|
||||
"polkadot_parachain_received_availabilty_bitfields_total",
|
||||
"polkadot_parachain_received_availability_bitfields_total",
|
||||
None,
|
||||
|value| value == (config.connected_count() * block_num) as f64,
|
||||
)
|
||||
|
||||
@@ -122,10 +122,10 @@ pub struct TestConfiguration {
|
||||
/// Randomly sampled pov_sizes
|
||||
#[serde(skip)]
|
||||
pub pov_sizes: Vec<usize>,
|
||||
/// The amount of bandiwdth remote validators have.
|
||||
/// The amount of bandwidth remote validators have.
|
||||
#[serde(default = "default_bandwidth")]
|
||||
pub peer_bandwidth: usize,
|
||||
/// The amount of bandiwdth our node has.
|
||||
/// The amount of bandwidth our node has.
|
||||
#[serde(default = "default_bandwidth")]
|
||||
pub bandwidth: usize,
|
||||
/// Optional peer emulation latency (round trip time) wrt node under test
|
||||
@@ -205,7 +205,7 @@ impl TestConfiguration {
|
||||
let peer_id_to_authority = peer_ids
|
||||
.iter()
|
||||
.zip(validator_authority_id.iter())
|
||||
.map(|(peer_id, authorithy_id)| (*peer_id, authorithy_id.clone()))
|
||||
.map(|(peer_id, authority_id)| (*peer_id, authority_id.clone()))
|
||||
.collect();
|
||||
|
||||
TestAuthorities {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub struct AvailabilityStoreState {
|
||||
|
||||
const LOG_TARGET: &str = "subsystem-bench::av-store-mock";
|
||||
|
||||
/// Mockup helper. Contains Ccunks and full availability data of all parachain blocks
|
||||
/// Mockup helper. Contains Chunks and full availability data of all parachain blocks
|
||||
/// used in a test.
|
||||
#[derive(Clone)]
|
||||
pub struct NetworkAvailabilityState {
|
||||
|
||||
@@ -89,7 +89,7 @@ impl MockChainApi {
|
||||
let hash = self
|
||||
.state
|
||||
.get_header_by_number(requested_number)
|
||||
.expect("Unknow block number")
|
||||
.expect("Unknown block number")
|
||||
.hash();
|
||||
sender.send(Ok(Some(hash))).unwrap();
|
||||
},
|
||||
|
||||
@@ -42,8 +42,8 @@ pub struct MockNetworkBridgeTx {
|
||||
network: NetworkEmulatorHandle,
|
||||
/// A channel to the network interface,
|
||||
to_network_interface: UnboundedSender<NetworkMessage>,
|
||||
/// Test authorithies
|
||||
test_authorithies: TestAuthorities,
|
||||
/// Test authorities
|
||||
test_authorities: TestAuthorities,
|
||||
}
|
||||
|
||||
/// A mock of the network bridge tx subsystem.
|
||||
@@ -58,9 +58,9 @@ impl MockNetworkBridgeTx {
|
||||
pub fn new(
|
||||
network: NetworkEmulatorHandle,
|
||||
to_network_interface: UnboundedSender<NetworkMessage>,
|
||||
test_authorithies: TestAuthorities,
|
||||
test_authorities: TestAuthorities,
|
||||
) -> MockNetworkBridgeTx {
|
||||
Self { network, to_network_interface, test_authorithies }
|
||||
Self { network, to_network_interface, test_authorities }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,13 +125,13 @@ impl MockNetworkBridgeTx {
|
||||
}
|
||||
},
|
||||
NetworkBridgeTxMessage::ReportPeer(_) => {
|
||||
// ingore rep changes
|
||||
// ignore rep changes
|
||||
},
|
||||
NetworkBridgeTxMessage::SendValidationMessage(peers, message) => {
|
||||
for peer in peers {
|
||||
self.to_network_interface
|
||||
.unbounded_send(NetworkMessage::MessageFromNode(
|
||||
self.test_authorithies
|
||||
self.test_authorities
|
||||
.peer_id_to_authority
|
||||
.get(&peer)
|
||||
.unwrap()
|
||||
|
||||
@@ -154,7 +154,7 @@ pub enum NetworkMessage {
|
||||
MessageFromNode(AuthorityDiscoveryId, VersionedValidationProtocol),
|
||||
/// A request originating from our node
|
||||
RequestFromNode(AuthorityDiscoveryId, Requests),
|
||||
/// A request originating from an emultated peer
|
||||
/// A request originating from an emulated peer
|
||||
RequestFromPeer(IncomingRequest),
|
||||
}
|
||||
|
||||
@@ -790,9 +790,9 @@ pub fn new_network(
|
||||
|
||||
let connected_count = config.connected_count();
|
||||
|
||||
let mut peers_indicies = (0..n_peers).collect_vec();
|
||||
let mut peers_indices = (0..n_peers).collect_vec();
|
||||
let (_connected, to_disconnect) =
|
||||
peers_indicies.partial_shuffle(&mut thread_rng(), connected_count);
|
||||
peers_indices.partial_shuffle(&mut thread_rng(), connected_count);
|
||||
|
||||
// Node under test is always mark as disconnected.
|
||||
peers[NODE_UNDER_TEST as usize].disconnect();
|
||||
@@ -958,7 +958,7 @@ impl Metrics {
|
||||
.inc_by(bytes as u64);
|
||||
}
|
||||
|
||||
/// Increment total receioved for a peer.
|
||||
/// Increment total received for a peer.
|
||||
pub fn on_peer_received(&self, peer_index: usize, bytes: usize) {
|
||||
self.peer_total_received
|
||||
.with_label_values(vec![format!("node{}", peer_index).as_str()].as_slice())
|
||||
@@ -1041,7 +1041,7 @@ mod tests {
|
||||
async fn test_expected_rate() {
|
||||
let tick_rate = 200;
|
||||
let budget = 1_000_000;
|
||||
// rate must not exceeed 100 credits per second
|
||||
// rate must not exceed 100 credits per second
|
||||
let mut rate_limiter = RateLimit::new(tick_rate, budget);
|
||||
let mut total_sent = 0usize;
|
||||
let start = Instant::now();
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Test utils
|
||||
|
||||
use crate::usage::BenchmarkUsage;
|
||||
use std::io::{stdout, Write};
|
||||
|
||||
pub struct WarmUpOptions<'a> {
|
||||
/// The maximum number of runs considered for warming up.
|
||||
pub warm_up: usize,
|
||||
/// The number of runs considered for benchmarking.
|
||||
pub bench: usize,
|
||||
/// The difference in CPU usage between runs considered as normal
|
||||
pub precision: f64,
|
||||
/// The subsystems whose CPU usage is checked during warm-up cycles
|
||||
pub subsystems: &'a [&'a str],
|
||||
}
|
||||
|
||||
impl<'a> WarmUpOptions<'a> {
|
||||
pub fn new(subsystems: &'a [&'a str]) -> Self {
|
||||
Self { warm_up: 100, bench: 3, precision: 0.02, subsystems }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn warm_up_and_benchmark(
|
||||
options: WarmUpOptions,
|
||||
run: impl Fn() -> BenchmarkUsage,
|
||||
) -> Result<BenchmarkUsage, String> {
|
||||
println!("Warming up...");
|
||||
let mut usages = Vec::with_capacity(options.bench);
|
||||
|
||||
for n in 1..=options.warm_up {
|
||||
let curr = run();
|
||||
if let Some(prev) = usages.last() {
|
||||
let diffs = options
|
||||
.subsystems
|
||||
.iter()
|
||||
.map(|&v| {
|
||||
curr.cpu_usage_diff(prev, v)
|
||||
.ok_or(format!("{} not found in benchmark {:?}", v, prev))
|
||||
})
|
||||
.collect::<Result<Vec<f64>, String>>()?;
|
||||
if !diffs.iter().all(|&v| v < options.precision) {
|
||||
usages.clear();
|
||||
}
|
||||
}
|
||||
usages.push(curr);
|
||||
print!("\r{}%", n * 100 / options.warm_up);
|
||||
if usages.len() == options.bench {
|
||||
println!("\rTook {} runs to warm up", n.saturating_sub(options.bench));
|
||||
break;
|
||||
}
|
||||
stdout().flush().unwrap();
|
||||
}
|
||||
|
||||
if usages.len() != options.bench {
|
||||
println!("Didn't warm up after {} runs", options.warm_up);
|
||||
return Err("Can't warm up".to_string())
|
||||
}
|
||||
|
||||
Ok(BenchmarkUsage::average(&usages))
|
||||
}
|
||||
@@ -805,7 +805,7 @@ pub enum StatementDistributionMessage {
|
||||
|
||||
/// This data becomes intrinsics or extrinsics which should be included in a future relay chain
|
||||
/// block.
|
||||
// It needs to be cloneable because multiple potential block authors can request copies.
|
||||
// It needs to be clonable because multiple potential block authors can request copies.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ProvisionableData {
|
||||
/// This bitfield indicates the availability of various candidate blocks.
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
///
|
||||
/// 2. The root fragment is invalid under the new constraints because it has been subsumed by
|
||||
/// the relay-chain. In this case, we can discard the root and split & re-root the fragment
|
||||
/// tree under its descendents and compare to the new constraints again. This is the
|
||||
/// tree under its descendants and compare to the new constraints again. This is the
|
||||
/// "prediction came true" case.
|
||||
///
|
||||
/// 3. The root fragment is invalid under the new constraints because a competing parachain
|
||||
|
||||
@@ -382,7 +382,7 @@ pub fn signing_key_and_index<'a>(
|
||||
|
||||
/// Sign the given data with the given validator ID.
|
||||
///
|
||||
/// Returns `Ok(None)` if the private key that correponds to that validator ID is not found in the
|
||||
/// Returns `Ok(None)` if the private key that corresponds to that validator ID is not found in the
|
||||
/// given keystore. Returns an error if the key could not be used for signing.
|
||||
pub fn sign(
|
||||
keystore: &KeystorePtr,
|
||||
|
||||
Reference in New Issue
Block a user