WIP: CI: add spellcheck (#3421)

* CI: add spellcheck

* revert me

* CI: explicit command for spellchecker

* spellcheck: edit misspells

* CI: run spellcheck on diff

* spellcheck: edits

* spellcheck: edit misspells

* spellcheck: add rules

* spellcheck: mv configs

* spellcheck: more edits

* spellcheck: chore

* spellcheck: one more thing

* spellcheck: and another one

* spellcheck: seems like it doesn't get to an end

* spellcheck: new words after rebase

* spellcheck: new words appearing out of nowhere

* chore

* review edits

* more review edits

* more edits

* wonky behavior

* wonky behavior 2

* wonky behavior 3

* change git behavior

* spellcheck: another bunch of new edits

* spellcheck: new words are koming out of nowhere

* CI: finding the master

* CI: fetching master implicitly

* CI: undebug

* new errors

* a bunch of new edits

* and some more

* Update node/core/approval-voting/src/approval_db/v1/mod.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

* Update xcm/xcm-executor/src/assets.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

* Apply suggestions from code review

Co-authored-by: Andronik Ordian <write@reusable.software>

* Suggestions from the code review

* CI: scan only changed files

Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
Denis Pisarev
2021-07-14 19:22:58 +02:00
committed by GitHub
parent f6305d29be
commit fc253e6e4d
239 changed files with 927 additions and 761 deletions
@@ -274,11 +274,11 @@ fn try_import_the_same_assignment() {
});
}
/// https://github.com/paritytech/polkadot/pull/2160#discussion_r547594835
/// <https://github.com/paritytech/polkadot/pull/2160#discussion_r547594835>
///
/// 1. Send a view update that removes block B from their view.
/// 2. Send a message from B that they incur COST_UNEXPECTED_MESSAGE for,
/// but then they receive BENEFIT_VALID_MESSAGE.
/// 2. Send a message from B that they incur `COST_UNEXPECTED_MESSAGE` for,
/// but then they receive `BENEFIT_VALID_MESSAGE`.
/// 3. Send all other messages related to B.
#[test]
fn spam_attack_results_in_negative_reputation_change() {
@@ -360,7 +360,7 @@ fn spam_attack_results_in_negative_reputation_change() {
/// Upon receiving them, they both will try to send the message each other.
/// This test makes sure they will not punish each other for such duplicate messages.
///
/// See https://github.com/paritytech/polkadot/issues/2499.
/// See <https://github.com/paritytech/polkadot/issues/2499>.
#[test]
fn peer_sending_us_the_same_we_just_sent_them_is_ok() {
let parent_hash = Hash::repeat_byte(0xFF);
@@ -72,7 +72,7 @@ enum FetchedState {
///
/// Once the contained `Sender` is dropped, any still running task will be canceled.
Started(oneshot::Sender<()>),
/// All relevant live_in have been removed, before we were able to get our chunk.
/// All relevant `live_in` have been removed, before we were able to get our chunk.
Canceled,
}
@@ -118,7 +118,7 @@ struct RunningTask {
/// Sender for communicating with other subsystems and reporting results.
sender: mpsc::Sender<FromFetchTask>,
/// Prometheues metrics for reporting results.
/// Prometheus metrics for reporting results.
metrics: Metrics,
/// Span tracking the fetching of this chunk.
@@ -199,7 +199,7 @@ fn task_stores_valid_chunk_if_there_is_one() {
struct TestRun {
/// Response to deliver for a given validator index.
/// None means, answer with NetworkError.
/// None means, answer with `NetworkError`.
chunk_responses: HashMap<Recipient, ChunkFetchingResponse>,
/// Set of chunks that should be considered valid:
valid_chunks: HashSet<Vec<u8>>,
@@ -238,7 +238,7 @@ impl TestRun {
});
}
/// Returns true, if after processing of the given message it would be ok for the stream to
/// Returns true, if after processing of the given message it would be OK for the stream to
/// end.
async fn handle_message(&self, msg: AllMessages) -> bool {
match msg {
@@ -153,8 +153,8 @@ impl Requester {
///
/// Starting requests where necessary.
///
/// Note: The passed in `leaf` is not the same as CandidateDescriptor::relay_parent in the
/// given cores. The latter is the relay_parent this candidate considers its parent, while the
/// Note: The passed in `leaf` is not the same as `CandidateDescriptor::relay_parent` in the
/// given cores. The latter is the `relay_parent` this candidate considers its parent, while the
/// passed in leaf might be some later block where the candidate is still pending availability.
async fn add_cores<Context>(
&mut self,
@@ -35,7 +35,7 @@ use crate::{
/// It should be ensured that a cached session stays live in the cache as long as we might need it.
pub struct SessionCache {
/// Look up cached sessions by SessionIndex.
/// Look up cached sessions by `SessionIndex`.
///
/// Note: Performance of fetching is really secondary here, but we need to ensure we are going
/// to get any existing cache entry, before fetching new information, as we should not mess up
@@ -85,7 +85,7 @@ where
/// Answer an incoming PoV fetch request by querying the av store.
///
/// Returns: Ok(true) if chunk was found and served.
/// Returns: `Ok(true)` if chunk was found and served.
pub async fn answer_pov_request<Context>(
ctx: &mut Context,
req: IncomingRequest<v1::PoVFetchingRequest>,
@@ -113,7 +113,7 @@ where
/// Answer an incoming chunk request by querying the av store.
///
/// Returns: Ok(true) if chunk was found and served.
/// Returns: `Ok(true)` if chunk was found and served.
pub async fn answer_chunk_request<Context>(
ctx: &mut Context,
req: IncomingRequest<v1::ChunkFetchingRequest>,
@@ -57,7 +57,7 @@ pub struct TestHarness {
pub pool: TaskExecutor,
}
/// TestState for mocking execution of this subsystem.
/// `TestState` for mocking execution of this subsystem.
///
/// The `Default` instance provides data, which makes the system succeed by providing a couple of
/// valid occupied cores. You can tune the data before calling `TestState::run`. E.g. modify some
+1 -1
View File
@@ -53,7 +53,7 @@ use polkadot_node_network_protocol::{
};
use polkadot_node_subsystem_util::metrics::{self, prometheus};
/// Peer set infos for network initialization.
/// Peer set info for network initialization.
///
/// To be added to [`NetworkConfiguration::extra_sets`].
pub use polkadot_node_network_protocol::peer_set::{peer_sets_info, IsAuthority};
@@ -39,7 +39,7 @@ use polkadot_overseer::AllMessages;
///
/// The resulting stream will end once any of its input ends.
///
/// TODO: Get rid of this: https://github.com/paritytech/polkadot/issues/2842
// TODO: Get rid of this: <https://github.com/paritytech/polkadot/issues/2842>
pub struct RequestMultiplexer {
receivers: Vec<(Protocol, mpsc::Receiver<network::IncomingRequest>)>,
statement_fetching: Option<mpsc::Receiver<network::IncomingRequest>>,
+1 -1
View File
@@ -232,7 +232,7 @@ impl Network for Arc<NetworkService<Block, Hash>> {
}
}
/// We assume one peer_id per authority_id.
/// We assume one `peer_id` per `authority_id`.
pub async fn get_peer_id_by_authority_id<AD: AuthorityDiscovery>(
authority_discovery: &mut AD,
authority: AuthorityDiscoveryId,
@@ -56,7 +56,7 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
///
/// This method will also disconnect from previously connected validators not in the `validator_ids` set.
/// it takes `network_service` and `authority_discovery_service` by value
/// and returns them as a workaround for the Future: Send requirement imposed by async fn impl.
/// and returns them as a workaround for the Future: Send requirement imposed by async function implementation.
pub async fn on_request(
&mut self,
validator_ids: Vec<AuthorityDiscoveryId>,
@@ -58,7 +58,7 @@ const COST_APPARENT_FLOOD: Rep = Rep::CostMinor("Message received when previous
///
/// This is to protect from a single slow validator preventing collations from happening.
///
/// With a collation size of 5Meg and bandwidth of 500Mbit/s (requirement for Kusama validators),
/// With a collation size of 5MB and bandwidth of 500Mbit/s (requirement for Kusama validators),
/// the transfer should be possible within 0.1 seconds. 400 milliseconds should therefore be
/// plenty and should be low enough for later validators to still be able to finish on time.
///
@@ -863,7 +863,7 @@ fn collators_reject_declare_messages() {
///
/// After the first response is done, the passed in lambda will be called with the receiver for the
/// next response and a sender for giving feedback on the response of the first transmission. After
/// the lamda has passed it is assumed that the second response is sent, which is checked by this
/// the lambda has passed it is assumed that the second response is sent, which is checked by this
/// function.
///
/// The lambda can trigger occasions on which the second response should be sent, like timeouts,
@@ -71,7 +71,7 @@ const BENEFIT_NOTIFY_GOOD: Rep = Rep::BenefitMinor("A collator was noted good by
///
/// This is to protect from a single slow collator preventing collations from happening.
///
/// With a collation size of 5Meg and bandwidth of 500Mbit/s (requirement for Kusama validators),
/// With a collation size of 5MB and bandwidth of 500Mbit/s (requirement for Kusama validators),
/// the transfer should be possible within 0.1 seconds. 400 milliseconds should therefore be
/// plenty, even with multiple heads and should be low enough for later collators to still be able
/// to finish on time.
@@ -718,7 +718,7 @@ where
}
/// A peer's view has changed. A number of things should be done:
/// - Ongoing collation requests have to be cancelled.
/// - Ongoing collation requests have to be canceled.
/// - Advertisements by this peer that are no longer relevant have to be removed.
async fn handle_peer_view_change(
state: &mut State,
@@ -738,7 +738,7 @@ async fn handle_peer_view_change(
/// This function will
/// - Check for duplicate requests.
/// - Check if the requested collation is in our view.
/// - Update PerRequest records with the `result` field if necessary.
/// - Update `PerRequest` records with the `result` field if necessary.
/// And as such invocations of this function may rely on that.
async fn request_collation<Context>(
ctx: &mut Context,
@@ -62,15 +62,15 @@ pub enum Fatal {
#[error("Spawning subsystem task failed")]
SpawnTask(#[source] SubsystemError),
/// DisputeSender mpsc receiver exhausted.
/// `DisputeSender` mpsc receiver exhausted.
#[error("Erasure chunk requester stream exhausted")]
SenderExhausted,
/// Errors coming from runtime::Runtime.
/// Errors coming from `runtime::Runtime`.
#[error("Error while accessing runtime information")]
Runtime(#[from] runtime::Fatal),
/// Errors coming from DisputeSender
/// Errors coming from `DisputeSender`
#[error("Error while accessing runtime information")]
Sender(#[from] sender::Fatal),
}
@@ -78,7 +78,7 @@ pub enum Fatal {
/// Non-fatal errors of this subsystem.
#[derive(Debug, Error)]
pub enum NonFatal {
/// Errors coming from DisputeSender
/// Errors coming from `DisputeSender`
#[error("Error while accessing runtime information")]
Sender(#[from] sender::NonFatal),
}
@@ -103,7 +103,7 @@ enum MuxedMessage {
///
/// - We need to make sure responses are actually sent (therefore we need to await futures
/// promptly).
/// - We need to update banned_peers accordingly to the result.
/// - We need to update `banned_peers` accordingly to the result.
ConfirmedImport(NonFatalResult<(PeerId, ImportStatementsResult)>),
/// A new request has arrived and should be handled.
@@ -56,7 +56,7 @@ pub const ALICE_INDEX: ValidatorIndex = ValidatorIndex(1);
lazy_static! {
/// Mocked AuthorityDiscovery service.
/// Mocked `AuthorityDiscovery` service.
pub static ref MOCK_AUTHORITY_DISCOVERY: MockAuthorityDiscovery = MockAuthorityDiscovery::new();
// Creating an innocent looking `SessionInfo` is really expensive in a debug build. Around
// 700ms on my machine, We therefore cache those keys here:
@@ -80,7 +80,7 @@ pub static ref MOCK_SESSION_INFO: SessionInfo =
..Default::default()
};
/// SessionInfo for the second session. (No more validators, but two more authorities.
/// `SessionInfo` for the second session. (No more validators, but two more authorities.
pub static ref MOCK_NEXT_SESSION_INFO: SessionInfo =
SessionInfo {
discovery_keys:
@@ -199,12 +199,12 @@ where
failed_rx
}
/// We partition the list of all sorted `authorities` into sqrt(len) groups of sqrt(len) size
/// We partition the list of all sorted `authorities` into `sqrt(len)` groups of `sqrt(len)` size
/// and form a matrix where each validator is connected to all validators in its row and column.
/// This is similar to [web3] research proposed topology, except for the groups are not parachain
/// This is similar to `[web3]` research proposed topology, except for the groups are not parachain
/// groups (because not all validators are parachain validators and the group size is small),
/// but formed randomly via BABE randomness from two epochs ago.
/// This limits the amount of gossip peers to 2 * sqrt(len) and ensures the diameter of 2.
/// This limits the amount of gossip peers to 2 * `sqrt(len)` and ensures the diameter of 2.
///
/// [web3]: https://research.web3.foundation/en/latest/polkadot/networking/3-avail-valid.html#topology
async fn update_gossip_topology<Context>(
+2 -2
View File
@@ -284,7 +284,7 @@ impl View {
/// Check if two views have the same heads.
///
/// Equivalent to the `PartialEq` fn,
/// Equivalent to the `PartialEq` function,
/// but ignores the `finalized_number` field.
pub fn check_heads_eq(&self, other: &Self) -> bool {
self.heads == other.heads
@@ -325,7 +325,7 @@ pub mod v1 {
/// Seconded statement with large payload (e.g. containing a runtime upgrade).
///
/// We only gossip the hash in that case, actual payloads can be fetched from sending node
/// via req/response.
/// via request/response.
#[codec(index = 1)]
LargeStatement(StatementMetadata),
}
@@ -16,18 +16,18 @@
//! Overview over request/responses as used in `Polkadot`.
//!
//! enum Protocol .... List of all supported protocols.
//! `enum Protocol` .... List of all supported protocols.
//!
//! enum Requests .... List of all supported requests, each entry matches one in protocols, but
//! `enum Requests` .... List of all supported requests, each entry matches one in protocols, but
//! has the actual request as payload.
//!
//! struct IncomingRequest .... wrapper for incoming requests, containing a sender for sending
//! `struct IncomingRequest` .... wrapper for incoming requests, containing a sender for sending
//! responses.
//!
//! struct OutgoingRequest .... wrapper for outgoing requests, containing a sender used by the
//! `struct OutgoingRequest` .... wrapper for outgoing requests, containing a sender used by the
//! networking code for delivering responses/delivery errors.
//!
//! trait `IsRequest` .... A trait describing a particular request. It is used for gathering meta
//! `trait IsRequest` .... A trait describing a particular request. It is used for gathering meta
//! data, like what is the corresponding response type.
//!
//! Versioned (v1 module): The actual requests and responses as sent over the network.
@@ -72,7 +72,7 @@ pub enum Protocol {
/// Minimum bandwidth we expect for validators - 500Mbit/s is the recommendation, so approximately
/// 50Meg bytes per second:
/// 50MB per second:
const MIN_BANDWIDTH_BYTES: u64 = 50 * 1024 * 1024;
/// Default request timeout in seconds.
@@ -79,7 +79,7 @@ impl Requests {
///
/// Note: `Requests` is just an enum collecting all supported requests supported by network
/// bridge, it is never sent over the wire. This function just encodes the individual requests
/// contained in the enum.
/// contained in the `enum`.
pub fn encode_request(self) -> (Protocol, OutgoingRequest<Vec<u8>>) {
match self {
Self::ChunkFetching(r) => r.encode_request(),
@@ -219,7 +219,7 @@ impl From<oneshot::Canceled> for RequestError {
/// `IncomingRequest`s are produced by `RequestMultiplexer` on behalf of the network bridge.
#[derive(Debug)]
pub struct IncomingRequest<Req> {
/// PeerId of sending peer.
/// `PeerId` of sending peer.
pub peer: PeerId,
/// The sent request.
pub payload: Req,
@@ -227,7 +227,7 @@ pub struct IncomingRequest<Req> {
pub pending_response: OutgoingResponseSender<Req>,
}
/// Sender for sendinb back responses on an `IncomingRequest`.
/// Sender for sending back responses on an `IncomingRequest`.
#[derive(Debug)]
pub struct OutgoingResponseSender<Req>{
pending_response: oneshot::Sender<netconfig::OutgoingResponse>,
@@ -241,9 +241,9 @@ where
{
/// Send the response back.
///
/// On success we return Ok(()), on error we return the not sent `Response`.
/// On success we return `Ok(())`, on error we return the not sent `Response`.
///
/// netconfig::OutgoingResponse exposes a way of modifying the peer's reputation. If needed we
/// `netconfig::OutgoingResponse` exposes a way of modifying the peer's reputation. If needed we
/// can change this function to expose this feature as well.
pub fn send_response(self, resp: Req::Response) -> Result<(), Req::Response> {
self.pending_response
@@ -375,7 +375,7 @@ where
}
}
/// Future for actually receiving a typed response for an OutgoingRequest.
/// Future for actually receiving a typed response for an `OutgoingRequest`.
async fn receive_response<Req>(
rec: oneshot::Receiver<Result<Vec<u8>, network::RequestFailure>>,
) -> OutgoingResult<Req::Response>
@@ -172,7 +172,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 `CommitedCandidateRecept`.
pub candidate_hash: CandidateHash,
}
@@ -17,7 +17,7 @@
//! The Statement Distribution Subsystem.
//!
//! This is responsible for distributing signed statements about candidate
//! validity amongst validators.
//! validity among validators.
#![deny(unused_crate_dependencies)]
#![warn(missing_docs)]
@@ -208,7 +208,7 @@ struct PeerRelayParentKnowledge {
/// How many large statements this peer already sent us.
///
/// Flood protection for large statements is rather hard and as soon as we get
/// https://github.com/paritytech/polkadot/issues/2979 implemented also no longer necessary.
/// `https://github.com/paritytech/polkadot/issues/2979` implemented also no longer necessary.
/// Reason: We keep messages around until we fetched the payload, but if a node makes up
/// statements and never provides the data, we will keep it around for the slot duration. Not
/// even signature checking would help, as the sender, if a validator, can just sign arbitrary
@@ -290,7 +290,7 @@ impl PeerRelayParentKnowledge {
/// Provide the maximum message count that we can receive per candidate. In practice we should
/// not receive more statements for any one candidate than there are members in the group assigned
/// to that para, but this maximum needs to be lenient to account for equivocations that may be
/// cross-group. As such, a maximum of 2 * n_validators is recommended.
/// cross-group. As such, a maximum of 2 * `n_validators` is recommended.
///
/// This returns an error if the peer should not have sent us this message according to protocol
/// rules for flood protection.
@@ -459,7 +459,7 @@ impl PeerData {
/// Provide the maximum message count that we can receive per candidate. In practice we should
/// not receive more statements for any one candidate than there are members in the group assigned
/// to that para, but this maximum needs to be lenient to account for equivocations that may be
/// cross-group. As such, a maximum of 2 * n_validators is recommended.
/// cross-group. As such, a maximum of 2 * `n_validators` is recommended.
///
/// This returns an error if the peer should not have sent us this message according to protocol
/// rules for flood protection.
@@ -45,7 +45,7 @@ pub enum RequesterMessage {
candidate_hash: CandidateHash,
tx: oneshot::Sender<Vec<PeerId>>
},
/// Fetching finished, ask for verification. If verification failes, task will continue asking
/// Fetching finished, ask for verification. If verification fails, task will continue asking
/// peers for data.
Finished {
/// Relay parent this candidate is in the context of.