diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index a5cae2cb5440..6c8a90e733fd 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -48,8 +48,8 @@ jobs: run: yarn test:sim:endpoints working-directory: packages/cli - - name: Sim tests eip4844 - run: yarn test:sim:eip4844 + - name: Sim tests deneb + run: yarn test:sim:deneb working-directory: packages/cli - name: Sim tests backup eth provider diff --git a/packages/api/src/beacon/routes/beacon/block.ts b/packages/api/src/beacon/routes/beacon/block.ts index de071418c3f3..2a4ad38fc1a3 100644 --- a/packages/api/src/beacon/routes/beacon/block.ts +++ b/packages/api/src/beacon/routes/beacon/block.ts @@ -1,7 +1,7 @@ import {ContainerType} from "@chainsafe/ssz"; import {ForkName} from "@lodestar/params"; import {IChainForkConfig} from "@lodestar/config"; -import {phase0, allForks, Slot, Root, ssz, RootHex, eip4844} from "@lodestar/types"; +import {phase0, allForks, Slot, Root, ssz, RootHex, deneb} from "@lodestar/types"; import { RoutesData, @@ -196,7 +196,7 @@ export type Api = { blockId: BlockId ): Promise< ApiClientResponse<{ - [HttpStatusCode.OK]: {executionOptimistic: ExecutionOptimistic; data: eip4844.BlobsSidecar}; + [HttpStatusCode.OK]: {executionOptimistic: ExecutionOptimistic; data: deneb.BlobsSidecar}; }> >; }; @@ -294,6 +294,6 @@ export function getReturnTypes(): ReturnTypes { getBlockHeader: ContainerDataExecutionOptimistic(BeaconHeaderResType), getBlockHeaders: ContainerDataExecutionOptimistic(ArrayOf(BeaconHeaderResType)), getBlockRoot: ContainerDataExecutionOptimistic(RootContainer), - getBlobsSidecar: ContainerDataExecutionOptimistic(ssz.eip4844.BlobsSidecar), + getBlobsSidecar: ContainerDataExecutionOptimistic(ssz.deneb.BlobsSidecar), }; } diff --git a/packages/api/src/builder/routes.ts b/packages/api/src/builder/routes.ts index 02f48fe6dc77..146ee33911fd 100644 --- a/packages/api/src/builder/routes.ts +++ b/packages/api/src/builder/routes.ts @@ -101,7 +101,7 @@ export function getReturnTypes(): ReturnTypes { submitBlindedBlockV2: WithVersion((fork: ForkName) => isForkBlobs(fork) ? ssz.allForksBlobs[fork].SignedBeaconBlockAndBlobsSidecar - : ssz.eip4844.SignedBeaconBlockAndBlobsSidecar + : ssz.deneb.SignedBeaconBlockAndBlobsSidecar ), }; } diff --git a/packages/api/test/unit/beacon/testData/beacon.ts b/packages/api/test/unit/beacon/testData/beacon.ts index 6efd420986b5..41f4b1d84f08 100644 --- a/packages/api/test/unit/beacon/testData/beacon.ts +++ b/packages/api/test/unit/beacon/testData/beacon.ts @@ -58,7 +58,7 @@ export const testData: GenericServerTestCases = { }, getBlobsSidecar: { args: ["head"], - res: {executionOptimistic: true, data: ssz.eip4844.BlobsSidecar.defaultValue()}, + res: {executionOptimistic: true, data: ssz.deneb.BlobsSidecar.defaultValue()}, }, // pool diff --git a/packages/api/test/unit/builder/testData.ts b/packages/api/test/unit/builder/testData.ts index 38a12ae6d637..443522269fa2 100644 --- a/packages/api/test/unit/builder/testData.ts +++ b/packages/api/test/unit/builder/testData.ts @@ -23,11 +23,11 @@ export const testData: GenericServerTestCases = { res: {version: ForkName.bellatrix, data: ssz.bellatrix.SignedBuilderBid.defaultValue()}, }, submitBlindedBlock: { - args: [ssz.eip4844.SignedBlindedBeaconBlock.defaultValue()], + args: [ssz.deneb.SignedBlindedBeaconBlock.defaultValue()], res: {version: ForkName.bellatrix, data: ssz.bellatrix.ExecutionPayload.defaultValue()}, }, submitBlindedBlockV2: { - args: [ssz.eip4844.SignedBlindedBeaconBlock.defaultValue()], - res: {version: ForkName.eip4844, data: ssz.eip4844.SignedBeaconBlockAndBlobsSidecar.defaultValue()}, + args: [ssz.deneb.SignedBlindedBeaconBlock.defaultValue()], + res: {version: ForkName.deneb, data: ssz.deneb.SignedBeaconBlockAndBlobsSidecar.defaultValue()}, }, }; diff --git a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts index e349b399f242..1d7ab43f64eb 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts @@ -2,7 +2,7 @@ import {routes, ServerApi} from "@lodestar/api"; import {computeTimeAtSlot} from "@lodestar/state-transition"; import {ForkSeq, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {sleep} from "@lodestar/utils"; -import {eip4844, allForks} from "@lodestar/types"; +import {deneb, allForks} from "@lodestar/types"; import {fromHexString, toHexString} from "@chainsafe/ssz"; import {getBlockInput} from "../../../../chain/blocks/types.js"; import {promiseAllMaybeAsync} from "../../../../util/promises.js"; @@ -183,7 +183,7 @@ export function getBeaconBlockApi({ const executionBuilder = chain.executionBuilder; if (!executionBuilder) throw Error("exeutionBuilder required to publish SignedBlindedBeaconBlock"); let signedBlock: allForks.SignedBeaconBlock; - if (config.getForkSeq(signedBlindedBlock.message.slot) >= ForkSeq.eip4844) { + if (config.getForkSeq(signedBlindedBlock.message.slot) >= ForkSeq.deneb) { const {beaconBlock, blobsSidecar} = await executionBuilder.submitBlindedBlockV2(signedBlindedBlock); signedBlock = beaconBlock; // add this blobs to the map for access & broadcasting in publishBlock @@ -215,15 +215,15 @@ export function getBeaconBlockApi({ metrics?.registerBeaconBlock(OpSource.api, seenTimestampSec, signedBlock.message); - // TODO EIP-4844: Open question if broadcast to both block topic + block_and_blobs topic + // TODO Deneb: Open question if broadcast to both block topic + block_and_blobs topic const blockForImport = - config.getForkSeq(signedBlock.message.slot) >= ForkSeq.eip4844 - ? getBlockInput.postEIP4844( + config.getForkSeq(signedBlock.message.slot) >= ForkSeq.deneb + ? getBlockInput.postDeneb( config, signedBlock, - chain.getBlobsSidecar(signedBlock.message as eip4844.BeaconBlock) + chain.getBlobsSidecar(signedBlock.message as deneb.BeaconBlock) ) - : getBlockInput.preEIP4844(config, signedBlock); + : getBlockInput.preDeneb(config, signedBlock); await promiseAllMaybeAsync([ // Send the block, regardless of whether or not it is valid. The API @@ -252,7 +252,7 @@ export function getBeaconBlockApi({ blobsSidecar = { beaconBlockRoot: blockRoot, beaconBlockSlot: block.message.slot, - blobs: [] as eip4844.Blobs, + blobs: [] as deneb.Blobs, kzgAggregatedProof: ckzg.computeAggregateKzgProof([]), }; } diff --git a/packages/beacon-node/src/api/impl/config/constants.ts b/packages/beacon-node/src/api/impl/config/constants.ts index 603d66b11308..87ffce91b4d9 100644 --- a/packages/beacon-node/src/api/impl/config/constants.ts +++ b/packages/beacon-node/src/api/impl/config/constants.ts @@ -97,7 +97,7 @@ export const specConstants = { // ## Capella domain types DOMAIN_BLS_TO_EXECUTION_CHANGE, - // EIP4844 types + // Deneb types BLOB_TX_TYPE, VERSIONED_HASH_VERSION_KZG, }; diff --git a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts index b60eb3622d64..fb2d37407e72 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 finalizedPostEIP4844 = finalizedCheckpoint.epoch >= config.EIP4844_FORK_EPOCH; + const finalizedPostDeneb = finalizedCheckpoint.epoch >= config.EIP4844_FORK_EPOCH; const finalizedCanonicalBlockRoots: BlockRootSlot[] = finalizedCanonicalBlocks.map((block) => ({ slot: block.slot, @@ -56,7 +56,7 @@ export async function archiveBlocks( size: finalizedCanonicalBlockRoots.length, }); - if (finalizedPostEIP4844) { + if (finalizedPostDeneb) { await migrateBlobsSidecarFromHotToColdDb(config, db, finalizedCanonicalBlockRoots); logger.verbose("Migrated blobsSidecar from hot DB to cold DB"); } @@ -72,7 +72,7 @@ export async function archiveBlocks( slots: finalizedNonCanonicalBlocks.map((summary) => summary.slot).join(","), }); - if (finalizedPostEIP4844) { + if (finalizedPostDeneb) { await db.blobsSidecar.batchDelete(nonCanonicalBlockRoots); logger.verbose("Deleted non canonical blobsSider from hot DB"); } @@ -80,7 +80,7 @@ export async function archiveBlocks( // Delete expired blobs // Keep only `[max(GENESIS_EPOCH, current_epoch - MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS), current_epoch]` - if (finalizedPostEIP4844) { + if (finalizedPostDeneb) { const blobsSidecarMinEpoch = currentEpoch - config.MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS; if (blobsSidecarMinEpoch >= config.EIP4844_FORK_EPOCH) { const slotsToDelete = await db.blobsSidecarArchive.keys({lt: computeStartSlotAtEpoch(blobsSidecarMinEpoch)}); @@ -162,7 +162,7 @@ async function migrateBlobsSidecarFromHotToColdDb( // load Buffer instead of ssz deserialized to improve performance const canonicalBlobsSidecarEntries: IKeyValue[] = await Promise.all( canonicalBlocks - .filter((block) => config.getForkSeq(block.slot) >= ForkSeq.eip4844) + .filter((block) => config.getForkSeq(block.slot) >= ForkSeq.deneb) .map(async (block) => { const bytes = await db.blobsSidecar.getBinary(block.root); if (!bytes) { diff --git a/packages/beacon-node/src/chain/blocks/importBlock.ts b/packages/beacon-node/src/chain/blocks/importBlock.ts index b0005ba607d9..305245863675 100644 --- a/packages/beacon-node/src/chain/blocks/importBlock.ts +++ b/packages/beacon-node/src/chain/blocks/importBlock.ts @@ -66,7 +66,7 @@ export async function importBlock( root: blockRootHex, }); - if (blockInput.type === BlockInputType.postEIP4844) { + if (blockInput.type === BlockInputType.postDeneb) { const {blobs} = blockInput; // NOTE: Old blobs are pruned on archive await this.db.blobsSidecar.add(blobs); diff --git a/packages/beacon-node/src/chain/blocks/types.ts b/packages/beacon-node/src/chain/blocks/types.ts index ddb8c1c25409..e6c7dfa76249 100644 --- a/packages/beacon-node/src/chain/blocks/types.ts +++ b/packages/beacon-node/src/chain/blocks/types.ts @@ -1,56 +1,56 @@ import {CachedBeaconStateAllForks, computeEpochAtSlot} from "@lodestar/state-transition"; import {MaybeValidExecutionStatus} from "@lodestar/fork-choice"; -import {allForks, eip4844, Slot} from "@lodestar/types"; +import {allForks, deneb, Slot} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; import {IChainForkConfig} from "@lodestar/config"; export enum BlockInputType { - preEIP4844 = "preEIP4844", - postEIP4844 = "postEIP4844", - postEIP4844OldBlobs = "postEIP4844OldBlobs", + preDeneb = "preDeneb", + postDeneb = "postDeneb", + postDenebOldBlobs = "postDenebOldBlobs", } export type BlockInput = - | {type: BlockInputType.preEIP4844; block: allForks.SignedBeaconBlock} - | {type: BlockInputType.postEIP4844; block: allForks.SignedBeaconBlock; blobs: eip4844.BlobsSidecar} - | {type: BlockInputType.postEIP4844OldBlobs; block: allForks.SignedBeaconBlock}; + | {type: BlockInputType.preDeneb; block: allForks.SignedBeaconBlock} + | {type: BlockInputType.postDeneb; block: allForks.SignedBeaconBlock; blobs: deneb.BlobsSidecar} + | {type: BlockInputType.postDenebOldBlobs; block: allForks.SignedBeaconBlock}; export function blockRequiresBlobs(config: IChainForkConfig, blockSlot: Slot, clockSlot: Slot): boolean { return ( - config.getForkSeq(blockSlot) >= ForkSeq.eip4844 && + config.getForkSeq(blockSlot) >= ForkSeq.deneb && // Only request blobs if they are recent enough computeEpochAtSlot(blockSlot) >= computeEpochAtSlot(clockSlot) - config.MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS ); } export const getBlockInput = { - preEIP4844(config: IChainForkConfig, block: allForks.SignedBeaconBlock): BlockInput { - if (config.getForkSeq(block.message.slot) >= ForkSeq.eip4844) { - throw Error(`Post EIP4844 block slot ${block.message.slot}`); + preDeneb(config: IChainForkConfig, block: allForks.SignedBeaconBlock): BlockInput { + if (config.getForkSeq(block.message.slot) >= ForkSeq.deneb) { + throw Error(`Post Deneb block slot ${block.message.slot}`); } return { - type: BlockInputType.preEIP4844, + type: BlockInputType.preDeneb, block, }; }, - postEIP4844(config: IChainForkConfig, block: allForks.SignedBeaconBlock, blobs: eip4844.BlobsSidecar): BlockInput { - if (config.getForkSeq(block.message.slot) < ForkSeq.eip4844) { - throw Error(`Pre EIP4844 block slot ${block.message.slot}`); + postDeneb(config: IChainForkConfig, block: allForks.SignedBeaconBlock, blobs: deneb.BlobsSidecar): BlockInput { + if (config.getForkSeq(block.message.slot) < ForkSeq.deneb) { + throw Error(`Pre Deneb block slot ${block.message.slot}`); } return { - type: BlockInputType.postEIP4844, + type: BlockInputType.postDeneb, block, blobs, }; }, - postEIP4844OldBlobs(config: IChainForkConfig, block: allForks.SignedBeaconBlock): BlockInput { - if (config.getForkSeq(block.message.slot) < ForkSeq.eip4844) { - throw Error(`Pre EIP4844 block slot ${block.message.slot}`); + postDenebOldBlobs(config: IChainForkConfig, block: allForks.SignedBeaconBlock): BlockInput { + if (config.getForkSeq(block.message.slot) < ForkSeq.deneb) { + throw Error(`Pre Deneb block slot ${block.message.slot}`); } return { - type: BlockInputType.postEIP4844OldBlobs, + type: BlockInputType.postDenebOldBlobs, block, }; }, diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts index 981e2c17ce90..0c3e00face4e 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts @@ -4,7 +4,7 @@ import { ExecutionPayloadStatus, DataAvailableStatus, } from "@lodestar/state-transition"; -import {eip4844} from "@lodestar/types"; +import {deneb} from "@lodestar/types"; import {ErrorAborted, ILogger, sleep} from "@lodestar/utils"; import {IChainForkConfig} from "@lodestar/config"; import {IMetrics} from "../../metrics/index.js"; @@ -39,9 +39,9 @@ export async function verifyBlocksStateTransitionOnly( const {block} = blocks[i]; const preState = i === 0 ? preState0 : postStates[i - 1]; - // TODO EIP-4844: Is the best place here to call validateBlobsSidecar()? - // TODO EIP-4844: Gossip may already call validateBlobsSidecar, add some flag to de-dup from here - // TODO EIP-4844: For sync if this function is expensive, consider adding sleep(0) if metrics show it + // TODO Deneb: Is the best place here to call validateBlobsSidecar()? + // TODO Deneb: Gossip may already call validateBlobsSidecar, add some flag to de-dup from here + // TODO Deneb: For sync if this function is expensive, consider adding sleep(0) if metrics show it const dataAvailableStatus = maybeValidateBlobs(config, blocks[i], opts); // STFN - per_slot_processing() + per_block_processing() @@ -54,7 +54,7 @@ export async function verifyBlocksStateTransitionOnly( // NOTE: Assume valid for now while sending payload to execution engine in parallel // Latter verifyBlocksInEpoch() will make sure that payload is indeed valid executionPayloadStatus: ExecutionPayloadStatus.valid, - // TODO EIP-4844: Data is validated above for + // TODO Deneb: Data is validated above for dataAvailableStatus, // false because it's verified below with better error typing verifyStateRoot: false, @@ -109,28 +109,28 @@ function maybeValidateBlobs( blockInput: BlockInput, opts: ImportBlockOpts ): DataAvailableStatus { - // TODO EIP4844: Make switch verify it's exhaustive + // TODO Deneb: Make switch verify it's exhaustive switch (blockInput.type) { - case BlockInputType.postEIP4844: { + case BlockInputType.postDeneb: { if (opts.validBlobsSidecar) { return DataAvailableStatus.available; } const {block, blobs} = blockInput; const blockSlot = block.message.slot; - const {blobKzgCommitments} = (block as eip4844.SignedBeaconBlock).message.body; + const {blobKzgCommitments} = (block as deneb.SignedBeaconBlock).message.body; const beaconBlockRoot = config.getForkTypes(blockSlot).BeaconBlock.hashTreeRoot(block.message); - // TODO EIP-4844: This function throws un-typed errors + // TODO Deneb: This function throws un-typed errors validateBlobsSidecar(blockSlot, beaconBlockRoot, blobKzgCommitments, blobs); return DataAvailableStatus.available; } - case BlockInputType.preEIP4844: - return DataAvailableStatus.preEIP4844; + case BlockInputType.preDeneb: + return DataAvailableStatus.preDeneb; // TODO: Ok to assume old data available? - case BlockInputType.postEIP4844OldBlobs: + case BlockInputType.postDenebOldBlobs: return DataAvailableStatus.available; } } diff --git a/packages/beacon-node/src/chain/chain.ts b/packages/beacon-node/src/chain/chain.ts index ab86b36b71c7..007fe981a299 100644 --- a/packages/beacon-node/src/chain/chain.ts +++ b/packages/beacon-node/src/chain/chain.ts @@ -12,7 +12,7 @@ import { PubkeyIndexMap, } from "@lodestar/state-transition"; import {IBeaconConfig} from "@lodestar/config"; -import {allForks, UintNum64, Root, phase0, Slot, RootHex, Epoch, ValidatorIndex, eip4844, Wei} from "@lodestar/types"; +import {allForks, UintNum64, Root, phase0, Slot, RootHex, Epoch, ValidatorIndex, deneb, Wei} from "@lodestar/types"; import {CheckpointWithHex, ExecutionStatus, IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {ProcessShutdownCallback} from "@lodestar/validator"; import {ILogger, pruneSetToMax, toHex} from "@lodestar/utils"; @@ -118,9 +118,9 @@ export class BeaconChain implements IBeaconChain { readonly beaconProposerCache: BeaconProposerCache; readonly checkpointBalancesCache: CheckpointBalancesCache; - // TODO EIP-4844: Prune data structure every time period, for both old entries + // TODO DENEB: Prune data structure every time period, for both old entries /** Map keyed by executionPayload.blockHash of the block for those blobs */ - readonly producedBlobsSidecarCache = new Map(); + readonly producedBlobsSidecarCache = new Map(); readonly opts: IChainOptions; protected readonly blockProcessor: BlockProcessor; @@ -398,9 +398,9 @@ export class BeaconChain implements IBeaconChain { // blinded blobs will be fetched and added to this cache later before finally // publishing the blinded block's full version if (blobs.type === BlobsResultType.produced) { - // TODO EIP-4844: Prune data structure for max entries + // TODO DENEB: Prune data structure for max entries this.producedBlobsSidecarCache.set(blobs.blockHash, { - // TODO EIP-4844: Optimize, hashing the full block is not free. + // TODO DENEB: Optimize, hashing the full block is not free. beaconBlockRoot: this.config.getForkTypes(block.slot).BeaconBlock.hashTreeRoot(block), beaconBlockSlot: block.slot, blobs: blobs.blobs, @@ -425,7 +425,7 @@ export class BeaconChain implements IBeaconChain { * kzg_aggregated_proof=compute_proof_from_blobs(blobs), * ) */ - getBlobsSidecar(beaconBlock: eip4844.BeaconBlock): eip4844.BlobsSidecar { + getBlobsSidecar(beaconBlock: deneb.BeaconBlock): deneb.BlobsSidecar { const blockHash = toHex(beaconBlock.body.executionPayload.blockHash); const blobsSidecar = this.producedBlobsSidecarCache.get(blockHash); if (!blobsSidecar) { @@ -649,7 +649,7 @@ export class BeaconChain implements IBeaconChain { } // Prune old blobsSidecar for block production, those are only useful on their slot - if (this.config.getForkSeq(slot) >= ForkSeq.eip4844 && this.producedBlobsSidecarCache.size > 0) { + if (this.config.getForkSeq(slot) >= ForkSeq.deneb && this.producedBlobsSidecarCache.size > 0) { for (const [key, blobsSidecar] of this.producedBlobsSidecarCache) { if (slot > blobsSidecar.beaconBlockSlot + MAX_RETAINED_SLOTS_CACHED_BLOBS_SIDECAR) { this.producedBlobsSidecarCache.delete(key); diff --git a/packages/beacon-node/src/chain/interface.ts b/packages/beacon-node/src/chain/interface.ts index 8242bf677ee3..65f27f105b55 100644 --- a/packages/beacon-node/src/chain/interface.ts +++ b/packages/beacon-node/src/chain/interface.ts @@ -1,4 +1,4 @@ -import {allForks, UintNum64, Root, phase0, Slot, RootHex, Epoch, ValidatorIndex, eip4844, Wei} from "@lodestar/types"; +import {allForks, UintNum64, Root, phase0, Slot, RootHex, Epoch, ValidatorIndex, deneb, Wei} from "@lodestar/types"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {IBeaconConfig} from "@lodestar/config"; import {CompositeTypeAny, TreeView, Type} from "@chainsafe/ssz"; @@ -88,7 +88,7 @@ export interface IBeaconChain { readonly beaconProposerCache: BeaconProposerCache; readonly checkpointBalancesCache: CheckpointBalancesCache; - readonly producedBlobsSidecarCache: Map; + readonly producedBlobsSidecarCache: Map; readonly opts: IChainOptions; /** Stop beacon chain processing */ @@ -111,7 +111,7 @@ export interface IBeaconChain { */ getCanonicalBlockAtSlot(slot: Slot): Promise; - getBlobsSidecar(beaconBlock: eip4844.BeaconBlock): eip4844.BlobsSidecar; + getBlobsSidecar(beaconBlock: deneb.BeaconBlock): deneb.BlobsSidecar; produceBlock(blockAttributes: BlockAttributes): Promise<{block: allForks.BeaconBlock; blockValue: Wei}>; produceBlindedBlock(blockAttributes: BlockAttributes): Promise<{block: allForks.BlindedBeaconBlock; blockValue: Wei}>; diff --git a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts index 260a41ac4a8a..46e3b3566c4f 100644 --- a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts +++ b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts @@ -11,7 +11,7 @@ import { BLSPubkey, BLSSignature, capella, - eip4844, + deneb, Wei, } from "@lodestar/types"; import { @@ -63,14 +63,14 @@ export type AssembledBlockType = T extends BlockType.Full : allForks.BlindedBeaconBlock; export enum BlobsResultType { - preEIP4844, + preDeneb, produced, blinded, } export type BlobsResult = - | {type: BlobsResultType.preEIP4844 | BlobsResultType.blinded} - | {type: BlobsResultType.produced; blobs: eip4844.Blobs; blockHash: RootHex}; + | {type: BlobsResultType.preDeneb | BlobsResultType.blinded} + | {type: BlobsResultType.produced; blobs: deneb.Blobs; blockHash: RootHex}; export async function produceBlockBody( this: BeaconChain, @@ -91,9 +91,9 @@ export async function produceBlockBody( proposerPubKey: BLSPubkey; } ): Promise<{body: AssembledBodyType; blobs: BlobsResult; blockValue: Wei}> { - // Type-safe for blobs variable. Translate 'null' value into 'preEIP4844' enum + // Type-safe for blobs variable. Translate 'null' value into 'preDeneb' enum // TODO: Not ideal, but better than just using null. - // TODO: Does not guarantee that preEIP4844 enum goes with a preEIP4844 block + // TODO: Does not guarantee that preDeneb enum goes with a preDeneb block let blobsResult: BlobsResult; let blockValue: Wei; @@ -173,15 +173,15 @@ export async function produceBlockBody( ); (blockBody as allForks.BlindedBeaconBlockBody).executionPayloadHeader = builderRes.header; blockValue = builderRes.blockValue; - if (ForkSeq[fork] >= ForkSeq.eip4844) { + if (ForkSeq[fork] >= ForkSeq.deneb) { const {blobKzgCommitments} = builderRes; if (blobKzgCommitments === undefined) { throw Error(`Invalid builder getHeader response for fork=${fork}, missing blobKzgCommitments`); } - (blockBody as eip4844.BlindedBeaconBlockBody).blobKzgCommitments = blobKzgCommitments; + (blockBody as deneb.BlindedBeaconBlockBody).blobKzgCommitments = blobKzgCommitments; blobsResult = {type: BlobsResultType.blinded}; } else { - blobsResult = {type: BlobsResultType.preEIP4844}; + blobsResult = {type: BlobsResultType.preDeneb}; } } @@ -205,7 +205,7 @@ export async function produceBlockBody( (blockBody as allForks.ExecutionBlockBody).executionPayload = ssz.allForksExecution[ fork ].ExecutionPayload.defaultValue(); - blobsResult = {type: BlobsResultType.preEIP4844}; + blobsResult = {type: BlobsResultType.preDeneb}; blockValue = BigInt(0); } else { const {prepType, payloadId} = prepareRes; @@ -229,11 +229,11 @@ export async function produceBlockBody( this.metrics?.blockPayload.emptyPayloads.inc({prepType}); } - if (ForkSeq[fork] >= ForkSeq.eip4844) { + if (ForkSeq[fork] >= ForkSeq.deneb) { // SPEC: https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/validator.md#blob-kzg-commitments // After retrieving the execution payload from the execution engine as specified in Bellatrix, use the // payload_id to retrieve blobs and blob_kzg_commitments via get_blobs_and_kzg_commitments(payload_id) - // TODO EIP-4844: getBlobsBundle and getPayload must be either coupled or called in parallel to save time. + // TODO Deneb: getBlobsBundle and getPayload must be either coupled or called in parallel to save time. const blobsBundle = await this.executionEngine.getBlobsBundle(payloadId); // Sanity check consistency between getPayload() and getBlobsBundle() @@ -247,10 +247,10 @@ export async function produceBlockBody( validateBlobsAndKzgCommitments(executionPayload, blobsBundle); } - (blockBody as eip4844.BeaconBlockBody).blobKzgCommitments = blobsBundle.kzgs; + (blockBody as deneb.BeaconBlockBody).blobKzgCommitments = blobsBundle.kzgs; blobsResult = {type: BlobsResultType.produced, blobs: blobsBundle.blobs, blockHash}; } else { - blobsResult = {type: BlobsResultType.preEIP4844}; + blobsResult = {type: BlobsResultType.preDeneb}; } } } catch (e) { @@ -267,7 +267,7 @@ export async function produceBlockBody( (blockBody as allForks.ExecutionBlockBody).executionPayload = ssz.allForksExecution[ fork ].ExecutionPayload.defaultValue(); - blobsResult = {type: BlobsResultType.preEIP4844}; + blobsResult = {type: BlobsResultType.preDeneb}; blockValue = BigInt(0); } else { // since merge transition is complete, we need a valid payload even if with an @@ -277,7 +277,7 @@ export async function produceBlockBody( } } } else { - blobsResult = {type: BlobsResultType.preEIP4844}; + blobsResult = {type: BlobsResultType.preDeneb}; blockValue = BigInt(0); } @@ -387,7 +387,7 @@ async function prepareExecutionPayloadHeader( ): Promise<{ header: allForks.ExecutionPayloadHeader; blockValue: Wei; - blobKzgCommitments?: eip4844.BlobKzgCommitments; + blobKzgCommitments?: deneb.BlobKzgCommitments; }> { if (!chain.executionBuilder) { throw Error("executionBuilder required"); diff --git a/packages/beacon-node/src/chain/produceBlock/validateBlobsAndKzgCommitments.ts b/packages/beacon-node/src/chain/produceBlock/validateBlobsAndKzgCommitments.ts index 51590555f3e6..ea1a9b37aa01 100644 --- a/packages/beacon-node/src/chain/produceBlock/validateBlobsAndKzgCommitments.ts +++ b/packages/beacon-node/src/chain/produceBlock/validateBlobsAndKzgCommitments.ts @@ -1,5 +1,5 @@ import {verifyKzgCommitmentsAgainstTransactions} from "@lodestar/state-transition"; -import {allForks, eip4844} from "@lodestar/types"; +import {allForks, deneb} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {BlobsBundle} from "../../execution/index.js"; import {byteArrayEquals} from "../../util/bytes.js"; @@ -18,7 +18,7 @@ export function validateBlobsAndKzgCommitments(payload: allForks.ExecutionPayloa } for (let i = 0; i < blobsBundle.blobs.length; i++) { - const kzg = ckzg.blobToKzgCommitment(blobsBundle.blobs[i]) as eip4844.KZGCommitment; + const kzg = ckzg.blobToKzgCommitment(blobsBundle.blobs[i]) as deneb.KZGCommitment; if (!byteArrayEquals(kzg, blobsBundle.kzgs[i])) { throw Error(`Wrong KZG[${i}] ${toHex(blobsBundle.kzgs[i])} expected ${toHex(kzg)}`); } diff --git a/packages/beacon-node/src/chain/validation/blobsSidecar.ts b/packages/beacon-node/src/chain/validation/blobsSidecar.ts index fb98f6495cea..bb46c384e508 100644 --- a/packages/beacon-node/src/chain/validation/blobsSidecar.ts +++ b/packages/beacon-node/src/chain/validation/blobsSidecar.ts @@ -1,6 +1,6 @@ import bls from "@chainsafe/bls"; import {CoordType} from "@chainsafe/bls/types"; -import {eip4844, Root, ssz} from "@lodestar/types"; +import {deneb, Root, ssz} from "@lodestar/types"; import {bytesToBigInt} from "@lodestar/utils"; import {BYTES_PER_FIELD_ELEMENT, FIELD_ELEMENTS_PER_BLOB} from "@lodestar/params"; import {verifyKzgCommitmentsAgainstTransactions} from "@lodestar/state-transition"; @@ -12,8 +12,8 @@ import {ckzg} from "../../util/kzg.js"; const BLS_MODULUS = BigInt("52435875175126190479447740508185965837690552500527637822603658699938581184513"); export function validateGossipBlobsSidecar( - signedBlock: eip4844.SignedBeaconBlock, - blobsSidecar: eip4844.BlobsSidecar + signedBlock: deneb.SignedBeaconBlock, + blobsSidecar: deneb.BlobsSidecar ): void { const block = signedBlock.message; @@ -72,8 +72,8 @@ export function validateGossipBlobsSidecar( export function validateBlobsSidecar( slot: number, beaconBlockRoot: Root, - expectedKzgCommitments: eip4844.KZGCommitment[], - blobsSidecar: eip4844.BlobsSidecar + expectedKzgCommitments: deneb.KZGCommitment[], + blobsSidecar: deneb.BlobsSidecar ): void { // assert slot == blobs_sidecar.beacon_block_slot if (slot != blobsSidecar.beaconBlockSlot) { @@ -106,12 +106,12 @@ export function validateBlobsSidecar( try { isProofValid = ckzg.verifyAggregateKzgProof(blobs, expectedKzgCommitments, kzgAggregatedProof); } catch (e) { - // TODO EIP-4844: TEMP Nov17: May always throw error -- we need to fix Geth's KZG to match C-KZG and the trusted setup used here + // TODO DENEB: TEMP Nov17: May always throw error -- we need to fix Geth's KZG to match C-KZG and the trusted setup used here (e as Error).message = `Error on verifyAggregateKzgProof: ${(e as Error).message}`; throw e; } - // TODO EIP-4844: TEMP Nov17: May always throw error -- we need to fix Geth's KZG to match C-KZG and the trusted setup used here + // TODO DENEB: TEMP Nov17: May always throw error -- we need to fix Geth's KZG to match C-KZG and the trusted setup used here if (!isProofValid) { throw Error("Invalid AggregateKzgProof"); } @@ -137,7 +137,7 @@ function blsKeyValidate(g1Point: Uint8Array): boolean { * ``` * Check that each FIELD_ELEMENT as a uint256 < BLS_MODULUS */ -function blobIsValidRange(blob: eip4844.Blob): boolean { +function blobIsValidRange(blob: deneb.Blob): boolean { for (let i = 0; i < FIELD_ELEMENTS_PER_BLOB; i++) { const fieldElement = blob.subarray(i * BYTES_PER_FIELD_ELEMENT, (i + 1) * BYTES_PER_FIELD_ELEMENT); const fieldElementBN = bytesToBigInt(fieldElement, "be"); diff --git a/packages/beacon-node/src/db/repositories/blobsSidecar.ts b/packages/beacon-node/src/db/repositories/blobsSidecar.ts index 12388713033a..13a7cd357a66 100644 --- a/packages/beacon-node/src/db/repositories/blobsSidecar.ts +++ b/packages/beacon-node/src/db/repositories/blobsSidecar.ts @@ -1,21 +1,21 @@ import {IChainForkConfig} from "@lodestar/config"; import {Bucket, Db, Repository} from "@lodestar/db"; -import {eip4844, ssz} from "@lodestar/types"; +import {deneb, ssz} from "@lodestar/types"; /** * BlobsSidecar by block root (= hash_tree_root(SignedBeaconBlockAndBlobsSidecar.beacon_block.message)) * * Used to store unfinalized BlobsSidecar */ -export class BlobsSidecarRepository extends Repository { +export class BlobsSidecarRepository extends Repository { constructor(config: IChainForkConfig, db: Db) { - super(config, db, Bucket.allForks_blobsSidecar, ssz.eip4844.BlobsSidecar); + super(config, db, Bucket.allForks_blobsSidecar, ssz.deneb.BlobsSidecar); } /** * Id is hashTreeRoot of unsigned BeaconBlock */ - getId(value: eip4844.BlobsSidecar): Uint8Array { + getId(value: deneb.BlobsSidecar): Uint8Array { return value.beaconBlockRoot; } } diff --git a/packages/beacon-node/src/db/repositories/blobsSidecarArchive.ts b/packages/beacon-node/src/db/repositories/blobsSidecarArchive.ts index 23d92b9b148c..58c84411992d 100644 --- a/packages/beacon-node/src/db/repositories/blobsSidecarArchive.ts +++ b/packages/beacon-node/src/db/repositories/blobsSidecarArchive.ts @@ -1,6 +1,6 @@ import {IChainForkConfig} from "@lodestar/config"; import {Db, Repository, IKeyValue, IFilterOptions, Bucket} from "@lodestar/db"; -import {Slot, Root, ssz, eip4844} from "@lodestar/types"; +import {Slot, Root, ssz, deneb} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; export interface IBlockFilterOptions extends IFilterOptions { @@ -16,14 +16,14 @@ export type BlockArchiveBatchPutBinaryItem = IKeyValue & { /** * Stores finalized blocks. Block slot is identifier. */ -export class BlobsSidecarArchiveRepository extends Repository { +export class BlobsSidecarArchiveRepository extends Repository { constructor(config: IChainForkConfig, db: Db) { - super(config, db, Bucket.allForks_blobsSidecarArchive, ssz.eip4844.BlobsSidecar); + super(config, db, Bucket.allForks_blobsSidecarArchive, ssz.deneb.BlobsSidecar); } // Handle key as slot - getId(value: eip4844.BlobsSidecar): Slot { + getId(value: deneb.BlobsSidecar): Slot { return value.beaconBlockSlot; } diff --git a/packages/beacon-node/src/execution/builder/http.ts b/packages/beacon-node/src/execution/builder/http.ts index 174888b275a8..eb8f9336bc24 100644 --- a/packages/beacon-node/src/execution/builder/http.ts +++ b/packages/beacon-node/src/execution/builder/http.ts @@ -1,4 +1,4 @@ -import {allForks, bellatrix, Slot, Root, BLSPubkey, ssz, eip4844, Wei} from "@lodestar/types"; +import {allForks, bellatrix, Slot, Root, BLSPubkey, ssz, deneb, Wei} from "@lodestar/types"; import {IChainForkConfig} from "@lodestar/config"; import {getClient, Api as BuilderApi} from "@lodestar/api/builder"; import {byteArrayEquals, toHexString} from "@chainsafe/ssz"; @@ -61,12 +61,12 @@ export class ExecutionBuilderHttp implements IExecutionBuilder { ): Promise<{ header: allForks.ExecutionPayloadHeader; blockValue: Wei; - blobKzgCommitments?: eip4844.BlobKzgCommitments; + blobKzgCommitments?: deneb.BlobKzgCommitments; }> { const res = await this.api.getHeader(slot, parentHash, proposerPubKey); ApiError.assert(res, "execution.builder.getheader"); const {header, value: blockValue} = res.response.data.message; - const {blobKzgCommitments} = res.response.data.message as {blobKzgCommitments?: eip4844.BlobKzgCommitments}; + const {blobKzgCommitments} = res.response.data.message as {blobKzgCommitments?: deneb.BlobKzgCommitments}; return {header, blockValue, blobKzgCommitments}; } @@ -124,7 +124,7 @@ export class ExecutionBuilderHttp implements IExecutionBuilder { throw Error(`blobsSidecar incorrect blockHash expected=${blockHash}, actual=${blobsBlockHash}`); } // Sanity-check that the KZG commitments match the versioned hashes in the transactions - const {blobKzgCommitments: kzgs} = beaconBlock.message.body as eip4844.BeaconBlockBody; + const {blobKzgCommitments: kzgs} = beaconBlock.message.body as deneb.BeaconBlockBody; if (kzgs === undefined) { throw Error("Missing blobKzgCommitments on beaconBlock's body"); } diff --git a/packages/beacon-node/src/execution/builder/interface.ts b/packages/beacon-node/src/execution/builder/interface.ts index 19f03b7f6367..42724afc6d36 100644 --- a/packages/beacon-node/src/execution/builder/interface.ts +++ b/packages/beacon-node/src/execution/builder/interface.ts @@ -1,4 +1,4 @@ -import {allForks, bellatrix, Root, Slot, BLSPubkey, eip4844, Wei} from "@lodestar/types"; +import {allForks, bellatrix, Root, Slot, BLSPubkey, deneb, Wei} from "@lodestar/types"; export interface IExecutionBuilder { /** @@ -18,7 +18,7 @@ export interface IExecutionBuilder { ): Promise<{ header: allForks.ExecutionPayloadHeader; blockValue: Wei; - blobKzgCommitments?: eip4844.BlobKzgCommitments; + blobKzgCommitments?: deneb.BlobKzgCommitments; }>; submitBlindedBlock(signedBlock: allForks.SignedBlindedBeaconBlock): Promise; submitBlindedBlockV2( diff --git a/packages/beacon-node/src/execution/engine/http.ts b/packages/beacon-node/src/execution/engine/http.ts index 3171c1cd69ec..45360269be2b 100644 --- a/packages/beacon-node/src/execution/engine/http.ts +++ b/packages/beacon-node/src/execution/engine/http.ts @@ -132,7 +132,7 @@ export class ExecutionEngineHttp implements IExecutionEngine { */ async notifyNewPayload(fork: ForkName, executionPayload: allForks.ExecutionPayload): Promise { const method = - ForkSeq[fork] >= ForkSeq.eip4844 + ForkSeq[fork] >= ForkSeq.deneb ? "engine_newPayloadV3" : ForkSeq[fork] >= ForkSeq.capella ? "engine_newPayloadV2" @@ -289,7 +289,7 @@ export class ExecutionEngineHttp implements IExecutionEngine { payloadId: PayloadId ): Promise<{executionPayload: allForks.ExecutionPayload; blockValue: Wei}> { const method = - ForkSeq[fork] >= ForkSeq.eip4844 + ForkSeq[fork] >= ForkSeq.deneb ? "engine_getPayloadV3" : ForkSeq[fork] >= ForkSeq.capella ? "engine_getPayloadV2" diff --git a/packages/beacon-node/src/execution/engine/interface.ts b/packages/beacon-node/src/execution/engine/interface.ts index 6a996d49bb3f..59daa2a4cc08 100644 --- a/packages/beacon-node/src/execution/engine/interface.ts +++ b/packages/beacon-node/src/execution/engine/interface.ts @@ -1,5 +1,5 @@ import {ForkName} from "@lodestar/params"; -import {KZGCommitment, Blob} from "@lodestar/types/eip4844"; +import {KZGCommitment, Blob} from "@lodestar/types/deneb"; import {RootHex, allForks, capella, Wei} from "@lodestar/types"; import {DATA, QUANTITY} from "../../eth1/provider/utils.js"; diff --git a/packages/beacon-node/src/execution/engine/mock.ts b/packages/beacon-node/src/execution/engine/mock.ts index feb4e5b53147..1de8e352f54f 100644 --- a/packages/beacon-node/src/execution/engine/mock.ts +++ b/packages/beacon-node/src/execution/engine/mock.ts @@ -4,7 +4,7 @@ import { OPAQUE_TX_BLOB_VERSIONED_HASHES_OFFSET, OPAQUE_TX_MESSAGE_OFFSET, } from "@lodestar/state-transition"; -import {bellatrix, eip4844, RootHex, ssz} from "@lodestar/types"; +import {bellatrix, deneb, RootHex, ssz} from "@lodestar/types"; import {fromHex, toHex} from "@lodestar/utils"; import { BYTES_PER_FIELD_ELEMENT, @@ -37,7 +37,7 @@ export type ExecutionEngineMockOpts = { genesisBlockHash: string; onlyPredefinedResponses?: boolean; capellaForkTimestamp?: number; - eip4844ForkTimestamp?: number; + denebForkTimestamp?: number; }; type ExecutionBlock = { @@ -292,13 +292,13 @@ export class ExecutionEngineMockBackend implements IJsonRpcBackend { executionPayload.transactions.push(tx); } - const kzgs: eip4844.KZGCommitment[] = []; - const blobs: eip4844.Blob[] = []; + const kzgs: deneb.KZGCommitment[] = []; + const blobs: deneb.Blob[] = []; - // if post eip4844, add between 0 and 2 blob transactions - if (ForkSeq[fork] >= ForkSeq.eip4844) { - const eip4844TxCount = Math.round(2 * Math.random()); - for (let i = 0; i < eip4844TxCount; i++) { + // if post deneb, add between 0 and 2 blob transactions + if (ForkSeq[fork] >= ForkSeq.deneb) { + const denebTxCount = Math.round(2 * Math.random()); + for (let i = 0; i < denebTxCount; i++) { const blob = generateRandomBlob(); const kzg = ckzg.blobToKzgCommitment(blob); executionPayload.transactions.push(transactionForKzgCommitment(kzg)); @@ -391,13 +391,13 @@ export class ExecutionEngineMockBackend implements IJsonRpcBackend { } private timestampToFork(timestamp: number): ForkExecution { - if (timestamp > (this.opts.eip4844ForkTimestamp ?? Infinity)) return ForkName.eip4844; + if (timestamp > (this.opts.denebForkTimestamp ?? Infinity)) return ForkName.deneb; if (timestamp > (this.opts.capellaForkTimestamp ?? Infinity)) return ForkName.capella; return ForkName.bellatrix; } } -function transactionForKzgCommitment(kzgCommitment: eip4844.KZGCommitment): bellatrix.Transaction { +function transactionForKzgCommitment(kzgCommitment: deneb.KZGCommitment): bellatrix.Transaction { // Some random value that after the offset's position const blobVersionedHashesOffset = OPAQUE_TX_BLOB_VERSIONED_HASHES_OFFSET + 64; @@ -423,7 +423,7 @@ function transactionForKzgCommitment(kzgCommitment: eip4844.KZGCommitment): bell /** * Generate random blob of sequential integers such that each element is < BLS_MODULUS */ -function generateRandomBlob(): eip4844.Blob { +function generateRandomBlob(): deneb.Blob { const blob = new Uint8Array(FIELD_ELEMENTS_PER_BLOB * BYTES_PER_FIELD_ELEMENT); const dv = new DataView(blob.buffer, blob.byteOffset, blob.byteLength); for (let i = 0; i < FIELD_ELEMENTS_PER_BLOB; i++) { diff --git a/packages/beacon-node/src/execution/engine/types.ts b/packages/beacon-node/src/execution/engine/types.ts index 629a10e87e58..8c08682db5f6 100644 --- a/packages/beacon-node/src/execution/engine/types.ts +++ b/packages/beacon-node/src/execution/engine/types.ts @@ -1,4 +1,4 @@ -import {allForks, capella, eip4844, Wei} from "@lodestar/types"; +import {allForks, capella, deneb, Wei} from "@lodestar/types"; import { BYTES_PER_LOGS_BLOOM, FIELD_ELEMENTS_PER_BLOB, @@ -112,7 +112,7 @@ export type ExecutionPayloadRpc = { blockHash: DATA; // 32 bytes transactions: DATA[]; withdrawals?: WithdrawalRpc[]; // Capella hardfork - excessDataGas?: QUANTITY; // EIP-4844 + excessDataGas?: QUANTITY; // DENEB }; export type WithdrawalRpc = { @@ -162,9 +162,9 @@ export function serializeExecutionPayload(fork: ForkName, data: allForks.Executi payload.withdrawals = withdrawals.map(serializeWithdrawal); } - // EIP-4844 adds excessDataGas to the ExecutionPayload - if ((data as eip4844.ExecutionPayload).excessDataGas !== undefined) { - payload.excessDataGas = numToQuantity((data as eip4844.ExecutionPayload).excessDataGas); + // DENEB adds excessDataGas to the ExecutionPayload + if ((data as deneb.ExecutionPayload).excessDataGas !== undefined) { + payload.excessDataGas = numToQuantity((data as deneb.ExecutionPayload).excessDataGas); } return payload; @@ -217,14 +217,14 @@ export function parseExecutionPayload( (executionPayload as capella.ExecutionPayload).withdrawals = withdrawals.map((w) => deserializeWithdrawal(w)); } - // EIP-4844 adds excessDataGas to the ExecutionPayload - if (ForkSeq[fork] >= ForkSeq.eip4844) { + // DENEB adds excessDataGas to the ExecutionPayload + if (ForkSeq[fork] >= ForkSeq.deneb) { if (data.excessDataGas == null) { throw Error( - `excessDataGas missing for ${fork} >= eip4844 executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}` + `excessDataGas missing for ${fork} >= deneb executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}` ); } - (executionPayload as eip4844.ExecutionPayload).excessDataGas = quantityToBigint(data.excessDataGas); + (executionPayload as deneb.ExecutionPayload).excessDataGas = quantityToBigint(data.excessDataGas); } return {executionPayload, blockValue}; diff --git a/packages/beacon-node/src/network/gossip/gossipsub.ts b/packages/beacon-node/src/network/gossip/gossipsub.ts index 85c63badd9e9..8b44d4499823 100644 --- a/packages/beacon-node/src/network/gossip/gossipsub.ts +++ b/packages/beacon-node/src/network/gossip/gossipsub.ts @@ -4,7 +4,7 @@ import {PeerScore, PeerScoreParams} from "@chainsafe/libp2p-gossipsub/score"; import {MetricsRegister, TopicLabel, TopicStrToLabel} from "@chainsafe/libp2p-gossipsub/metrics"; import {IBeaconConfig} from "@lodestar/config"; import {ATTESTATION_SUBNET_COUNT, ForkName, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; -import {allForks, altair, phase0, capella, eip4844} from "@lodestar/types"; +import {allForks, altair, phase0, capella, deneb} from "@lodestar/types"; import {ILogger, Map2d, Map2dArr} from "@lodestar/utils"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; @@ -199,7 +199,7 @@ export class Eth2Gossipsub extends GossipSub { await this.publishObject({type: GossipType.beacon_block, fork}, signedBlock); } - async publishSignedBeaconBlockAndBlobsSidecar(item: eip4844.SignedBeaconBlockAndBlobsSidecar): Promise { + async publishSignedBeaconBlockAndBlobsSidecar(item: deneb.SignedBeaconBlockAndBlobsSidecar): Promise { const fork = this.config.getForkName(item.beaconBlock.message.slot); await this.publishObject( {type: GossipType.beacon_block_and_blobs_sidecar, fork}, diff --git a/packages/beacon-node/src/network/gossip/handlers/index.ts b/packages/beacon-node/src/network/gossip/handlers/index.ts index c5dba75f4b96..79dde50e7d92 100644 --- a/packages/beacon-node/src/network/gossip/handlers/index.ts +++ b/packages/beacon-node/src/network/gossip/handlers/index.ts @@ -165,25 +165,25 @@ export function getGossipHandlers(modules: ValidatorFnsModules, options: GossipH return { [GossipType.beacon_block]: async (signedBlock, topic, peerIdStr, seenTimestampSec) => { - // TODO EIP-4844: Can blocks be received by this topic? - if (config.getForkSeq(signedBlock.message.slot) >= ForkSeq.eip4844) { - throw new GossipActionError(GossipAction.REJECT, {code: "POST_EIP4844_BLOCK"}); + // TODO Deneb: Can blocks be received by this topic? + if (config.getForkSeq(signedBlock.message.slot) >= ForkSeq.deneb) { + throw new GossipActionError(GossipAction.REJECT, {code: "POST_DENEB_BLOCK"}); } - const blockInput = getBlockInput.preEIP4844(config, signedBlock); + const blockInput = getBlockInput.preDeneb(config, signedBlock); await validateBeaconBlock(blockInput, topic.fork, peerIdStr, seenTimestampSec); handleValidBeaconBlock(blockInput, peerIdStr, seenTimestampSec); }, [GossipType.beacon_block_and_blobs_sidecar]: async (blockAndBlocks, topic, peerIdStr, seenTimestampSec) => { const {beaconBlock, blobsSidecar} = blockAndBlocks; - // TODO EIP-4844: Should throw for pre fork blocks? - if (config.getForkSeq(beaconBlock.message.slot) < ForkSeq.eip4844) { - throw new GossipActionError(GossipAction.REJECT, {code: "PRE_EIP4844_BLOCK"}); + // TODO Deneb: Should throw for pre fork blocks? + if (config.getForkSeq(beaconBlock.message.slot) < ForkSeq.deneb) { + throw new GossipActionError(GossipAction.REJECT, {code: "PRE_DENEB_BLOCK"}); } // Validate block + blob. Then forward, then handle both - const blockInput = getBlockInput.postEIP4844(config, beaconBlock, blobsSidecar); + const blockInput = getBlockInput.postDeneb(config, beaconBlock, blobsSidecar); await validateBeaconBlock(blockInput, topic.fork, peerIdStr, seenTimestampSec); validateGossipBlobsSidecar(beaconBlock, blobsSidecar); handleValidBeaconBlock(blockInput, peerIdStr, seenTimestampSec); diff --git a/packages/beacon-node/src/network/gossip/interface.ts b/packages/beacon-node/src/network/gossip/interface.ts index 9ebe784165ae..61ae8e93073c 100644 --- a/packages/beacon-node/src/network/gossip/interface.ts +++ b/packages/beacon-node/src/network/gossip/interface.ts @@ -4,7 +4,7 @@ import {Message, TopicValidatorResult} from "@libp2p/interface-pubsub"; import StrictEventEmitter from "strict-event-emitter-types"; import {PeerIdStr} from "@chainsafe/libp2p-gossipsub/types"; import {ForkName} from "@lodestar/params"; -import {allForks, altair, capella, eip4844, phase0} from "@lodestar/types"; +import {allForks, altair, capella, deneb, phase0} from "@lodestar/types"; import {IBeaconConfig} from "@lodestar/config"; import {ILogger} from "@lodestar/utils"; import {IBeaconChain} from "../../chain/index.js"; @@ -67,7 +67,7 @@ export type GossipTopic = GossipTopicMap[keyof GossipTopicMap]; export type GossipTypeMap = { [GossipType.beacon_block]: allForks.SignedBeaconBlock; - [GossipType.beacon_block_and_blobs_sidecar]: eip4844.SignedBeaconBlockAndBlobsSidecar; + [GossipType.beacon_block_and_blobs_sidecar]: deneb.SignedBeaconBlockAndBlobsSidecar; [GossipType.beacon_aggregate_and_proof]: phase0.SignedAggregateAndProof; [GossipType.beacon_attestation]: phase0.Attestation; [GossipType.voluntary_exit]: phase0.SignedVoluntaryExit; @@ -83,7 +83,7 @@ export type GossipTypeMap = { export type GossipFnByType = { [GossipType.beacon_block]: (signedBlock: allForks.SignedBeaconBlock) => Promise | void; [GossipType.beacon_block_and_blobs_sidecar]: ( - signedBeaconBlockAndBlobsSidecar: eip4844.SignedBeaconBlockAndBlobsSidecar + signedBeaconBlockAndBlobsSidecar: deneb.SignedBeaconBlockAndBlobsSidecar ) => Promise | void; [GossipType.beacon_aggregate_and_proof]: (aggregateAndProof: phase0.SignedAggregateAndProof) => Promise | void; [GossipType.beacon_attestation]: (attestation: phase0.Attestation) => Promise | void; diff --git a/packages/beacon-node/src/network/gossip/topic.ts b/packages/beacon-node/src/network/gossip/topic.ts index d8a9e9fe62d4..650aa2b49d80 100644 --- a/packages/beacon-node/src/network/gossip/topic.ts +++ b/packages/beacon-node/src/network/gossip/topic.ts @@ -76,7 +76,7 @@ export function getGossipSSZType(topic: GossipTopic) { // beacon_block is updated in altair to support the updated SignedBeaconBlock type return ssz[topic.fork].SignedBeaconBlock; case GossipType.beacon_block_and_blobs_sidecar: - return ssz.eip4844.SignedBeaconBlockAndBlobsSidecar; + return ssz.deneb.SignedBeaconBlockAndBlobsSidecar; case GossipType.beacon_aggregate_and_proof: return ssz.phase0.SignedAggregateAndProof; case GossipType.beacon_attestation: @@ -170,8 +170,8 @@ export function getCoreTopicsAtFork( {type: GossipType.attester_slashing}, ]; - // After EIP4844 only track beacon_block_and_blobs_sidecar topic - if (ForkSeq[fork] < ForkSeq.eip4844) { + // After Deneb only track beacon_block_and_blobs_sidecar topic + if (ForkSeq[fork] < ForkSeq.deneb) { topics.push({type: GossipType.beacon_block}); } else { topics.push({type: GossipType.beacon_block_and_blobs_sidecar}); diff --git a/packages/beacon-node/src/network/gossip/validation/queue.ts b/packages/beacon-node/src/network/gossip/validation/queue.ts index 84030d101fc5..4a0c7eba4839 100644 --- a/packages/beacon-node/src/network/gossip/validation/queue.ts +++ b/packages/beacon-node/src/network/gossip/validation/queue.ts @@ -11,7 +11,7 @@ const gossipQueueOpts: { } = { // validation gossip block asap [GossipType.beacon_block]: {maxLength: 1024, type: QueueType.FIFO, noYieldIfOneItem: true}, - // TODO EIP-4844: What's a good queue max given that now blocks are much bigger? + // TODO DENEB: What's a good queue max given that now blocks are much bigger? [GossipType.beacon_block_and_blobs_sidecar]: {maxLength: 32, type: QueueType.FIFO, noYieldIfOneItem: true}, // lighthoue has aggregate_queue 4096 and unknown_block_aggregate_queue 1024, we use single queue [GossipType.beacon_aggregate_and_proof]: {maxLength: 5120, type: QueueType.LIFO, maxConcurrency: 16}, diff --git a/packages/beacon-node/src/network/network.ts b/packages/beacon-node/src/network/network.ts index 9ebb1317d412..3ea70858cc36 100644 --- a/packages/beacon-node/src/network/network.ts +++ b/packages/beacon-node/src/network/network.ts @@ -6,7 +6,7 @@ import {ILogger, sleep} from "@lodestar/utils"; import {ATTESTATION_SUBNET_COUNT, ForkName, ForkSeq, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {ENR} from "@chainsafe/discv5"; import {computeEpochAtSlot, computeTimeAtSlot} from "@lodestar/state-transition"; -import {altair, eip4844, Epoch, phase0} from "@lodestar/types"; +import {altair, deneb, Epoch, phase0} from "@lodestar/types"; import {routes} from "@lodestar/api"; import {IMetrics} from "../metrics/index.js"; import {ChainEvent, IBeaconChain, IBeaconClock} from "../chain/index.js"; @@ -217,16 +217,16 @@ export class Network implements INetwork { publishBeaconBlockMaybeBlobs(blockInput: BlockInput): Promise { switch (blockInput.type) { - case BlockInputType.preEIP4844: + case BlockInputType.preDeneb: return this.gossip.publishBeaconBlock(blockInput.block); - case BlockInputType.postEIP4844: + case BlockInputType.postDeneb: return this.gossip.publishSignedBeaconBlockAndBlobsSidecar({ - beaconBlock: blockInput.block as eip4844.SignedBeaconBlock, + beaconBlock: blockInput.block as deneb.SignedBeaconBlock, blobsSidecar: blockInput.blobs, }); - case BlockInputType.postEIP4844OldBlobs: + case BlockInputType.postDenebOldBlobs: throw Error(`Attempting to broadcast old BlockInput slot ${blockInput.block.message.slot}`); } } @@ -239,22 +239,22 @@ export class Network implements INetwork { } async beaconBlocksMaybeBlobsByRoot(peerId: PeerId, request: phase0.BeaconBlocksByRootRequest): Promise { - // Assume all requests are post EIP-4844 - if (this.config.getForkSeq(this.chain.forkChoice.getFinalizedBlock().slot) >= ForkSeq.eip4844) { + // Assume all requests are post Deneb + if (this.config.getForkSeq(this.chain.forkChoice.getFinalizedBlock().slot) >= ForkSeq.deneb) { const blocksAndBlobs = await this.reqResp.beaconBlockAndBlobsSidecarByRoot(peerId, request); return blocksAndBlobs.map(({beaconBlock, blobsSidecar}) => - getBlockInput.postEIP4844(this.config, beaconBlock, blobsSidecar) + getBlockInput.postDeneb(this.config, beaconBlock, blobsSidecar) ); } - // Assume all request are pre EIP-4844 - else if (this.config.getForkSeq(this.clock.currentSlot) < ForkSeq.eip4844) { + // Assume all request are pre Deneb + else if (this.config.getForkSeq(this.clock.currentSlot) < ForkSeq.deneb) { const blocks = await this.reqResp.beaconBlocksByRoot(peerId, request); - return blocks.map((block) => getBlockInput.preEIP4844(this.config, block)); + return blocks.map((block) => getBlockInput.preDeneb(this.config, block)); } - // NOTE: Consider blocks may be post or pre EIP-4844 - // TODO EIP-4844: Request either blocks, or blocks+blobs + // NOTE: Consider blocks may be post or pre Deneb + // TODO Deneb: Request either blocks, or blocks+blobs else { const results = await Promise.all( request.map( @@ -266,7 +266,7 @@ export class Network implements INetwork { if (resultBlockBlobs.status === "fulfilled" && resultBlockBlobs.value.length === 1) { const {beaconBlock, blobsSidecar} = resultBlockBlobs.value[0]; - return getBlockInput.postEIP4844(this.config, beaconBlock, blobsSidecar); + return getBlockInput.postDeneb(this.config, beaconBlock, blobsSidecar); } if (resultBlocks.status === "rejected") { @@ -280,20 +280,20 @@ export class Network implements INetwork { const block = resultBlocks.value[0]; - if (this.config.getForkSeq(block.message.slot) >= ForkSeq.eip4844) { + if (this.config.getForkSeq(block.message.slot) >= ForkSeq.deneb) { // beaconBlockAndBlobsSidecarByRoot should have succeeded if (resultBlockBlobs.status === "rejected") { // Recycle existing error for beaconBlockAndBlobsSidecarByRoot if any return Promise.reject(resultBlockBlobs.reason); } else { throw Error( - `Received post EIP-4844 ${beaconBlockRoot} over beaconBlocksByRoot not beaconBlockAndBlobsSidecarByRoot` + `Received post Deneb ${beaconBlockRoot} over beaconBlocksByRoot not beaconBlockAndBlobsSidecarByRoot` ); } } - // Block is pre EIP-4844 - return getBlockInput.preEIP4844(this.config, block); + // Block is pre Deneb + return getBlockInput.preDeneb(this.config, block); } ) ); @@ -468,8 +468,8 @@ export class Network implements INetwork { {type: GossipType.attester_slashing}, ]; - // After EIP4844 only track beacon_block_and_blobs_sidecar topic - if (ForkSeq[fork] < ForkSeq.eip4844) { + // After Deneb only track beacon_block_and_blobs_sidecar topic + if (ForkSeq[fork] < ForkSeq.deneb) { topics.push({type: GossipType.beacon_block}); } else { topics.push({type: GossipType.beacon_block_and_blobs_sidecar}); diff --git a/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts b/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts index 7f1ba6d04518..1929ed22e253 100644 --- a/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts +++ b/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts @@ -14,7 +14,7 @@ import { } from "@lodestar/reqresp"; import {ReqRespOpts} from "@lodestar/reqresp/lib/ReqResp.js"; import * as reqRespProtocols from "@lodestar/reqresp/protocols"; -import {allForks, altair, eip4844, phase0, Root} from "@lodestar/types"; +import {allForks, altair, deneb, phase0, Root} from "@lodestar/types"; import {ILogger} from "@lodestar/utils"; import {IMetrics} from "../../metrics/metrics.js"; import {INetworkEventBus, NetworkEvent} from "../events.js"; @@ -254,10 +254,10 @@ export class ReqRespBeaconNode extends ReqResp implements IReqRespBeaconNode { async blobsSidecarsByRange( peerId: PeerId, - request: eip4844.BlobsSidecarsByRangeRequest - ): Promise { + request: deneb.BlobsSidecarsByRangeRequest + ): Promise { return collectMaxResponse( - this.sendRequest( + this.sendRequest( peerId, ReqRespMethod.BlobsSidecarsByRange, [Version.V1], @@ -269,10 +269,10 @@ export class ReqRespBeaconNode extends ReqResp implements IReqRespBeaconNode { async beaconBlockAndBlobsSidecarByRoot( peerId: PeerId, - request: eip4844.BeaconBlockAndBlobsSidecarByRootRequest - ): Promise { + request: deneb.BeaconBlockAndBlobsSidecarByRootRequest + ): Promise { return collectMaxResponse( - this.sendRequest( + this.sendRequest( peerId, ReqRespMethod.BeaconBlockAndBlobsSidecarByRoot, [Version.V1], @@ -319,7 +319,7 @@ export class ReqRespBeaconNode extends ReqResp implements IReqRespBeaconNode { ); } - if (ForkSeq[fork] >= ForkSeq.eip4844) { + if (ForkSeq[fork] >= ForkSeq.deneb) { protocols.push( reqRespProtocols.BeaconBlockAndBlobsSidecarByRoot( modules, diff --git a/packages/beacon-node/src/network/reqresp/doBeaconBlocksMaybeBlobsByRange.ts b/packages/beacon-node/src/network/reqresp/doBeaconBlocksMaybeBlobsByRange.ts index aeb0fb89fa5f..ea3fe659a998 100644 --- a/packages/beacon-node/src/network/reqresp/doBeaconBlocksMaybeBlobsByRange.ts +++ b/packages/beacon-node/src/network/reqresp/doBeaconBlocksMaybeBlobsByRange.ts @@ -1,6 +1,6 @@ import {PeerId} from "@libp2p/interface-peer-id"; import {IBeaconConfig} from "@lodestar/config"; -import {eip4844, Epoch, phase0} from "@lodestar/types"; +import {deneb, Epoch, phase0} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; import {computeEpochAtSlot} from "@lodestar/state-transition"; @@ -15,16 +15,16 @@ export async function doBeaconBlocksMaybeBlobsByRange( request: phase0.BeaconBlocksByRangeRequest, currentEpoch: Epoch ): Promise { - // TODO EIP-4844: Assumes all blocks in the same epoch - // TODO EIP-4844: Ensure all blocks are in the same epoch - if (config.getForkSeq(request.startSlot) < ForkSeq.eip4844) { + // TODO Deneb: Assumes all blocks in the same epoch + // TODO Deneb: Ensure all blocks are in the same epoch + if (config.getForkSeq(request.startSlot) < ForkSeq.deneb) { const blocks = await reqResp.beaconBlocksByRange(peerId, request); - return blocks.map((block) => getBlockInput.preEIP4844(config, block)); + return blocks.map((block) => getBlockInput.preDeneb(config, block)); } // Only request blobs if they are recent enough else if (computeEpochAtSlot(request.startSlot) >= currentEpoch - config.MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS) { - // TODO EIP-4844: Do two requests at once for blocks and blobs + // TODO Deneb: Do two requests at once for blocks and blobs const blocks = await reqResp.beaconBlocksByRange(peerId, request); const blobsSidecars = await reqResp.blobsSidecarsByRange(peerId, request); @@ -42,7 +42,7 @@ export async function doBeaconBlocksMaybeBlobsByRange( // Assuming that the blocks and blobs will come in same sorted order for (let i = 0; i < blocks.length; i++) { const block = blocks[i]; - let blobsSidecar: eip4844.BlobsSidecar; + let blobsSidecar: deneb.BlobsSidecar; if (blobsSidecars[blobSideCarIndex]?.beaconBlockSlot === block.message.slot) { blobsSidecar = blobsSidecars[blobSideCarIndex]; @@ -50,7 +50,7 @@ export async function doBeaconBlocksMaybeBlobsByRange( blobSideCarIndex++; } else { // Quick inspect if the blobsSidecar was expected - const blobKzgCommitmentsLen = (block.message.body as eip4844.BeaconBlockBody).blobKzgCommitments.length; + const blobKzgCommitmentsLen = (block.message.body as deneb.BeaconBlockBody).blobKzgCommitments.length; if (blobKzgCommitmentsLen !== 0) { throw Error( `Missing blobsSidecar for blockSlot=${block.message.slot} with blobKzgCommitmentsLen=${blobKzgCommitmentsLen}` @@ -63,7 +63,7 @@ export async function doBeaconBlocksMaybeBlobsByRange( kzgAggregatedProof: emptyKzgAggregatedProof, }; } - blockInputs.push(getBlockInput.postEIP4844(config, block, blobsSidecar)); + blockInputs.push(getBlockInput.postDeneb(config, block, blobsSidecar)); } // If there are still unconsumed blobs this means that the response was inconsistent @@ -80,9 +80,9 @@ export async function doBeaconBlocksMaybeBlobsByRange( return blockInputs; } - // Post EIP-4844 but old blobs + // Post Deneb but old blobs else { const blocks = await reqResp.beaconBlocksByRange(peerId, request); - return blocks.map((block) => getBlockInput.postEIP4844OldBlobs(config, block)); + return blocks.map((block) => getBlockInput.postDenebOldBlobs(config, block)); } } diff --git a/packages/beacon-node/src/network/reqresp/handlers/beaconBlockAndBlobsSidecarByRoot.ts b/packages/beacon-node/src/network/reqresp/handlers/beaconBlockAndBlobsSidecarByRoot.ts index 34b45366f2f0..13147a47fde4 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/beaconBlockAndBlobsSidecarByRoot.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/beaconBlockAndBlobsSidecarByRoot.ts @@ -1,15 +1,15 @@ import {ContextBytesType, EncodedPayload, EncodedPayloadType} from "@lodestar/reqresp"; -import {eip4844} from "@lodestar/types"; +import {deneb} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; import {getSlotFromBytes} from "../../../util/multifork.js"; export async function* onBeaconBlockAndBlobsSidecarByRoot( - requestBody: eip4844.BeaconBlockAndBlobsSidecarByRootRequest, + requestBody: deneb.BeaconBlockAndBlobsSidecarByRootRequest, chain: IBeaconChain, db: IBeaconDb -): AsyncIterable> { +): AsyncIterable> { const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot; for (const blockRoot of requestBody) { diff --git a/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts b/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts index afc223ea8275..d7d6312c1e31 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts @@ -1,6 +1,6 @@ import {GENESIS_SLOT, MAX_REQUEST_BLOCKS} from "@lodestar/params"; import {ContextBytesType, EncodedPayloadBytes, EncodedPayloadType, ResponseError, RespStatus} from "@lodestar/reqresp"; -import {eip4844, phase0} from "@lodestar/types"; +import {deneb, phase0} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; @@ -19,7 +19,7 @@ export function onBeaconBlocksByRange( } export async function* onBlocksOrBlobsSidecarsByRange( - request: eip4844.BlobsSidecarsByRangeRequest, + request: deneb.BlobsSidecarsByRangeRequest, chain: IBeaconChain, db: { finalized: Pick; @@ -37,7 +37,7 @@ export async function* onBlocksOrBlobsSidecarsByRange( const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot; // Finalized range of blobs - // TODO EIP-4844: Should the finalized block be included here or below? + // TODO DENEB: Should the finalized block be included here or below? if (startSlot <= finalizedSlot) { // Chain of blobs won't change @@ -57,7 +57,7 @@ export async function* onBlocksOrBlobsSidecarsByRange( if (endSlot > finalizedSlot) { const headRoot = chain.forkChoice.getHeadRoot(); - // TODO EIP-4844: forkChoice should mantain an array of canonical blocks, and change only on reorg + // TODO DENEB: forkChoice should mantain an array of canonical blocks, and change only on reorg const headChain = chain.forkChoice.getAllAncestorBlocks(headRoot); // Iterate head chain with ascending block numbers @@ -96,8 +96,8 @@ export async function* onBlocksOrBlobsSidecarsByRange( } export function validateBeaconBlocksByRangeRequest( - request: eip4844.BlobsSidecarsByRangeRequest -): eip4844.BlobsSidecarsByRangeRequest { + request: deneb.BlobsSidecarsByRangeRequest +): deneb.BlobsSidecarsByRangeRequest { const {startSlot} = request; let {count} = request; diff --git a/packages/beacon-node/src/network/reqresp/handlers/blobsSidecarsByRange.ts b/packages/beacon-node/src/network/reqresp/handlers/blobsSidecarsByRange.ts index e54fe62bd8d3..dbf389ba2134 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/blobsSidecarsByRange.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/blobsSidecarsByRange.ts @@ -1,13 +1,13 @@ -import {eip4844} from "@lodestar/types"; +import {deneb} from "@lodestar/types"; import {EncodedPayloadBytes} from "@lodestar/reqresp"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; import {onBlocksOrBlobsSidecarsByRange} from "./beaconBlocksByRange.js"; -// TODO EIP-4844: Unit test +// TODO DENEB: Unit test export function onBlobsSidecarsByRange( - request: eip4844.BlobsSidecarsByRangeRequest, + request: deneb.BlobsSidecarsByRangeRequest, chain: IBeaconChain, db: IBeaconDb ): AsyncIterable { diff --git a/packages/beacon-node/src/network/reqresp/interface.ts b/packages/beacon-node/src/network/reqresp/interface.ts index 554b58c9f6bd..2cb9529b5674 100644 --- a/packages/beacon-node/src/network/reqresp/interface.ts +++ b/packages/beacon-node/src/network/reqresp/interface.ts @@ -1,5 +1,5 @@ import {PeerId} from "@libp2p/interface-peer-id"; -import {allForks, altair, eip4844, phase0} from "@lodestar/types"; +import {allForks, altair, deneb, phase0} from "@lodestar/types"; export interface IReqRespBeaconNode { start(): void; @@ -13,11 +13,11 @@ export interface IReqRespBeaconNode { request: phase0.BeaconBlocksByRangeRequest ): Promise; beaconBlocksByRoot(peerId: PeerId, request: phase0.BeaconBlocksByRootRequest): Promise; - blobsSidecarsByRange(peerId: PeerId, request: eip4844.BlobsSidecarsByRangeRequest): Promise; + blobsSidecarsByRange(peerId: PeerId, request: deneb.BlobsSidecarsByRangeRequest): Promise; beaconBlockAndBlobsSidecarByRoot( peerId: PeerId, - request: eip4844.BeaconBlockAndBlobsSidecarByRootRequest - ): Promise; + request: deneb.BeaconBlockAndBlobsSidecarByRootRequest + ): Promise; lightClientBootstrap(peerId: PeerId, request: Uint8Array): Promise; lightClientOptimisticUpdate(peerId: PeerId): Promise; lightClientFinalityUpdate(peerId: PeerId): Promise; diff --git a/packages/beacon-node/src/node/nodejs.ts b/packages/beacon-node/src/node/nodejs.ts index 93c7cd4b544c..e4c6706e3da8 100644 --- a/packages/beacon-node/src/node/nodejs.ts +++ b/packages/beacon-node/src/node/nodejs.ts @@ -140,9 +140,9 @@ export class BeaconNode { setMaxListeners(Infinity, controller.signal); const signal = controller.signal; - // TODO EIP-4844, where is the best place to do this? + // TODO DENEB, where is the best place to do this? if (config.EIP4844_FORK_EPOCH < Infinity) { - // TODO EIP-4844: "c-kzg" is not installed by default, so if the library is not installed this will throw + // 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(); loadEthereumTrustedSetup(); diff --git a/packages/beacon-node/src/sync/unknownBlock.ts b/packages/beacon-node/src/sync/unknownBlock.ts index a6d032506058..fc7dd6570594 100644 --- a/packages/beacon-node/src/sync/unknownBlock.ts +++ b/packages/beacon-node/src/sync/unknownBlock.ts @@ -260,7 +260,7 @@ export class UnknownBlockSync { for (let i = 0; i < MAX_ATTEMPTS_PER_BLOCK; i++) { const peer = shuffledPeers[i % shuffledPeers.length]; try { - // TODO EIP-4844: Use + // TODO DENEB: Use const [blockInput] = await this.network.beaconBlocksMaybeBlobsByRoot(peer, [blockRoot]); // Peer does not have the block, try with next peer 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 9913cf400b5a..a60be56977fb 100644 --- a/packages/beacon-node/test/e2e/api/impl/config.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/config.test.ts @@ -9,8 +9,8 @@ const CONSTANT_NAMES_SKIP_LIST = new Set([ // This constant can also be derived from existing constants so it's not critical. // PARTICIPATION_FLAG_WEIGHTS = [TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT] "PARTICIPATION_FLAG_WEIGHTS", - // TODO EIP-4844: This constant was added then removed on a spec re-write. - // When developing eip-4844 branch the tracked version still doesn't have released the removal + // 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", ]); diff --git a/packages/beacon-node/test/e2e/api/impl/getBlobsSidecar.test.ts b/packages/beacon-node/test/e2e/api/impl/getBlobsSidecar.test.ts index 06200ef4f407..d95c776b5b30 100644 --- a/packages/beacon-node/test/e2e/api/impl/getBlobsSidecar.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/getBlobsSidecar.test.ts @@ -14,7 +14,7 @@ describe("getBlobsSideCar", function () { it("getBlobsSideCar", async () => { const block = config.getForkTypes(GENESIS_SLOT).SignedBeaconBlock.defaultValue(); - const blobsSidecar = ssz.eip4844.BlobsSidecar.defaultValue(); + const blobsSidecar = ssz.deneb.BlobsSidecar.defaultValue(); block.message.slot = GENESIS_SLOT; server.dbStub.blockArchive.get.resolves(block); diff --git a/packages/beacon-node/test/e2e/network/eip4844.test.ts b/packages/beacon-node/test/e2e/network/deneb.test.ts similarity index 52% rename from packages/beacon-node/test/e2e/network/eip4844.test.ts rename to packages/beacon-node/test/e2e/network/deneb.test.ts index 242e2de835d3..af99e916c3de 100644 --- a/packages/beacon-node/test/e2e/network/eip4844.test.ts +++ b/packages/beacon-node/test/e2e/network/deneb.test.ts @@ -1,29 +1,29 @@ import {expect} from "chai"; -import {eip4844, ssz} from "@lodestar/types"; +import {deneb, ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {signedBeaconBlockAndBlobsSidecarFromBytes} from "../../../src/network/reqresp/handlers/beaconBlockAndBlobsSidecarByRoot.js"; describe("signedBeaconBlockAndBlobsSidecarFromBytes", () => { it("signedBeaconBlockAndBlobsSidecarFromBytes", () => { - const beaconBlock = ssz.eip4844.SignedBeaconBlock.defaultValue(); - const blobsSidecar = ssz.eip4844.BlobsSidecar.defaultValue(); + const beaconBlock = ssz.deneb.SignedBeaconBlock.defaultValue(); + const blobsSidecar = ssz.deneb.BlobsSidecar.defaultValue(); const signedBeaconBlockAndBlobsSidecarBytes = signedBeaconBlockAndBlobsSidecarFromBytes( - ssz.eip4844.SignedBeaconBlock.serialize(beaconBlock), - ssz.eip4844.BlobsSidecar.serialize(blobsSidecar) + ssz.deneb.SignedBeaconBlock.serialize(beaconBlock), + ssz.deneb.BlobsSidecar.serialize(blobsSidecar) ); - const signedBeaconBlockAndBlobsSidecar: eip4844.SignedBeaconBlockAndBlobsSidecar = { + const signedBeaconBlockAndBlobsSidecar: deneb.SignedBeaconBlockAndBlobsSidecar = { beaconBlock, blobsSidecar, }; expect(toHex(signedBeaconBlockAndBlobsSidecarBytes)).equals( - toHex(ssz.eip4844.SignedBeaconBlockAndBlobsSidecar.serialize(signedBeaconBlockAndBlobsSidecar)), + toHex(ssz.deneb.SignedBeaconBlockAndBlobsSidecar.serialize(signedBeaconBlockAndBlobsSidecar)), "Wrong signedBeaconBlockAndBlobsSidecarBytes" ); // Ensure deserialize does not throw - ssz.eip4844.SignedBeaconBlockAndBlobsSidecar.deserialize(signedBeaconBlockAndBlobsSidecarBytes); + ssz.deneb.SignedBeaconBlockAndBlobsSidecar.deserialize(signedBeaconBlockAndBlobsSidecarBytes); }); }); diff --git a/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts b/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts index 39f75d75c296..a70e43b2e344 100644 --- a/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts +++ b/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts @@ -106,7 +106,7 @@ describe.skip("verify+import blocks - range sync perf test", () => { return chain; }, fn: async (chain) => { - const blocksImport = blocks.value.map((block) => getBlockInput.preEIP4844(chain.config, block)); + const blocksImport = blocks.value.map((block) => getBlockInput.preDeneb(chain.config, block)); await chain.processChainSegment(blocksImport, { // Only skip importing attestations for finalized sync. For head sync attestation are valuable. diff --git a/packages/beacon-node/test/spec/presets/finality.ts b/packages/beacon-node/test/spec/presets/finality.ts index fedc1165cd65..d488ec115d19 100644 --- a/packages/beacon-node/test/spec/presets/finality.ts +++ b/packages/beacon-node/test/spec/presets/finality.ts @@ -23,7 +23,7 @@ export const finality: TestRunnerFn = (fo const signedBlock = testcase[`blocks_${i}`] as bellatrix.SignedBeaconBlock; state = stateTransition(state, signedBlock, { - // TODO EIP-4844: Should assume valid and available for this test? + // TODO DENEB: Should assume valid and available for this test? executionPayloadStatus: ExecutionPayloadStatus.valid, dataAvailableStatus: DataAvailableStatus.available, verifyStateRoot: false, diff --git a/packages/beacon-node/test/spec/presets/fork.ts b/packages/beacon-node/test/spec/presets/fork.ts index 30e722b0c97f..d04521ed263c 100644 --- a/packages/beacon-node/test/spec/presets/fork.ts +++ b/packages/beacon-node/test/spec/presets/fork.ts @@ -30,8 +30,8 @@ export const fork: TestRunnerFn = (forkNext) return slotFns.upgradeStateToBellatrix(preState as CachedBeaconStateAltair); case ForkName.capella: return slotFns.upgradeStateToCapella(preState as CachedBeaconStateBellatrix); - case ForkName.eip4844: - return slotFns.upgradeStateTo4844(preState as CachedBeaconStateCapella); + case ForkName.deneb: + return slotFns.upgradeStateToDeneb(preState as CachedBeaconStateCapella); } }, options: { diff --git a/packages/beacon-node/test/spec/presets/fork_choice.ts b/packages/beacon-node/test/spec/presets/fork_choice.ts index bd9c77741ddf..dd86d6f3e658 100644 --- a/packages/beacon-node/test/spec/presets/fork_choice.ts +++ b/packages/beacon-node/test/spec/presets/fork_choice.ts @@ -148,9 +148,9 @@ export const forkChoiceTest = (opts: {onlyPredefinedResponses: boolean}): TestRu }); const blockImport = - config.getForkSeq(slot) < ForkSeq.eip4844 - ? getBlockInput.preEIP4844(config, signedBlock) - : getBlockInput.postEIP4844OldBlobs(config, signedBlock); + config.getForkSeq(slot) < ForkSeq.deneb + ? getBlockInput.preDeneb(config, signedBlock) + : getBlockInput.postDenebOldBlobs(config, signedBlock); try { await chain.processBlock(blockImport, { diff --git a/packages/beacon-node/test/spec/presets/genesis.ts b/packages/beacon-node/test/spec/presets/genesis.ts index 110a0f7bfa15..2768241d90fa 100644 --- a/packages/beacon-node/test/spec/presets/genesis.ts +++ b/packages/beacon-node/test/spec/presets/genesis.ts @@ -1,5 +1,5 @@ import {expect} from "chai"; -import {phase0, Root, ssz, TimeSeconds, allForks, eip4844} from "@lodestar/types"; +import {phase0, Root, ssz, TimeSeconds, allForks, deneb} from "@lodestar/types"; import {InputType} from "@lodestar/spec-test-util"; import { BeaconStateAllForks, @@ -54,7 +54,7 @@ const genesisInitialization: TestRunnerFn> = executionPayloadStatus: testCase.execution.execution_valid ? ExecutionPayloadStatus.valid : ExecutionPayloadStatus.invalid, - // TODO EIP-4844: Make this value dynamic on fork EIP4844 - dataAvailableStatus: DataAvailableStatus.preEIP4844, + // TODO Deneb: Make this value dynamic on fork Deneb + dataAvailableStatus: DataAvailableStatus.preDeneb, } ); }, diff --git a/packages/beacon-node/test/spec/presets/sanity.ts b/packages/beacon-node/test/spec/presets/sanity.ts index 2e374b6a4804..eb10f3e8de85 100644 --- a/packages/beacon-node/test/spec/presets/sanity.ts +++ b/packages/beacon-node/test/spec/presets/sanity.ts @@ -6,7 +6,7 @@ import { processSlots, stateTransition, } from "@lodestar/state-transition"; -import {allForks, eip4844, ssz} from "@lodestar/types"; +import {allForks, deneb, ssz} from "@lodestar/types"; import {ForkName} from "@lodestar/params"; import {bnToNum} from "@lodestar/utils"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; @@ -62,9 +62,9 @@ export const sanityBlocks: TestRunnerFn getBlockInput.preEIP4844(config, block)), + blocks.map((block) => getBlockInput.preDeneb(config, block)), opts ); return { diff --git a/packages/beacon-node/test/unit/network/doBeaconBlocksMaybeBlobsByRange.test.ts b/packages/beacon-node/test/unit/network/doBeaconBlocksMaybeBlobsByRange.test.ts index 180bc019108e..18fbb8d5e9c5 100644 --- a/packages/beacon-node/test/unit/network/doBeaconBlocksMaybeBlobsByRange.test.ts +++ b/packages/beacon-node/test/unit/network/doBeaconBlocksMaybeBlobsByRange.test.ts @@ -1,7 +1,7 @@ import sinon, {SinonStubbedInstance} from "sinon"; import {expect} from "chai"; import {peerIdFromString} from "@libp2p/peer-id"; -import {ssz, eip4844} from "@lodestar/types"; +import {ssz, deneb} from "@lodestar/types"; import {createIBeaconConfig, createIChainForkConfig, defaultChainConfig} from "@lodestar/config"; import {doBeaconBlocksMaybeBlobsByRange, ReqRespBeaconNode} from "../../../src/network/reqresp/index.js"; @@ -32,18 +32,18 @@ describe("doBeaconBlocksMaybeBlobsByRange", () => { const config = createIBeaconConfig(chainConfig, genesisValidatorsRoot); const rangeRequest = ssz.phase0.BeaconBlocksByRangeRequest.defaultValue(); - const block1 = ssz.eip4844.SignedBeaconBlock.defaultValue(); + const block1 = ssz.deneb.SignedBeaconBlock.defaultValue(); block1.message.slot = 1; - const block2 = ssz.eip4844.SignedBeaconBlock.defaultValue(); + const block2 = ssz.deneb.SignedBeaconBlock.defaultValue(); block2.message.slot = 2; - const blobsSidecar1 = ssz.eip4844.BlobsSidecar.defaultValue(); + const blobsSidecar1 = ssz.deneb.BlobsSidecar.defaultValue(); blobsSidecar1.beaconBlockSlot = 1; - const blobsSidecar2 = ssz.eip4844.BlobsSidecar.defaultValue(); + const blobsSidecar2 = ssz.deneb.BlobsSidecar.defaultValue(); blobsSidecar2.beaconBlockSlot = 2; // Array of testcases which are array of matched blocks with/without (if empty) sidecars - const testCases: [string, [eip4844.SignedBeaconBlock, eip4844.BlobsSidecar | undefined][]][] = [ + const testCases: [string, [deneb.SignedBeaconBlock, deneb.BlobsSidecar | undefined][]][] = [ ["one block with sidecar", [[block1, blobsSidecar1]]], [ "two blocks with sidecar", @@ -56,9 +56,9 @@ describe("doBeaconBlocksMaybeBlobsByRange", () => { ]; testCases.map(([testName, blocksWithBlobs]) => { it(testName, async () => { - const blocks = blocksWithBlobs.map(([block, _blobs]) => block as eip4844.SignedBeaconBlock); + const blocks = blocksWithBlobs.map(([block, _blobs]) => block as deneb.SignedBeaconBlock); const blobsSidecars = blocksWithBlobs - .map(([_block, blobs]) => blobs as eip4844.BlobsSidecar) + .map(([_block, blobs]) => blobs as deneb.BlobsSidecar) .filter((blobs) => blobs !== undefined); const emptyKzgAggregatedProof = ckzg.computeAggregateKzgProof([]); const expectedResponse = blocksWithBlobs.map(([block, blobsSidecar]) => { @@ -66,13 +66,13 @@ describe("doBeaconBlocksMaybeBlobsByRange", () => { blobsSidecar !== undefined ? blobsSidecar : { - beaconBlockRoot: ssz.eip4844.BeaconBlock.hashTreeRoot(block.message), + beaconBlockRoot: ssz.deneb.BeaconBlock.hashTreeRoot(block.message), beaconBlockSlot: block.message.slot, blobs: [], kzgAggregatedProof: emptyKzgAggregatedProof, }; return { - type: BlockInputType.postEIP4844, + type: BlockInputType.postDeneb, block, blobs, }; diff --git a/packages/beacon-node/test/unit/network/fork.test.ts b/packages/beacon-node/test/unit/network/fork.test.ts index c631969507c0..b4c5ed35cee8 100644 --- a/packages/beacon-node/test/unit/network/fork.test.ts +++ b/packages/beacon-node/test/unit/network/fork.test.ts @@ -8,13 +8,13 @@ function getForkConfig({ altair, bellatrix, capella, - eip4844, + deneb, }: { phase0: number; altair: number; bellatrix: number; capella: number; - eip4844: number; + deneb: number; }): IBeaconConfig { const forks: Record = { phase0: { @@ -49,10 +49,10 @@ function getForkConfig({ prevVersion: Buffer.from([0, 0, 0, 2]), prevForkName: ForkName.bellatrix, }, - eip4844: { - name: ForkName.eip4844, - seq: ForkSeq.eip4844, - epoch: eip4844, + deneb: { + name: ForkName.deneb, + seq: ForkSeq.deneb, + epoch: deneb, version: Buffer.from([0, 0, 0, 4]), prevVersion: Buffer.from([0, 0, 0, 3]), prevForkName: ForkName.capella, @@ -132,11 +132,11 @@ const testScenarios = [ for (const testScenario of testScenarios) { const {phase0, altair, bellatrix, capella, testCases} = testScenario; - // TODO EIP-4844: Is it necessary to test? - const eip4844 = Infinity; + // TODO DENEB: Is it necessary to test? + const deneb = Infinity; describe(`network / fork: phase0: ${phase0}, altair: ${altair}, bellatrix: ${bellatrix} capella: ${capella}`, () => { - const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, eip4844}); + const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb}); const forks = forkConfig.forks; for (const testCase of testCases) { const {epoch, currentFork, nextFork, activeForks} = testCase; diff --git a/packages/beacon-node/test/unit/network/gossip/topic.test.ts b/packages/beacon-node/test/unit/network/gossip/topic.test.ts index 387238341891..7eb037a8fe43 100644 --- a/packages/beacon-node/test/unit/network/gossip/topic.test.ts +++ b/packages/beacon-node/test/unit/network/gossip/topic.test.ts @@ -17,7 +17,7 @@ describe("network / gossip / topic", function () { ], [GossipType.beacon_block_and_blobs_sidecar]: [ { - topic: {type: GossipType.beacon_block_and_blobs_sidecar, fork: ForkName.eip4844, encoding}, + topic: {type: GossipType.beacon_block_and_blobs_sidecar, fork: ForkName.deneb, encoding}, topicStr: "/eth2/46acb19a/beacon_block_and_blobs_sidecar/ssz_snappy", }, ], diff --git a/packages/beacon-node/test/unit/sync/range/batch.test.ts b/packages/beacon-node/test/unit/sync/range/batch.test.ts index 54b7614a24fc..1cc55b4f6f31 100644 --- a/packages/beacon-node/test/unit/sync/range/batch.test.ts +++ b/packages/beacon-node/test/unit/sync/range/batch.test.ts @@ -12,7 +12,7 @@ describe("sync / range / batch", async () => { // Common mock data const startEpoch = 0; const peer = await createSecp256k1PeerId(); - const blocksDownloaded = [getBlockInput.preEIP4844(config, ssz.phase0.SignedBeaconBlock.defaultValue())]; + const blocksDownloaded = [getBlockInput.preDeneb(config, ssz.phase0.SignedBeaconBlock.defaultValue())]; it("Should return correct blockByRangeRequest", () => { const batch = new Batch(startEpoch, config); diff --git a/packages/beacon-node/test/unit/sync/range/chain.test.ts b/packages/beacon-node/test/unit/sync/range/chain.test.ts index 03b675f9a7d5..cefdbbb00be9 100644 --- a/packages/beacon-node/test/unit/sync/range/chain.test.ts +++ b/packages/beacon-node/test/unit/sync/range/chain.test.ts @@ -83,7 +83,7 @@ describe("sync / range / chain", () => { const shouldReject = badBlocks?.has(i); if (shouldReject) badBlocks?.delete(i); blocks.push( - getBlockInput.preEIP4844(config, { + getBlockInput.preDeneb(config, { message: generateEmptyBlock(i), signature: shouldReject ? REJECT_BLOCK : ACCEPT_BLOCK, }) @@ -124,7 +124,7 @@ describe("sync / range / chain", () => { const blocks: BlockInput[] = []; for (let i = request.startSlot; i < request.startSlot + request.count; i += request.step) { blocks.push( - getBlockInput.preEIP4844(config, { + getBlockInput.preDeneb(config, { message: generateEmptyBlock(i), signature: ACCEPT_BLOCK, }) diff --git a/packages/beacon-node/test/unit/sync/unknownBlock.test.ts b/packages/beacon-node/test/unit/sync/unknownBlock.test.ts index cb405fd505ce..77eed4c2cdd9 100644 --- a/packages/beacon-node/test/unit/sync/unknownBlock.test.ts +++ b/packages/beacon-node/test/unit/sync/unknownBlock.test.ts @@ -55,7 +55,7 @@ describe("sync / UnknownBlockSync", () => { Array.from(roots) .map((root) => blocksByRoot.get(toHexString(root))) .filter(notNullish) - .map((block) => getBlockInput.preEIP4844(config, block)), + .map((block) => getBlockInput.preDeneb(config, block)), reportPeer: (peerId, action, actionName) => reportPeerResolveFn([peerId, action, actionName]), }; @@ -77,7 +77,7 @@ describe("sync / UnknownBlockSync", () => { }; new UnknownBlockSync(config, network as INetwork, chain as IBeaconChain, logger, null); - network.events?.emit(NetworkEvent.unknownBlockParent, getBlockInput.preEIP4844(config, blockC), peerIdStr); + network.events?.emit(NetworkEvent.unknownBlockParent, getBlockInput.preDeneb(config, blockC), peerIdStr); if (reportPeer) { const err = await reportPeerPromise; diff --git a/packages/beacon-node/test/unit/util/kzg.test.ts b/packages/beacon-node/test/unit/util/kzg.test.ts index b8d0402bf461..6bb8c17d41c5 100644 --- a/packages/beacon-node/test/unit/util/kzg.test.ts +++ b/packages/beacon-node/test/unit/util/kzg.test.ts @@ -1,5 +1,5 @@ import {expect} from "chai"; -import {bellatrix, eip4844, ssz} from "@lodestar/types"; +import {bellatrix, deneb, ssz} from "@lodestar/types"; import {BLOB_TX_TYPE, BYTES_PER_FIELD_ELEMENT} from "@lodestar/params"; import { kzgCommitmentToVersionedHash, @@ -31,14 +31,14 @@ describe("C-KZG", () => { const blobs = [generateRandomBlob(), generateRandomBlob()]; const kzgCommitments = blobs.map((blob) => ckzg.blobToKzgCommitment(blob)); - const signedBeaconBlock = ssz.eip4844.SignedBeaconBlock.defaultValue(); + const signedBeaconBlock = ssz.deneb.SignedBeaconBlock.defaultValue(); for (const kzgCommitment of kzgCommitments) { signedBeaconBlock.message.body.executionPayload.transactions.push(transactionForKzgCommitment(kzgCommitment)); signedBeaconBlock.message.body.blobKzgCommitments.push(kzgCommitment); } - const beaconBlockRoot = ssz.eip4844.BeaconBlock.hashTreeRoot(signedBeaconBlock.message); + const beaconBlockRoot = ssz.deneb.BeaconBlock.hashTreeRoot(signedBeaconBlock.message); - const blobsSidecar: eip4844.BlobsSidecar = { + const blobsSidecar: deneb.BlobsSidecar = { beaconBlockRoot, beaconBlockSlot: 0, blobs, @@ -53,7 +53,7 @@ describe("C-KZG", () => { }); }); -function transactionForKzgCommitment(kzgCommitment: eip4844.KZGCommitment): bellatrix.Transaction { +function transactionForKzgCommitment(kzgCommitment: deneb.KZGCommitment): bellatrix.Transaction { // Some random value that after the offset's position const blobVersionedHashesOffset = OPAQUE_TX_BLOB_VERSIONED_HASHES_OFFSET + 64; @@ -79,7 +79,7 @@ function transactionForKzgCommitment(kzgCommitment: eip4844.KZGCommitment): bell /** * Generate random blob of sequential integers such that each element is < BLS_MODULUS */ -function generateRandomBlob(): eip4844.Blob { +function generateRandomBlob(): deneb.Blob { const blob = new Uint8Array(FIELD_ELEMENTS_PER_BLOB_MAINNET * BYTES_PER_FIELD_ELEMENT); const dv = new DataView(blob.buffer, blob.byteOffset, blob.byteLength); for (let i = 0; i < FIELD_ELEMENTS_PER_BLOB_MAINNET; i++) { diff --git a/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts b/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts index c91c95bacabc..731f44df59c8 100644 --- a/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts +++ b/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts @@ -3,7 +3,7 @@ import {TrustedSetupJSON, trustedSetupJsonToBin, TRUSTED_SETUP_BIN_FILEPATH} fro // CLI TOOL: Use to transform a JSON trusted setup into .ssz // -// Note: Closer to EIP-4844 this tool may never be useful again, +// Note: Closer to DENEB this tool may never be useful again, // see https://github.com/ethereum/c-kzg-4844/issues/3 const INPUT_FILE = process.argv[2]; diff --git a/packages/beacon-node/test/utils/config.ts b/packages/beacon-node/test/utils/config.ts index a1d381462380..18d6b0e14b90 100644 --- a/packages/beacon-node/test/utils/config.ts +++ b/packages/beacon-node/test/utils/config.ts @@ -24,7 +24,7 @@ export function getConfig(fork: ForkName, forkEpoch = 0): IChainForkConfig { BELLATRIX_FORK_EPOCH: 0, CAPELLA_FORK_EPOCH: forkEpoch, }); - case ForkName.eip4844: + case ForkName.deneb: return createIChainForkConfig({ ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, diff --git a/packages/beacon-node/test/utils/mocks/chain/chain.ts b/packages/beacon-node/test/utils/mocks/chain/chain.ts index 2c757e5afb1e..9784f978af0d 100644 --- a/packages/beacon-node/test/utils/mocks/chain/chain.ts +++ b/packages/beacon-node/test/utils/mocks/chain/chain.ts @@ -1,7 +1,7 @@ import sinon from "sinon"; import {CompositeTypeAny, toHexString, TreeView} from "@chainsafe/ssz"; -import {phase0, allForks, UintNum64, Root, Slot, ssz, Uint16, UintBn64, RootHex, eip4844, Wei} from "@lodestar/types"; +import {phase0, allForks, UintNum64, Root, Slot, ssz, Uint16, UintBn64, RootHex, deneb, Wei} from "@lodestar/types"; import {IBeaconConfig} from "@lodestar/config"; import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {CheckpointWithHex, IForkChoice, ProtoBlock, ExecutionStatus, AncestorStatus} from "@lodestar/fork-choice"; @@ -105,7 +105,7 @@ export class MockBeaconChain implements IBeaconChain { private readonly state: CachedBeaconStateAllForks; private abortController: AbortController; - readonly producedBlobsSidecarCache = new Map(); + readonly producedBlobsSidecarCache = new Map(); constructor({genesisTime, chainId, networkId, state, config}: IMockChainParams) { this.logger = testLogger(); diff --git a/packages/beacon-node/test/utils/node/beacon.ts b/packages/beacon-node/test/utils/node/beacon.ts index be020f85d2c7..8626f8c1c996 100644 --- a/packages/beacon-node/test/utils/node/beacon.ts +++ b/packages/beacon-node/test/utils/node/beacon.ts @@ -92,8 +92,8 @@ export async function getDevBeaconNode( block.message.stateRoot = state.hashTreeRoot(); await db.blockArchive.add(block); - if (config.getForkSeq(GENESIS_SLOT) >= ForkSeq.eip4844) { - const blobsSidecar = ssz.eip4844.BlobsSidecar.defaultValue(); + if (config.getForkSeq(GENESIS_SLOT) >= ForkSeq.deneb) { + const blobsSidecar = ssz.deneb.BlobsSidecar.defaultValue(); blobsSidecar.beaconBlockRoot = config.getForkTypes(GENESIS_SLOT).BeaconBlock.hashTreeRoot(block.message); await db.blobsSidecar.add(blobsSidecar); } diff --git a/packages/cli/package.json b/packages/cli/package.json index bd4def331589..b3671e698587 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -36,7 +36,7 @@ "test:e2e": "mocha --timeout 30000 'test/e2e/**/*.test.ts'", "test:sim:multifork": "LODESTAR_PRESET=minimal ts-node --esm test/sim/multi_fork.test.ts", "test:sim:endpoints": "LODESTAR_PRESET=minimal ts-node --esm test/sim/endpoints.test.ts", - "test:sim:eip4844": "LODESTAR_PRESET=minimal ts-node --esm test/sim/eip4844.test.ts", + "test:sim:deneb": "LODESTAR_PRESET=minimal ts-node --esm test/sim/deneb.test.ts", "test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal ts-node --esm test/sim/backup_eth_provider.test.ts", "test": "yarn test:unit && yarn test:e2e", "coverage": "codecov -F lodestar", diff --git a/packages/cli/test/sim/eip4844.test.ts b/packages/cli/test/sim/deneb.test.ts similarity index 100% rename from packages/cli/test/sim/eip4844.test.ts rename to packages/cli/test/sim/deneb.test.ts diff --git a/packages/config/src/chainConfig/presets/mainnet.ts b/packages/config/src/chainConfig/presets/mainnet.ts index 900450e236b8..5881db80b6ce 100644 --- a/packages/config/src/chainConfig/presets/mainnet.ts +++ b/packages/config/src/chainConfig/presets/mainnet.ts @@ -41,7 +41,7 @@ export const chainConfig: IChainConfig = { CAPELLA_FORK_VERSION: b("0x03000000"), CAPELLA_FORK_EPOCH: Infinity, - // EIP-4844 + // DENEB EIP4844_FORK_VERSION: b("0x04000000"), EIP4844_FORK_EPOCH: Infinity, diff --git a/packages/config/src/chainConfig/presets/minimal.ts b/packages/config/src/chainConfig/presets/minimal.ts index f63dad4e00d7..e4281b20e900 100644 --- a/packages/config/src/chainConfig/presets/minimal.ts +++ b/packages/config/src/chainConfig/presets/minimal.ts @@ -39,7 +39,7 @@ export const chainConfig: IChainConfig = { // Capella CAPELLA_FORK_VERSION: b("0x03000001"), CAPELLA_FORK_EPOCH: Infinity, - // EIP-4844 + // Deneb EIP4844_FORK_VERSION: b("0x04000001"), EIP4844_FORK_EPOCH: Infinity, diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index 84430e18abe6..b17e0fa01556 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -37,7 +37,7 @@ export type IChainConfig = { // Capella CAPELLA_FORK_VERSION: Uint8Array; CAPELLA_FORK_EPOCH: number; - // EIP-4844 + // DENEB EIP4844_FORK_VERSION: Uint8Array; EIP4844_FORK_EPOCH: number; @@ -63,7 +63,7 @@ export type IChainConfig = { DEPOSIT_NETWORK_ID: number; DEPOSIT_CONTRACT_ADDRESS: Uint8Array; - // EIP-4844 + // DENEB // https://github.com/ethereum/consensus-specs/blob/11a037fd9227e29ee809c9397b09f8cc3383a8c0/specs/eip4844/p2p-interface.md#configuration MAX_REQUEST_BLOBS_SIDECARS: number; /** The minimum epoch range over which a node must serve blobs sidecars */ @@ -95,7 +95,7 @@ export const chainConfigTypes: SpecTypes = { // Capella CAPELLA_FORK_VERSION: "bytes", CAPELLA_FORK_EPOCH: "number", - // EIP-4844 + // DENEB EIP4844_FORK_VERSION: "bytes", EIP4844_FORK_EPOCH: "number", diff --git a/packages/config/src/forkConfig/index.ts b/packages/config/src/forkConfig/index.ts index a75e45728fdf..cc82aab595c8 100644 --- a/packages/config/src/forkConfig/index.ts +++ b/packages/config/src/forkConfig/index.ts @@ -39,9 +39,9 @@ export function createIForkConfig(config: IChainConfig): IForkConfig { prevVersion: config.BELLATRIX_FORK_VERSION, prevForkName: ForkName.bellatrix, }; - const eip4844: IForkInfo = { - name: ForkName.eip4844, - seq: ForkSeq.eip4844, + const deneb: IForkInfo = { + name: ForkName.deneb, + seq: ForkSeq.deneb, epoch: config.EIP4844_FORK_EPOCH, version: config.EIP4844_FORK_VERSION, prevVersion: config.CAPELLA_FORK_VERSION, @@ -50,7 +50,7 @@ export function createIForkConfig(config: IChainConfig): IForkConfig { /** Forks in order order of occurence, `phase0` first */ // Note: Downstream code relies on proper ordering. - const forks = {phase0, altair, bellatrix, capella, eip4844}; + const forks = {phase0, altair, bellatrix, capella, deneb}; // Prevents allocating an array on every getForkInfo() call const forksAscendingEpochOrder = Object.values(forks); diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 72ba515bbab6..04e8abeb96cd 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -47,8 +47,8 @@ export enum Bucket { index_stateArchiveRootIndex = 26, // State Root -> slot - allForks_blobsSidecar = 27, // EIP-4844 BeaconBlockRoot -> BlobsSidecar - allForks_blobsSidecarArchive = 28, // EIP-4844 BeaconBlockSlot -> BlobsSidecar + allForks_blobsSidecar = 27, // DENEB BeaconBlockRoot -> BlobsSidecar + allForks_blobsSidecarArchive = 28, // DENEB BeaconBlockSlot -> BlobsSidecar // Lightclient server // altair_bestUpdatePerCommitteePeriod = 30, // DEPRECATED on v0.32.0 diff --git a/packages/params/src/forkName.ts b/packages/params/src/forkName.ts index da6c9f70a1a3..ad19f63d5dc6 100644 --- a/packages/params/src/forkName.ts +++ b/packages/params/src/forkName.ts @@ -6,7 +6,7 @@ export enum ForkName { altair = "altair", bellatrix = "bellatrix", capella = "capella", - eip4844 = "eip4844", + deneb = "deneb", } /** @@ -17,7 +17,7 @@ export enum ForkSeq { altair = 1, bellatrix = 2, capella = 3, - eip4844 = 4, + deneb = 4, } export type ForkExecution = Exclude; diff --git a/packages/params/src/presets/mainnet.ts b/packages/params/src/presets/mainnet.ts index 3fc4cdd3690b..6c09ae2b5f50 100644 --- a/packages/params/src/presets/mainnet.ts +++ b/packages/params/src/presets/mainnet.ts @@ -114,7 +114,7 @@ export const mainnetPreset: BeaconPreset = { MAX_WITHDRAWALS_PER_PAYLOAD: 16, MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP: 16384, - // EIP-4844 + // DENEB /////////// // https://github.com/ethereum/consensus-specs/blob/dev/presets/mainnet/eip4844.yaml FIELD_ELEMENTS_PER_BLOB: 4096, diff --git a/packages/params/src/presets/minimal.ts b/packages/params/src/presets/minimal.ts index b9de2107bc88..5e4aca671137 100644 --- a/packages/params/src/presets/minimal.ts +++ b/packages/params/src/presets/minimal.ts @@ -121,7 +121,7 @@ export const minimalPreset: BeaconPreset = { MAX_WITHDRAWALS_PER_PAYLOAD: 4, MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP: 16, - // EIP-4844 + // DENEB /////////// // https://github.com/ethereum/consensus-specs/blob/dev/presets/minimal/eip4844.yaml FIELD_ELEMENTS_PER_BLOB: 4, diff --git a/packages/params/test/e2e/ensure-config-is-synced.test.ts b/packages/params/test/e2e/ensure-config-is-synced.test.ts index e27dd13c7d2b..916283984423 100644 --- a/packages/params/test/e2e/ensure-config-is-synced.test.ts +++ b/packages/params/test/e2e/ensure-config-is-synced.test.ts @@ -37,7 +37,10 @@ async function downloadRemoteConfig(preset: "mainnet" | "minimal", commit: strin const downloadedParams = await Promise.all( Object.values(ForkName).map((forkName) => axios({ - url: `https://raw.githubusercontent.com/ethereum/consensus-specs/${commit}/presets/${preset}/${forkName}.yaml`, + url: `https://raw.githubusercontent.com/ethereum/consensus-specs/${commit}/presets/${preset}/${ + // TODO eip4844: clean this up when specs are released with deneb + forkName === "deneb" ? "eip4844" : forkName + }.yaml`, timeout: 30 * 1000, }).then((response) => loadConfigYaml(response.data)) ) diff --git a/packages/reqresp/src/protocols/BeaconBlockAndBlobsSidecarByRoot.ts b/packages/reqresp/src/protocols/BeaconBlockAndBlobsSidecarByRoot.ts index 57219069eae3..03b8c566bfd5 100644 --- a/packages/reqresp/src/protocols/BeaconBlockAndBlobsSidecarByRoot.ts +++ b/packages/reqresp/src/protocols/BeaconBlockAndBlobsSidecarByRoot.ts @@ -1,20 +1,20 @@ -import {eip4844, ssz} from "@lodestar/types"; +import {deneb, ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {ContextBytesType, Encoding, ProtocolDefinitionGenerator} from "../types.js"; // eslint-disable-next-line @typescript-eslint/naming-convention export const BeaconBlockAndBlobsSidecarByRoot: ProtocolDefinitionGenerator< - eip4844.BeaconBlockAndBlobsSidecarByRootRequest, - eip4844.SignedBeaconBlockAndBlobsSidecar + deneb.BeaconBlockAndBlobsSidecarByRootRequest, + deneb.SignedBeaconBlockAndBlobsSidecar > = (modules, handler) => { return { method: "beacon_block_and_blobs_sidecar_by_root", version: 1, encoding: Encoding.SSZ_SNAPPY, handler, - requestType: () => ssz.eip4844.BeaconBlockAndBlobsSidecarByRootRequest, + requestType: () => ssz.deneb.BeaconBlockAndBlobsSidecarByRootRequest, // TODO: Make it fork compliant - responseType: () => ssz.eip4844.SignedBeaconBlockAndBlobsSidecar, + responseType: () => ssz.deneb.SignedBeaconBlockAndBlobsSidecar, renderRequestBody: (req) => req.map((root) => toHex(root)).join(","), contextBytes: { type: ContextBytesType.ForkDigest, @@ -22,7 +22,7 @@ export const BeaconBlockAndBlobsSidecarByRoot: ProtocolDefinitionGenerator< forkFromResponse: ({beaconBlock}) => modules.config.getForkName(beaconBlock.message.slot), }, inboundRateLimits: { - // TODO EIP-4844: For now same value as BeaconBlocksByRoot https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 + // TODO DENEB: For now same value as BeaconBlocksByRoot https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 byPeer: {quota: 128, quotaTimeMs: 10_000}, getRequestCount: (req) => req.length, }, diff --git a/packages/reqresp/src/protocols/BlobsSidecarsByRange.ts b/packages/reqresp/src/protocols/BlobsSidecarsByRange.ts index a2e8ca5dbc55..36233885fe2d 100644 --- a/packages/reqresp/src/protocols/BlobsSidecarsByRange.ts +++ b/packages/reqresp/src/protocols/BlobsSidecarsByRange.ts @@ -1,20 +1,20 @@ import {MAX_REQUEST_BLOCKS} from "@lodestar/params"; -import {eip4844, ssz} from "@lodestar/types"; +import {deneb, ssz} from "@lodestar/types"; import {ContextBytesType, Encoding, ProtocolDefinitionGenerator} from "../types.js"; // eslint-disable-next-line @typescript-eslint/naming-convention export const BlobsSidecarsByRange: ProtocolDefinitionGenerator< - eip4844.BlobsSidecarsByRangeRequest, - eip4844.BlobsSidecar + deneb.BlobsSidecarsByRangeRequest, + deneb.BlobsSidecar > = (modules, handler) => { return { method: "blobs_sidecars_by_range", version: 1, encoding: Encoding.SSZ_SNAPPY, handler, - requestType: () => ssz.eip4844.BlobsSidecarsByRangeRequest, + requestType: () => ssz.deneb.BlobsSidecarsByRangeRequest, // TODO: Make it fork compliant - responseType: () => ssz.eip4844.BlobsSidecar, + responseType: () => ssz.deneb.BlobsSidecar, renderRequestBody: (req) => `${req.startSlot},${req.count}`, contextBytes: { type: ContextBytesType.ForkDigest, @@ -22,7 +22,7 @@ export const BlobsSidecarsByRange: ProtocolDefinitionGenerator< forkFromResponse: (blobsSidecar) => modules.config.getForkName(blobsSidecar.beaconBlockSlot), }, inboundRateLimits: { - // TODO EIP-4844: For now same value as BeaconBlocksByRange https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 + // TODO DENEB: For now same value as BeaconBlocksByRange https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 byPeer: {quota: MAX_REQUEST_BLOCKS, quotaTimeMs: 10_000}, getRequestCount: (req) => req.count, }, diff --git a/packages/state-transition/src/block/externalData.ts b/packages/state-transition/src/block/externalData.ts index f20add5bd4cc..7e183f8ddb44 100644 --- a/packages/state-transition/src/block/externalData.ts +++ b/packages/state-transition/src/block/externalData.ts @@ -14,7 +14,7 @@ export enum ExecutionPayloadStatus { } export enum DataAvailableStatus { - preEIP4844 = "preEIP4844", + preDeneb = "preDeneb", notAvailable = "notAvailable", available = "available", } diff --git a/packages/state-transition/src/block/index.ts b/packages/state-transition/src/block/index.ts index 72c73140a523..1085fe6eab43 100644 --- a/packages/state-transition/src/block/index.ts +++ b/packages/state-transition/src/block/index.ts @@ -1,5 +1,5 @@ import {ForkSeq} from "@lodestar/params"; -import {allForks, altair, capella, eip4844} from "@lodestar/types"; +import {allForks, altair, capella, deneb} from "@lodestar/types"; import {getFullOrBlindedPayload, isExecutionEnabled} from "../util/execution.js"; import {CachedBeaconStateAllForks, CachedBeaconStateCapella, CachedBeaconStateBellatrix} from "../types.js"; import {processExecutionPayload} from "./processExecutionPayload.js"; @@ -43,7 +43,7 @@ export function processBlock( // on the randao_mix computed with the reveal of the previous block. if (fork >= ForkSeq.bellatrix && isExecutionEnabled(state as CachedBeaconStateBellatrix, block)) { const fullOrBlindedPayload = getFullOrBlindedPayload(block); - // TODO EIP-4844: Allow to disable withdrawals for interop testing + // TODO Deneb: Allow to disable withdrawals for interop testing // https://github.com/ethereum/consensus-specs/blob/b62c9e877990242d63aa17a2a59a49bc649a2f2e/specs/eip4844/beacon-chain.md#disabling-withdrawals if (fork >= ForkSeq.capella) { processWithdrawals( @@ -61,16 +61,16 @@ export function processBlock( processSyncAggregate(state, block as altair.BeaconBlock, verifySignatures); } - if (fork >= ForkSeq.eip4844) { - processBlobKzgCommitments(block.body as eip4844.BeaconBlockBody); + if (fork >= ForkSeq.deneb) { + processBlobKzgCommitments(block.body as deneb.BeaconBlockBody); - // New in EIP-4844, note: Can sync optimistically without this condition, see note on `is_data_available` + // New in Deneb, note: Can sync optimistically without this condition, see note on `is_data_available` // NOTE: Ommitted and should be verified beforehand // assert is_data_available(block.slot, hash_tree_root(block), block.body.blob_kzg_commitments) switch (externalData.dataAvailableStatus) { - case DataAvailableStatus.preEIP4844: - throw Error("dataAvailableStatus preEIP4844"); + case DataAvailableStatus.preDeneb: + throw Error("dataAvailableStatus preDeneb"); case DataAvailableStatus.notAvailable: throw Error("dataAvailableStatus notAvailable"); case DataAvailableStatus.available: diff --git a/packages/state-transition/src/block/processBlobKzgCommitments.ts b/packages/state-transition/src/block/processBlobKzgCommitments.ts index 195ad056c26c..9ad74a0c74aa 100644 --- a/packages/state-transition/src/block/processBlobKzgCommitments.ts +++ b/packages/state-transition/src/block/processBlobKzgCommitments.ts @@ -1,4 +1,4 @@ -import {eip4844} from "@lodestar/types"; +import {deneb} from "@lodestar/types"; import {verifyKzgCommitmentsAgainstTransactions} from "../util/index.js"; /** @@ -10,7 +10,7 @@ import {verifyKzgCommitmentsAgainstTransactions} from "../util/index.js"; * body.blob_kzg_commitments * ) */ -export function processBlobKzgCommitments(body: eip4844.BeaconBlockBody): void { +export function processBlobKzgCommitments(body: deneb.BeaconBlockBody): void { if (!verifyKzgCommitmentsAgainstTransactions(body.executionPayload.transactions, body.blobKzgCommitments)) { throw Error("Invalid KZG commitments against transactions"); } diff --git a/packages/state-transition/src/block/processExecutionPayload.ts b/packages/state-transition/src/block/processExecutionPayload.ts index d8d83d991475..cf7fb2955822 100644 --- a/packages/state-transition/src/block/processExecutionPayload.ts +++ b/packages/state-transition/src/block/processExecutionPayload.ts @@ -1,4 +1,4 @@ -import {ssz, allForks, capella, eip4844} from "@lodestar/types"; +import {ssz, allForks, capella, deneb} from "@lodestar/types"; import {toHexString, byteArrayEquals} from "@chainsafe/ssz"; import {ForkSeq} from "@lodestar/params"; import {CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js"; @@ -89,14 +89,14 @@ export function processExecutionPayload( ); } - if (fork >= ForkSeq.eip4844) { + if (fork >= ForkSeq.deneb) { // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/beacon-chain.md#process_execution_payload - (bellatrixPayloadFields as eip4844.ExecutionPayloadHeader).excessDataGas = (payload as - | eip4844.ExecutionPayloadHeader - | eip4844.ExecutionPayload).excessDataGas; + (bellatrixPayloadFields as deneb.ExecutionPayloadHeader).excessDataGas = (payload as + | deneb.ExecutionPayloadHeader + | deneb.ExecutionPayload).excessDataGas; } - // TODO EIP-4844: Types are not happy by default. Since it's a generic allForks type going through ViewDU + // TODO Deneb: Types are not happy by default. Since it's a generic allForks type going through ViewDU // transformation then into allForks, probably some weird intersection incompatibility happens state.latestExecutionPayloadHeader = state.config .getExecutionForkTypes(state.slot) diff --git a/packages/state-transition/src/cache/stateCache.ts b/packages/state-transition/src/cache/stateCache.ts index 83c834c1d6aa..0dd537c262ba 100644 --- a/packages/state-transition/src/cache/stateCache.ts +++ b/packages/state-transition/src/cache/stateCache.ts @@ -7,7 +7,7 @@ import { BeaconStateAltair, BeaconStateBellatrix, BeaconStateCapella, - BeaconStateEip4844, + BeaconStateDeneb, } from "./types.js"; export type BeaconStateCache = { @@ -117,7 +117,7 @@ export type CachedBeaconStatePhase0 = CachedBeaconState; export type CachedBeaconStateAltair = CachedBeaconState; export type CachedBeaconStateBellatrix = CachedBeaconState; export type CachedBeaconStateCapella = CachedBeaconState; -export type CachedBeaconStateEip4844 = CachedBeaconState; +export type CachedBeaconStateDeneb = CachedBeaconState; export type CachedBeaconStateAllForks = CachedBeaconState; export type CachedBeaconStateExecutions = CachedBeaconState; diff --git a/packages/state-transition/src/cache/types.ts b/packages/state-transition/src/cache/types.ts index 3d206fb16788..7d63139e3eb6 100644 --- a/packages/state-transition/src/cache/types.ts +++ b/packages/state-transition/src/cache/types.ts @@ -5,7 +5,7 @@ export type BeaconStatePhase0 = CompositeViewDU; export type BeaconStateAltair = CompositeViewDU; export type BeaconStateBellatrix = CompositeViewDU; export type BeaconStateCapella = CompositeViewDU; -export type BeaconStateEip4844 = CompositeViewDU; +export type BeaconStateDeneb = CompositeViewDU; // Union at the TreeViewDU level // - Works well as function argument and as generic type for allForks functions @@ -17,6 +17,6 @@ export type BeaconStateAllForks = | BeaconStateAltair | BeaconStateBellatrix | BeaconStateCapella - | BeaconStateEip4844; + | BeaconStateDeneb; -export type BeaconStateExecutions = BeaconStateBellatrix | BeaconStateCapella | BeaconStateEip4844; +export type BeaconStateExecutions = BeaconStateBellatrix | BeaconStateCapella | BeaconStateDeneb; diff --git a/packages/state-transition/src/index.ts b/packages/state-transition/src/index.ts index 506bf425316c..4e9aaf433414 100644 --- a/packages/state-transition/src/index.ts +++ b/packages/state-transition/src/index.ts @@ -9,7 +9,7 @@ export { CachedBeaconStateAltair, CachedBeaconStateBellatrix, CachedBeaconStateCapella, - CachedBeaconStateEip4844, + CachedBeaconStateDeneb, CachedBeaconStateAllForks, CachedBeaconStateExecutions, // Non-cached states @@ -17,7 +17,7 @@ export { BeaconStateAltair, BeaconStateBellatrix, BeaconStateCapella, - BeaconStateEip4844, + BeaconStateDeneb, BeaconStateAllForks, BeaconStateExecutions, } from "./types.js"; diff --git a/packages/state-transition/src/slot/index.ts b/packages/state-transition/src/slot/index.ts index 73f1017865d6..13c85b200622 100644 --- a/packages/state-transition/src/slot/index.ts +++ b/packages/state-transition/src/slot/index.ts @@ -6,7 +6,7 @@ import {ZERO_HASH} from "../constants/index.js"; export {upgradeStateToAltair} from "./upgradeStateToAltair.js"; export {upgradeStateToBellatrix} from "./upgradeStateToBellatrix.js"; export {upgradeStateToCapella} from "./upgradeStateToCapella.js"; -export {upgradeStateTo4844} from "./upgradeStateTo4844.js"; +export {upgradeStateToDeneb} from "./upgradeStateToDeneb.js"; /** * Dial state to next slot. Common for all forks diff --git a/packages/state-transition/src/slot/upgradeStateTo4844.ts b/packages/state-transition/src/slot/upgradeStateTo4844.ts deleted file mode 100644 index 2e3f7bdfb48e..000000000000 --- a/packages/state-transition/src/slot/upgradeStateTo4844.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {ssz} from "@lodestar/types"; -import {CachedBeaconStateEip4844} from "../types.js"; -import {getCachedBeaconState} from "../cache/stateCache.js"; -import {CachedBeaconStateCapella} from "../types.js"; - -/** - * Upgrade a state from Capella to 4844. - */ -export function upgradeStateTo4844(stateCapella: CachedBeaconStateCapella): CachedBeaconStateEip4844 { - const {config} = stateCapella; - - const stateCapellaNode = ssz.capella.BeaconState.commitViewDU(stateCapella); - const state4844View = ssz.eip4844.BeaconState.getViewDU(stateCapellaNode); - - const state4844 = getCachedBeaconState(state4844View, stateCapella); - - state4844.fork = ssz.phase0.Fork.toViewDU({ - previousVersion: stateCapella.fork.currentVersion, - currentVersion: config.EIP4844_FORK_VERSION, - epoch: stateCapella.epochCtx.epoch, - }); - - // The field order of eip4844 latestExecutionPayloadHeader is not the same to capella - // all fields after excessDataGas need to explicitly set - state4844.latestExecutionPayloadHeader.excessDataGas = ssz.UintBn256.defaultValue(); - state4844.latestExecutionPayloadHeader.blockHash = stateCapella.latestExecutionPayloadHeader.blockHash; - state4844.latestExecutionPayloadHeader.transactionsRoot = stateCapella.latestExecutionPayloadHeader.transactionsRoot; - state4844.latestExecutionPayloadHeader.withdrawalsRoot = stateCapella.latestExecutionPayloadHeader.withdrawalsRoot; - - state4844.commit(); - - return state4844; -} diff --git a/packages/state-transition/src/slot/upgradeStateToDeneb.ts b/packages/state-transition/src/slot/upgradeStateToDeneb.ts new file mode 100644 index 000000000000..1f5e2201f69f --- /dev/null +++ b/packages/state-transition/src/slot/upgradeStateToDeneb.ts @@ -0,0 +1,33 @@ +import {ssz} from "@lodestar/types"; +import {CachedBeaconStateDeneb} from "../types.js"; +import {getCachedBeaconState} from "../cache/stateCache.js"; +import {CachedBeaconStateCapella} from "../types.js"; + +/** + * Upgrade a state from Capella to Deneb. + */ +export function upgradeStateToDeneb(stateCapella: CachedBeaconStateCapella): CachedBeaconStateDeneb { + const {config} = stateCapella; + + const stateCapellaNode = ssz.capella.BeaconState.commitViewDU(stateCapella); + const stateDenebView = ssz.deneb.BeaconState.getViewDU(stateCapellaNode); + + const stateDeneb = getCachedBeaconState(stateDenebView, stateCapella); + + stateDeneb.fork = ssz.phase0.Fork.toViewDU({ + previousVersion: stateCapella.fork.currentVersion, + currentVersion: config.EIP4844_FORK_VERSION, + epoch: stateCapella.epochCtx.epoch, + }); + + // The field order of deneb latestExecutionPayloadHeader is not the same to capella + // all fields after excessDataGas need to explicitly set + stateDeneb.latestExecutionPayloadHeader.excessDataGas = ssz.UintBn256.defaultValue(); + stateDeneb.latestExecutionPayloadHeader.blockHash = stateCapella.latestExecutionPayloadHeader.blockHash; + stateDeneb.latestExecutionPayloadHeader.transactionsRoot = stateCapella.latestExecutionPayloadHeader.transactionsRoot; + stateDeneb.latestExecutionPayloadHeader.withdrawalsRoot = stateCapella.latestExecutionPayloadHeader.withdrawalsRoot; + + stateDeneb.commit(); + + return stateDeneb; +} diff --git a/packages/state-transition/src/stateTransition.ts b/packages/state-transition/src/stateTransition.ts index 8f110b771c37..6f49415b1c54 100644 --- a/packages/state-transition/src/stateTransition.ts +++ b/packages/state-transition/src/stateTransition.ts @@ -17,7 +17,7 @@ import { upgradeStateToAltair, upgradeStateToBellatrix, upgradeStateToCapella, - upgradeStateTo4844, + upgradeStateToDeneb, } from "./slot/index.js"; import {processBlock} from "./block/index.js"; import {processEpoch} from "./epoch/index.js"; @@ -26,7 +26,7 @@ import {ProcessBlockOpts} from "./block/types.js"; // Multifork capable state transition -// NOTE EIP-4844: Mandatory BlockExternalData to decide if block is available or not +// NOTE DENEB: Mandatory BlockExternalData to decide if block is available or not export type StateTransitionOpts = BlockExternalData & EpochProcessOpts & ProcessBlockOpts & { @@ -42,7 +42,7 @@ export function stateTransition( state: CachedBeaconStateAllForks, signedBlock: allForks.FullOrBlindedSignedBeaconBlock, options: StateTransitionOpts = { - // TODO EIP-4844: Review what default values make sense + // TODO DENEB: Review what default values make sense executionPayloadStatus: ExecutionPayloadStatus.valid, dataAvailableStatus: DataAvailableStatus.available, }, @@ -177,7 +177,7 @@ function processSlotsWithTransientCache( postState = upgradeStateToCapella(postState as CachedBeaconStateBellatrix) as CachedBeaconStateAllForks; } if (stateSlot === config.EIP4844_FORK_EPOCH) { - postState = upgradeStateTo4844(postState as CachedBeaconStateCapella) as CachedBeaconStateAllForks; + postState = upgradeStateToDeneb(postState as CachedBeaconStateCapella) as CachedBeaconStateAllForks; } } else { postState.slot++; diff --git a/packages/state-transition/src/types.ts b/packages/state-transition/src/types.ts index e879a88e8b5b..b554b8f18c59 100644 --- a/packages/state-transition/src/types.ts +++ b/packages/state-transition/src/types.ts @@ -8,7 +8,7 @@ export { CachedBeaconStateAltair, CachedBeaconStateBellatrix, CachedBeaconStateCapella, - CachedBeaconStateEip4844, + CachedBeaconStateDeneb, } from "./cache/stateCache.js"; export { @@ -18,5 +18,5 @@ export { BeaconStateAltair, BeaconStateBellatrix, BeaconStateCapella, - BeaconStateEip4844, + BeaconStateDeneb, } from "./cache/types.js"; diff --git a/packages/state-transition/src/util/blobs.ts b/packages/state-transition/src/util/blobs.ts index 0ec5234a04e7..e9f0acd558e2 100644 --- a/packages/state-transition/src/util/blobs.ts +++ b/packages/state-transition/src/util/blobs.ts @@ -1,10 +1,10 @@ import SHA256 from "@chainsafe/as-sha256"; import {byteArrayEquals} from "@chainsafe/ssz"; import {BLOB_TX_TYPE, VERSIONED_HASH_VERSION_KZG} from "@lodestar/params"; -import {bellatrix, eip4844} from "@lodestar/types"; +import {bellatrix, deneb} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; -// TODO EIP-4844: Move to params +// TODO DENEB: Move to params const BYTES_PER_HASH = 32; /** @@ -28,12 +28,12 @@ type VersionHash = Uint8Array; */ export function verifyKzgCommitmentsAgainstTransactions( transactions: bellatrix.Transaction[], - blobKzgCommitments: eip4844.KZGCommitment[] + blobKzgCommitments: deneb.KZGCommitment[] ): boolean { const allVersionedHashes: VersionHash[] = []; for (const tx of transactions) { if (tx[0] === BLOB_TX_TYPE) { - // TODO EIP-4844: Optimize array manipulation + // TODO DENEB: Optimize array manipulation allVersionedHashes.push(...txPeekBlobVersionedHashes(tx)); } } @@ -51,7 +51,7 @@ export function verifyKzgCommitmentsAgainstTransactions( } } - // TODO EIP-4844: Use proper API, either throw error or return boolean + // TODO DENEB: Use proper API, either throw error or return boolean return true; } @@ -86,7 +86,7 @@ function txPeekBlobVersionedHashes(opaqueTx: bellatrix.Transaction): VersionHash return versionedHashes; } -export function kzgCommitmentToVersionedHash(kzgCommitment: eip4844.KZGCommitment): VersionHash { +export function kzgCommitmentToVersionedHash(kzgCommitment: deneb.KZGCommitment): VersionHash { const hash = SHA256.digest(kzgCommitment); // Equivalent to `VERSIONED_HASH_VERSION_KZG + hash(kzg_commitment)[1:]` hash[0] = VERSIONED_HASH_VERSION_KZG; diff --git a/packages/state-transition/src/util/genesis.ts b/packages/state-transition/src/util/genesis.ts index 1070ef6effee..872c98d93eec 100644 --- a/packages/state-transition/src/util/genesis.ts +++ b/packages/state-transition/src/util/genesis.ts @@ -217,7 +217,7 @@ export function initializeBeaconStateFromEth1( executionPayloadHeader?: CompositeViewDU< | typeof ssz.bellatrix.ExecutionPayloadHeader | typeof ssz.capella.ExecutionPayloadHeader - | typeof ssz.eip4844.ExecutionPayloadHeader + | typeof ssz.deneb.ExecutionPayloadHeader > ): CachedBeaconStateAllForks { const stateView = getGenesisBeaconState( @@ -280,12 +280,12 @@ export function initializeBeaconStateFromEth1( } if (GENESIS_SLOT >= config.EIP4844_FORK_EPOCH) { - const stateEip4844 = state as CompositeViewDU; - stateEip4844.fork.previousVersion = config.EIP4844_FORK_VERSION; - stateEip4844.fork.currentVersion = config.EIP4844_FORK_VERSION; - stateEip4844.latestExecutionPayloadHeader = - (executionPayloadHeader as CompositeViewDU) ?? - ssz.eip4844.ExecutionPayloadHeader.defaultViewDU(); + const stateDeneb = state as CompositeViewDU; + stateDeneb.fork.previousVersion = config.EIP4844_FORK_VERSION; + stateDeneb.fork.currentVersion = config.EIP4844_FORK_VERSION; + stateDeneb.latestExecutionPayloadHeader = + (executionPayloadHeader as CompositeViewDU) ?? + ssz.deneb.ExecutionPayloadHeader.defaultViewDU(); } state.commit(); diff --git a/packages/state-transition/test/unit/util/blobs.test.ts b/packages/state-transition/test/unit/util/blobs.test.ts index 9ce23fd7f85a..64e33b92929b 100644 --- a/packages/state-transition/test/unit/util/blobs.test.ts +++ b/packages/state-transition/test/unit/util/blobs.test.ts @@ -46,7 +46,7 @@ describe("blobs", () => { // value: uint256 // 32 bytes // data: ByteList[MAX_CALLDATA_SIZE] // 4 bytes offset // access_list: List[AccessTuple, MAX_ACCESS_LIST_SIZE] // 4 bytes offset - // max_fee_per_data_gas: uint256 # new in PR 5707, a.k.a. fee market change of EIP-4844 // 32 bytes offset + // max_fee_per_data_gas: uint256 # new in PR 5707, a.k.a. fee market change of Deneb // 32 bytes offset // blob_versioned_hashes: List[VersionedHash, MAX_VERSIONED_HASHES_LIST_SIZE] // 4 bytes offset // field_offset = 32 + 8 + 32 + 32 + 8 + 4 + 32 + 4 + 4 + 32 = 188 diff --git a/packages/types/package.json b/packages/types/package.json index 5532416035b4..58d9ed6d1c50 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -29,8 +29,8 @@ "./bellatrix": { "import": "./lib/bellatrix/index.js" }, - "./eip4844": { - "import": "./lib/eip4844/index.js" + "./deneb": { + "import": "./lib/deneb/index.js" }, "./phase0": { "import": "./lib/phase0/index.js" diff --git a/packages/types/src/allForks/sszTypes.ts b/packages/types/src/allForks/sszTypes.ts index bff6e24369a0..37f755ff9eb0 100644 --- a/packages/types/src/allForks/sszTypes.ts +++ b/packages/types/src/allForks/sszTypes.ts @@ -2,7 +2,7 @@ import {ssz as phase0} from "../phase0/index.js"; import {ssz as altair} from "../altair/index.js"; import {ssz as bellatrix} from "../bellatrix/index.js"; import {ssz as capella} from "../capella/index.js"; -import {ssz as eip4844} from "../eip4844/index.js"; +import {ssz as deneb} from "../deneb/index.js"; /** * Index the ssz types that differ by fork @@ -37,11 +37,11 @@ export const allForks = { BeaconState: capella.BeaconState, Metadata: altair.Metadata, }, - eip4844: { - BeaconBlockBody: eip4844.BeaconBlockBody, - BeaconBlock: eip4844.BeaconBlock, - SignedBeaconBlock: eip4844.SignedBeaconBlock, - BeaconState: eip4844.BeaconState, + deneb: { + BeaconBlockBody: deneb.BeaconBlockBody, + BeaconBlock: deneb.BeaconBlock, + SignedBeaconBlock: deneb.SignedBeaconBlock, + BeaconState: deneb.BeaconState, Metadata: altair.Metadata, }, }; @@ -72,15 +72,15 @@ export const allForksExecution = { BuilderBid: capella.BuilderBid, SignedBuilderBid: capella.SignedBuilderBid, }, - eip4844: { - BeaconBlockBody: eip4844.BeaconBlockBody, - BeaconBlock: eip4844.BeaconBlock, - SignedBeaconBlock: eip4844.SignedBeaconBlock, - BeaconState: eip4844.BeaconState, - ExecutionPayload: eip4844.ExecutionPayload, - ExecutionPayloadHeader: eip4844.ExecutionPayloadHeader, - BuilderBid: eip4844.BuilderBid, - SignedBuilderBid: eip4844.SignedBuilderBid, + deneb: { + BeaconBlockBody: deneb.BeaconBlockBody, + BeaconBlock: deneb.BeaconBlock, + SignedBeaconBlock: deneb.SignedBeaconBlock, + BeaconState: deneb.BeaconState, + ExecutionPayload: deneb.ExecutionPayload, + ExecutionPayloadHeader: deneb.ExecutionPayloadHeader, + BuilderBid: deneb.BuilderBid, + SignedBuilderBid: deneb.SignedBuilderBid, }, }; @@ -99,15 +99,15 @@ export const allForksBlinded = { BeaconBlock: capella.BlindedBeaconBlock, SignedBeaconBlock: capella.SignedBlindedBeaconBlock, }, - eip4844: { - BeaconBlockBody: eip4844.BlindedBeaconBlockBody, - BeaconBlock: eip4844.BlindedBeaconBlock, - SignedBeaconBlock: eip4844.SignedBlindedBeaconBlock, + deneb: { + BeaconBlockBody: deneb.BlindedBeaconBlockBody, + BeaconBlock: deneb.BlindedBeaconBlock, + SignedBeaconBlock: deneb.SignedBlindedBeaconBlock, }, }; export const allForksBlobs = { - eip4844: { - SignedBeaconBlockAndBlobsSidecar: eip4844.SignedBeaconBlockAndBlobsSidecar, + deneb: { + SignedBeaconBlockAndBlobsSidecar: deneb.SignedBeaconBlockAndBlobsSidecar, }, }; diff --git a/packages/types/src/allForks/types.ts b/packages/types/src/allForks/types.ts index c4b0b97cf511..0171a7254fd7 100644 --- a/packages/types/src/allForks/types.ts +++ b/packages/types/src/allForks/types.ts @@ -3,13 +3,13 @@ import {ts as phase0} from "../phase0/index.js"; import {ts as altair} from "../altair/index.js"; import {ts as bellatrix} from "../bellatrix/index.js"; import {ts as capella} from "../capella/index.js"; -import {ts as eip4844} from "../eip4844/index.js"; +import {ts as deneb} from "../deneb/index.js"; import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; import {ssz as bellatrixSsz} from "../bellatrix/index.js"; import {ssz as capellaSsz} from "../capella/index.js"; -import {ssz as eip4844Ssz} from "../eip4844/index.js"; +import {ssz as denebSsz} from "../deneb/index.js"; // Re-export union types for types that are _known_ to differ @@ -18,47 +18,47 @@ export type BeaconBlockBody = | altair.BeaconBlockBody | bellatrix.BeaconBlockBody | capella.BeaconBlockBody - | eip4844.BeaconBlockBody; + | deneb.BeaconBlockBody; export type BeaconBlock = | phase0.BeaconBlock | altair.BeaconBlock | bellatrix.BeaconBlock | capella.BeaconBlock - | eip4844.BeaconBlock; + | deneb.BeaconBlock; export type SignedBeaconBlock = | phase0.SignedBeaconBlock | altair.SignedBeaconBlock | bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock - | eip4844.SignedBeaconBlock; + | deneb.SignedBeaconBlock; export type BeaconState = | phase0.BeaconState | altair.BeaconState | bellatrix.BeaconState | capella.BeaconState - | eip4844.BeaconState; + | deneb.BeaconState; export type Metadata = phase0.Metadata | altair.Metadata; // For easy reference in the assemble block for building payloads -export type ExecutionBlockBody = bellatrix.BeaconBlockBody | capella.BeaconBlockBody | eip4844.BeaconBlockBody; +export type ExecutionBlockBody = bellatrix.BeaconBlockBody | capella.BeaconBlockBody | deneb.BeaconBlockBody; // These two additional types will also change bellatrix forward -export type ExecutionPayload = bellatrix.ExecutionPayload | capella.ExecutionPayload | eip4844.ExecutionPayload; +export type ExecutionPayload = bellatrix.ExecutionPayload | capella.ExecutionPayload | deneb.ExecutionPayload; export type ExecutionPayloadHeader = | bellatrix.ExecutionPayloadHeader | capella.ExecutionPayloadHeader - | eip4844.ExecutionPayloadHeader; + | deneb.ExecutionPayloadHeader; // Blinded types that will change across forks export type BlindedBeaconBlockBody = | bellatrix.BlindedBeaconBlockBody | capella.BlindedBeaconBlockBody - | eip4844.BlindedBeaconBlockBody; -export type BlindedBeaconBlock = bellatrix.BlindedBeaconBlock | capella.BlindedBeaconBlock | eip4844.BlindedBeaconBlock; + | deneb.BlindedBeaconBlockBody; +export type BlindedBeaconBlock = bellatrix.BlindedBeaconBlock | capella.BlindedBeaconBlock | deneb.BlindedBeaconBlock; export type SignedBlindedBeaconBlock = | bellatrix.SignedBlindedBeaconBlock | capella.SignedBlindedBeaconBlock - | eip4844.SignedBlindedBeaconBlock; + | deneb.SignedBlindedBeaconBlock; // Full or blinded types export type FullOrBlindedExecutionPayload = @@ -68,10 +68,10 @@ export type FullOrBlindedBeaconBlockBody = BeaconBlockBody | BlindedBeaconBlockB export type FullOrBlindedBeaconBlock = BeaconBlock | BlindedBeaconBlock; export type FullOrBlindedSignedBeaconBlock = SignedBeaconBlock | SignedBlindedBeaconBlock; -export type BuilderBid = bellatrix.BuilderBid | capella.BuilderBid | eip4844.BuilderBid; -export type SignedBuilderBid = bellatrix.SignedBuilderBid | capella.SignedBuilderBid | eip4844.SignedBuilderBid; +export type BuilderBid = bellatrix.BuilderBid | capella.BuilderBid | deneb.BuilderBid; +export type SignedBuilderBid = bellatrix.SignedBuilderBid | capella.SignedBuilderBid | deneb.SignedBuilderBid; -export type SignedBeaconBlockAndBlobsSidecar = eip4844.SignedBeaconBlockAndBlobsSidecar; +export type SignedBeaconBlockAndBlobsSidecar = deneb.SignedBeaconBlockAndBlobsSidecar; /** * Types known to change between forks */ @@ -129,58 +129,58 @@ export type AllForksSSZTypes = { | typeof altairSsz.BeaconBlockBody | typeof bellatrixSsz.BeaconBlockBody | typeof capellaSsz.BeaconBlockBody - | typeof eip4844Ssz.BeaconBlockBody + | typeof denebSsz.BeaconBlockBody >; BeaconBlock: AllForksTypeOf< | typeof phase0Ssz.BeaconBlock | typeof altairSsz.BeaconBlock | typeof bellatrixSsz.BeaconBlock | typeof capellaSsz.BeaconBlock - | typeof eip4844Ssz.BeaconBlock + | typeof denebSsz.BeaconBlock >; SignedBeaconBlock: AllForksTypeOf< | typeof phase0Ssz.SignedBeaconBlock | typeof altairSsz.SignedBeaconBlock | typeof bellatrixSsz.SignedBeaconBlock | typeof capellaSsz.SignedBeaconBlock - | typeof eip4844Ssz.SignedBeaconBlock + | typeof denebSsz.SignedBeaconBlock >; BeaconState: AllForksTypeOf< | typeof phase0Ssz.BeaconState | typeof altairSsz.BeaconState | typeof bellatrixSsz.BeaconState | typeof capellaSsz.BeaconState - | typeof eip4844Ssz.BeaconState + | typeof denebSsz.BeaconState >; Metadata: AllForksTypeOf; }; export type AllForksExecutionSSZTypes = { BeaconBlockBody: AllForksTypeOf< - typeof bellatrixSsz.BeaconBlockBody | typeof capellaSsz.BeaconBlockBody | typeof eip4844Ssz.BeaconBlockBody + typeof bellatrixSsz.BeaconBlockBody | typeof capellaSsz.BeaconBlockBody | typeof denebSsz.BeaconBlockBody >; BeaconBlock: AllForksTypeOf< - typeof bellatrixSsz.BeaconBlock | typeof capellaSsz.BeaconBlock | typeof eip4844Ssz.BeaconBlock + typeof bellatrixSsz.BeaconBlock | typeof capellaSsz.BeaconBlock | typeof denebSsz.BeaconBlock >; SignedBeaconBlock: AllForksTypeOf< - typeof bellatrixSsz.SignedBeaconBlock | typeof capellaSsz.SignedBeaconBlock | typeof eip4844Ssz.SignedBeaconBlock + typeof bellatrixSsz.SignedBeaconBlock | typeof capellaSsz.SignedBeaconBlock | typeof denebSsz.SignedBeaconBlock >; BeaconState: AllForksTypeOf< - typeof bellatrixSsz.BeaconState | typeof capellaSsz.BeaconState | typeof eip4844Ssz.BeaconState + typeof bellatrixSsz.BeaconState | typeof capellaSsz.BeaconState | typeof denebSsz.BeaconState >; ExecutionPayload: AllForksTypeOf< - typeof bellatrixSsz.ExecutionPayload | typeof capellaSsz.ExecutionPayload | typeof eip4844Ssz.ExecutionPayload + typeof bellatrixSsz.ExecutionPayload | typeof capellaSsz.ExecutionPayload | typeof denebSsz.ExecutionPayload >; ExecutionPayloadHeader: AllForksTypeOf< | typeof bellatrixSsz.ExecutionPayloadHeader | typeof capellaSsz.ExecutionPayloadHeader - | typeof eip4844Ssz.ExecutionPayloadHeader + | typeof denebSsz.ExecutionPayloadHeader >; BuilderBid: AllForksTypeOf< - typeof bellatrixSsz.BuilderBid | typeof capellaSsz.BuilderBid | typeof eip4844Ssz.BuilderBid + typeof bellatrixSsz.BuilderBid | typeof capellaSsz.BuilderBid | typeof denebSsz.BuilderBid >; SignedBuilderBid: AllForksTypeOf< - typeof bellatrixSsz.SignedBuilderBid | typeof capellaSsz.SignedBuilderBid | typeof eip4844Ssz.SignedBuilderBid + typeof bellatrixSsz.SignedBuilderBid | typeof capellaSsz.SignedBuilderBid | typeof denebSsz.SignedBuilderBid >; }; @@ -188,18 +188,18 @@ export type AllForksBlindedSSZTypes = { BeaconBlockBody: AllForksTypeOf< | typeof bellatrixSsz.BlindedBeaconBlockBody | typeof capellaSsz.BlindedBeaconBlock - | typeof eip4844Ssz.BlindedBeaconBlock + | typeof denebSsz.BlindedBeaconBlock >; BeaconBlock: AllForksTypeOf< - typeof bellatrixSsz.BlindedBeaconBlock | typeof capellaSsz.BlindedBeaconBlock | typeof eip4844Ssz.BlindedBeaconBlock + typeof bellatrixSsz.BlindedBeaconBlock | typeof capellaSsz.BlindedBeaconBlock | typeof denebSsz.BlindedBeaconBlock >; SignedBeaconBlock: AllForksTypeOf< | typeof bellatrixSsz.SignedBlindedBeaconBlock | typeof capellaSsz.SignedBlindedBeaconBlock - | typeof eip4844Ssz.SignedBlindedBeaconBlock + | typeof denebSsz.SignedBlindedBeaconBlock >; }; export type AllForksBlobsSSZTypes = { - SignedBeaconBlockAndBlobsSidecar: AllForksTypeOf; + SignedBeaconBlockAndBlobsSidecar: AllForksTypeOf; }; diff --git a/packages/types/src/eip4844/index.ts b/packages/types/src/deneb/index.ts similarity index 100% rename from packages/types/src/eip4844/index.ts rename to packages/types/src/deneb/index.ts diff --git a/packages/types/src/eip4844/sszTypes.ts b/packages/types/src/deneb/sszTypes.ts similarity index 93% rename from packages/types/src/eip4844/sszTypes.ts rename to packages/types/src/deneb/sszTypes.ts index 8b535f166aa9..9f79e2b23d74 100644 --- a/packages/types/src/eip4844/sszTypes.ts +++ b/packages/types/src/deneb/sszTypes.ts @@ -84,7 +84,7 @@ export const BeaconBlockAndBlobsSidecarByRootRequest = new ListCompositeType(Roo export const ExecutionPayload = new ContainerType( { ...bellatrixSsz.CommonExecutionPayloadType.fields, - excessDataGas: UintBn256, // New in EIP-4844 + excessDataGas: UintBn256, // New in DENEB // Extra payload fields blockHash: Root, transactions: bellatrixSsz.Transactions, @@ -96,7 +96,7 @@ export const ExecutionPayload = new ContainerType( export const ExecutionPayloadHeader = new ContainerType( { ...bellatrixSsz.CommonExecutionPayloadType.fields, - excessDataGas: UintBn256, // New in EIP-4844 + excessDataGas: UintBn256, // New in DENEB blockHash: Root, transactionsRoot: Root, withdrawalsRoot: Root, @@ -108,9 +108,9 @@ export const ExecutionPayloadHeader = new ContainerType( export const BeaconBlockBody = new ContainerType( { ...altairSsz.BeaconBlockBody.fields, - executionPayload: ExecutionPayload, // Modified in EIP-4844 + executionPayload: ExecutionPayload, // Modified in DENEB blsToExecutionChanges: capellaSsz.BeaconBlockBody.fields.blsToExecutionChanges, - blobKzgCommitments: BlobKzgCommitments, // New in EIP-4844 + blobKzgCommitments: BlobKzgCommitments, // New in DENEB }, {typeName: "BeaconBlockBody", jsonCase: "eth2", cachePermanentRootStruct: true} ); @@ -118,14 +118,14 @@ export const BeaconBlockBody = new ContainerType( export const BeaconBlock = new ContainerType( { ...capellaSsz.BeaconBlock.fields, - body: BeaconBlockBody, // Modified in EIP-4844 + body: BeaconBlockBody, // Modified in DENEB }, {typeName: "BeaconBlock", jsonCase: "eth2", cachePermanentRootStruct: true} ); export const SignedBeaconBlock = new ContainerType( { - message: BeaconBlock, // Modified in EIP-4844 + message: BeaconBlock, // Modified in DENEB signature: BLSSignature, }, {typeName: "SignedBeaconBlock", jsonCase: "eth2"} @@ -152,8 +152,8 @@ export const SignedBeaconBlockAndBlobsSidecar = new ContainerType( export const BlindedBeaconBlockBody = new ContainerType( { ...BeaconBlockBody.fields, - executionPayloadHeader: ExecutionPayloadHeader, // Modified in EIP-4844 - blobKzgCommitments: BlobKzgCommitments, // New in EIP-4844 + executionPayloadHeader: ExecutionPayloadHeader, // Modified in DENEB + blobKzgCommitments: BlobKzgCommitments, // New in DENEB }, {typeName: "BlindedBeaconBlockBody", jsonCase: "eth2", cachePermanentRootStruct: true} ); @@ -161,14 +161,14 @@ export const BlindedBeaconBlockBody = new ContainerType( export const BlindedBeaconBlock = new ContainerType( { ...capellaSsz.BlindedBeaconBlock.fields, - body: BlindedBeaconBlockBody, // Modified in EIP-4844 + body: BlindedBeaconBlockBody, // Modified in DENEB }, {typeName: "BlindedBeaconBlock", jsonCase: "eth2", cachePermanentRootStruct: true} ); export const SignedBlindedBeaconBlock = new ContainerType( { - message: BlindedBeaconBlock, // Modified in EIP-4844 + message: BlindedBeaconBlock, // Modified in DENEB signature: BLSSignature, }, {typeName: "SignedBlindedBeaconBlock", jsonCase: "eth2"} @@ -230,7 +230,7 @@ export const BeaconState = new ContainerType( currentSyncCommittee: altairSsz.SyncCommittee, nextSyncCommittee: altairSsz.SyncCommittee, // Execution - latestExecutionPayloadHeader: ExecutionPayloadHeader, // Modified in EIP-4844 + latestExecutionPayloadHeader: ExecutionPayloadHeader, // Modified in DENEB // Withdrawals nextWithdrawalIndex: capellaSsz.BeaconState.fields.nextWithdrawalIndex, nextWithdrawalValidatorIndex: capellaSsz.BeaconState.fields.nextWithdrawalValidatorIndex, diff --git a/packages/types/src/eip4844/types.ts b/packages/types/src/deneb/types.ts similarity index 100% rename from packages/types/src/eip4844/types.ts rename to packages/types/src/deneb/types.ts diff --git a/packages/types/src/sszTypes.ts b/packages/types/src/sszTypes.ts index de120240d687..6a751fabfb6e 100644 --- a/packages/types/src/sszTypes.ts +++ b/packages/types/src/sszTypes.ts @@ -3,7 +3,7 @@ export {ssz as phase0} from "./phase0/index.js"; export {ssz as altair} from "./altair/index.js"; export {ssz as bellatrix} from "./bellatrix/index.js"; export {ssz as capella} from "./capella/index.js"; -export {ssz as eip4844} from "./eip4844/index.js"; +export {ssz as deneb} from "./deneb/index.js"; import {ssz as allForksSsz} from "./allForks/index.js"; export const allForks = allForksSsz.allForks; diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index ef9663c2b756..b3837510401d 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -3,7 +3,7 @@ export {ts as phase0} from "./phase0/index.js"; export {ts as altair} from "./altair/index.js"; export {ts as bellatrix} from "./bellatrix/index.js"; export {ts as capella} from "./capella/index.js"; -export {ts as eip4844} from "./eip4844/index.js"; +export {ts as deneb} from "./deneb/index.js"; export {ts as allForks} from "./allForks/index.js"; diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index 44a0cbf20276..2abdfb7630dc 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -72,7 +72,7 @@ function getSpecCriticalParams(localConfig: IChainConfig): Record