Skip to content

Commit 4b2f34b

Browse files
nflaigg11tech
authored andcommitted
chore: review electra branch - part 1 (#7015)
1 parent ce6a0c7 commit 4b2f34b

File tree

28 files changed

+57
-60
lines changed

28 files changed

+57
-60
lines changed

packages/api/src/beacon/routes/beacon/block.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
deneb,
99
isSignedBlockContents,
1010
SignedBeaconBlock,
11+
BeaconBlockBody,
1112
SignedBeaconBlockOrContents,
1213
SignedBlindedBeaconBlock,
1314
SignedBlockContents,
1415
sszTypesFor,
15-
BeaconBlockBody,
1616
} from "@lodestar/types";
1717
import {ForkName, ForkPreElectra, ForkPreExecution, isForkBlobs, isForkExecution} from "@lodestar/params";
1818
import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js";

packages/api/src/beacon/routes/beacon/pool.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
317317
url: "/eth/v1/beacon/pool/attestations",
318318
method: "POST",
319319
req: {
320-
writeReqJson: ({signedAttestations}) => ({
321-
body: AttestationListTypePhase0.toJson(signedAttestations),
322-
}),
320+
writeReqJson: ({signedAttestations}) => ({body: AttestationListTypePhase0.toJson(signedAttestations)}),
323321
parseReqJson: ({body}) => ({signedAttestations: AttestationListTypePhase0.fromJson(body)}),
324322
writeReqSsz: ({signedAttestations}) => ({body: AttestationListTypePhase0.serialize(signedAttestations)}),
325323
parseReqSsz: ({body}) => ({signedAttestations: AttestationListTypePhase0.deserialize(body)}),
@@ -414,7 +412,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
414412
return {
415413
body: isForkPostElectra(fork)
416414
? ssz.electra.AttesterSlashing.serialize(attesterSlashing as electra.AttesterSlashing)
417-
: ssz.electra.AttesterSlashing.serialize(attesterSlashing as phase0.AttesterSlashing),
415+
: ssz.phase0.AttesterSlashing.serialize(attesterSlashing as phase0.AttesterSlashing),
418416
headers: {[MetaHeader.Version]: fork},
419417
};
420418
},

packages/api/src/beacon/routes/validator.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,15 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
880880
writeReqJson: ({signedAggregateAndProofs}) => ({
881881
body: SignedAggregateAndProofListPhase0Type.toJson(signedAggregateAndProofs),
882882
}),
883-
parseReqJson: ({body}) => ({signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.fromJson(body)}),
883+
parseReqJson: ({body}) => ({
884+
signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.fromJson(body),
885+
}),
884886
writeReqSsz: ({signedAggregateAndProofs}) => ({
885887
body: SignedAggregateAndProofListPhase0Type.serialize(signedAggregateAndProofs),
886888
}),
887-
parseReqSsz: ({body}) => ({signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.deserialize(body)}),
889+
parseReqSsz: ({body}) => ({
890+
signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.deserialize(body),
891+
}),
888892
schema: {
889893
body: Schema.ObjectArray,
890894
},

packages/api/test/unit/beacon/oapiSpec.test.ts

-5
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ const ignoredTopics = [
8686
topic block_gossip not implemented
8787
*/
8888
"block_gossip",
89-
90-
// Modified in electra to include version
91-
// should be removed from the ignore list after spec update
92-
"attestation",
93-
"attester_slashing",
9489
];
9590

9691
// eventstream types are defined as comments in the description of "examples".

packages/api/test/unit/beacon/testData/beacon.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const testData: GenericServerTestCases<Endpoints> = {
138138
res: undefined,
139139
},
140140
submitPoolAttesterSlashingsV2: {
141-
args: {attesterSlashing: ssz.electra.AttesterSlashing.defaultValue()},
141+
args: {attesterSlashing: ssz.phase0.AttesterSlashing.defaultValue()},
142142
res: undefined,
143143
},
144144
submitPoolProposerSlashings: {

packages/beacon-node/src/api/impl/beacon/blocks/index.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {routes} from "@lodestar/api";
2-
import {ApplicationMethods} from "@lodestar/api/server";
2+
import {ApiError, ApplicationMethods} from "@lodestar/api/server";
33
import {
44
computeEpochAtSlot,
55
computeTimeAtSlot,
66
reconstructFullBlockOrContents,
77
signedBeaconBlockToBlinded,
88
} from "@lodestar/state-transition";
9-
import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution} from "@lodestar/params";
9+
import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution, isForkPostElectra} from "@lodestar/params";
1010
import {sleep, fromHex, toRootHex} from "@lodestar/utils";
1111
import {
1212
deneb,
@@ -407,16 +407,22 @@ export function getBeaconBlockApi({
407407

408408
async getBlockAttestations({blockId}) {
409409
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
410+
const fork = config.getForkName(block.message.slot);
411+
412+
if (isForkPostElectra(fork)) {
413+
throw new ApiError(400, `Use getBlockAttestationsV2 to retrieve electra+ block attestations fork=${fork}`);
414+
}
415+
410416
return {
411-
data: Array.from(block.message.body.attestations),
417+
data: block.message.body.attestations,
412418
meta: {executionOptimistic, finalized},
413419
};
414420
},
415421

416422
async getBlockAttestationsV2({blockId}) {
417423
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
418424
return {
419-
data: Array.from(block.message.body.attestations),
425+
data: block.message.body.attestations,
420426
meta: {executionOptimistic, finalized, version: config.getForkName(block.message.slot)},
421427
};
422428
},

packages/beacon-node/src/api/impl/config/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646

4747
/**
4848
* Hand-picked list of constants declared in consensus-spec .md files.
49-
* This list is asserted to be up-to-date with the test `test/e2e/api/specConstants.test.ts`
49+
* This list is asserted to be up-to-date with the test `test/e2e/api/impl/config.test.ts`
5050
*/
5151
export const specConstants = {
5252
// phase0/beacon-chain.md

packages/beacon-node/src/api/impl/validator/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ForkPreBlobs,
2222
ForkBlobs,
2323
ForkExecution,
24+
isForkPostElectra,
2425
} from "@lodestar/params";
2526
import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator";
2627
import {
@@ -814,7 +815,7 @@ export function getValidatorApi(
814815
const attEpoch = computeEpochAtSlot(slot);
815816
const headBlockRootHex = chain.forkChoice.getHead().blockRoot;
816817
const headBlockRoot = fromHex(headBlockRootHex);
817-
const fork = config.getForkSeq(slot);
818+
const fork = config.getForkName(slot);
818819

819820
const beaconBlockRoot =
820821
slot >= headSlot
@@ -846,7 +847,7 @@ export function getValidatorApi(
846847
return {
847848
data: {
848849
slot,
849-
index: fork >= ForkSeq.electra ? 0 : committeeIndex,
850+
index: isForkPostElectra(fork) ? 0 : committeeIndex,
850851
beaconBlockRoot,
851852
source: attEpochState.currentJustifiedCheckpoint,
852853
target: {epoch: attEpoch, root: targetRoot},

packages/beacon-node/src/chain/errors/attestationError.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export enum AttestationErrorCode {
128128
/** Too many skipped slots. */
129129
TOO_MANY_SKIPPED_SLOTS = "ATTESTATION_ERROR_TOO_MANY_SKIPPED_SLOTS",
130130
/**
131-
* Electra: The aggregated attestation doesn't have only one committee bit set.
131+
* Electra: The aggregated attestation does not have exactly one committee bit set.
132132
*/
133133
NOT_EXACTLY_ONE_COMMITTEE_BIT_SET = "ATTESTATION_ERROR_NOT_EXACTLY_ONE_COMMITTEE_BIT_SET",
134134
/**

packages/beacon-node/src/eth1/interface.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export interface IEth1ForBlockProduction {
6464
startPollingMergeBlock(): void;
6565

6666
/**
67-
* Should stop polling eth1Data after a Electra block is finalized AND deposit_receipts_start_index is reached
67+
* Should stop polling eth1Data after a Electra block is finalized AND deposit_requests_start_index is reached
6868
*/
6969
stopPollingEth1Data(): void;
7070
}

packages/beacon-node/src/network/gossip/topic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function getGossipSSZType(topic: GossipTopic) {
9393
case GossipType.proposer_slashing:
9494
return ssz.phase0.ProposerSlashing;
9595
case GossipType.attester_slashing:
96-
return ssz.phase0.AttesterSlashing;
96+
return sszTypesFor(topic.fork).AttesterSlashing;
9797
case GossipType.voluntary_exit:
9898
return ssz.phase0.SignedVoluntaryExit;
9999
case GossipType.sync_committee_contribution_and_proof:

packages/beacon-node/test/perf/chain/opPools/aggregatedAttestationPool.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe(`getAttestationsForBlock vc=${vc}`, () => {
3232
before(function () {
3333
this.timeout(5 * 60 * 1000); // Generating the states for the first time is very slow
3434

35-
originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true, vc}) as CachedBeaconStateAltair;
35+
originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true, vc});
3636

3737
const {blockHeader, checkpoint} = computeAnchorCheckpoint(originalState.config, originalState);
3838
// TODO figure out why getBlockRootAtSlot(originalState, justifiedSlot) is not the same to justifiedCheckpoint.root

packages/beacon-node/test/perf/chain/opPools/opPool.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe("opPool", () => {
2424
before(function () {
2525
this.timeout(2 * 60 * 1000); // Generating the states for the first time is very slow
2626

27-
originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true}) as CachedBeaconStateAltair;
27+
originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true});
2828
});
2929

3030
itBench({

packages/beacon-node/test/perf/chain/produceBlock/produceBlockBody.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe("produceBlockBody", () => {
2525

2626
before(async () => {
2727
db = new BeaconDb(config, await LevelDbController.create({name: ".tmpdb"}, {logger}));
28-
state = stateOg.clone() as CachedBeaconStateAltair;
28+
state = stateOg.clone();
2929
chain = new BeaconChain(
3030
{
3131
proposerBoost: true,

packages/beacon-node/test/scripts/el-interop/besu/common-setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ echo "12345678" > $DATA_DIR/password.txt
1616
pubKey="0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
1717

1818
# echo a hex encoded 256 bit secret into a file
19-
echo $JWT_SECRET_HEX> $DATA_DIR/jwtsecret
19+
echo $JWT_SECRET_HEX> $DATA_DIR/jwtsecret

packages/beacon-node/test/scripts/el-interop/besu/post-merge.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ currentDir=$(pwd)
55

66
. $scriptDir/common-setup.sh
77

8-
$EL_BINARY_DIR/besu --engine-rpc-enabled --rpc-http-enabled --rpc-http-api ADMIN,ETH,MINER,NET --rpc-http-port $ETH_PORT --engine-rpc-port $ENGINE_PORT --engine-jwt-secret $currentDir/$DATA_DIR/jwtsecret --data-path $DATA_DIR --data-storage-format BONSAI --genesis-file $DATA_DIR/genesis.json
8+
$EL_BINARY_DIR/besu --engine-rpc-enabled --rpc-http-enabled --rpc-http-api ADMIN,ETH,MINER,NET --rpc-http-port $ETH_PORT --engine-rpc-port $ENGINE_PORT --engine-jwt-secret $currentDir/$DATA_DIR/jwtsecret --data-path $DATA_DIR --data-storage-format BONSAI --genesis-file $DATA_DIR/genesis.json

packages/beacon-node/test/scripts/el-interop/besudocker/post-merge.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ currentDir=$(pwd)
55

66
. $scriptDir/common-setup.sh
77

8-
docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) --name custom-execution -p $ETH_PORT:$ETH_PORT -p $ENGINE_PORT:$ENGINE_PORT -v $currentDir/$DATA_DIR:/data $EL_BINARY_DIR --engine-rpc-enabled --rpc-http-enabled --rpc-http-api ADMIN,ETH,MINER,NET --rpc-http-port $ETH_PORT --engine-rpc-port $ENGINE_PORT --engine-jwt-secret /data/jwtsecret --data-path /data/besu --data-storage-format BONSAI --genesis-file /data/genesis.json
8+
docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) --name custom-execution -p $ETH_PORT:$ETH_PORT -p $ENGINE_PORT:$ENGINE_PORT -v $currentDir/$DATA_DIR:/data $EL_BINARY_DIR --engine-rpc-enabled --rpc-http-enabled --rpc-http-api ADMIN,ETH,MINER,NET --rpc-http-port $ETH_PORT --engine-rpc-port $ENGINE_PORT --engine-jwt-secret /data/jwtsecret --data-path /data/besu --data-storage-format BONSAI --genesis-file /data/genesis.json

packages/beacon-node/test/scripts/el-interop/ethereumjsdocker/electra.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@
9191
"gasUsed":"0x0",
9292
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
9393
"baseFeePerGas":"0x7"
94-
}
94+
}

packages/beacon-node/test/sim/electra-interop.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe("executionEngine / ExecutionEngineHttp", function () {
252252

253253
/**
254254
* Want to test two things:
255-
* 1) Send two raw deposit transactions, and see if two new validators with corrent balances show up in the state.validators and unfinalized cache
255+
* 1) Send two raw deposit transactions, and see if two new validators with correct balances show up in the state.validators and unfinalized cache
256256
* 2) Upon state-transition, see if the two new validators move from unfinalized cache to finalized cache
257257
*/
258258
async function runNodeWithEL({

packages/beacon-node/test/spec/presets/genesis.test.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ const genesisInitialization: TestRunnerFn<GenesisInitSpecTest, BeaconStateAllFor
6060
deposits,
6161
undefined,
6262
testcase["execution_payload_header"] &&
63-
executionPayloadHeaderType.toViewDU(
64-
testcase["execution_payload_header"] as ExecutionPayloadHeader<ForkName.electra>
65-
)
63+
executionPayloadHeaderType.toViewDU(testcase["execution_payload_header"])
6664
);
6765
},
6866
// eth1.yaml

packages/beacon-node/test/spec/presets/operations.test.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import * as blockFns from "@lodestar/state-transition/block";
1212
import {ssz, phase0, altair, bellatrix, capella, electra, sszTypesFor} from "@lodestar/types";
1313
import {InputType} from "@lodestar/spec-test-util";
14-
import {ACTIVE_PRESET, ForkName, ForkSeq} from "@lodestar/params";
14+
import {ACTIVE_PRESET, ForkName} from "@lodestar/params";
1515

1616
import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js";
1717
import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js";
@@ -57,11 +57,6 @@ const operationFns: Record<string, BlockProcessFn<CachedBeaconStateAllForks>> =
5757
blockFns.processDeposit(fork, state, testCase.deposit);
5858
},
5959

60-
deposit_receipt: (state, testCase: {deposit_receipt: electra.DepositRequest}) => {
61-
const fork = state.config.getForkSeq(state.slot);
62-
blockFns.processDepositRequest(fork, state as CachedBeaconStateElectra, testCase.deposit_receipt);
63-
},
64-
6560
proposer_slashing: (state, testCase: {proposer_slashing: phase0.ProposerSlashing}) => {
6661
const fork = state.config.getForkSeq(state.slot);
6762
blockFns.processProposerSlashing(fork, state, testCase.proposer_slashing);
@@ -89,15 +84,18 @@ const operationFns: Record<string, BlockProcessFn<CachedBeaconStateAllForks>> =
8984
},
9085

9186
withdrawals: (state, testCase: {execution_payload: capella.ExecutionPayload}) => {
92-
blockFns.processWithdrawals(ForkSeq.capella, state as CachedBeaconStateCapella, testCase.execution_payload);
87+
const fork = state.config.getForkSeq(state.slot);
88+
blockFns.processWithdrawals(fork, state as CachedBeaconStateCapella, testCase.execution_payload);
9389
},
9490

9591
withdrawal_request: (state, testCase: {withdrawal_request: electra.WithdrawalRequest}) => {
96-
blockFns.processWithdrawalRequest(ForkSeq.electra, state as CachedBeaconStateElectra, testCase.withdrawal_request);
92+
const fork = state.config.getForkSeq(state.slot);
93+
blockFns.processWithdrawalRequest(fork, state as CachedBeaconStateElectra, testCase.withdrawal_request);
9794
},
9895

9996
deposit_request: (state, testCase: {deposit_request: electra.DepositRequest}) => {
100-
blockFns.processDepositRequest(ForkSeq.electra, state as CachedBeaconStateElectra, testCase.deposit_request);
97+
const fork = state.config.getForkSeq(state.slot);
98+
blockFns.processDepositRequest(fork, state as CachedBeaconStateElectra, testCase.deposit_request);
10199
},
102100

103101
consolidation_request: (state, testCase: {consolidation_request: electra.ConsolidationRequest}) => {
@@ -140,7 +138,6 @@ const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> = (fork,
140138
block: ssz[fork].BeaconBlock,
141139
body: ssz[fork].BeaconBlockBody,
142140
deposit: ssz.phase0.Deposit,
143-
deposit_receipt: ssz.electra.DepositRequest,
144141
proposer_slashing: ssz.phase0.ProposerSlashing,
145142
voluntary_exit: ssz.phase0.SignedVoluntaryExit,
146143
// Altair

packages/beacon-node/test/unit/chain/shufflingCache.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {describe, it, expect, beforeEach} from "vitest";
22

3-
import {getShufflingDecisionBlock, CachedBeaconStateAllForks} from "@lodestar/state-transition";
3+
import {getShufflingDecisionBlock} from "@lodestar/state-transition";
44
// eslint-disable-next-line import/no-relative-packages
55
import {generateTestCachedBeaconStateOnlyValidators} from "../../../../state-transition/test/perf/util.js";
66
import {ShufflingCache} from "../../../src/chain/shufflingCache.js";
@@ -14,7 +14,7 @@ describe("ShufflingCache", function () {
1414

1515
beforeEach(() => {
1616
shufflingCache = new ShufflingCache(null, {maxShufflingCacheEpochs: 1});
17-
shufflingCache.processState(state as CachedBeaconStateAllForks, currentEpoch);
17+
shufflingCache.processState(state, currentEpoch);
1818
});
1919

2020
it("should get shuffling from cache", async function () {
@@ -29,7 +29,7 @@ describe("ShufflingCache", function () {
2929
shufflingCache.insertPromise(currentEpoch, "0x00");
3030
expect(await shufflingCache.get(currentEpoch, decisionRoot)).toEqual(state.epochCtx.currentShuffling);
3131
// insert shufflings at other epochs does prune the cache
32-
shufflingCache.processState(state as CachedBeaconStateAllForks, currentEpoch + 1);
32+
shufflingCache.processState(state, currentEpoch + 1);
3333
// the current shuffling is not available anymore
3434
expect(await shufflingCache.get(currentEpoch, decisionRoot)).toBeNull();
3535
});
@@ -39,7 +39,7 @@ describe("ShufflingCache", function () {
3939
shufflingCache.insertPromise(currentEpoch + 1, nextDecisionRoot);
4040
const shufflingRequest0 = shufflingCache.get(currentEpoch + 1, nextDecisionRoot);
4141
const shufflingRequest1 = shufflingCache.get(currentEpoch + 1, nextDecisionRoot);
42-
shufflingCache.processState(state as CachedBeaconStateAllForks, currentEpoch + 1);
42+
shufflingCache.processState(state, currentEpoch + 1);
4343
expect(await shufflingRequest0).toEqual(state.epochCtx.nextShuffling);
4444
expect(await shufflingRequest1).toEqual(state.epochCtx.nextShuffling);
4545
});

packages/beacon-node/test/unit/eth1/utils/deposits.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,23 @@ describe("eth1 / util / deposits", function () {
7474
expectedReturnedIndexes: [],
7575
},
7676
{
77-
id: "No deposits to be included post Electra after deposit_receipts_start_index",
77+
id: "No deposits to be included post Electra after deposit_requests_start_index",
7878
depositCount: 2030,
7979
eth1DepositIndex: 2025,
8080
depositIndexes: Array.from({length: 2030}, (_, i) => i),
8181
expectedReturnedIndexes: [],
8282
postElectra: true,
8383
},
8484
{
85-
id: "Should return deposits post Electra before deposit_receipts_start_index",
85+
id: "Should return deposits post Electra before deposit_requests_start_index",
8686
depositCount: 2022,
8787
eth1DepositIndex: 2018,
8888
depositIndexes: Array.from({length: 2022}, (_, i) => i),
8989
expectedReturnedIndexes: [2018, 2019, 2020, 2021],
9090
postElectra: true,
9191
},
9292
{
93-
id: "Should return deposits less than MAX_DEPOSITS post Electra before deposit_receipts_start_index",
93+
id: "Should return deposits less than MAX_DEPOSITS post Electra before deposit_requests_start_index",
9494
depositCount: 10 * MAX_DEPOSITS,
9595
eth1DepositIndex: 0,
9696
depositIndexes: Array.from({length: 10 * MAX_DEPOSITS}, (_, i) => i),

packages/beacon-node/test/unit/util/sszBytes.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe("attestation SSZ serialized picking", () => {
8888
}
8989
});
9090

91-
it("getAggregateionBitsFromAttestationSerialized - invalid data", () => {
91+
it("getAggregationBitsFromAttestationSerialized - invalid data", () => {
9292
const invalidAggregationBitsDataSizes = [0, 4, 100, 128, 227];
9393
for (const size of invalidAggregationBitsDataSizes) {
9494
expect(getAggregationBitsFromAttestationSerialized(ForkName.phase0, Buffer.alloc(size))).toBeNull();

packages/beacon-node/test/utils/validationData/attestation.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
computeSigningRoot,
55
computeStartSlotAtEpoch,
66
getShufflingDecisionBlock,
7-
CachedBeaconStateAllForks,
87
} from "@lodestar/state-transition";
98
import {ProtoBlock, IForkChoice, ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice";
109
import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
@@ -83,8 +82,8 @@ export function getAttestationValidData(opts: AttestationValidDataOpts): {
8382
};
8483

8584
const shufflingCache = new ShufflingCache();
86-
shufflingCache.processState(state as CachedBeaconStateAllForks, state.epochCtx.currentShuffling.epoch);
87-
shufflingCache.processState(state as CachedBeaconStateAllForks, state.epochCtx.nextShuffling.epoch);
85+
shufflingCache.processState(state, state.epochCtx.currentShuffling.epoch);
86+
shufflingCache.processState(state, state.epochCtx.nextShuffling.epoch);
8887
const dependentRoot = getShufflingDecisionBlock(state, state.epochCtx.currentShuffling.epoch);
8988

9089
const forkChoice = {
@@ -134,7 +133,7 @@ export function getAttestationValidData(opts: AttestationValidDataOpts): {
134133
getState: async () => state,
135134
// TODO: remove this once we have a better way to get state
136135
getStateSync: () => state,
137-
} as unknown as Partial<IStateRegenerator> as IStateRegenerator;
136+
} as Partial<IStateRegenerator> as IStateRegenerator;
138137

139138
const chain = {
140139
clock,

0 commit comments

Comments
 (0)