Skip to content

Commit

Permalink
chore: fix typos (#6036)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodDaisy authored Oct 14, 2023
1 parent c06f4e5 commit a05e1b3
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/utils/urlFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function urlToTokens(path: string): Token[] {
* Compile a route URL formater with syntax `/path/{var1}/{var2}`.
* Returns a function that expects an object `{var1: 1, var2: 2}`, and returns`/path/1/2`.
*
* It's cheap enough to be neglibible. For the sample input below it costs:
* It's cheap enough to be negligible. For the sample input below it costs:
* - compile: 1010 ns / op
* - execute: 105 ns / op
* - execute with template literal: 12 ns / op
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/api/rest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class BeaconRestApiServer extends RestApiServer {
}

protected shouldIgnoreError(err: Error): boolean {
// Don't log ErrorAborted errors, they happen on node shutdown and are not usefull
// Don't log ErrorAborted errors, they happen on node shutdown and are not useful
// Don't log NodeISSyncing errors, they happen very frequently while syncing and the validator polls duties
return err instanceof ErrorAborted || err instanceof NodeIsSyncing;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class WorkerNetworkCore implements INetworkCore {
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
// the initialization to timeout. The number below is big enough to almost disable the timeout
timeout: 5 * 60 * 1000,
// TODO: types are broken on spawn, which claims that `NetworkWorkerApi` does not satifies its contrains
// TODO: types are broken on spawn, which claims that `NetworkWorkerApi` does not satisfies its contrains
})) as unknown as ModuleThread<NetworkWorkerApi>;

return new WorkerNetworkCore({
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/network/peers/peerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ALLOWED_NEGATIVE_GOSSIPSUB_FACTOR = 0.1;

// TODO:
// maxPeers and targetPeers should be dynamic on the num of validators connected
// The Node should compute a recomended value every interval and log a warning
// The Node should compute a recommended value every interval and log a warning
// to terminal if it deviates significantly from the user's settings

export type PeerManagerOpts = {
Expand Down Expand Up @@ -119,7 +119,7 @@ enum RelevantPeerStatus {
}

/**
* Performs all peer managment functionality in a single grouped class:
* Performs all peer management functionality in a single grouped class:
* - Ping peers every `PING_INTERVAL_MS`
* - Status peers every `STATUS_INTERVAL_MS`
* - Execute discovery query if under target peers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function assertPeerRelevance(
!isZeroRoot(remote.finalizedRoot) &&
!isZeroRoot(local.finalizedRoot)
) {
// NOTE: due to prefering to not access chain state here, we can't check the finalized root against our history.
// NOTE: due to preferring to not access chain state here, we can't check the finalized root against our history.
// The impact of not doing check is low: peers that are behind us we can't confirm they are in the same chain as us.
// In the worst case they will attempt to sync from us, fail and disconnect. The ENR fork check should be sufficient
// to differentiate most peers in normal network conditions.
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/network/processor/gossipHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function getDefaultHandlers(modules: ValidatorFnsModules, options: GossipHandler
} else {
// TODO DENEB:
//
// If block + blobs not fully recieved in the slot within some deadline, we should trigger block/blob
// If block + blobs not fully received in the slot within some deadline, we should trigger block/blob
// pull using req/resp by root pre-emptively even though it will be trigged on seeing any block/blob
// gossip on next slot via missing parent checks
}
Expand All @@ -310,7 +310,7 @@ function getDefaultHandlers(modules: ValidatorFnsModules, options: GossipHandler
} else {
// TODO DENEB:
//
// If block + blobs not fully recieved in the slot within some deadline, we should trigger block/blob
// If block + blobs not fully received in the slot within some deadline, we should trigger block/blob
// pull using req/resp by root pre-emptively even though it will be trigged on seeing any block/blob
// gossip on next slot via missing parent checks
}
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/network/processor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const MAX_UNKNOWN_ROOTS_SLOT_CACHE_SIZE = 3;
* If message slots are withint this window, it'll likely to be filtered by gossipsub seenCache.
* This is mainly for DOS protection, see https://github.com/ChainSafe/lodestar/issues/5393
*/
const EARLIEST_PERMISSABLE_SLOT_DISTANCE = 32;
const EARLIEST_PERMISSIBLE_SLOT_DISTANCE = 32;

type WorkOpts = {
bypassQueue?: boolean;
Expand Down Expand Up @@ -249,7 +249,7 @@ export class NetworkProcessor {
if (slotRoot) {
// DOS protection: avoid processing messages that are too old
const {slot, root} = slotRoot;
if (slot < this.chain.clock.currentSlot - EARLIEST_PERMISSABLE_SLOT_DISTANCE) {
if (slot < this.chain.clock.currentSlot - EARLIEST_PERMISSIBLE_SLOT_DISTANCE) {
// TODO: Should report the dropped job to gossip? It will be eventually pruned from the mcache
this.metrics?.networkProcessor.gossipValidationError.inc({
topic: topicType,
Expand Down
8 changes: 4 additions & 4 deletions packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ export class ReqRespBeaconNode extends ReqResp {
versions: number[],
requestData: Uint8Array
): AsyncIterable<ResponseIncoming> {
// Remember prefered encoding
// Remember preferred encoding
const encoding = this.peersData.getEncodingPreference(peerId.toString()) ?? Encoding.SSZ_SNAPPY;

// Overwritte placeholder requestData from main thread with correct sequenceNumber
// Overwrite placeholder requestData from main thread with correct sequenceNumber
if (method === ReqRespMethod.Ping) {
requestData = requestSszTypeByMethod[ReqRespMethod.Ping].serialize(this.metadataController.seqNumber);
}
Expand Down Expand Up @@ -258,12 +258,12 @@ export class ReqRespBeaconNode extends ReqResp {
protected onIncomingRequestBody(request: RequestTypedContainer, peer: PeerId): void {
// Allow onRequest to return and close the stream
// For Goodbye there may be a race condition where the listener of `receivedGoodbye`
// disconnects in the same syncronous call, preventing the stream from ending cleanly
// disconnects in the same synchronous call, preventing the stream from ending cleanly
setTimeout(() => this.networkEventBus.emit(NetworkEvent.reqRespRequest, {request, peer}), 0);
}

protected onIncomingRequest(peerId: PeerId, protocol: ProtocolDescriptor): void {
// Remember prefered encoding
// Remember preferred encoding
if (protocol.method === ReqRespMethod.Status) {
this.peersData.setEncodingPreference(peerId.toString(), protocol.encoding);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/subnets/attnetsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum SubnetSource {

/**
* Manage random (long lived) subnets and committee (short lived) subnets.
* - PeerManager uses attnetsService to know which peers are requried for duties
* - PeerManager uses attnetsService to know which peers are required for duties
* - Network call addCommitteeSubscriptions() from API calls
* - Gossip handler checks shouldProcess to know if validator is aggregator
*/
Expand Down

0 comments on commit a05e1b3

Please sign in to comment.