Skip to content

Commit

Permalink
chore: remove now useless bls init (#6513)
Browse files Browse the repository at this point in the history
* feat: allow to select bls implementation

* chore: remove unneeded init
  • Loading branch information
jeluard committed Mar 13, 2024
1 parent 15974b5 commit 87f07fe
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions packages/light-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import mitt from "mitt";
import {init as initBls} from "@chainsafe/bls/switchable";
import {fromHexString, toHexString} from "@chainsafe/ssz";
import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD} from "@lodestar/params";
import {phase0, RootHex, Slot, SyncPeriod, allForks} from "@lodestar/types";
import {createBeaconConfig, BeaconConfig, ChainForkConfig} from "@lodestar/config";
import {isErrorAborted, sleep} from "@lodestar/utils";
import {getCurrentSlot, slotWithFutureTolerance, timeUntilNextEpoch} from "./utils/clock.js";
import {isNode} from "./utils/utils.js";
import {chunkifyInclusiveRange} from "./utils/chunkify.js";
import {LightclientEmitter, LightclientEvent} from "./events.js";
import {getLcLoggerConsole, ILcLogger} from "./utils/logger.js";
Expand Down Expand Up @@ -153,12 +151,6 @@ export class Lightclient {
): Promise<Lightclient> {
const {transport, checkpointRoot} = args;

// Initialize the BLS implementation. This may requires initializing the WebAssembly instance
// so why it's an async process. This should be initialized once before any bls operations.
// This process has to be done manually because of an issue in Karma runner
// https://github.com/karma-runner/karma/issues/3804
await initBls(isNode ? "blst-native" : "herumi");

// Fetch bootstrap state with proof at the trusted block root
const {data: bootstrap} = await transport.getBootstrap(toHexString(checkpointRoot));

Expand Down Expand Up @@ -202,12 +194,6 @@ export class Lightclient {
}

async sync(fromPeriod: SyncPeriod, toPeriod: SyncPeriod): Promise<void> {
// Initialize the BLS implementation. This may requires initializing the WebAssembly instance
// so why it's a an async process. This should be initialized once before any bls operations.
// This process has to be done manually because of an issue in Karma runner
// https://github.com/karma-runner/karma/issues/3804
await initBls(isNode ? "blst-native" : "herumi");

const periodRanges = chunkifyInclusiveRange(fromPeriod, toPeriod, MAX_PERIODS_PER_REQUEST);

for (const [fromPeriodRng, toPeriodRng] of periodRanges) {
Expand All @@ -224,12 +210,6 @@ export class Lightclient {
}

private async runLoop(): Promise<void> {
// Initialize the BLS implementation. This may requires initializing the WebAssembly instance
// so why it's a an async process. This should be initialized once before any bls operations.
// This process has to be done manually because of an issue in Karma runner
// https://github.com/karma-runner/karma/issues/3804
await initBls(isNode ? "blst-native" : "herumi");

// eslint-disable-next-line no-constant-condition
while (true) {
const currentPeriod = computeSyncPeriodAtSlot(this.currentSlot);
Expand Down

0 comments on commit 87f07fe

Please sign in to comment.