Skip to content

Commit

Permalink
test: fix ssz_static spec tests for all forks (#6771)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored and g11tech committed Jul 30, 2024
1 parent f90648c commit c39f72a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions packages/beacon-node/test/spec/presets/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> = (fork,
sszTypes: {
pre: ssz[fork].BeaconState,
post: ssz[fork].BeaconState,
attestation: fork === ForkName.electra ? ssz.electra.Attestation : ssz.phase0.Attestation,
attester_slashing: fork === ForkName.electra ? ssz.electra.AttesterSlashing : ssz.phase0.AttesterSlashing,
attestation: ssz.allForks[fork].Attestation,
attester_slashing: ssz.allForks[fork].AttesterSlashing,
block: ssz[fork].BeaconBlock,
body: ssz[fork].BeaconBlockBody,
deposit: ssz.phase0.Deposit,
deposit_receipt: ssz.electra.DepositRequest,
deposit_receipt: ssz.electra.DepositReceipt,
proposer_slashing: ssz.phase0.ProposerSlashing,
voluntary_exit: ssz.phase0.SignedVoluntaryExit,
// Altair
Expand All @@ -155,6 +155,7 @@ const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> = (fork,
: ssz.bellatrix.ExecutionPayload,
// Capella
address_change: ssz.capella.SignedBLSToExecutionChange,
// Electra
consolidation: ssz.electra.SignedConsolidation,
execution_layer_withdrawal_request: ssz.electra.ExecutionLayerWithdrawalRequest,
},
Expand Down
5 changes: 5 additions & 0 deletions packages/beacon-node/test/spec/presets/ssz_static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import fs from "node:fs";
import path from "node:path";
import {it, vi} from "vitest";
import {Type} from "@chainsafe/ssz";
<<<<<<< HEAD
import {ssz, sszTypesFor} from "@lodestar/types";
import {ACTIVE_PRESET, ForkName} from "@lodestar/params";
=======
import {ssz} from "@lodestar/types";
import {ACTIVE_PRESET, ForkName, ForkLightClient, ForkExecution} from "@lodestar/params";
>>>>>>> 82d0692d63d (test: fix ssz_static spec tests for all forks (#6771))
import {replaceUintTypeWithUintBigintType} from "../utils/replaceUintTypeWithUintBigintType.js";
import {parseSszStaticTestcase} from "../utils/sszTestCaseParser.js";
import {runValidSszTest} from "../utils/runValidSszTest.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,4 @@ export const FULL_EXIT_REQUEST_AMOUNT = 0;
export const NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA = 87;
export const NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA = 6;
export const FINALIZED_ROOT_DEPTH_ELECTRA = 7;
export const FINALIZED_ROOT_INDEX_ELECTRA = 169;
export const FINALIZED_ROOT_INDEX_ELECTRA = 169;
11 changes: 4 additions & 7 deletions packages/types/src/electra/sszTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,7 @@ export const PendingBalanceDeposit = new ContainerType(
{typeName: "PendingBalanceDeposit", jsonCase: "eth2"}
);

export const PendingBalanceDeposits = new ListCompositeType(
PendingBalanceDeposit,
Number(PENDING_BALANCE_DEPOSITS_LIMIT)
);
export const PendingBalanceDeposits = new ListCompositeType(PendingBalanceDeposit, PENDING_BALANCE_DEPOSITS_LIMIT);

export const PendingPartialWithdrawal = new ContainerType(
{
Expand Down Expand Up @@ -348,9 +345,9 @@ export const BeaconState = new ContainerType(
earliestExitEpoch: Epoch, // New in Electra:EIP7251
consolidationBalanceToConsume: Gwei, // New in Electra:EIP7251
earliestConsolidationEpoch: Epoch, // New in Electra:EIP7251
pendingBalanceDeposits: PendingBalanceDeposits, // new in electra:eip7251
pendingPartialWithdrawals: new ListCompositeType(PendingPartialWithdrawal, Number(PENDING_PARTIAL_WITHDRAWALS_LIMIT)), // New in Electra:EIP7251
pendingConsolidations: new ListCompositeType(PendingConsolidation, Number(PENDING_CONSOLIDATIONS_LIMIT)), // new in electra:eip7251
pendingBalanceDeposits: PendingBalanceDeposits, // New in Electra:EIP7251
pendingPartialWithdrawals: new ListCompositeType(PendingPartialWithdrawal, PENDING_PARTIAL_WITHDRAWALS_LIMIT), // New in Electra:EIP7251
pendingConsolidations: new ListCompositeType(PendingConsolidation, PENDING_CONSOLIDATIONS_LIMIT), // New in Electra:EIP7251
},
{typeName: "BeaconState", jsonCase: "eth2"}
);
Expand Down

0 comments on commit c39f72a

Please sign in to comment.