Skip to content

Commit

Permalink
fix: make electra-fork passes lint and check-types (#6785)
Browse files Browse the repository at this point in the history
fix lint and check-types
  • Loading branch information
ensi321 authored May 16, 2024
1 parent fa08f3a commit 7dc2944
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/api/test/unit/beacon/oapiSpec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const reqSerializers = {
...routes.lightclient.getReqSerializers(),
...routes.node.getReqSerializers(),
...routes.proof.getReqSerializers(),
...routes.validator.getReqSerializers(),
...routes.validator.getReqSerializers(config),
};

const returnTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {PublicKey} from "@chainsafe/bls/types";
import {DOMAIN_AGGREGATE_AND_PROOF, ForkSeq} from "@lodestar/params";
import {allForks, ssz} from "@lodestar/types";
import {Epoch, phase0} from "@lodestar/types";
import {Epoch} from "@lodestar/types";
import {
computeSigningRoot,
computeStartSlotAtEpoch,
Expand Down
6 changes: 3 additions & 3 deletions packages/beacon-node/test/sim/electra-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ describe("executionEngine / ExecutionEngineHttp", function () {
}
}

if (payload.depositRequests.length !== 1) {
throw Error(`Number of depositRequests mismatched. Expected: 1, actual: ${payload.depositRequests.length}`);
if (payload.depositReceipts.length !== 1) {
throw Error(`Number of depositRequests mismatched. Expected: 1, actual: ${payload.depositReceipts.length}`);
}

const actualDepositRequest = payload.depositRequests[0];
const actualDepositRequest = payload.depositReceipts[0];
assert.deepStrictEqual(
actualDepositRequest,
depositRequestB,
Expand Down
2 changes: 1 addition & 1 deletion packages/fork-choice/test/perf/forkChoice/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function initializeForkChoice(opts: Opts): ForkChoice {
genesisSlot
);

const balances = new Uint8Array(Array.from({length: opts.initialValidatorCount}, () => 32));
const balances = new Uint16Array(Array.from({length: opts.initialValidatorCount}, () => 32));

const fcStore: IForkChoiceStore = {
currentSlot: genesisSlot,
Expand Down
6 changes: 3 additions & 3 deletions packages/fork-choice/test/unit/forkChoice/forkChoice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ describe("Forkchoice", function () {
currentSlot: genesisSlot + 1,
justified: {
checkpoint: {epoch: genesisEpoch, root: fromHexString(finalizedRoot), rootHex: finalizedRoot},
balances: new Uint8Array([32]),
balances: new Uint16Array([32]),
totalBalance: 32,
},
unrealizedJustified: {
checkpoint: {epoch: genesisEpoch, root: fromHexString(finalizedRoot), rootHex: finalizedRoot},
balances: new Uint8Array([32]),
balances: new Uint16Array([32]),
},
finalizedCheckpoint: {epoch: genesisEpoch, root: fromHexString(finalizedRoot), rootHex: finalizedRoot},
unrealizedFinalizedCheckpoint: {epoch: genesisEpoch, root: fromHexString(finalizedRoot), rootHex: finalizedRoot},
justifiedBalancesGetter: () => new Uint8Array([32]),
justifiedBalancesGetter: () => new Uint16Array([32]),
equivocatingIndices: new Set(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ describe("Forkchoice / GetProposerHead", function () {
currentSlot: genesisSlot + 1,
justified: {
checkpoint: {epoch: genesisEpoch, root: fromHexString(genesisBlock.blockRoot), rootHex: genesisBlock.blockRoot},
balances: new Uint8Array(Array(32).fill(150)),
balances: new Uint16Array(Array(32).fill(150)),
totalBalance: 32 * 150,
},
unrealizedJustified: {
checkpoint: {epoch: genesisEpoch, root: fromHexString(genesisBlock.blockRoot), rootHex: genesisBlock.blockRoot},
balances: new Uint8Array(Array(32).fill(150)),
balances: new Uint16Array(Array(32).fill(150)),
},
finalizedCheckpoint: {
epoch: genesisEpoch,
Expand All @@ -109,7 +109,7 @@ describe("Forkchoice / GetProposerHead", function () {
root: fromHexString(genesisBlock.blockRoot),
rootHex: genesisBlock.blockRoot,
},
justifiedBalancesGetter: () => new Uint8Array(Array(32).fill(150)),
justifiedBalancesGetter: () => new Uint16Array(Array(32).fill(150)),
equivocatingIndices: new Set(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe("computeDeltas", () => {
nextEpoch: 0,
}));

const balances = new Uint8Array([firstBalance, secondBalance]);
const balances = new Uint16Array([firstBalance, secondBalance]);
// 1st validator is part of an attester slashing
const equivocatingIndices = new Set([0]);
let deltas = computeDeltas(indices.size, votes, balances, balances, equivocatingIndices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function processRewardsAndPenalties(
const balances = state.balances.getAll();

for (let i = 0, len = rewards.length; i < len; i++) {
const result = balances[i] + rewards[i] - penalties[i] - (slashingPenalties[i] ?? 0)
const result = balances[i] + rewards[i] - penalties[i] - (slashingPenalties[i] ?? 0);
balances[i] = Math.max(result, 0);
}

Expand Down

0 comments on commit 7dc2944

Please sign in to comment.