Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force name functions #2867

Merged
merged 6 commits into from
Jul 22, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change arrow functions to regular functions
dapplion committed Jul 20, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 1856c0ae2ddda3b95b69cb3a3a595bf2325813d2
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ import {
import {getNextSyncCommittee} from "../../altair/epoch/sync_committee";
import {ssz} from "@chainsafe/lodestar-types";
import {CachedInactivityScoreList, CachedInactivityScoreListProxyHandler} from "./cachedInactivityScoreList";
import {newFilledArray} from "../../util";

/**
* `BeaconState` with various caches
@@ -79,12 +80,8 @@ export function createCachedBeaconState<T extends allForks.BeaconState>(
};
currIndexedSyncCommittee = emptyIndexedSyncCommittee;
nextIndexedSyncCommittee = emptyIndexedSyncCommittee;
cachedPreviousParticipation = MutableVector.from(
Array.from({length: cachedValidators.length}, () => emptyParticipationStatus)
);
cachedCurrentParticipation = MutableVector.from(
Array.from({length: cachedValidators.length}, () => emptyParticipationStatus)
);
cachedPreviousParticipation = MutableVector.from(newFilledArray(cachedValidators.length, emptyParticipationStatus));
cachedCurrentParticipation = MutableVector.from(newFilledArray(cachedValidators.length, emptyParticipationStatus));
cachedInactivityScores = MutableVector.empty();
} else {
const {pubkey2index} = epochCtx;
4 changes: 2 additions & 2 deletions packages/cli/src/util/process.ts
Original file line number Diff line number Diff line change
@@ -12,10 +12,10 @@ export function onGracefulShutdown(
logFn: (msg: string) => void = console.log
): void {
for (const signal of exitSignals) {
process.once(signal, async () => {
process.once(signal, async function onSignal() {
logFn("Stopping gracefully, use Ctrl+C again to force process exit");

process.on(signal, () => {
process.on(signal, function onSecondSignal() {
logFn("Forcing process exit");
process.exit(1);
});
2 changes: 1 addition & 1 deletion packages/lodestar/src/network/network.ts
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ export class Network implements INetwork {
);

this.chain.emitter.on(ChainEvent.clockEpoch, this.onEpoch);
modules.signal.addEventListener("abort", () => this.close(), {once: true});
modules.signal.addEventListener("abort", this.close.bind(this), {once: true});
}

/** Destroy this instance. Can only be called once. */
4 changes: 2 additions & 2 deletions packages/lodestar/src/network/peers/peerManager.ts
Original file line number Diff line number Diff line change
@@ -119,8 +119,8 @@ export class PeerManager {
// On start-up will connected to existing peers in libp2p.peerStore, same as autoDial behaviour
this.heartbeat();
this.intervals = [
setInterval(() => this.pingAndStatusTimeouts(), CHECK_PING_STATUS_INTERVAL),
setInterval(() => this.heartbeat(), HEARTBEAT_INTERVAL_MS),
setInterval(this.pingAndStatusTimeouts.bind(this), CHECK_PING_STATUS_INTERVAL),
setInterval(this.heartbeat.bind(this), HEARTBEAT_INTERVAL_MS),
];
}

4 changes: 2 additions & 2 deletions packages/lodestar/test/utils/network.ts
Original file line number Diff line number Diff line change
@@ -40,14 +40,14 @@ export async function disconnect(network: Network, peer: PeerId): Promise<void>
export function onPeerConnect(network: Network): Promise<void> {
return new Promise<void>((resolve) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
network["libp2p"].connectionManager.on(Libp2pEvent.peerConnect, () => resolve())
network["libp2p"].connectionManager.on(Libp2pEvent.peerConnect, resolve)
);
}

export function onPeerDisconnect(network: Network): Promise<void> {
return new Promise<void>((resolve) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
network["libp2p"].connectionManager.on(Libp2pEvent.peerDisconnect, () => resolve())
network["libp2p"].connectionManager.on(Libp2pEvent.peerDisconnect, resolve)
);
}