Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/api/src/beacon/routes/beacon/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
deneb,
isSignedBlockContents,
SignedBeaconBlock,
BeaconBlockBody,
SignedBeaconBlockOrContents,
SignedBlindedBeaconBlock,
SignedBlockContents,
sszTypesFor,
BeaconBlockBody,
} from "@lodestar/types";
import {ForkName, ForkPreElectra, ForkPreExecution, isForkBlobs, isForkExecution} from "@lodestar/params";
import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js";
Expand Down
6 changes: 2 additions & 4 deletions packages/api/src/beacon/routes/beacon/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
url: "/eth/v1/beacon/pool/attestations",
method: "POST",
req: {
writeReqJson: ({signedAttestations}) => ({
body: AttestationListTypePhase0.toJson(signedAttestations),
}),
writeReqJson: ({signedAttestations}) => ({body: AttestationListTypePhase0.toJson(signedAttestations)}),
parseReqJson: ({body}) => ({signedAttestations: AttestationListTypePhase0.fromJson(body)}),
writeReqSsz: ({signedAttestations}) => ({body: AttestationListTypePhase0.serialize(signedAttestations)}),
parseReqSsz: ({body}) => ({signedAttestations: AttestationListTypePhase0.deserialize(body)}),
Expand Down Expand Up @@ -414,7 +412,7 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
return {
body: isForkPostElectra(fork)
? ssz.electra.AttesterSlashing.serialize(attesterSlashing as electra.AttesterSlashing)
: ssz.electra.AttesterSlashing.serialize(attesterSlashing as phase0.AttesterSlashing),
: ssz.phase0.AttesterSlashing.serialize(attesterSlashing as phase0.AttesterSlashing),
headers: {[MetaHeader.Version]: fork},
};
},
Expand Down
8 changes: 6 additions & 2 deletions packages/api/src/beacon/routes/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,15 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
writeReqJson: ({signedAggregateAndProofs}) => ({
body: SignedAggregateAndProofListPhase0Type.toJson(signedAggregateAndProofs),
}),
parseReqJson: ({body}) => ({signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.fromJson(body)}),
parseReqJson: ({body}) => ({
signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.fromJson(body),
}),
writeReqSsz: ({signedAggregateAndProofs}) => ({
body: SignedAggregateAndProofListPhase0Type.serialize(signedAggregateAndProofs),
}),
parseReqSsz: ({body}) => ({signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.deserialize(body)}),
parseReqSsz: ({body}) => ({
signedAggregateAndProofs: SignedAggregateAndProofListPhase0Type.deserialize(body),
}),
schema: {
body: Schema.ObjectArray,
},
Expand Down
5 changes: 0 additions & 5 deletions packages/api/test/unit/beacon/oapiSpec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ const ignoredTopics = [
topic block_gossip not implemented
*/
"block_gossip",

// Modified in electra to include version
// should be removed from the ignore list after spec update
"attestation",
"attester_slashing",
];

// eventstream types are defined as comments in the description of "examples".
Expand Down
2 changes: 1 addition & 1 deletion packages/api/test/unit/beacon/testData/beacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const testData: GenericServerTestCases<Endpoints> = {
res: undefined,
},
submitPoolAttesterSlashingsV2: {
args: {attesterSlashing: ssz.electra.AttesterSlashing.defaultValue()},
args: {attesterSlashing: ssz.phase0.AttesterSlashing.defaultValue()},
res: undefined,
},
submitPoolProposerSlashings: {
Expand Down
14 changes: 10 additions & 4 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {routes} from "@lodestar/api";
import {ApplicationMethods} from "@lodestar/api/server";
import {ApiError, ApplicationMethods} from "@lodestar/api/server";
import {
computeEpochAtSlot,
computeTimeAtSlot,
reconstructFullBlockOrContents,
signedBeaconBlockToBlinded,
} from "@lodestar/state-transition";
import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution} from "@lodestar/params";
import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution, isForkPostElectra} from "@lodestar/params";
import {sleep, fromHex, toHex} from "@lodestar/utils";
import {
deneb,
Expand Down Expand Up @@ -407,16 +407,22 @@ export function getBeaconBlockApi({

async getBlockAttestations({blockId}) {
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
const fork = config.getForkName(block.message.slot);

if (isForkPostElectra(fork)) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to apply similar logic to other apis that only support phase0 once #6998 is merged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After Electra is live, we should probably hardcode every deprecated attestation V1 endpoints to throw deprecation error ie. get rid of this if (isForkPostElectra(fork)) statement

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can just statically throw an error and refer to v2 apis similar to this error. After electra is live we can also hard-code everywhere to use v2 apis only on the validator client side as all beacon node must have implemented them at this point, otherwise they can't handle electra attestations.

throw new ApiError(400, `Use getBlockAttestationsV2 to retrieve electra+ block attestations fork=${fork}`);
}

return {
data: Array.from(block.message.body.attestations),
data: block.message.body.attestations,
meta: {executionOptimistic, finalized},
};
},

async getBlockAttestationsV2({blockId}) {
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
return {
data: Array.from(block.message.body.attestations),
data: block.message.body.attestations,
meta: {executionOptimistic, finalized, version: config.getForkName(block.message.slot)},
};
},
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/api/impl/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {

/**
* Hand-picked list of constants declared in consensus-spec .md files.
* This list is asserted to be up-to-date with the test `test/e2e/api/specConstants.test.ts`
* This list is asserted to be up-to-date with the test `test/e2e/api/impl/config.test.ts`
*/
export const specConstants = {
// phase0/beacon-chain.md
Expand Down
5 changes: 3 additions & 2 deletions packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
ForkPreBlobs,
ForkBlobs,
ForkExecution,
isForkPostElectra,
} from "@lodestar/params";
import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator";
import {
Expand Down Expand Up @@ -814,7 +815,7 @@ export function getValidatorApi(
const attEpoch = computeEpochAtSlot(slot);
const headBlockRootHex = chain.forkChoice.getHead().blockRoot;
const headBlockRoot = fromHex(headBlockRootHex);
const fork = config.getForkSeq(slot);
const fork = config.getForkName(slot);

const beaconBlockRoot =
slot >= headSlot
Expand Down Expand Up @@ -846,7 +847,7 @@ export function getValidatorApi(
return {
data: {
slot,
index: fork >= ForkSeq.electra ? 0 : committeeIndex,
index: isForkPostElectra(fork) ? 0 : committeeIndex,
beaconBlockRoot,
source: attEpochState.currentJustifiedCheckpoint,
target: {epoch: attEpoch, root: targetRoot},
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/errors/attestationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export enum AttestationErrorCode {
/** Too many skipped slots. */
TOO_MANY_SKIPPED_SLOTS = "ATTESTATION_ERROR_TOO_MANY_SKIPPED_SLOTS",
/**
* Electra: The aggregated attestation doesn't have only one committee bit set.
* Electra: The aggregated attestation does not have exactly one committee bit set.
*/
NOT_EXACTLY_ONE_COMMITTEE_BIT_SET = "ATTESTATION_ERROR_NOT_EXACTLY_ONE_COMMITTEE_BIT_SET",
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/eth1/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface IEth1ForBlockProduction {
startPollingMergeBlock(): void;

/**
* Should stop polling eth1Data after a Electra block is finalized AND deposit_receipts_start_index is reached
* Should stop polling eth1Data after a Electra block is finalized AND deposit_requests_start_index is reached
*/
stopPollingEth1Data(): void;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/gossip/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function getGossipSSZType(topic: GossipTopic) {
case GossipType.proposer_slashing:
return ssz.phase0.ProposerSlashing;
case GossipType.attester_slashing:
return ssz.phase0.AttesterSlashing;
return sszTypesFor(topic.fork).AttesterSlashing;
case GossipType.voluntary_exit:
return ssz.phase0.SignedVoluntaryExit;
case GossipType.sync_committee_contribution_and_proof:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe(`getAttestationsForBlock vc=${vc}`, () => {
before(function () {
this.timeout(5 * 60 * 1000); // Generating the states for the first time is very slow

originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true, vc}) as CachedBeaconStateAltair;
originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true, vc});

const {blockHeader, checkpoint} = computeAnchorCheckpoint(originalState.config, originalState);
// TODO figure out why getBlockRootAtSlot(originalState, justifiedSlot) is not the same to justifiedCheckpoint.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("opPool", () => {
before(function () {
this.timeout(2 * 60 * 1000); // Generating the states for the first time is very slow

originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true}) as CachedBeaconStateAltair;
originalState = generatePerfTestCachedStateAltair({goBackOneSlot: true});
});

itBench({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("produceBlockBody", () => {

before(async () => {
db = new BeaconDb(config, await LevelDbController.create({name: ".tmpdb"}, {logger}));
state = stateOg.clone() as CachedBeaconStateAltair;
state = stateOg.clone();
chain = new BeaconChain(
{
proposerBoost: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ echo "12345678" > $DATA_DIR/password.txt
pubKey="0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"

# echo a hex encoded 256 bit secret into a file
echo $JWT_SECRET_HEX> $DATA_DIR/jwtsecret
echo $JWT_SECRET_HEX> $DATA_DIR/jwtsecret
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ currentDir=$(pwd)

. $scriptDir/common-setup.sh

$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
$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
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ currentDir=$(pwd)

. $scriptDir/common-setup.sh

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
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
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@
"gasUsed":"0x0",
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas":"0x7"
}
}
2 changes: 1 addition & 1 deletion packages/beacon-node/test/sim/electra-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe("executionEngine / ExecutionEngineHttp", function () {

/**
* Want to test two things:
* 1) Send two raw deposit transactions, and see if two new validators with corrent balances show up in the state.validators and unfinalized cache
* 1) Send two raw deposit transactions, and see if two new validators with correct balances show up in the state.validators and unfinalized cache
* 2) Upon state-transition, see if the two new validators move from unfinalized cache to finalized cache
*/
async function runNodeWithEL({
Expand Down
4 changes: 1 addition & 3 deletions packages/beacon-node/test/spec/presets/genesis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ const genesisInitialization: TestRunnerFn<GenesisInitSpecTest, BeaconStateAllFor
deposits,
undefined,
testcase["execution_payload_header"] &&
executionPayloadHeaderType.toViewDU(
testcase["execution_payload_header"] as ExecutionPayloadHeader<ForkName.electra>
)
executionPayloadHeaderType.toViewDU(testcase["execution_payload_header"])
);
},
// eth1.yaml
Expand Down
17 changes: 7 additions & 10 deletions packages/beacon-node/test/spec/presets/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import * as blockFns from "@lodestar/state-transition/block";
import {ssz, phase0, altair, bellatrix, capella, electra, sszTypesFor} from "@lodestar/types";
import {InputType} from "@lodestar/spec-test-util";
import {ACTIVE_PRESET, ForkName, ForkSeq} from "@lodestar/params";
import {ACTIVE_PRESET, ForkName} from "@lodestar/params";

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

deposit_receipt: (state, testCase: {deposit_receipt: electra.DepositRequest}) => {
const fork = state.config.getForkSeq(state.slot);
blockFns.processDepositRequest(fork, state as CachedBeaconStateElectra, testCase.deposit_receipt);
},

proposer_slashing: (state, testCase: {proposer_slashing: phase0.ProposerSlashing}) => {
const fork = state.config.getForkSeq(state.slot);
blockFns.processProposerSlashing(fork, state, testCase.proposer_slashing);
Expand Down Expand Up @@ -89,15 +84,18 @@ const operationFns: Record<string, BlockProcessFn<CachedBeaconStateAllForks>> =
},

withdrawals: (state, testCase: {execution_payload: capella.ExecutionPayload}) => {
blockFns.processWithdrawals(ForkSeq.capella, state as CachedBeaconStateCapella, testCase.execution_payload);
const fork = state.config.getForkSeq(state.slot);
blockFns.processWithdrawals(fork, state as CachedBeaconStateCapella, testCase.execution_payload);
},

withdrawal_request: (state, testCase: {withdrawal_request: electra.WithdrawalRequest}) => {
blockFns.processWithdrawalRequest(ForkSeq.electra, state as CachedBeaconStateElectra, testCase.withdrawal_request);
const fork = state.config.getForkSeq(state.slot);
blockFns.processWithdrawalRequest(fork, state as CachedBeaconStateElectra, testCase.withdrawal_request);
},

deposit_request: (state, testCase: {deposit_request: electra.DepositRequest}) => {
blockFns.processDepositRequest(ForkSeq.electra, state as CachedBeaconStateElectra, testCase.deposit_request);
const fork = state.config.getForkSeq(state.slot);
blockFns.processDepositRequest(fork, state as CachedBeaconStateElectra, testCase.deposit_request);
},

consolidation_request: (state, testCase: {consolidation_request: electra.ConsolidationRequest}) => {
Expand Down Expand Up @@ -140,7 +138,6 @@ const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> = (fork,
block: ssz[fork].BeaconBlock,
body: ssz[fork].BeaconBlockBody,
deposit: ssz.phase0.Deposit,
deposit_receipt: ssz.electra.DepositRequest,
proposer_slashing: ssz.phase0.ProposerSlashing,
voluntary_exit: ssz.phase0.SignedVoluntaryExit,
// Altair
Expand Down
8 changes: 4 additions & 4 deletions packages/beacon-node/test/unit/chain/shufflingCache.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {describe, it, expect, beforeEach} from "vitest";

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

beforeEach(() => {
shufflingCache = new ShufflingCache(null, {maxShufflingCacheEpochs: 1});
shufflingCache.processState(state as CachedBeaconStateAllForks, currentEpoch);
shufflingCache.processState(state, currentEpoch);
});

it("should get shuffling from cache", async function () {
Expand All @@ -29,7 +29,7 @@ describe("ShufflingCache", function () {
shufflingCache.insertPromise(currentEpoch, "0x00");
expect(await shufflingCache.get(currentEpoch, decisionRoot)).toEqual(state.epochCtx.currentShuffling);
// insert shufflings at other epochs does prune the cache
shufflingCache.processState(state as CachedBeaconStateAllForks, currentEpoch + 1);
shufflingCache.processState(state, currentEpoch + 1);
// the current shuffling is not available anymore
expect(await shufflingCache.get(currentEpoch, decisionRoot)).toBeNull();
});
Expand All @@ -39,7 +39,7 @@ describe("ShufflingCache", function () {
shufflingCache.insertPromise(currentEpoch + 1, nextDecisionRoot);
const shufflingRequest0 = shufflingCache.get(currentEpoch + 1, nextDecisionRoot);
const shufflingRequest1 = shufflingCache.get(currentEpoch + 1, nextDecisionRoot);
shufflingCache.processState(state as CachedBeaconStateAllForks, currentEpoch + 1);
shufflingCache.processState(state, currentEpoch + 1);
expect(await shufflingRequest0).toEqual(state.epochCtx.nextShuffling);
expect(await shufflingRequest1).toEqual(state.epochCtx.nextShuffling);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/beacon-node/test/unit/eth1/utils/deposits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,23 @@ describe("eth1 / util / deposits", function () {
expectedReturnedIndexes: [],
},
{
id: "No deposits to be included post Electra after deposit_receipts_start_index",
id: "No deposits to be included post Electra after deposit_requests_start_index",
depositCount: 2030,
eth1DepositIndex: 2025,
depositIndexes: Array.from({length: 2030}, (_, i) => i),
expectedReturnedIndexes: [],
postElectra: true,
},
{
id: "Should return deposits post Electra before deposit_receipts_start_index",
id: "Should return deposits post Electra before deposit_requests_start_index",
depositCount: 2022,
eth1DepositIndex: 2018,
depositIndexes: Array.from({length: 2022}, (_, i) => i),
expectedReturnedIndexes: [2018, 2019, 2020, 2021],
postElectra: true,
},
{
id: "Should return deposits less than MAX_DEPOSITS post Electra before deposit_receipts_start_index",
id: "Should return deposits less than MAX_DEPOSITS post Electra before deposit_requests_start_index",
depositCount: 10 * MAX_DEPOSITS,
eth1DepositIndex: 0,
depositIndexes: Array.from({length: 10 * MAX_DEPOSITS}, (_, i) => i),
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/test/unit/util/sszBytes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe("attestation SSZ serialized picking", () => {
}
});

it("getAggregateionBitsFromAttestationSerialized - invalid data", () => {
it("getAggregationBitsFromAttestationSerialized - invalid data", () => {
const invalidAggregationBitsDataSizes = [0, 4, 100, 128, 227];
for (const size of invalidAggregationBitsDataSizes) {
expect(getAggregationBitsFromAttestationSerialized(ForkName.phase0, Buffer.alloc(size))).toBeNull();
Expand Down
7 changes: 3 additions & 4 deletions packages/beacon-node/test/utils/validationData/attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
computeSigningRoot,
computeStartSlotAtEpoch,
getShufflingDecisionBlock,
CachedBeaconStateAllForks,
} from "@lodestar/state-transition";
import {ProtoBlock, IForkChoice, ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice";
import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
Expand Down Expand Up @@ -83,8 +82,8 @@ export function getAttestationValidData(opts: AttestationValidDataOpts): {
};

const shufflingCache = new ShufflingCache();
shufflingCache.processState(state as CachedBeaconStateAllForks, state.epochCtx.currentShuffling.epoch);
shufflingCache.processState(state as CachedBeaconStateAllForks, state.epochCtx.nextShuffling.epoch);
shufflingCache.processState(state, state.epochCtx.currentShuffling.epoch);
shufflingCache.processState(state, state.epochCtx.nextShuffling.epoch);
const dependentRoot = getShufflingDecisionBlock(state, state.epochCtx.currentShuffling.epoch);

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

const chain = {
clock,
Expand Down
Loading