Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support missing electra spec test #6765

Merged
merged 1 commit into from
May 14, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const epochTransitionFns: Record<string, EpochTransitionFn> = {
slashings_reset: epochFns.processSlashingsReset,
sync_committee_updates: epochFns.processSyncCommitteeUpdates as EpochTransitionFn,
historical_summaries_update: epochFns.processHistoricalSummariesUpdate as EpochTransitionFn,
pending_balance_deposits: epochFns.processPendingBalanceDeposits as EpochTransitionFn,
pending_consolidations: epochFns.processPendingConsolidations as EpochTransitionFn,
};

/**
Expand Down
17 changes: 17 additions & 0 deletions packages/beacon-node/test/spec/presets/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ const operationFns: Record<string, BlockProcessFn<CachedBeaconStateAllForks>> =
withdrawals: (state, testCase: {execution_payload: capella.ExecutionPayload}) => {
blockFns.processWithdrawals(ForkSeq.capella, state as CachedBeaconStateCapella, testCase.execution_payload);
},

consolidation: (state, testCase: {consolidation: electra.SignedConsolidation}) => {
blockFns.processConsolidation(state as CachedBeaconStateElectra, testCase.consolidation);
},

execution_layer_withdrawal_request: (
state,
testCase: {execution_layer_withdrawal_request: electra.ExecutionLayerWithdrawalRequest}
) => {
blockFns.processExecutionLayerWithdrawalRequest(
ForkSeq.electra,
state as CachedBeaconStateElectra,
testCase.execution_layer_withdrawal_request
);
},
};

export type BlockProcessFn<T extends CachedBeaconStateAllForks> = (state: T, testCase: any) => void;
Expand Down Expand Up @@ -140,6 +155,8 @@ const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> = (fork,
: ssz.bellatrix.ExecutionPayload,
// Capella
address_change: ssz.capella.SignedBLSToExecutionChange,
consolidation: ssz.electra.SignedConsolidation,
execution_layer_withdrawal_request: ssz.electra.ExecutionLayerWithdrawalRequest,
},
shouldError: (testCase) => testCase.post === undefined,
getExpected: (testCase) => testCase.post,
Expand Down
1 change: 1 addition & 0 deletions packages/state-transition/src/block/processOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export {
processExecutionLayerWithdrawalRequest,
processBlsToExecutionChange,
processDepositRequest,
processConsolidation,
};

export function processOperations(
Expand Down
Loading