diff --git a/packages/api/test/unit/builder/builder.test.ts b/packages/api/test/unit/builder/builder.test.ts index 9fddd34567ad..8a4766e64f00 100644 --- a/packages/api/test/unit/builder/builder.test.ts +++ b/packages/api/test/unit/builder/builder.test.ts @@ -12,7 +12,7 @@ describe("builder", () => { /* eslint-disable @typescript-eslint/naming-convention */ ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, - EIP4844_FORK_EPOCH: 0, + DENEB_FORK_EPOCH: 0, }), getClient, getRoutes, diff --git a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts index 2691b3e82204..41442c6b0064 100644 --- a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts +++ b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts @@ -41,7 +41,7 @@ export async function archiveBlocks( const finalizedNonCanonicalBlocks = forkChoice.getAllNonAncestorBlocks(finalizedCheckpoint.rootHex); // NOTE: The finalized block will be exactly the first block of `epoch` or previous - const finalizedPostDeneb = finalizedCheckpoint.epoch >= config.EIP4844_FORK_EPOCH; + const finalizedPostDeneb = finalizedCheckpoint.epoch >= config.DENEB_FORK_EPOCH; const finalizedCanonicalBlockRoots: BlockRootSlot[] = finalizedCanonicalBlocks.map((block) => ({ slot: block.slot, @@ -82,7 +82,7 @@ export async function archiveBlocks( // Keep only `[max(GENESIS_EPOCH, current_epoch - MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS), current_epoch]` if (finalizedPostDeneb) { const blobsSidecarMinEpoch = currentEpoch - config.MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS; - if (blobsSidecarMinEpoch >= config.EIP4844_FORK_EPOCH) { + if (blobsSidecarMinEpoch >= config.DENEB_FORK_EPOCH) { const slotsToDelete = await db.blobsSidecarArchive.keys({lt: computeStartSlotAtEpoch(blobsSidecarMinEpoch)}); if (slotsToDelete.length > 0) { await db.blobsSidecarArchive.batchDelete(slotsToDelete); diff --git a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts index 0736e16ada04..e648dc7b0ae3 100644 --- a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts +++ b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts @@ -52,7 +52,7 @@ async function beaconBlockAndBlobsSidecarByRootFallback( if (resBlockBlobs.err) { // From the spec, if the block is from before the fork, errors with 3: ResourceUnavailable // > Clients MUST support requesting blocks and sidecars since minimum_request_epoch, where - // minimum_request_epoch = max(finalized_epoch, current_epoch - MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS, EIP4844_FORK_EPOCH). + // minimum_request_epoch = max(finalized_epoch, current_epoch - MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS, DENEB_FORK_EPOCH). // If any root in the request content references a block earlier than minimum_request_epoch, // peers SHOULD respond with error code 3: ResourceUnavailable. // Ref: https://github.com/ethereum/consensus-specs/blob/aede132f4999ed54b98d35e27aca9451042a1ee9/specs/eip4844/p2p-interface.md#beaconblockandblobssidecarbyroot-v1 diff --git a/packages/beacon-node/src/node/nodejs.ts b/packages/beacon-node/src/node/nodejs.ts index c2dbb8f131d6..b0a068514f48 100644 --- a/packages/beacon-node/src/node/nodejs.ts +++ b/packages/beacon-node/src/node/nodejs.ts @@ -150,7 +150,7 @@ export class BeaconNode { const signal = controller.signal; // TODO DENEB, where is the best place to do this? - if (config.EIP4844_FORK_EPOCH < Infinity) { + if (config.DENEB_FORK_EPOCH < Infinity) { // TODO DENEB: "c-kzg" is not installed by default, so if the library is not installed this will throw // See "Not able to build lodestar from source" https://github.com/ChainSafe/lodestar/issues/4886 await initCKZG(); diff --git a/packages/beacon-node/test/e2e/api/impl/config.test.ts b/packages/beacon-node/test/e2e/api/impl/config.test.ts index a60be56977fb..e1d66d76fe3b 100644 --- a/packages/beacon-node/test/e2e/api/impl/config.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/config.test.ts @@ -11,7 +11,7 @@ const CONSTANT_NAMES_SKIP_LIST = new Set([ "PARTICIPATION_FLAG_WEIGHTS", // TODO DENEB: This constant was added then removed on a spec re-write. // When developing DENEB branch the tracked version still doesn't have released the removal - "DOMAIN_BLOBS_SIDECAR", + "DOMAIN_BLOB_SIDECAR", ]); describe("api / impl / config", function () { diff --git a/packages/beacon-node/test/spec/general/index.test.ts b/packages/beacon-node/test/spec/general/index.test.ts index b5db55fffdc7..f6bfb0b7b2a1 100644 --- a/packages/beacon-node/test/spec/general/index.test.ts +++ b/packages/beacon-node/test/spec/general/index.test.ts @@ -1,21 +1,41 @@ import path from "node:path"; import {RunnerType} from "../utils/types.js"; -import {specTestIterator} from "../utils/specTestIterator.js"; +import {SkipOpts, specTestIterator} from "../utils/specTestIterator.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; import {blsTestRunner} from "./bls.js"; import {sszGeneric} from "./ssz_generic.js"; /* eslint-disable @typescript-eslint/naming-convention */ -specTestIterator(path.join(ethereumConsensusSpecsTests.outputDir, "tests", "general"), { - bls: {type: RunnerType.default, fn: blsTestRunner}, - ssz_generic: { - type: RunnerType.custom, - fn: sszGeneric([ - // NOTE: ComplexTestStruct tests are not correctly generated. - // where deserialized .d value is D: '0x00'. However the tests guide mark that field as D: Bytes[256]. - // Those test won't be fixed since most implementations staticly compile types. - "ComplexTestStruct", - ]), +// NOTE: You MUST always provide a detailed reason of why a spec test is skipped plus link +// to an issue marking it as pending to re-enable and an aproximate timeline of when it will +// be fixed. +// NOTE: Comment the minimum set of test necessary to unblock PRs: For example, instead of +// skipping all `bls_to_execution_change` tests, just skip for a fork setting: +// ``` +// skippedPrefixes: [ +// // Skipped since this only test that withdrawals are de-activated +// "eip4844/operations/bls_to_execution_change", +// ], +// ``` +const skipOpts: SkipOpts = { + // Add kzg runner, tracked here: https://github.com/ChainSafe/lodestar/issues/5279 + skippedRunners: ["kzg"], +}; + +specTestIterator( + path.join(ethereumConsensusSpecsTests.outputDir, "tests", "general"), + { + bls: {type: RunnerType.default, fn: blsTestRunner}, + ssz_generic: { + type: RunnerType.custom, + fn: sszGeneric([ + // NOTE: ComplexTestStruct tests are not correctly generated. + // where deserialized .d value is D: '0x00'. However the tests guide mark that field as D: Bytes[256]. + // Those test won't be fixed since most implementations staticly compile types. + "ComplexTestStruct", + ]), + }, }, -}); + skipOpts +); diff --git a/packages/beacon-node/test/spec/presets/index.test.ts b/packages/beacon-node/test/spec/presets/index.test.ts index 0ff8eefcd977..7aa8398c0111 100644 --- a/packages/beacon-node/test/spec/presets/index.test.ts +++ b/packages/beacon-node/test/spec/presets/index.test.ts @@ -30,6 +30,11 @@ import {transition} from "./transition.js"; // ], // ``` const skipOpts: SkipOpts = { + // To be enabled in decouple blobs PR: https://github.com/ChainSafe/lodestar/pull/5181 + skippedForks: ["deneb"], + // To be enabled with the fork choice safe slots to justified removal PR + // https://github.com/ChainSafe/lodestar/pull/5126 + skippedRunners: ["fork_choice"], // TODO: capella // BeaconBlockBody proof in lightclient is the new addition in v1.3.0-rc.2-hotfix // Skip them for now to enable subsequently diff --git a/packages/beacon-node/test/spec/presets/transition.ts b/packages/beacon-node/test/spec/presets/transition.ts index 85e26dd15d8d..07b02e0da658 100644 --- a/packages/beacon-node/test/spec/presets/transition.ts +++ b/packages/beacon-node/test/spec/presets/transition.ts @@ -98,7 +98,7 @@ function getTransitionConfig(fork: ForkName, forkEpoch: number): Partial { ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, CAPELLA_FORK_EPOCH: 0, - EIP4844_FORK_EPOCH: 0, + DENEB_FORK_EPOCH: 0, }); const genesisValidatorsRoot = Buffer.alloc(32, 0xaa); const config = createBeaconConfig(chainConfig, genesisValidatorsRoot); diff --git a/packages/beacon-node/test/utils/config.ts b/packages/beacon-node/test/utils/config.ts index 2ebe0159a5c7..54c058d30722 100644 --- a/packages/beacon-node/test/utils/config.ts +++ b/packages/beacon-node/test/utils/config.ts @@ -29,7 +29,7 @@ export function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig { ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, CAPELLA_FORK_EPOCH: 0, - EIP4844_FORK_EPOCH: forkEpoch, + DENEB_FORK_EPOCH: forkEpoch, }); } } diff --git a/packages/config/src/chainConfig/networks/zhejiang.ts b/packages/config/src/chainConfig/networks/zhejiang.ts index 18df13eefc20..42bab23110ab 100644 --- a/packages/config/src/chainConfig/networks/zhejiang.ts +++ b/packages/config/src/chainConfig/networks/zhejiang.ts @@ -31,7 +31,7 @@ export const zhejiangChainConfig: ChainConfig = { CAPELLA_FORK_VERSION: b("0x00000072"), CAPELLA_FORK_EPOCH: 1350, // Deneb - EIP4844_FORK_VERSION: b("0x00000073"), + DENEB_FORK_VERSION: b("0x00000073"), // Deposit contract // --------------------------------------------------------------- diff --git a/packages/config/src/chainConfig/presets/mainnet.ts b/packages/config/src/chainConfig/presets/mainnet.ts index c7418898c194..b7d79948668b 100644 --- a/packages/config/src/chainConfig/presets/mainnet.ts +++ b/packages/config/src/chainConfig/presets/mainnet.ts @@ -42,8 +42,8 @@ export const chainConfig: ChainConfig = { CAPELLA_FORK_EPOCH: 194048, // April 12 (epoch: 194048 slot: 6209536 UTC: 4/12/2023, 10:27:35 PM) // DENEB - EIP4844_FORK_VERSION: b("0x04000000"), - EIP4844_FORK_EPOCH: Infinity, + DENEB_FORK_VERSION: b("0x04000000"), + DENEB_FORK_EPOCH: Infinity, // Time parameters // --------------------------------------------------------------- diff --git a/packages/config/src/chainConfig/presets/minimal.ts b/packages/config/src/chainConfig/presets/minimal.ts index d58eda92ccca..d7d70342ea43 100644 --- a/packages/config/src/chainConfig/presets/minimal.ts +++ b/packages/config/src/chainConfig/presets/minimal.ts @@ -40,8 +40,8 @@ export const chainConfig: ChainConfig = { CAPELLA_FORK_VERSION: b("0x03000001"), CAPELLA_FORK_EPOCH: Infinity, // Deneb - EIP4844_FORK_VERSION: b("0x04000001"), - EIP4844_FORK_EPOCH: Infinity, + DENEB_FORK_VERSION: b("0x04000001"), + DENEB_FORK_EPOCH: Infinity, // Time parameters // --------------------------------------------------------------- diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index 1031449c8830..3a4b967b3005 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -38,8 +38,8 @@ export type ChainConfig = { CAPELLA_FORK_VERSION: Uint8Array; CAPELLA_FORK_EPOCH: number; // DENEB - EIP4844_FORK_VERSION: Uint8Array; - EIP4844_FORK_EPOCH: number; + DENEB_FORK_VERSION: Uint8Array; + DENEB_FORK_EPOCH: number; // Time parameters SECONDS_PER_SLOT: number; @@ -96,8 +96,8 @@ export const chainConfigTypes: SpecTypes = { CAPELLA_FORK_VERSION: "bytes", CAPELLA_FORK_EPOCH: "number", // DENEB - EIP4844_FORK_VERSION: "bytes", - EIP4844_FORK_EPOCH: "number", + DENEB_FORK_VERSION: "bytes", + DENEB_FORK_EPOCH: "number", // Time parameters SECONDS_PER_SLOT: "number", diff --git a/packages/config/src/forkConfig/index.ts b/packages/config/src/forkConfig/index.ts index 9cfa2da2d777..d630f1ddfc88 100644 --- a/packages/config/src/forkConfig/index.ts +++ b/packages/config/src/forkConfig/index.ts @@ -50,8 +50,8 @@ export function createForkConfig(config: ChainConfig): ForkConfig { const deneb: ForkInfo = { name: ForkName.deneb, seq: ForkSeq.deneb, - epoch: config.EIP4844_FORK_EPOCH, - version: config.EIP4844_FORK_VERSION, + epoch: config.DENEB_FORK_EPOCH, + version: config.DENEB_FORK_VERSION, prevVersion: config.CAPELLA_FORK_VERSION, prevForkName: ForkName.capella, }; diff --git a/packages/light-client/src/spec/utils.ts b/packages/light-client/src/spec/utils.ts index d986e22606a8..8ffaeed6a714 100644 --- a/packages/light-client/src/spec/utils.ts +++ b/packages/light-client/src/spec/utils.ts @@ -121,7 +121,7 @@ export function isValidLightClientHeader(config: ChainForkConfig, header: allFor ); } - if (epoch < config.EIP4844_FORK_EPOCH) { + if (epoch < config.DENEB_FORK_EPOCH) { if ( (header as deneb.LightClientHeader).execution.excessDataGas && (header as deneb.LightClientHeader).execution.excessDataGas !== BigInt(0) diff --git a/packages/light-client/test/unit/isValidLightClientHeader.test.ts b/packages/light-client/test/unit/isValidLightClientHeader.test.ts index 033a2c806098..a39436bc7be2 100644 --- a/packages/light-client/test/unit/isValidLightClientHeader.test.ts +++ b/packages/light-client/test/unit/isValidLightClientHeader.test.ts @@ -11,7 +11,7 @@ describe("isValidLightClientHeader", function () { ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, CAPELLA_FORK_EPOCH: 1, - EIP4844_FORK_EPOCH: Infinity, + DENEB_FORK_EPOCH: Infinity, }); const genesisValidatorsRoot = Buffer.alloc(32, 0xaa); diff --git a/packages/state-transition/src/slot/upgradeStateToDeneb.ts b/packages/state-transition/src/slot/upgradeStateToDeneb.ts index 1f5e2201f69f..18a5c81b59c1 100644 --- a/packages/state-transition/src/slot/upgradeStateToDeneb.ts +++ b/packages/state-transition/src/slot/upgradeStateToDeneb.ts @@ -16,7 +16,7 @@ export function upgradeStateToDeneb(stateCapella: CachedBeaconStateCapella): Cac stateDeneb.fork = ssz.phase0.Fork.toViewDU({ previousVersion: stateCapella.fork.currentVersion, - currentVersion: config.EIP4844_FORK_VERSION, + currentVersion: config.DENEB_FORK_VERSION, epoch: stateCapella.epochCtx.epoch, }); diff --git a/packages/state-transition/src/stateTransition.ts b/packages/state-transition/src/stateTransition.ts index 545b4f0e9752..7ec1f36f78da 100644 --- a/packages/state-transition/src/stateTransition.ts +++ b/packages/state-transition/src/stateTransition.ts @@ -193,7 +193,7 @@ function processSlotsWithTransientCache( if (stateSlot === config.CAPELLA_FORK_EPOCH) { postState = upgradeStateToCapella(postState as CachedBeaconStateBellatrix) as CachedBeaconStateAllForks; } - if (stateSlot === config.EIP4844_FORK_EPOCH) { + if (stateSlot === config.DENEB_FORK_EPOCH) { postState = upgradeStateToDeneb(postState as CachedBeaconStateCapella) as CachedBeaconStateAllForks; } } else { diff --git a/packages/state-transition/src/util/genesis.ts b/packages/state-transition/src/util/genesis.ts index 1142318549e6..16a1107941ad 100644 --- a/packages/state-transition/src/util/genesis.ts +++ b/packages/state-transition/src/util/genesis.ts @@ -275,10 +275,10 @@ export function initializeBeaconStateFromEth1( ssz.capella.ExecutionPayloadHeader.defaultViewDU(); } - if (GENESIS_SLOT >= config.EIP4844_FORK_EPOCH) { + if (GENESIS_SLOT >= config.DENEB_FORK_EPOCH) { const stateDeneb = state as CompositeViewDU; - stateDeneb.fork.previousVersion = config.EIP4844_FORK_VERSION; - stateDeneb.fork.currentVersion = config.EIP4844_FORK_VERSION; + stateDeneb.fork.previousVersion = config.DENEB_FORK_VERSION; + stateDeneb.fork.currentVersion = config.DENEB_FORK_VERSION; stateDeneb.latestExecutionPayloadHeader = (executionPayloadHeader as CompositeViewDU) ?? ssz.deneb.ExecutionPayloadHeader.defaultViewDU(); diff --git a/packages/types/src/deneb/sszTypes.ts b/packages/types/src/deneb/sszTypes.ts index 221fd0e5dc7d..9392ddac57e5 100644 --- a/packages/types/src/deneb/sszTypes.ts +++ b/packages/types/src/deneb/sszTypes.ts @@ -13,7 +13,6 @@ import {ssz as primitiveSsz} from "../primitive/index.js"; import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; import {ssz as capellaSsz} from "../capella/index.js"; -import {ssz as bellatrixSsz} from "../bellatrix/index.js"; const {UintNum64, Slot, Root, BLSSignature, UintBn256, Bytes32, Bytes48, Bytes96, BLSPubkey} = primitiveSsz; @@ -86,23 +85,16 @@ export const BeaconBlockAndBlobsSidecarByRootRequest = new ListCompositeType(Roo export const ExecutionPayload = new ContainerType( { - ...bellatrixSsz.CommonExecutionPayloadType.fields, + ...capellaSsz.ExecutionPayload.fields, excessDataGas: UintBn256, // New in DENEB - // Extra payload fields - blockHash: Root, - transactions: bellatrixSsz.Transactions, - withdrawals: capellaSsz.Withdrawals, // New in capella }, {typeName: "ExecutionPayload", jsonCase: "eth2"} ); export const ExecutionPayloadHeader = new ContainerType( { - ...bellatrixSsz.CommonExecutionPayloadType.fields, + ...capellaSsz.ExecutionPayloadHeader.fields, excessDataGas: UintBn256, // New in DENEB - blockHash: Root, - transactionsRoot: Root, - withdrawalsRoot: Root, }, {typeName: "ExecutionPayloadHeader", jsonCase: "eth2"} ); diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index ee19d9f12a03..731da00595f7 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -72,7 +72,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record