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

fix: handle dataGasUsed in engine for deneb payload #5629

Merged
merged 1 commit into from
Jun 13, 2023
Merged
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
22 changes: 17 additions & 5 deletions packages/beacon-node/src/execution/engine/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export type ExecutionPayloadRpc = {
blockHash: DATA; // 32 bytes
transactions: DATA[];
withdrawals?: WithdrawalRpc[]; // Capella hardfork
dataGasUsed?: QUANTITY; // DENEB
excessDataGas?: QUANTITY; // DENEB
};

Expand Down Expand Up @@ -187,9 +188,11 @@ export function serializeExecutionPayload(fork: ForkName, data: allForks.Executi
payload.withdrawals = withdrawals.map(serializeWithdrawal);
}

// DENEB adds excessDataGas to the ExecutionPayload
if ((data as deneb.ExecutionPayload).excessDataGas !== undefined) {
payload.excessDataGas = numToQuantity((data as deneb.ExecutionPayload).excessDataGas);
// DENEB adds dataGasUsed & excessDataGas to the ExecutionPayload
if (ForkSeq[fork] >= ForkSeq.deneb) {
const {dataGasUsed, excessDataGas} = data as deneb.ExecutionPayload;
payload.dataGasUsed = numToQuantity(dataGasUsed);
payload.excessDataGas = numToQuantity(excessDataGas);
}

return payload;
Expand Down Expand Up @@ -251,12 +254,21 @@ export function parseExecutionPayload(

// DENEB adds excessDataGas to the ExecutionPayload
if (ForkSeq[fork] >= ForkSeq.deneb) {
if (data.excessDataGas == null) {
const {dataGasUsed, excessDataGas} = data;

if (dataGasUsed == null) {
throw Error(
`dataGasUsed missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
);
}
if (excessDataGas == null) {
throw Error(
`excessDataGas missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
);
}
(executionPayload as deneb.ExecutionPayload).excessDataGas = quantityToBigint(data.excessDataGas);

(executionPayload as deneb.ExecutionPayload).dataGasUsed = quantityToBigint(dataGasUsed);
(executionPayload as deneb.ExecutionPayload).excessDataGas = quantityToBigint(excessDataGas);
}

return {executionPayload, blockValue, blobsBundle};
Expand Down