diff --git a/packages/beacon-node/src/chain/blocks/utils/elephantWithWings.ts b/packages/beacon-node/src/chain/blocks/utils/elephantWithWings.ts new file mode 100644 index 000000000000..4879daf8f4a1 --- /dev/null +++ b/packages/beacon-node/src/chain/blocks/utils/elephantWithWings.ts @@ -0,0 +1,20 @@ +export const ELECTRA_ELEPHANTWITHWINGS_BANNER = String.raw` + :~~. + :!:^::^^!!^ + :!^^ !:J. + .!!:! .^7^ + .?7~: ^#! !!!^!~. + :!^ GP~..^^?^ ^!: + !^ Y5 #7: + .:^^~7~. ! ~~6800~~^ ^6800^ ~~6800 68 00 68~~ 00~ || + .~! 55J ~~6800~~ :! !^ .YP :JP 7B. ^7# + ^7 :: 5 #:::^::~~6800~~^^?!?.~:: :! !^ 6800 .^PJ JG ~!B + :G ^7 ^ !^68 00^ ~~6800~~ :! !: .&~ ^#! ^!55~~~6800~~7G~ !7B + 7G ~!5J ^? !.----. ~! ~~6800~~ .7#: 6800 ~ + ?G :^?G. ...... ^?^.!G. ?G :^?G. ...... ^?^.!G. ! + ~! ~~6800~~ .7#: 6800 G~ 7G ~!5J ^? !.----. :: + :! !: .&~ ^#! ^!55~~~6800~~7G~ !7B :G ^7 ^ !^68 00^ ~~6800~~ :: + :! !^ 6800 .^PJ JG ~!B ^7 :: 5 ^^ !!!! #:::^::~~6800~~^^?!?.~ + :! !^ .YP :JP 7B. ^7# .~!~ ~~6800 ^6800^ ~~6800~~ + 6800 68 00 68~~ 00~ 6800 +`; diff --git a/packages/beacon-node/src/chain/blocks/verifyBlock.ts b/packages/beacon-node/src/chain/blocks/verifyBlock.ts index 4f8bcfa86d01..201abf8b7c83 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlock.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlock.ts @@ -18,6 +18,7 @@ import {BlockInput, ImportBlockOpts} from "./types.js"; import {POS_PANDA_MERGE_TRANSITION_BANNER} from "./utils/pandaMergeTransitionBanner.js"; import {CAPELLA_OWL_BANNER} from "./utils/ownBanner.js"; import {DENEB_BLOWFISH_BANNER} from "./utils/blowfishBanner.js"; +import {ELECTRA_ELEPHANTWITHWINGS_BANNER} from "./utils/elephantWithWings.js"; import {verifyBlocksStateTransitionOnly} from "./verifyBlocksStateTransitionOnly.js"; import {verifyBlocksSignatures} from "./verifyBlocksSignatures.js"; import {verifyBlocksExecutionPayload, SegmentExecStatus} from "./verifyBlocksExecutionPayloads.js"; @@ -129,6 +130,11 @@ export async function verifyBlocksInEpoch( this.logger.info("Activating withdrawals", {epoch: this.config.CAPELLA_FORK_EPOCH}); break; + case ForkName.electra: + this.logger.info(ELECTRA_ELEPHANTWITHWINGS_BANNER); + this.logger.info("Activating verkle", {epoch: this.config.ELECTRA_FORK_EPOCH}); + break; + case ForkName.deneb: this.logger.info(DENEB_BLOWFISH_BANNER); this.logger.info("Activating blobs", {epoch: this.config.DENEB_FORK_EPOCH}); diff --git a/packages/beacon-node/src/execution/engine/types.ts b/packages/beacon-node/src/execution/engine/types.ts index 442b336051e0..968f33866d75 100644 --- a/packages/beacon-node/src/execution/engine/types.ts +++ b/packages/beacon-node/src/execution/engine/types.ts @@ -1,5 +1,5 @@ import * as util from "node:util"; -import {allForks, capella, deneb, Wei, bellatrix, Root, verge, ssz} from "@lodestar/types"; +import {allForks, capella, deneb, Wei, bellatrix, Root, electra, ssz} from "@lodestar/types"; import { BYTES_PER_LOGS_BLOOM, FIELD_ELEMENTS_PER_BLOB, @@ -195,14 +195,14 @@ export function serializeExecutionPayload(fork: ForkName, data: allForks.Executi payload.excessBlobGas = numToQuantity(excessBlobGas); } - // VERGE adds executionWitness to the ExecutionPayload - if (ForkSeq[fork] >= ForkSeq.verge) { - const {executionWitness} = data as verge.ExecutionPayload; + // ELECTRA adds executionWitness to the ExecutionPayload + if (ForkSeq[fork] >= ForkSeq.electra) { + const {executionWitness} = data as electra.ExecutionPayload; // right now the caseMap of ssz ExecutionWitness is camel cased and can // directly be used to serialize tojson - payload.executionWitness = ssz.verge.ExecutionWitness.toJson(executionWitness); + payload.executionWitness = ssz.electra.ExecutionWitness.toJson(executionWitness); // serialization with ssz serialize suffix diff's suffix to a string while geth expects num - (payload.executionWitness as verge.ExecutionWitness).stateDiff.forEach((sDiff) => { + (payload.executionWitness as electra.ExecutionWitness).stateDiff.forEach((sDiff) => { sDiff.suffixDiffs.forEach((sfDiff) => { sfDiff.suffix = Number(sfDiff.suffix); }); @@ -285,8 +285,8 @@ export function parseExecutionPayload( (executionPayload as deneb.ExecutionPayload).excessBlobGas = quantityToBigint(excessBlobGas); } - // VERGE adds execution witness to the payload - if (ForkSeq[fork] >= ForkSeq.verge) { + // ELECTRA adds execution witness to the payload + if (ForkSeq[fork] >= ForkSeq.electra) { // right now the casing of executionWitness is camel case in the ssz caseMap // we can directly use fromJson to read the serialized data from payload const {executionWitness} = data; @@ -295,8 +295,8 @@ export function parseExecutionPayload( util.inspect(executionWitness, false, null, true /* enable colors */), {blockNumber: data.blockNumber} ); - (executionPayload as verge.ExecutionPayload).executionWitness = - ssz.verge.ExecutionWitness.fromJson(executionWitness); + (executionPayload as electra.ExecutionPayload).executionWitness = + ssz.electra.ExecutionWitness.fromJson(executionWitness); } return {executionPayload, executionPayloadValue, blobsBundle}; diff --git a/packages/beacon-node/test/spec/presets/fork.test.ts b/packages/beacon-node/test/spec/presets/fork.test.ts index 64a00b63e220..c121e651fcea 100644 --- a/packages/beacon-node/test/spec/presets/fork.test.ts +++ b/packages/beacon-node/test/spec/presets/fork.test.ts @@ -36,8 +36,8 @@ const fork: TestRunnerFn = (forkNext) => { return slotFns.upgradeStateToCapella(preState as CachedBeaconStateBellatrix); case ForkName.deneb: return slotFns.upgradeStateToDeneb(preState as CachedBeaconStateCapella); - case ForkName.verge: - return slotFns.upgradeStateToVerge(preState as CachedBeaconStateDeneb); + case ForkName.electra: + return slotFns.upgradeStateToElectra(preState as CachedBeaconStateDeneb); } }, options: { diff --git a/packages/beacon-node/test/spec/presets/transition.test.ts b/packages/beacon-node/test/spec/presets/transition.test.ts index 9524044f15a8..1f98dbb41f58 100644 --- a/packages/beacon-node/test/spec/presets/transition.test.ts +++ b/packages/beacon-node/test/spec/presets/transition.test.ts @@ -102,7 +102,7 @@ function getTransitionConfig(fork: ForkName, forkEpoch: number): Partial = { phase0: { @@ -59,10 +59,10 @@ function getForkConfig({ prevVersion: Buffer.from([0, 0, 0, 3]), prevForkName: ForkName.capella, }, - verge: { - name: ForkName.verge, - seq: ForkSeq.verge, - epoch: verge, + electra: { + name: ForkName.electra, + seq: ForkSeq.electra, + epoch: electra, version: Buffer.from([0, 0, 0, 4]), prevVersion: Buffer.from([0, 0, 0, 3]), prevForkName: ForkName.capella, @@ -143,10 +143,10 @@ const testScenarios = [ for (const testScenario of testScenarios) { const {phase0, altair, bellatrix, capella, testCases} = testScenario; const deneb = Infinity; - const verge = Infinity; + const electra = Infinity; describe(`network / fork: phase0: ${phase0}, altair: ${altair}, bellatrix: ${bellatrix} capella: ${capella}`, () => { - const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, verge}); + const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra}); const forks = forkConfig.forks; for (const testCase of testCases) { const {epoch, currentFork, nextFork, activeForks} = testCase; diff --git a/packages/beacon-node/test/utils/config.ts b/packages/beacon-node/test/utils/config.ts index 727b0669517a..2aad1c14c03e 100644 --- a/packages/beacon-node/test/utils/config.ts +++ b/packages/beacon-node/test/utils/config.ts @@ -31,7 +31,7 @@ export function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig { CAPELLA_FORK_EPOCH: 0, DENEB_FORK_EPOCH: forkEpoch, }); - case ForkName.verge: + case ForkName.electra: return createChainForkConfig({ ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, diff --git a/packages/config/src/chainConfig/presets/mainnet.ts b/packages/config/src/chainConfig/presets/mainnet.ts index cb315608a9ae..a1d2f89cf880 100644 --- a/packages/config/src/chainConfig/presets/mainnet.ts +++ b/packages/config/src/chainConfig/presets/mainnet.ts @@ -45,7 +45,7 @@ export const chainConfig: ChainConfig = { DENEB_FORK_VERSION: b("0x04000000"), DENEB_FORK_EPOCH: Infinity, - // VERGE + // ELECTRA ELECTRA_FORK_VERSION: b("0x05000000"), ELECTRA_FORK_EPOCH: Infinity, diff --git a/packages/config/src/chainConfig/presets/minimal.ts b/packages/config/src/chainConfig/presets/minimal.ts index ebc3a430da53..75db5ac1e34e 100644 --- a/packages/config/src/chainConfig/presets/minimal.ts +++ b/packages/config/src/chainConfig/presets/minimal.ts @@ -42,7 +42,7 @@ export const chainConfig: ChainConfig = { // Deneb DENEB_FORK_VERSION: b("0x04000001"), DENEB_FORK_EPOCH: Infinity, - // Verge + // Electra ELECTRA_FORK_VERSION: b("0x05000001"), ELECTRA_FORK_EPOCH: Infinity, diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index ae1fd75c497b..7bf3406234fc 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -40,7 +40,7 @@ export type ChainConfig = { // DENEB DENEB_FORK_VERSION: Uint8Array; DENEB_FORK_EPOCH: number; - // VERGE + // ELECTRA ELECTRA_FORK_VERSION: Uint8Array; ELECTRA_FORK_EPOCH: number; @@ -96,7 +96,7 @@ export const chainConfigTypes: SpecTypes = { // DENEB DENEB_FORK_VERSION: "bytes", DENEB_FORK_EPOCH: "number", - // VERGE + // ELECTRA ELECTRA_FORK_VERSION: "bytes", ELECTRA_FORK_EPOCH: "number", diff --git a/packages/config/src/forkConfig/index.ts b/packages/config/src/forkConfig/index.ts index b8a3be3ced5a..6615b4ce44e7 100644 --- a/packages/config/src/forkConfig/index.ts +++ b/packages/config/src/forkConfig/index.ts @@ -55,9 +55,9 @@ export function createForkConfig(config: ChainConfig): ForkConfig { prevVersion: config.CAPELLA_FORK_VERSION, prevForkName: ForkName.capella, }; - const verge: ForkInfo = { - name: ForkName.verge, - seq: ForkSeq.verge, + const electra: ForkInfo = { + name: ForkName.electra, + seq: ForkSeq.electra, epoch: config.ELECTRA_FORK_EPOCH, version: config.ELECTRA_FORK_VERSION, prevVersion: config.CAPELLA_FORK_VERSION, @@ -66,7 +66,7 @@ export function createForkConfig(config: ChainConfig): ForkConfig { /** Forks in order order of occurence, `phase0` first */ // Note: Downstream code relies on proper ordering. - const forks = {phase0, altair, bellatrix, capella, verge, deneb}; + const forks = {phase0, altair, bellatrix, capella, electra, deneb}; // Prevents allocating an array on every getForkInfo() call const forksAscendingEpochOrder = Object.values(forks); diff --git a/packages/params/src/forkName.ts b/packages/params/src/forkName.ts index ea8617257606..c779046292b6 100644 --- a/packages/params/src/forkName.ts +++ b/packages/params/src/forkName.ts @@ -7,7 +7,7 @@ export enum ForkName { bellatrix = "bellatrix", capella = "capella", deneb = "deneb", - verge = "verge", + electra = "electra", } /** @@ -18,8 +18,8 @@ export enum ForkSeq { altair = 1, bellatrix = 2, capella = 3, - // Verge is scheduled after capella for now - verge = 4, + // Electra is scheduled after capella for now + electra = 4, deneb = 5, } @@ -47,8 +47,8 @@ export function isForkVerge(fork: ForkName): fork is ForkVerge { return isForkWithdrawals(fork) && fork !== ForkName.capella; } -export type ForkPreBlobs = ForkPreVerge | ForkName.verge; +export type ForkPreBlobs = ForkPreVerge | ForkName.electra; export type ForkBlobs = Exclude; export function isForkBlobs(fork: ForkName): fork is ForkBlobs { - return isForkVerge(fork) && fork !== ForkName.verge; + return isForkVerge(fork) && fork !== ForkName.electra; } diff --git a/packages/params/src/index.ts b/packages/params/src/index.ts index 8b8a8a88d3a4..674edb7dcf66 100644 --- a/packages/params/src/index.ts +++ b/packages/params/src/index.ts @@ -236,7 +236,7 @@ export const BYTES_PER_FIELD_ELEMENT = 32; export const BLOB_TX_TYPE = 0x03; export const VERSIONED_HASH_VERSION_KZG = 0x01; -// TODO: Verge spec notes these as preset but there's only one value +// TODO: Electra spec notes these as preset but there's only one value // https://github.com/ethereum/consensus-specs/blob/db74090c1e8dc1fb2c052bae268e22dc63061e32/specs/verge/beacon-chain.md#preset export const MAX_STEMS = 2 ** 16; export const MAX_COMMITMENTS_PER_STEM = 33; diff --git a/packages/state-transition/src/cache/stateCache.ts b/packages/state-transition/src/cache/stateCache.ts index 302bc9cc35e3..964a0a344ebd 100644 --- a/packages/state-transition/src/cache/stateCache.ts +++ b/packages/state-transition/src/cache/stateCache.ts @@ -11,7 +11,7 @@ import { BeaconStateBellatrix, BeaconStateCapella, BeaconStateDeneb, - BeaconStateVerge, + BeaconStateElectra, } from "./types.js"; export type BeaconStateCache = { @@ -130,7 +130,7 @@ export type CachedBeaconStateAltair = CachedBeaconState; export type CachedBeaconStateBellatrix = CachedBeaconState; export type CachedBeaconStateCapella = CachedBeaconState; export type CachedBeaconStateDeneb = CachedBeaconState; -export type CachedBeaconStateVerge = CachedBeaconState; +export type CachedBeaconStateElectra = 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 cb85a5bcf64e..a865aa4f4183 100644 --- a/packages/state-transition/src/cache/types.ts +++ b/packages/state-transition/src/cache/types.ts @@ -7,7 +7,7 @@ export type BeaconStateAltair = CompositeViewDU; export type BeaconStateBellatrix = CompositeViewDU; export type BeaconStateCapella = CompositeViewDU; export type BeaconStateDeneb = CompositeViewDU; -export type BeaconStateVerge = CompositeViewDU; +export type BeaconStateElectra = CompositeViewDU; // Union at the TreeViewDU level // - Works well as function argument and as generic type for allForks functions @@ -20,8 +20,8 @@ export type BeaconStateAllForks = | BeaconStateBellatrix | BeaconStateCapella | BeaconStateDeneb - | BeaconStateVerge; + | BeaconStateElectra; -export type BeaconStateExecutions = BeaconStateBellatrix | BeaconStateCapella | BeaconStateDeneb | BeaconStateVerge; +export type BeaconStateExecutions = BeaconStateBellatrix | BeaconStateCapella | BeaconStateDeneb | BeaconStateElectra; export type ShufflingGetter = (shufflingEpoch: Epoch, dependentRoot: RootHex) => EpochShuffling | null; diff --git a/packages/state-transition/src/slot/index.ts b/packages/state-transition/src/slot/index.ts index 8c47495bcccb..b05bd7ac93f2 100644 --- a/packages/state-transition/src/slot/index.ts +++ b/packages/state-transition/src/slot/index.ts @@ -7,7 +7,7 @@ export {upgradeStateToAltair} from "./upgradeStateToAltair.js"; export {upgradeStateToBellatrix} from "./upgradeStateToBellatrix.js"; export {upgradeStateToCapella} from "./upgradeStateToCapella.js"; export {upgradeStateToDeneb} from "./upgradeStateToDeneb.js"; -export {upgradeStateToVerge} from "./upgradeStateToVerge.js"; +export {upgradeStateToElectra} from "./upgradeStateToElectra.js"; /** * Dial state to next slot. Common for all forks diff --git a/packages/state-transition/src/slot/upgradeStateToElectra.ts b/packages/state-transition/src/slot/upgradeStateToElectra.ts new file mode 100644 index 000000000000..d43d0d344486 --- /dev/null +++ b/packages/state-transition/src/slot/upgradeStateToElectra.ts @@ -0,0 +1,26 @@ +import {ssz} from "@lodestar/types"; +import {CachedBeaconStateCapella, CachedBeaconStateElectra} from "../types.js"; +import {getCachedBeaconState} from "../cache/stateCache.js"; + +/** + * Upgrade a state from Capella (Eventualy DENEB) to Electra. + */ +export function upgradeStateToElectra(stateCapella: CachedBeaconStateCapella): CachedBeaconStateElectra { + const {config} = stateCapella; + + const stateCapellaNode = ssz.capella.BeaconState.commitViewDU(stateCapella); + const stateElectraView = ssz.electra.BeaconState.getViewDU(stateCapellaNode); + + const stateElectra = getCachedBeaconState(stateElectraView, stateCapella); + + stateElectra.fork = ssz.phase0.Fork.toViewDU({ + previousVersion: stateCapella.fork.currentVersion, + currentVersion: config.ELECTRA_FORK_VERSION, + epoch: stateCapella.epochCtx.epoch, + }); + + // latestExecutionPayloadHeader's executionWitnessRoot will have default zero root + + stateElectra.commit(); + return stateElectra; +} diff --git a/packages/state-transition/src/slot/upgradeStateToVerge.ts b/packages/state-transition/src/slot/upgradeStateToVerge.ts deleted file mode 100644 index 0a7e60c81d8d..000000000000 --- a/packages/state-transition/src/slot/upgradeStateToVerge.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {ssz} from "@lodestar/types"; -import {CachedBeaconStateDeneb, CachedBeaconStateVerge} from "../types.js"; -import {getCachedBeaconState} from "../cache/stateCache.js"; - -/** - * Upgrade a state from Deneb to Verge. - */ -export function upgradeStateToVerge(stateDeneb: CachedBeaconStateDeneb): CachedBeaconStateVerge { - const {config} = stateDeneb; - - const stateDenebNode = ssz.deneb.BeaconState.commitViewDU(stateDeneb); - const stateVergeView = ssz.verge.BeaconState.getViewDU(stateDenebNode); - - const stateVerge = getCachedBeaconState(stateVergeView, stateDeneb); - - stateVerge.fork = ssz.phase0.Fork.toViewDU({ - previousVersion: stateDeneb.fork.currentVersion, - currentVersion: config.DENEB_FORK_VERSION, - epoch: stateDeneb.epochCtx.epoch, - }); - - // latestExecutionPayloadHeader's executionWitnessRoot will have default zero root - - stateVerge.commit(); - return stateVerge; -} diff --git a/packages/state-transition/src/stateTransition.ts b/packages/state-transition/src/stateTransition.ts index 57a1c16a93e6..e4fc2b9039bd 100644 --- a/packages/state-transition/src/stateTransition.ts +++ b/packages/state-transition/src/stateTransition.ts @@ -9,7 +9,7 @@ import { CachedBeaconStateAltair, CachedBeaconStateBellatrix, CachedBeaconStateCapella, - CachedBeaconStateDeneb, + // CachedBeaconStateDeneb, } from "./types.js"; import {computeEpochAtSlot} from "./util/index.js"; import {verifyProposerSignature} from "./signatureSets/index.js"; @@ -24,7 +24,7 @@ import {processBlock} from "./block/index.js"; import {processEpoch} from "./epoch/index.js"; import {BlockExternalData, DataAvailableStatus, ExecutionPayloadStatus} from "./block/externalData.js"; import {ProcessBlockOpts} from "./block/types.js"; -import {upgradeStateToVerge} from "./slot/upgradeStateToVerge.js"; +import {upgradeStateToElectra} from "./slot/upgradeStateToElectra.js"; // Multifork capable state transition @@ -199,7 +199,7 @@ function processSlotsWithTransientCache( postState = upgradeStateToDeneb(postState as CachedBeaconStateCapella) as CachedBeaconStateAllForks; } if (stateSlot === config.ELECTRA_FORK_EPOCH) { - postState = upgradeStateToVerge(postState as CachedBeaconStateDeneb) as CachedBeaconStateAllForks; + postState = upgradeStateToElectra(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 02f33fba0d39..d3a1ed69a7a9 100644 --- a/packages/state-transition/src/types.ts +++ b/packages/state-transition/src/types.ts @@ -9,7 +9,7 @@ export type { CachedBeaconStateBellatrix, CachedBeaconStateCapella, CachedBeaconStateDeneb, - CachedBeaconStateVerge, + CachedBeaconStateElectra, } from "./cache/stateCache.js"; export type { @@ -20,5 +20,5 @@ export type { BeaconStateBellatrix, BeaconStateCapella, BeaconStateDeneb, - BeaconStateVerge, + BeaconStateElectra, } from "./cache/types.js"; diff --git a/packages/state-transition/src/util/execution.ts b/packages/state-transition/src/util/execution.ts index 10e936f25784..ca9cd0f1dc5c 100644 --- a/packages/state-transition/src/util/execution.ts +++ b/packages/state-transition/src/util/execution.ts @@ -1,4 +1,4 @@ -import {allForks, bellatrix, capella, deneb, verge, isBlindedBeaconBlockBody, ssz} from "@lodestar/types"; +import {allForks, bellatrix, capella, deneb, electra, isBlindedBeaconBlockBody, ssz} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; import { @@ -170,10 +170,10 @@ export function executionPayloadToPayloadHeader( ).excessBlobGas; } - if (fork >= ForkSeq.verge) { + if (fork >= ForkSeq.electra) { // https://github.com/ethereum/consensus-specs/blob/db74090c1e8dc1fb2c052bae268e22dc63061e32/specs/verge/beacon-chain.md#process_execution_payload - (bellatrixPayloadFields as verge.ExecutionPayloadHeader).executionWitnessRoot = - ssz.verge.ExecutionWitness.hashTreeRoot((payload as verge.ExecutionPayload).executionWitness); + (bellatrixPayloadFields as electra.ExecutionPayloadHeader).executionWitnessRoot = + ssz.electra.ExecutionWitness.hashTreeRoot((payload as electra.ExecutionPayload).executionWitness); } return bellatrixPayloadFields; diff --git a/packages/state-transition/src/util/genesis.ts b/packages/state-transition/src/util/genesis.ts index ce76cce5ef64..1edbab34ad57 100644 --- a/packages/state-transition/src/util/genesis.ts +++ b/packages/state-transition/src/util/genesis.ts @@ -214,7 +214,7 @@ export function initializeBeaconStateFromEth1( | typeof ssz.bellatrix.ExecutionPayloadHeader | typeof ssz.capella.ExecutionPayloadHeader | typeof ssz.deneb.ExecutionPayloadHeader - | typeof ssz.verge.ExecutionPayloadHeader + | typeof ssz.electra.ExecutionPayloadHeader > ): CachedBeaconStateAllForks { const stateView = getGenesisBeaconState( @@ -286,12 +286,12 @@ export function initializeBeaconStateFromEth1( } if (GENESIS_SLOT >= config.ELECTRA_FORK_EPOCH) { - const stateVerge = state as CompositeViewDU; - stateVerge.fork.previousVersion = config.ELECTRA_FORK_VERSION; - stateVerge.fork.currentVersion = config.ELECTRA_FORK_VERSION; - stateVerge.latestExecutionPayloadHeader = - (executionPayloadHeader as CompositeViewDU) ?? - ssz.verge.ExecutionPayloadHeader.defaultViewDU(); + const stateElectra = state as CompositeViewDU; + stateElectra.fork.previousVersion = config.ELECTRA_FORK_VERSION; + stateElectra.fork.currentVersion = config.ELECTRA_FORK_VERSION; + stateElectra.latestExecutionPayloadHeader = + (executionPayloadHeader as CompositeViewDU) ?? + ssz.electra.ExecutionPayloadHeader.defaultViewDU(); } state.commit(); diff --git a/packages/types/src/allForks/sszTypes.ts b/packages/types/src/allForks/sszTypes.ts index ef210bde40b7..2f976728b6c2 100644 --- a/packages/types/src/allForks/sszTypes.ts +++ b/packages/types/src/allForks/sszTypes.ts @@ -3,7 +3,7 @@ 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 deneb} from "../deneb/index.js"; -import {ssz as verge} from "../verge/index.js"; +import {ssz as electra} from "../electra/index.js"; /** * Index the ssz types that differ by fork @@ -45,11 +45,11 @@ export const allForks = { BeaconState: deneb.BeaconState, Metadata: altair.Metadata, }, - verge: { - BeaconBlockBody: verge.BeaconBlockBody, - BeaconBlock: verge.BeaconBlock, - SignedBeaconBlock: verge.SignedBeaconBlock, - BeaconState: verge.BeaconState, + electra: { + BeaconBlockBody: electra.BeaconBlockBody, + BeaconBlock: electra.BeaconBlock, + SignedBeaconBlock: electra.SignedBeaconBlock, + BeaconState: electra.BeaconState, Metadata: altair.Metadata, }, }; @@ -93,13 +93,13 @@ export const allForksExecution = { SignedBuilderBid: deneb.SignedBuilderBid, SSEPayloadAttributes: deneb.SSEPayloadAttributes, }, - verge: { - BeaconBlockBody: verge.BeaconBlockBody, - BeaconBlock: verge.BeaconBlock, - SignedBeaconBlock: verge.SignedBeaconBlock, - BeaconState: verge.BeaconState, - ExecutionPayload: verge.ExecutionPayload, - ExecutionPayloadHeader: verge.ExecutionPayloadHeader, + electra: { + BeaconBlockBody: electra.BeaconBlockBody, + BeaconBlock: electra.BeaconBlock, + SignedBeaconBlock: electra.SignedBeaconBlock, + BeaconState: electra.BeaconState, + ExecutionPayload: electra.ExecutionPayload, + ExecutionPayloadHeader: electra.ExecutionPayloadHeader, BuilderBid: deneb.BuilderBid, SignedBuilderBid: deneb.SignedBuilderBid, SSEPayloadAttributes: deneb.SSEPayloadAttributes, @@ -126,10 +126,10 @@ export const allForksBlinded = { BeaconBlock: deneb.BlindedBeaconBlock, SignedBeaconBlock: deneb.SignedBlindedBeaconBlock, }, - verge: { - BeaconBlockBody: verge.BlindedBeaconBlockBody, - BeaconBlock: verge.BlindedBeaconBlock, - SignedBeaconBlock: verge.SignedBlindedBeaconBlock, + electra: { + BeaconBlockBody: electra.BlindedBeaconBlockBody, + BeaconBlock: electra.BlindedBeaconBlock, + SignedBeaconBlock: electra.SignedBlindedBeaconBlock, }, }; @@ -174,15 +174,15 @@ export const allForksLightClient = { LightClientOptimisticUpdate: deneb.LightClientOptimisticUpdate, LightClientStore: deneb.LightClientStore, }, - verge: { - BeaconBlock: verge.BeaconBlock, - BeaconBlockBody: verge.BeaconBlockBody, - LightClientHeader: verge.LightClientHeader, - LightClientBootstrap: verge.LightClientBootstrap, - LightClientUpdate: verge.LightClientUpdate, - LightClientFinalityUpdate: verge.LightClientFinalityUpdate, - LightClientOptimisticUpdate: verge.LightClientOptimisticUpdate, - LightClientStore: verge.LightClientStore, + electra: { + BeaconBlock: electra.BeaconBlock, + BeaconBlockBody: electra.BeaconBlockBody, + LightClientHeader: electra.LightClientHeader, + LightClientBootstrap: electra.LightClientBootstrap, + LightClientUpdate: electra.LightClientUpdate, + LightClientFinalityUpdate: electra.LightClientFinalityUpdate, + LightClientOptimisticUpdate: electra.LightClientOptimisticUpdate, + LightClientStore: electra.LightClientStore, }, }; @@ -192,8 +192,8 @@ export const allForksBlobs = { BlindedBlobSidecar: deneb.BlindedBlobSidecar, ExecutionPayloadAndBlobsBundle: deneb.ExecutionPayloadAndBlobsBundle, }, - verge: { - BlobSidecar: deneb.BlobSidecar, - BlindedBlobSidecar: deneb.BlindedBlobSidecar, - }, + // electra: { + // BlobSidecar: deneb.BlobSidecar, + // ExecutionPayloadAndBlobsBundle: electra.ExecutionPayloadAndBlobsBundle, + // }, }; diff --git a/packages/types/src/allForks/types.ts b/packages/types/src/allForks/types.ts index eda078c1c5d6..5c72fc5df115 100644 --- a/packages/types/src/allForks/types.ts +++ b/packages/types/src/allForks/types.ts @@ -4,14 +4,14 @@ 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 deneb} from "../deneb/index.js"; -import {ts as verge} from "../verge/index.js"; +import {ts as electra} from "../electra/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 denebSsz} from "../deneb/index.js"; -import {ssz as vergeSsz} from "../verge/index.js"; +import {ssz as electraSsz} from "../electra/index.js"; // Re-export union types for types that are _known_ to differ @@ -21,28 +21,28 @@ export type BeaconBlockBody = | bellatrix.BeaconBlockBody | capella.BeaconBlockBody | deneb.BeaconBlockBody - | verge.BeaconBlockBody; + | electra.BeaconBlockBody; export type BeaconBlock = | phase0.BeaconBlock | altair.BeaconBlock | bellatrix.BeaconBlock | capella.BeaconBlock | deneb.BeaconBlock - | verge.BeaconBlock; + | electra.BeaconBlock; export type SignedBeaconBlock = | phase0.SignedBeaconBlock | altair.SignedBeaconBlock | bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock | deneb.SignedBeaconBlock - | verge.SignedBeaconBlock; + | electra.SignedBeaconBlock; export type BeaconState = | phase0.BeaconState | altair.BeaconState | bellatrix.BeaconState | capella.BeaconState | deneb.BeaconState - | verge.BeaconState; + | electra.BeaconState; export type Metadata = phase0.Metadata | altair.Metadata; // For easy reference in the assemble block for building payloads @@ -50,36 +50,36 @@ export type ExecutionBlockBody = | bellatrix.BeaconBlockBody | capella.BeaconBlockBody | deneb.BeaconBlockBody - | verge.BeaconBlockBody; + | electra.BeaconBlockBody; // These two additional types will also change bellatrix forward export type ExecutionPayload = | bellatrix.ExecutionPayload | capella.ExecutionPayload | deneb.ExecutionPayload - | verge.ExecutionPayload; + | electra.ExecutionPayload; export type ExecutionPayloadHeader = | bellatrix.ExecutionPayloadHeader | capella.ExecutionPayloadHeader | deneb.ExecutionPayloadHeader - | verge.ExecutionPayloadHeader; + | electra.ExecutionPayloadHeader; // Blinded types that will change across forks export type BlindedBeaconBlockBody = | bellatrix.BlindedBeaconBlockBody | capella.BlindedBeaconBlockBody | deneb.BlindedBeaconBlockBody - | verge.BlindedBeaconBlockBody; + | electra.BlindedBeaconBlockBody; export type BlindedBeaconBlock = | bellatrix.BlindedBeaconBlock | capella.BlindedBeaconBlock | deneb.BlindedBeaconBlock - | verge.BlindedBeaconBlock; + | electra.BlindedBeaconBlock; export type SignedBlindedBeaconBlock = | bellatrix.SignedBlindedBeaconBlock | capella.SignedBlindedBeaconBlock | deneb.SignedBlindedBeaconBlock - | verge.SignedBlindedBeaconBlock; + | electra.SignedBlindedBeaconBlock; // Full or blinded types export type FullOrBlindedExecutionPayload = @@ -213,7 +213,7 @@ export type AllForksSSZTypes = { | typeof bellatrixSsz.BeaconBlockBody | typeof capellaSsz.BeaconBlockBody | typeof denebSsz.BeaconBlockBody - | typeof vergeSsz.BeaconBlockBody + | typeof electraSsz.BeaconBlockBody >; BeaconBlock: AllForksTypeOf< | typeof phase0Ssz.BeaconBlock @@ -221,7 +221,7 @@ export type AllForksSSZTypes = { | typeof bellatrixSsz.BeaconBlock | typeof capellaSsz.BeaconBlock | typeof denebSsz.BeaconBlock - | typeof vergeSsz.BeaconBlock + | typeof electraSsz.BeaconBlock >; SignedBeaconBlock: AllForksTypeOf< | typeof phase0Ssz.SignedBeaconBlock @@ -229,7 +229,7 @@ export type AllForksSSZTypes = { | typeof bellatrixSsz.SignedBeaconBlock | typeof capellaSsz.SignedBeaconBlock | typeof denebSsz.SignedBeaconBlock - | typeof vergeSsz.SignedBeaconBlock + | typeof electraSsz.SignedBeaconBlock >; BeaconState: AllForksTypeOf< | typeof phase0Ssz.BeaconState @@ -237,7 +237,7 @@ export type AllForksSSZTypes = { | typeof bellatrixSsz.BeaconState | typeof capellaSsz.BeaconState | typeof denebSsz.BeaconState - | typeof vergeSsz.BeaconState + | typeof electraSsz.BeaconState >; Metadata: AllForksTypeOf; }; @@ -247,37 +247,37 @@ export type AllForksExecutionSSZTypes = { | typeof bellatrixSsz.BeaconBlockBody | typeof capellaSsz.BeaconBlockBody | typeof denebSsz.BeaconBlockBody - | typeof vergeSsz.BeaconBlockBody + | typeof electraSsz.BeaconBlockBody >; BeaconBlock: AllForksTypeOf< | typeof bellatrixSsz.BeaconBlock | typeof capellaSsz.BeaconBlock | typeof denebSsz.BeaconBlock - | typeof vergeSsz.BeaconBlock + | typeof electraSsz.BeaconBlock >; SignedBeaconBlock: AllForksTypeOf< | typeof bellatrixSsz.SignedBeaconBlock | typeof capellaSsz.SignedBeaconBlock | typeof denebSsz.SignedBeaconBlock - | typeof vergeSsz.SignedBeaconBlock + | typeof electraSsz.SignedBeaconBlock >; BeaconState: AllForksTypeOf< | typeof bellatrixSsz.BeaconState | typeof capellaSsz.BeaconState | typeof denebSsz.BeaconState - | typeof vergeSsz.BeaconState + | typeof electraSsz.BeaconState >; ExecutionPayload: AllForksTypeOf< | typeof bellatrixSsz.ExecutionPayload | typeof capellaSsz.ExecutionPayload | typeof denebSsz.ExecutionPayload - | typeof vergeSsz.ExecutionPayload + | typeof electraSsz.ExecutionPayload >; ExecutionPayloadHeader: AllForksTypeOf< | typeof bellatrixSsz.ExecutionPayloadHeader | typeof capellaSsz.ExecutionPayloadHeader | typeof denebSsz.ExecutionPayloadHeader - | typeof vergeSsz.ExecutionPayloadHeader + | typeof electraSsz.ExecutionPayloadHeader >; BuilderBid: AllForksTypeOf< typeof bellatrixSsz.BuilderBid | typeof capellaSsz.BuilderBid | typeof denebSsz.BuilderBid @@ -297,19 +297,19 @@ export type AllForksBlindedSSZTypes = { | typeof bellatrixSsz.BlindedBeaconBlockBody | typeof capellaSsz.BlindedBeaconBlock | typeof denebSsz.BlindedBeaconBlock - | typeof vergeSsz.BlindedBeaconBlock + | typeof electraSsz.BlindedBeaconBlock >; BeaconBlock: AllForksTypeOf< | typeof bellatrixSsz.BlindedBeaconBlock | typeof capellaSsz.BlindedBeaconBlock | typeof denebSsz.BlindedBeaconBlock - | typeof vergeSsz.BlindedBeaconBlock + | typeof electraSsz.BlindedBeaconBlock >; SignedBeaconBlock: AllForksTypeOf< | typeof bellatrixSsz.SignedBlindedBeaconBlock | typeof capellaSsz.SignedBlindedBeaconBlock | typeof denebSsz.SignedBlindedBeaconBlock - | typeof vergeSsz.SignedBlindedBeaconBlock + | typeof electraSsz.SignedBlindedBeaconBlock >; }; @@ -319,14 +319,14 @@ export type AllForksLightClientSSZTypes = { | typeof bellatrixSsz.BeaconBlock | typeof capellaSsz.BeaconBlock | typeof denebSsz.BeaconBlock - | typeof vergeSsz.BeaconBlock + | typeof electraSsz.BeaconBlock >; BeaconBlockBody: AllForksTypeOf< | typeof altairSsz.BeaconBlockBody | typeof bellatrixSsz.BeaconBlockBody | typeof capellaSsz.BeaconBlockBody | typeof denebSsz.BeaconBlockBody - | typeof vergeSsz.BeaconBlockBody + | typeof electraSsz.BeaconBlockBody >; LightClientHeader: AllForksTypeOf< typeof altairSsz.LightClientHeader | typeof capellaSsz.LightClientHeader | typeof denebSsz.LightClientHeader diff --git a/packages/types/src/verge/index.ts b/packages/types/src/electra/index.ts similarity index 100% rename from packages/types/src/verge/index.ts rename to packages/types/src/electra/index.ts diff --git a/packages/types/src/verge/sszTypes.ts b/packages/types/src/electra/sszTypes.ts similarity index 96% rename from packages/types/src/verge/sszTypes.ts rename to packages/types/src/electra/sszTypes.ts index 34dcd403dba2..486edcc5cdef 100644 --- a/packages/types/src/verge/sszTypes.ts +++ b/packages/types/src/electra/sszTypes.ts @@ -109,7 +109,7 @@ export const ExecutionWitness = new ContainerType( export const ExecutionPayload = new ContainerType( { ...capellaSsz.ExecutionPayload.fields, - executionWitness: ExecutionWitness, // New in verge + executionWitness: ExecutionWitness, // New in electra }, {typeName: "ExecutionPayload", jsonCase: "eth2"} ); @@ -117,7 +117,7 @@ export const ExecutionPayload = new ContainerType( export const ExecutionPayloadHeader = new ContainerType( { ...capellaSsz.ExecutionPayloadHeader.fields, - executionWitnessRoot: Root, // New in verge + executionWitnessRoot: Root, // New in electra }, {typeName: "ExecutionPayloadHeader", jsonCase: "eth2"} ); @@ -126,7 +126,7 @@ export const ExecutionPayloadHeader = new ContainerType( export const BeaconBlockBody = new ContainerType( { ...altairSsz.BeaconBlockBody.fields, - executionPayload: ExecutionPayload, // Modified in verge + executionPayload: ExecutionPayload, // Modified in electra blsToExecutionChanges: capellaSsz.BeaconBlockBody.fields.blsToExecutionChanges, // blobKzgCommitments: denebSsz.BlobKzgCommitments, }, @@ -136,14 +136,14 @@ export const BeaconBlockBody = new ContainerType( export const BeaconBlock = new ContainerType( { ...capellaSsz.BeaconBlock.fields, - body: BeaconBlockBody, // Modified in verge + body: BeaconBlockBody, // Modified in electra }, {typeName: "BeaconBlock", jsonCase: "eth2", cachePermanentRootStruct: true} ); export const SignedBeaconBlock = new ContainerType( { - message: BeaconBlock, // Modified in verge + message: BeaconBlock, // Modified in electra signature: BLSSignature, }, {typeName: "SignedBeaconBlock", jsonCase: "eth2"} @@ -152,7 +152,7 @@ export const SignedBeaconBlock = new ContainerType( export const BlindedBeaconBlockBody = new ContainerType( { ...altairSsz.BeaconBlockBody.fields, - executionPayloadHeader: ExecutionPayloadHeader, // Modified in verge + executionPayloadHeader: ExecutionPayloadHeader, // Modified in electra blsToExecutionChanges: capellaSsz.BeaconBlockBody.fields.blsToExecutionChanges, // blobKzgCommitments: denebSsz.BlobKzgCommitments, }, @@ -213,7 +213,7 @@ export const BeaconState = new ContainerType( currentSyncCommittee: altairSsz.SyncCommittee, nextSyncCommittee: altairSsz.SyncCommittee, // Execution - latestExecutionPayloadHeader: ExecutionPayloadHeader, // Modified in verge + latestExecutionPayloadHeader: ExecutionPayloadHeader, // Modified in electra // Withdrawals nextWithdrawalIndex: capellaSsz.BeaconState.fields.nextWithdrawalIndex, nextWithdrawalValidatorIndex: capellaSsz.BeaconState.fields.nextWithdrawalValidatorIndex, diff --git a/packages/types/src/verge/types.ts b/packages/types/src/electra/types.ts similarity index 100% rename from packages/types/src/verge/types.ts rename to packages/types/src/electra/types.ts diff --git a/packages/types/src/sszTypes.ts b/packages/types/src/sszTypes.ts index 4e6c3eccfc39..ff3e77ab6947 100644 --- a/packages/types/src/sszTypes.ts +++ b/packages/types/src/sszTypes.ts @@ -4,7 +4,7 @@ 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 deneb} from "./deneb/index.js"; -export {ssz as verge} from "./verge/index.js"; +export {ssz as electra} from "./electra/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 84f261af00b3..fbd7d5621da0 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -6,7 +6,7 @@ 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 deneb} from "./deneb/index.js"; -export {ts as verge} from "./verge/index.js"; +export {ts as electra} from "./electra/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 38e453a4820e..301273698073 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -73,7 +73,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record