Skip to content

Commit a7d26dc

Browse files
committed
fix: update withdrawal request container to match consensus spec
1 parent 68ded3d commit a7d26dc

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

packages/beacon-node/src/execution/engine/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ export function serializeExecutionLayerWithdrawalRequest(
419419
): ExecutionLayerWithdrawalRequestRpc {
420420
return {
421421
sourceAddress: bytesToData(withdrawalRequest.sourceAddress),
422-
validatorPublicKey: bytesToData(withdrawalRequest.validatorPublicKey),
422+
validatorPublicKey: bytesToData(withdrawalRequest.validatorPubkey),
423423
amount: numToQuantity(withdrawalRequest.amount),
424424
};
425425
}
@@ -429,7 +429,7 @@ export function deserializeExecutionLayerWithdrawalRequest(
429429
): electra.ExecutionLayerWithdrawalRequest {
430430
return {
431431
sourceAddress: dataToBytes(withdrawalRequest.sourceAddress, 20),
432-
validatorPublicKey: dataToBytes(withdrawalRequest.validatorPublicKey, 48),
432+
validatorPubkey: dataToBytes(withdrawalRequest.validatorPublicKey, 48),
433433
amount: quantityToNum(withdrawalRequest.amount),
434434
};
435435
}

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

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "node:fs";
22
import path from "node:path";
3-
import {expect, it, vi} from "vitest";
3+
import {it, vi} from "vitest";
44
import {Type} from "@chainsafe/ssz";
55
import {ssz} from "@lodestar/types";
66
import {ACTIVE_PRESET, ForkName, ForkLightClient, ForkExecution} from "@lodestar/params";
@@ -58,24 +58,22 @@ const sszStatic =
5858
(ssz.phase0 as Types)[typeName];
5959

6060
if (!sszType) {
61-
expect.fail(
62-
`Missing SSZ type definition for ${typeName}; this will prevent associated ssz_static tests to be executed`
63-
);
64-
} else {
65-
const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);
61+
throw Error(`Missing SSZ type ${typeName} for fork ${fork}`);
62+
}
63+
64+
const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);
6665

67-
for (const testCase of fs.readdirSync(testSuiteDirpath)) {
68-
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
69-
it(testCase, function () {
70-
// Mainnet must deal with big full states and hash each one multiple times
71-
if (ACTIVE_PRESET === "mainnet") {
72-
vi.setConfig({testTimeout: 30 * 1000});
73-
}
66+
for (const testCase of fs.readdirSync(testSuiteDirpath)) {
67+
// Do not manually skip tests here, do it in packages/beacon-node/test/spec/presets/index.test.ts
68+
it(testCase, function () {
69+
// Mainnet must deal with big full states and hash each one multiple times
70+
if (ACTIVE_PRESET === "mainnet") {
71+
vi.setConfig({testTimeout: 30 * 1000});
72+
}
7473

75-
const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase));
76-
runValidSszTest(sszTypeNoUint, testData);
77-
});
78-
}
74+
const testData = parseSszStaticTestcase(path.join(testSuiteDirpath, testCase));
75+
runValidSszTest(sszTypeNoUint, testData);
76+
});
7977
}
8078
};
8179

packages/state-transition/src/block/processExecutionLayerWithdrawalRequest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function processExecutionLayerWithdrawalRequest(
3232

3333
// bail out if validator is not in beacon state
3434
// note that we don't need to check for 6110 unfinalized vals as they won't be eligible for withdraw/exit anyway
35-
const validatorIndex = pubkey2index.get(executionLayerWithdrawalRequest.validatorPublicKey);
35+
const validatorIndex = pubkey2index.get(executionLayerWithdrawalRequest.validatorPubkey);
3636
if (validatorIndex === undefined) {
3737
return;
3838
}

packages/types/src/electra/sszTypes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const DepositReceipts = new ListCompositeType(DepositReceipt, MAX_DEPOSIT
128128
export const ExecutionLayerWithdrawalRequest = new ContainerType(
129129
{
130130
sourceAddress: ExecutionAddress,
131-
validatorPublicKey: BLSPubkey,
131+
validatorPubkey: BLSPubkey,
132132
amount: UintNum64,
133133
},
134134
{typeName: "ExecutionLayerWithdrawalRequest", jsonCase: "eth2"}

0 commit comments

Comments
 (0)