diff --git a/packages/beacon-node/src/execution/engine/types.ts b/packages/beacon-node/src/execution/engine/types.ts index 14ec66bdcca6..3f7254f12976 100644 --- a/packages/beacon-node/src/execution/engine/types.ts +++ b/packages/beacon-node/src/execution/engine/types.ts @@ -129,8 +129,8 @@ export type ExecutionPayloadRpc = { blockHash: DATA; // 32 bytes transactions: DATA[]; withdrawals?: WithdrawalRpc[]; // Capella hardfork - dataGasUsed?: QUANTITY; // DENEB - excessDataGas?: QUANTITY; // DENEB + blobGasUsed?: QUANTITY; // DENEB + excessBlobGas?: QUANTITY; // DENEB parentBeaconBlockRoot?: QUANTITY; // DENEB }; @@ -185,11 +185,11 @@ export function serializeExecutionPayload(fork: ForkName, data: allForks.Executi payload.withdrawals = withdrawals.map(serializeWithdrawal); } - // DENEB adds dataGasUsed & excessDataGas to the ExecutionPayload + // DENEB adds blobGasUsed & excessBlobGas to the ExecutionPayload if (ForkSeq[fork] >= ForkSeq.deneb) { - const {dataGasUsed, excessDataGas} = data as deneb.ExecutionPayload; - payload.dataGasUsed = numToQuantity(dataGasUsed); - payload.excessDataGas = numToQuantity(excessDataGas); + const {blobGasUsed, excessBlobGas} = data as deneb.ExecutionPayload; + payload.blobGasUsed = numToQuantity(blobGasUsed); + payload.excessBlobGas = numToQuantity(excessBlobGas); } return payload; @@ -249,23 +249,23 @@ export function parseExecutionPayload( (executionPayload as capella.ExecutionPayload).withdrawals = withdrawals.map((w) => deserializeWithdrawal(w)); } - // DENEB adds excessDataGas to the ExecutionPayload + // DENEB adds excessBlobGas to the ExecutionPayload if (ForkSeq[fork] >= ForkSeq.deneb) { - const {dataGasUsed, excessDataGas} = data; + const {blobGasUsed, excessBlobGas} = data; - if (dataGasUsed == null) { + if (blobGasUsed == null) { throw Error( - `dataGasUsed missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}` + `blobGasUsed missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}` ); } - if (excessDataGas == null) { + if (excessBlobGas == null) { throw Error( - `excessDataGas missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}` + `excessBlobGas missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}` ); } - (executionPayload as deneb.ExecutionPayload).dataGasUsed = quantityToBigint(dataGasUsed); - (executionPayload as deneb.ExecutionPayload).excessDataGas = quantityToBigint(excessDataGas); + (executionPayload as deneb.ExecutionPayload).blobGasUsed = quantityToBigint(blobGasUsed); + (executionPayload as deneb.ExecutionPayload).excessBlobGas = quantityToBigint(excessBlobGas); } return {executionPayload, blockValue, blobsBundle}; diff --git a/packages/light-client/src/spec/utils.ts b/packages/light-client/src/spec/utils.ts index 8f74b94568d9..0ff1775f55c1 100644 --- a/packages/light-client/src/spec/utils.ts +++ b/packages/light-client/src/spec/utils.ts @@ -98,10 +98,10 @@ export function upgradeLightClientHeader( // eslint-disable-next-line no-fallthrough case ForkName.deneb: - (upgradedHeader as deneb.LightClientHeader).execution.dataGasUsed = - ssz.deneb.LightClientHeader.fields.execution.fields.dataGasUsed.defaultValue(); - (upgradedHeader as deneb.LightClientHeader).execution.excessDataGas = - ssz.deneb.LightClientHeader.fields.execution.fields.excessDataGas.defaultValue(); + (upgradedHeader as deneb.LightClientHeader).execution.blobGasUsed = + ssz.deneb.LightClientHeader.fields.execution.fields.blobGasUsed.defaultValue(); + (upgradedHeader as deneb.LightClientHeader).execution.excessBlobGas = + ssz.deneb.LightClientHeader.fields.execution.fields.excessBlobGas.defaultValue(); // Break if no further upgradation is required else fall through if (ForkSeq[targetFork] <= ForkSeq.deneb) break; @@ -129,10 +129,10 @@ export function isValidLightClientHeader(config: ChainForkConfig, header: allFor if (epoch < config.DENEB_FORK_EPOCH) { if ( - ((header as deneb.LightClientHeader).execution.dataGasUsed && - (header as deneb.LightClientHeader).execution.dataGasUsed !== BigInt(0)) || - ((header as deneb.LightClientHeader).execution.excessDataGas && - (header as deneb.LightClientHeader).execution.excessDataGas !== BigInt(0)) + ((header as deneb.LightClientHeader).execution.blobGasUsed && + (header as deneb.LightClientHeader).execution.blobGasUsed !== BigInt(0)) || + ((header as deneb.LightClientHeader).execution.excessBlobGas && + (header as deneb.LightClientHeader).execution.excessBlobGas !== BigInt(0)) ) { return false; } diff --git a/packages/light-client/test/unit/isValidLightClientHeader.test.ts b/packages/light-client/test/unit/isValidLightClientHeader.test.ts index 72836fb3169b..a28ac65ff618 100644 --- a/packages/light-client/test/unit/isValidLightClientHeader.test.ts +++ b/packages/light-client/test/unit/isValidLightClientHeader.test.ts @@ -76,7 +76,7 @@ describe("isValidLightClientHeader", function () { const capellaUpgradedDenebHeader = { beacon: capellaLCHeader.beacon, - execution: {...capellaLCHeader.execution, dataGasUsed: 0, excessDataGas: 0}, + execution: {...capellaLCHeader.execution, blobGasUsed: 0, excessBlobGas: 0}, executionBranch: capellaLCHeader.executionBranch, }; diff --git a/packages/state-transition/src/block/processExecutionPayload.ts b/packages/state-transition/src/block/processExecutionPayload.ts index 56b304cbfc90..4965c21397b4 100644 --- a/packages/state-transition/src/block/processExecutionPayload.ts +++ b/packages/state-transition/src/block/processExecutionPayload.ts @@ -109,12 +109,12 @@ export function executionPayloadToPayloadHeader( if (fork >= ForkSeq.deneb) { // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/beacon-chain.md#process_execution_payload - (bellatrixPayloadFields as deneb.ExecutionPayloadHeader).dataGasUsed = ( + (bellatrixPayloadFields as deneb.ExecutionPayloadHeader).blobGasUsed = ( payload as deneb.ExecutionPayloadHeader | deneb.ExecutionPayload - ).dataGasUsed; - (bellatrixPayloadFields as deneb.ExecutionPayloadHeader).excessDataGas = ( + ).blobGasUsed; + (bellatrixPayloadFields as deneb.ExecutionPayloadHeader).excessBlobGas = ( payload as deneb.ExecutionPayloadHeader | deneb.ExecutionPayload - ).excessDataGas; + ).excessBlobGas; } return bellatrixPayloadFields; diff --git a/packages/state-transition/src/slot/upgradeStateToDeneb.ts b/packages/state-transition/src/slot/upgradeStateToDeneb.ts index c6c0c867060f..53be75f72ad8 100644 --- a/packages/state-transition/src/slot/upgradeStateToDeneb.ts +++ b/packages/state-transition/src/slot/upgradeStateToDeneb.ts @@ -20,7 +20,7 @@ export function upgradeStateToDeneb(stateCapella: CachedBeaconStateCapella): Cac epoch: stateCapella.epochCtx.epoch, }); - // Since excessDataGas and dataGasUsed are appened in the end to latestExecutionPayloadHeader so they should + // Since excessBlobGas and blobGasUsed are appened in the end to latestExecutionPayloadHeader so they should // be set to defaults and need no assigning, but right now any access to latestExecutionPayloadHeader fails // with LeafNode has no left node. Weirdly its beacuse of addition of the second field as with one field // it seems to work. @@ -28,8 +28,8 @@ export function upgradeStateToDeneb(stateCapella: CachedBeaconStateCapella): Cac // TODO DENEB: Debug and remove the following cloning stateDeneb.latestExecutionPayloadHeader = ssz.deneb.BeaconState.fields.latestExecutionPayloadHeader.toViewDU({ ...stateCapella.latestExecutionPayloadHeader.toValue(), - excessDataGas: BigInt(0), - dataGasUsed: BigInt(0), + excessBlobGas: BigInt(0), + blobGasUsed: BigInt(0), }); stateDeneb.commit(); diff --git a/packages/types/src/deneb/sszTypes.ts b/packages/types/src/deneb/sszTypes.ts index eb04bb1e7a38..2ba06346708b 100644 --- a/packages/types/src/deneb/sszTypes.ts +++ b/packages/types/src/deneb/sszTypes.ts @@ -125,8 +125,8 @@ export const BeaconBlockAndBlobsSidecarByRootRequest = new ListCompositeType(Roo export const ExecutionPayload = new ContainerType( { ...capellaSsz.ExecutionPayload.fields, - dataGasUsed: UintBn64, // New in DENEB - excessDataGas: UintBn64, // New in DENEB + blobGasUsed: UintBn64, // New in DENEB + excessBlobGas: UintBn64, // New in DENEB }, {typeName: "ExecutionPayload", jsonCase: "eth2"} ); @@ -134,8 +134,8 @@ export const ExecutionPayload = new ContainerType( export const ExecutionPayloadHeader = new ContainerType( { ...capellaSsz.ExecutionPayloadHeader.fields, - dataGasUsed: UintBn64, // New in DENEB - excessDataGas: UintBn64, // New in DENEB + blobGasUsed: UintBn64, // New in DENEB + excessBlobGas: UintBn64, // New in DENEB }, {typeName: "ExecutionPayloadHeader", jsonCase: "eth2"} );