From 3e779a6c717bfebfebf77e24fd8c1af60e0f31ad Mon Sep 17 00:00:00 2001 From: harkamal Date: Tue, 13 Aug 2024 17:00:05 +0530 Subject: [PATCH 1/3] feat: placeholder PR for epbs add types stub and epoch config fix types fixes rename cleanup types fix types --- .../test/spec/presets/fork.test.ts | 2 + .../test/spec/presets/transition.test.ts | 9 + .../upgradeLightClientHeader.test.ts | 33 ++- .../test/unit/network/fork.test.ts | 13 +- packages/beacon-node/test/utils/config.ts | 9 + .../config/src/chainConfig/configs/mainnet.ts | 4 + .../config/src/chainConfig/configs/minimal.ts | 4 + packages/config/src/chainConfig/types.ts | 6 + packages/config/src/forkConfig/index.ts | 10 +- packages/light-client/src/spec/utils.ts | 4 + packages/params/src/forkName.ts | 19 ++ packages/params/src/index.ts | 11 + packages/params/src/presets/mainnet.ts | 6 + packages/params/src/presets/minimal.ts | 6 + packages/params/src/types.ts | 8 + .../test/unit/upgradeState.test.ts | 9 + packages/types/src/ebps/index.ts | 3 + packages/types/src/ebps/sszTypes.ts | 236 ++++++++++++++++++ packages/types/src/ebps/types.ts | 32 +++ packages/types/src/sszTypes.ts | 4 +- packages/types/src/types.ts | 39 +++ packages/types/src/utils/typeguards.ts | 10 +- packages/validator/src/util/params.ts | 5 + .../test/unit/utils/interopConfigs.ts | 4 +- 24 files changed, 474 insertions(+), 12 deletions(-) create mode 100644 packages/types/src/ebps/index.ts create mode 100644 packages/types/src/ebps/sszTypes.ts create mode 100644 packages/types/src/ebps/types.ts diff --git a/packages/beacon-node/test/spec/presets/fork.test.ts b/packages/beacon-node/test/spec/presets/fork.test.ts index c121e651fcea..efcf75166207 100644 --- a/packages/beacon-node/test/spec/presets/fork.test.ts +++ b/packages/beacon-node/test/spec/presets/fork.test.ts @@ -38,6 +38,8 @@ const fork: TestRunnerFn = (forkNext) => { return slotFns.upgradeStateToDeneb(preState as CachedBeaconStateCapella); case ForkName.electra: return slotFns.upgradeStateToElectra(preState as CachedBeaconStateDeneb); + case ForkName.ebps: + throw Error("not Implemented"); } }, options: { diff --git a/packages/beacon-node/test/spec/presets/transition.test.ts b/packages/beacon-node/test/spec/presets/transition.test.ts index cae7c667b590..41619b5bed48 100644 --- a/packages/beacon-node/test/spec/presets/transition.test.ts +++ b/packages/beacon-node/test/spec/presets/transition.test.ts @@ -110,6 +110,15 @@ function getTransitionConfig(fork: ForkName, forkEpoch: number): Partial${toFork}`, function () { + lcHeaderByFork[fromFork].beacon.slot = testSlots[fromFork]; + lcHeaderByFork[toFork].beacon.slot = testSlots[fromFork]; + + expect(() => { + upgradeLightClientHeader(config, toFork, lcHeaderByFork[fromFork]); + }).toThrow("Not Implemented"); + }); + } + + // Since ebps is not implemented for loop is till deneb (Object.values(ForkName).length-1) + // Once ebps is implemnted run for loop till Object.values(ForkName).length + + // for (let i = ForkSeq.altair; i < Object.values(ForkName).length; i++) { + + for (let i = ForkSeq.altair; i < Object.values(ForkName).length - 1; i++) { for (let j = i; j > 0; j--) { const fromFork = ForkName[ForkSeq[i] as ForkName]; const toFork = ForkName[ForkSeq[j] as ForkName]; diff --git a/packages/beacon-node/test/unit/network/fork.test.ts b/packages/beacon-node/test/unit/network/fork.test.ts index bbe1c0870d30..101d4eed0a23 100644 --- a/packages/beacon-node/test/unit/network/fork.test.ts +++ b/packages/beacon-node/test/unit/network/fork.test.ts @@ -10,6 +10,7 @@ function getForkConfig({ capella, deneb, electra, + ebps, }: { phase0: number; altair: number; @@ -17,6 +18,7 @@ function getForkConfig({ capella: number; deneb: number; electra: number; + ebps: number; }): BeaconConfig { const forks: Record = { phase0: { @@ -67,6 +69,14 @@ function getForkConfig({ prevVersion: Buffer.from([0, 0, 0, 4]), prevForkName: ForkName.deneb, }, + ebps: { + name: ForkName.ebps, + seq: ForkSeq.ebps, + epoch: ebps, + version: Buffer.from([0, 0, 0, 9]), + prevVersion: Buffer.from([0, 0, 0, 5]), + prevForkName: ForkName.electra, + }, }; const forksAscendingEpochOrder = Object.values(forks); const forksDescendingEpochOrder = Object.values(forks).reverse(); @@ -144,9 +154,10 @@ for (const testScenario of testScenarios) { const {phase0, altair, bellatrix, capella, testCases} = testScenario; const deneb = Infinity; const electra = Infinity; + const ebps = Infinity; describe(`network / fork: phase0: ${phase0}, altair: ${altair}, bellatrix: ${bellatrix} capella: ${capella}`, () => { - const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra}); + const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, ebps}); 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 2aad1c14c03e..930ec3dfcf28 100644 --- a/packages/beacon-node/test/utils/config.ts +++ b/packages/beacon-node/test/utils/config.ts @@ -39,5 +39,14 @@ export function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig { DENEB_FORK_EPOCH: 0, ELECTRA_FORK_EPOCH: forkEpoch, }); + case ForkName.ebps: + return createChainForkConfig({ + ALTAIR_FORK_EPOCH: 0, + BELLATRIX_FORK_EPOCH: 0, + CAPELLA_FORK_EPOCH: 0, + DENEB_FORK_EPOCH: 0, + ELECTRA_FORK_EPOCH: 0, + EBPS_FORK_EPOCH: forkEpoch, + }); } } diff --git a/packages/config/src/chainConfig/configs/mainnet.ts b/packages/config/src/chainConfig/configs/mainnet.ts index 741ddc99f8cd..705d65c492c4 100644 --- a/packages/config/src/chainConfig/configs/mainnet.ts +++ b/packages/config/src/chainConfig/configs/mainnet.ts @@ -53,6 +53,10 @@ export const chainConfig: ChainConfig = { ELECTRA_FORK_VERSION: b("0x05000000"), ELECTRA_FORK_EPOCH: Infinity, + // Ebps + EBPS_FORK_VERSION: b("0x09000000"), + EBPS_FORK_EPOCH: Infinity, + // Time parameters // --------------------------------------------------------------- // 12 seconds diff --git a/packages/config/src/chainConfig/configs/minimal.ts b/packages/config/src/chainConfig/configs/minimal.ts index 26f49cc3e47d..5f8b28c178d5 100644 --- a/packages/config/src/chainConfig/configs/minimal.ts +++ b/packages/config/src/chainConfig/configs/minimal.ts @@ -49,6 +49,10 @@ export const chainConfig: ChainConfig = { ELECTRA_FORK_VERSION: b("0x05000001"), ELECTRA_FORK_EPOCH: Infinity, + // Ebps + EBPS_FORK_VERSION: b("0x05000001"), + EBPS_FORK_EPOCH: Infinity, + // Time parameters // --------------------------------------------------------------- // [customized] Faster for testing purposes diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index 05fff02f2eaf..781d26cde2bd 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -43,6 +43,9 @@ export type ChainConfig = { // ELECTRA ELECTRA_FORK_VERSION: Uint8Array; ELECTRA_FORK_EPOCH: number; + // EBPS + EBPS_FORK_VERSION: Uint8Array; + EBPS_FORK_EPOCH: number; // Time parameters SECONDS_PER_SLOT: number; @@ -107,6 +110,9 @@ export const chainConfigTypes: SpecTypes = { // ELECTRA ELECTRA_FORK_VERSION: "bytes", ELECTRA_FORK_EPOCH: "number", + // EBPS + EBPS_FORK_VERSION: "bytes", + EBPS_FORK_EPOCH: "number", // Time parameters SECONDS_PER_SLOT: "number", diff --git a/packages/config/src/forkConfig/index.ts b/packages/config/src/forkConfig/index.ts index 513cd7559ee3..3349ab536a73 100644 --- a/packages/config/src/forkConfig/index.ts +++ b/packages/config/src/forkConfig/index.ts @@ -67,10 +67,18 @@ export function createForkConfig(config: ChainConfig): ForkConfig { prevVersion: config.DENEB_FORK_VERSION, prevForkName: ForkName.deneb, }; + const ebps: ForkInfo = { + name: ForkName.ebps, + seq: ForkSeq.ebps, + epoch: config.EBPS_FORK_EPOCH, + version: config.EBPS_FORK_VERSION, + prevVersion: config.ELECTRA_FORK_VERSION, + prevForkName: ForkName.electra, + }; /** Forks in order order of occurence, `phase0` first */ // Note: Downstream code relies on proper ordering. - const forks = {phase0, altair, bellatrix, capella, deneb, electra}; + const forks = {phase0, altair, bellatrix, capella, deneb, electra, ebps}; // Prevents allocating an array on every getForkInfo() call const forksAscendingEpochOrder = Object.values(forks); diff --git a/packages/light-client/src/spec/utils.ts b/packages/light-client/src/spec/utils.ts index 3e59cb14cfa0..b2a2803aa2ca 100644 --- a/packages/light-client/src/spec/utils.ts +++ b/packages/light-client/src/spec/utils.ts @@ -124,6 +124,10 @@ export function upgradeLightClientHeader( // Break if no further upgrades is required else fall through if (ForkSeq[targetFork] <= ForkSeq.electra) break; + + // eslint-disable-next-line no-fallthrough + case ForkName.ebps: + throw Error("Not Implemented"); } return upgradedHeader; } diff --git a/packages/params/src/forkName.ts b/packages/params/src/forkName.ts index 42e8917942d2..11648a9cb462 100644 --- a/packages/params/src/forkName.ts +++ b/packages/params/src/forkName.ts @@ -8,6 +8,7 @@ export enum ForkName { capella = "capella", deneb = "deneb", electra = "electra", + ebps = "ebps", } /** @@ -20,6 +21,7 @@ export enum ForkSeq { capella = 3, deneb = 4, electra = 5, + ebps = 6, } function exclude(coll: T[], val: U[]): Exclude[] { @@ -93,3 +95,20 @@ export const forkPostElectra = exclude(forkAll, [ export function isForkPostElectra(fork: ForkName): fork is ForkPostElectra { return isForkBlobs(fork) && fork !== ForkName.deneb; } + +// TODO add electra type in ForkPreEpbs +export type ForkPreEpbs = ForkPreBlobs | ForkName.deneb | ForkName.electra; +export type ForkExecutionPreEpbs = Exclude; +export const forkExecutionPreEpbs = [ForkName.bellatrix, ForkName.capella, ForkName.deneb, ForkName.electra]; +export type ForkEpbs = Exclude; +export const forkEpbs = exclude(forkAll, [ + ForkName.phase0, + ForkName.altair, + ForkName.bellatrix, + ForkName.capella, + ForkName.deneb, + ForkName.electra, +]); +export function isForkEpbs(fork: ForkName): fork is ForkEpbs { + return isForkBlobs(fork) && fork !== ForkName.deneb && fork !== ForkName.electra; +} diff --git a/packages/params/src/index.ts b/packages/params/src/index.ts index e7fd5b976336..129cc6b23055 100644 --- a/packages/params/src/index.ts +++ b/packages/params/src/index.ts @@ -108,6 +108,9 @@ export const { MAX_ATTESTATIONS_ELECTRA, MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA, + + PTC_SIZE, + MAX_PAYLOAD_ATTESTATIONS, } = activePreset; //////////// @@ -145,6 +148,8 @@ export const DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF = Uint8Array.from([8, 0, 0, 0 export const DOMAIN_CONTRIBUTION_AND_PROOF = Uint8Array.from([9, 0, 0, 0]); export const DOMAIN_BLS_TO_EXECUTION_CHANGE = Uint8Array.from([10, 0, 0, 0]); export const DOMAIN_CONSOLIDATION = Uint8Array.from([11, 0, 0, 0]); +export const DOMAIN_PTC_ATTESTER = Uint8Array.from([12, 0, 0, 0]); //DomainType('0x0C000000') # (New in EIP-7732) +export const DOMAIN_BEACON_BUILDER = Uint8Array.from([27, 0, 0, 0]); // DomainType('0x1B000000') # (New in EIP-7732) // Application specific domains @@ -268,3 +273,9 @@ export const NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA = 87; export const NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA = 6; export const FINALIZED_ROOT_DEPTH_ELECTRA = 7; export const FINALIZED_ROOT_INDEX_ELECTRA = 169; + +// ebps +export const PAYLOAD_ABSENT = 0; +export const PAYLOAD_PRESENT = 1; +export const PAYLOAD_WITHHELD = 2; +export const PAYLOAD_INVALID_STATUS = 3; diff --git a/packages/params/src/presets/mainnet.ts b/packages/params/src/presets/mainnet.ts index a4a88aac1f58..869223c2fedf 100644 --- a/packages/params/src/presets/mainnet.ts +++ b/packages/params/src/presets/mainnet.ts @@ -135,4 +135,10 @@ export const mainnetPreset: BeaconPreset = { PENDING_CONSOLIDATIONS_LIMIT: 262144, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096, + + // ebps - EIP-7732 + // uint64(2**9) = 512 + PTC_SIZE: 512, + // 2**2 = 4 + MAX_PAYLOAD_ATTESTATIONS: 4, }; diff --git a/packages/params/src/presets/minimal.ts b/packages/params/src/presets/minimal.ts index 97eff53cf013..e19278431799 100644 --- a/packages/params/src/presets/minimal.ts +++ b/packages/params/src/presets/minimal.ts @@ -136,4 +136,10 @@ export const minimalPreset: BeaconPreset = { PENDING_CONSOLIDATIONS_LIMIT: 64, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096, + + // ebps - EIP-7732 + // uint64(2**9) = 512 + PTC_SIZE: 512, + // 2**2 = 4 + MAX_PAYLOAD_ATTESTATIONS: 4, }; diff --git a/packages/params/src/types.ts b/packages/params/src/types.ts index e867b4a3cf71..82222b1ac32f 100644 --- a/packages/params/src/types.ts +++ b/packages/params/src/types.ts @@ -97,6 +97,10 @@ export type BeaconPreset = { PENDING_CONSOLIDATIONS_LIMIT: number; MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: number; WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: number; + + // EBPS + PTC_SIZE: number; + MAX_PAYLOAD_ATTESTATIONS: number; }; /** @@ -197,6 +201,10 @@ export const beaconPresetTypes: BeaconPresetTypes = { PENDING_CONSOLIDATIONS_LIMIT: "number", MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: "number", WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: "number", + + // EBPS + PTC_SIZE: "number", + MAX_PAYLOAD_ATTESTATIONS: "number", }; type BeaconPresetTypes = { diff --git a/packages/state-transition/test/unit/upgradeState.test.ts b/packages/state-transition/test/unit/upgradeState.test.ts index df9b052542f9..f09e843dcf5c 100644 --- a/packages/state-transition/test/unit/upgradeState.test.ts +++ b/packages/state-transition/test/unit/upgradeState.test.ts @@ -79,5 +79,14 @@ function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig { DENEB_FORK_EPOCH: 0, ELECTRA_FORK_EPOCH: forkEpoch, }); + case ForkName.ebps: + return createChainForkConfig({ + ALTAIR_FORK_EPOCH: 0, + BELLATRIX_FORK_EPOCH: 0, + CAPELLA_FORK_EPOCH: 0, + DENEB_FORK_EPOCH: 0, + ELECTRA_FORK_EPOCH: 0, + EBPS_FORK_EPOCH: forkEpoch, + }); } } diff --git a/packages/types/src/ebps/index.ts b/packages/types/src/ebps/index.ts new file mode 100644 index 000000000000..7856cd729620 --- /dev/null +++ b/packages/types/src/ebps/index.ts @@ -0,0 +1,3 @@ +export * from "./types.js"; +export * as ts from "./types.js"; +export * as ssz from "./sszTypes.js"; diff --git a/packages/types/src/ebps/sszTypes.ts b/packages/types/src/ebps/sszTypes.ts new file mode 100644 index 000000000000..5a7cf9c1b8c9 --- /dev/null +++ b/packages/types/src/ebps/sszTypes.ts @@ -0,0 +1,236 @@ +import {ContainerType, ListCompositeType, BitVectorType, ListBasicType} from "@chainsafe/ssz"; +import {PTC_SIZE, MAX_PAYLOAD_ATTESTATIONS, EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ssz as primitiveSsz} from "../primitive/index.js"; +import {ssz as phase0Ssz} from "../phase0/index.js"; +import {ssz as altairSsz} from "../altair/index.js"; +import {ssz as capellaSsz} from "../capella/index.js"; +import {ssz as denebSsz} from "../deneb/index.js"; + +const {BLSSignature, Root, Slot, Uint8, ValidatorIndex, Gwei, Boolean, UintNum64} = primitiveSsz; + +export const PayloadAttestationData = new ContainerType( + { + beaconBlockRoot: Root, + slot: Slot, + payload_status: Uint8, + }, + {typeName: "PayloadAttestationData", jsonCase: "eth2"} +); + +export const PayloadAttestation = new ContainerType( + { + aggregationBits: new BitVectorType(PTC_SIZE), + data: PayloadAttestationData, + signature: BLSSignature, + }, + {typeName: "PayloadAttestation", jsonCase: "eth2"} +); +export const PayloadAttestations = new ListCompositeType(PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS); + +export const PayloadAttestationMessage = new ContainerType( + { + validator_index: ValidatorIndex, + data: PayloadAttestationData, + signature: BLSSignature, + }, + {typeName: "PayloadAttestationMessage", jsonCase: "eth2"} +); + +export const AttestingIndices = new ListBasicType(ValidatorIndex, PTC_SIZE); +export const IndexedPayloadAttestation = new ContainerType( + { + attestingIndices: AttestingIndices, + data: PayloadAttestationData, + signature: BLSSignature, + }, + {typeName: "IndexedPayloadAttestation", jsonCase: "eth2"} +); + +export const ExecutionPayload = new ContainerType( + { + ...denebSsz.ExecutionPayload.fields, + }, + {typeName: "ExecutionPayload", jsonCase: "eth2"} +); + +export const ExecutionPayloadHeader = new ContainerType( + { + parentBlockHash: Root, + parentBlockRoot: Root, + blockHash: Root, + gasLimit: UintNum64, + builderIndex: ValidatorIndex, + slot: Slot, + value: Gwei, + blobKzgCommitmentsRoot: Root, + }, + {typeName: "ExecutionPayloadHeader", jsonCase: "eth2"} +); + +export const SignedExecutionPayloadHeader = new ContainerType( + { + message: ExecutionPayloadHeader, + signature: BLSSignature, + }, + {typeName: "SignedExecutionPayloadHeader", jsonCase: "eth2"} +); + +export const ExecutionPayloadEnvelope = new ContainerType( + { + payload: ExecutionPayload, + builderIndex: ValidatorIndex, + beaconBlockRoot: Root, + blobKzgCommitments: denebSsz.BlobKzgCommitments, + payloadWithheld: Boolean, + stateRoot: Root, + }, + {typeName: "ExecutionPayloadEnvelope", jsonCase: "eth2"} +); + +export const SignedExecutionPayloadEnvelope = new ContainerType( + { + message: ExecutionPayloadEnvelope, + signature: BLSSignature, + }, + {typeName: "SignedExecutionPayloadEnvelope", jsonCase: "eth2"} +); + +export const BeaconBlockBody = new ContainerType( + { + // execution related fields pre epbs are removed and instead + ...altairSsz.BeaconBlockBody.fields, + blsToExecutionChanges: capellaSsz.BLSToExecutionChanges, + signedExecutionPayloadHeader: SignedExecutionPayloadHeader, // [New in EIP-7732] + payloadAttestations: new ListCompositeType(PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS), // [New in EIP-7732] + }, + {typeName: "BeaconBlockBody", jsonCase: "eth2", cachePermanentRootStruct: true} +); + +export const BeaconBlock = new ContainerType( + { + ...denebSsz.BeaconBlock.fields, + body: BeaconBlockBody, // Modified in EPBS + }, + {typeName: "BeaconBlock", jsonCase: "eth2", cachePermanentRootStruct: true} +); + +export const SignedBeaconBlock = new ContainerType( + { + message: BeaconBlock, + signature: BLSSignature, + }, + {typeName: "SignedBeaconBlock", jsonCase: "eth2"} +); + +export const BlindedBeaconBlockBody = BeaconBlockBody; + +export const BlindedBeaconBlock = BeaconBlock; + +export const SignedBlindedBeaconBlock = SignedBeaconBlock; + +export const BuilderBid = ExecutionPayloadHeader; +export const SignedBuilderBid = SignedExecutionPayloadHeader; + +export const ExecutionPayloadAndBlobsBundle = new ContainerType( + { + executionPayload: ExecutionPayload, + blobsBundle: denebSsz.BlobsBundle, + }, + {typeName: "ExecutionPayloadAndBlobsBundle", jsonCase: "eth2"} +); + +export const BeaconState = new ContainerType( + { + ...capellaSsz.BeaconState.fields, + latestExecutionPayloadHeader: ExecutionPayloadHeader, + // TODO electra fields once rebased on electra + latestBlockHash: Root, // [New in EIP-7732] + latestFullSlot: Slot, // [New in EIP-7732] + latestWithdrawalsRoot: Root, // [New in EIP-7732] + }, + {typeName: "BeaconState", jsonCase: "eth2"} +); + +export const LightClientHeader = new ContainerType( + { + beacon: phase0Ssz.BeaconBlockHeader, + execution: ExecutionPayloadHeader, + executionBranch: capellaSsz.LightClientHeader.fields.executionBranch, + }, + {typeName: "LightClientHeader", jsonCase: "eth2"} +); + +export const LightClientBootstrap = new ContainerType( + { + header: LightClientHeader, + currentSyncCommittee: altairSsz.SyncCommittee, + currentSyncCommitteeBranch: altairSsz.LightClientBootstrap.fields.currentSyncCommitteeBranch, + }, + {typeName: "LightClientBootstrap", jsonCase: "eth2"} +); + +export const LightClientUpdate = new ContainerType( + { + attestedHeader: LightClientHeader, + nextSyncCommittee: altairSsz.SyncCommittee, + nextSyncCommitteeBranch: altairSsz.LightClientUpdate.fields.nextSyncCommitteeBranch, + finalizedHeader: LightClientHeader, + finalityBranch: altairSsz.LightClientUpdate.fields.finalityBranch, + syncAggregate: altairSsz.SyncAggregate, + signatureSlot: Slot, + }, + {typeName: "LightClientUpdate", jsonCase: "eth2"} +); + +export const LightClientFinalityUpdate = new ContainerType( + { + attestedHeader: LightClientHeader, + finalizedHeader: LightClientHeader, + finalityBranch: altairSsz.LightClientFinalityUpdate.fields.finalityBranch, + syncAggregate: altairSsz.SyncAggregate, + signatureSlot: Slot, + }, + {typeName: "LightClientFinalityUpdate", jsonCase: "eth2"} +); + +export const LightClientOptimisticUpdate = new ContainerType( + { + attestedHeader: LightClientHeader, + syncAggregate: altairSsz.SyncAggregate, + signatureSlot: Slot, + }, + {typeName: "LightClientOptimisticUpdate", jsonCase: "eth2"} +); + +export const LightClientStore = new ContainerType( + { + snapshot: LightClientBootstrap, + validUpdates: new ListCompositeType(LightClientUpdate, EPOCHS_PER_SYNC_COMMITTEE_PERIOD * SLOTS_PER_EPOCH), + }, + {typeName: "LightClientStore", jsonCase: "eth2"} +); + +export const SSEPayloadAttributes = new ContainerType( + { + ...denebSsz.SSEPayloadAttributes.fields, + }, + {typeName: "SSEPayloadAttributes", jsonCase: "eth2"} +); + +export const BlockContents = new ContainerType( + { + block: BeaconBlock, + kzgProofs: denebSsz.KZGProofs, + blobs: denebSsz.Blobs, + }, + {typeName: "BlockContents", jsonCase: "eth2"} +); + +export const SignedBlockContents = new ContainerType( + { + signedBlock: SignedBeaconBlock, + kzgProofs: denebSsz.KZGProofs, + blobs: denebSsz.Blobs, + }, + {typeName: "SignedBlockContents", jsonCase: "eth2"} +); diff --git a/packages/types/src/ebps/types.ts b/packages/types/src/ebps/types.ts new file mode 100644 index 000000000000..caaa63ad8cbb --- /dev/null +++ b/packages/types/src/ebps/types.ts @@ -0,0 +1,32 @@ +import {ValueOf} from "@chainsafe/ssz"; +import * as ssz from "./sszTypes.js"; + +export type ExecutionPayloadAndBlobsBundle = ValueOf; + +export type ExecutionPayload = ValueOf; +export type ExecutionPayloadHeader = ValueOf; + +export type BeaconBlockBody = ValueOf; +export type BeaconBlock = ValueOf; +export type SignedBeaconBlock = ValueOf; + +export type BeaconState = ValueOf; + +export type BlindedBeaconBlockBody = ValueOf; +export type BlindedBeaconBlock = ValueOf; +export type SignedBlindedBeaconBlock = ValueOf; + +export type BuilderBid = ValueOf; +export type SignedBuilderBid = ValueOf; +export type SSEPayloadAttributes = ValueOf; + +export type LightClientHeader = ValueOf; +export type LightClientBootstrap = ValueOf; +export type LightClientUpdate = ValueOf; +export type LightClientFinalityUpdate = ValueOf; +export type LightClientOptimisticUpdate = ValueOf; +export type LightClientStore = ValueOf; + +export type BlockContents = ValueOf; +export type SignedBlockContents = ValueOf; +export type Contents = Omit; diff --git a/packages/types/src/sszTypes.ts b/packages/types/src/sszTypes.ts index 4399904a94bc..e17d5e80a4ce 100644 --- a/packages/types/src/sszTypes.ts +++ b/packages/types/src/sszTypes.ts @@ -6,9 +6,10 @@ 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 electra} from "./electra/index.js"; +import {ssz as ebps} from "./ebps/index.js"; export * from "./primitive/sszTypes.js"; -export {phase0, altair, bellatrix, capella, deneb, electra}; +export {phase0, altair, bellatrix, capella, deneb, electra, ebps}; /** * Index the ssz types that differ by fork @@ -21,6 +22,7 @@ const typesByFork = { [ForkName.capella]: {...phase0, ...altair, ...bellatrix, ...capella}, [ForkName.deneb]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb}, [ForkName.electra]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra}, + [ForkName.ebps]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra, ...ebps}, }; /** diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index 1071eed79a10..13ed10ed2f42 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -5,6 +5,7 @@ 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 electra} from "./electra/index.js"; +import {ts as ebps} from "./ebps/index.js"; import {Slot} from "./primitive/types.js"; export * from "./primitive/types.js"; @@ -14,6 +15,7 @@ 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 electra} from "./electra/index.js"; +export {ts as ebps} from "./ebps/index.js"; /** Common non-spec type to represent roots as strings */ export type RootHex = string; @@ -200,6 +202,43 @@ type TypesByFork = { AggregateAndProof: electra.AggregateAndProof; SignedAggregateAndProof: electra.SignedAggregateAndProof; }; + [ForkName.ebps]: { + BeaconBlockHeader: phase0.BeaconBlockHeader; + SignedBeaconBlockHeader: phase0.SignedBeaconBlockHeader; + BeaconBlock: ebps.BeaconBlock; + BeaconBlockBody: ebps.BeaconBlockBody; + BeaconState: ebps.BeaconState; + SignedBeaconBlock: ebps.SignedBeaconBlock; + Metadata: altair.Metadata; + LightClientHeader: ebps.LightClientHeader; + LightClientBootstrap: ebps.LightClientBootstrap; + LightClientUpdate: ebps.LightClientUpdate; + LightClientFinalityUpdate: ebps.LightClientFinalityUpdate; + LightClientOptimisticUpdate: ebps.LightClientOptimisticUpdate; + LightClientStore: ebps.LightClientStore; + BlindedBeaconBlock: ebps.BlindedBeaconBlock; + BlindedBeaconBlockBody: ebps.BlindedBeaconBlockBody; + SignedBlindedBeaconBlock: ebps.SignedBlindedBeaconBlock; + ExecutionPayload: ebps.ExecutionPayload; + ExecutionPayloadHeader: ebps.ExecutionPayloadHeader; + BuilderBid: ebps.BuilderBid; + SignedBuilderBid: ebps.SignedBuilderBid; + SSEPayloadAttributes: ebps.SSEPayloadAttributes; + BlockContents: ebps.BlockContents; + SignedBlockContents: ebps.SignedBlockContents; + + ExecutionPayloadAndBlobsBundle: deneb.ExecutionPayloadAndBlobsBundle; + BlobsBundle: deneb.BlobsBundle; + Contents: deneb.Contents; + SyncCommittee: altair.SyncCommittee; + SyncAggregate: altair.SyncAggregate; + Attestation: phase0.Attestation; + IndexedAttestation: phase0.IndexedAttestation; + IndexedAttestationBigint: phase0.IndexedAttestationBigint; + AttesterSlashing: phase0.AttesterSlashing; + AggregateAndProof: phase0.AggregateAndProof; + SignedAggregateAndProof: phase0.SignedAggregateAndProof; + }; }; export type TypesFor = K extends void diff --git a/packages/types/src/utils/typeguards.ts b/packages/types/src/utils/typeguards.ts index 72910645f6e1..1047a5ddf470 100644 --- a/packages/types/src/utils/typeguards.ts +++ b/packages/types/src/utils/typeguards.ts @@ -1,4 +1,4 @@ -import {ForkBlobs, ForkExecution, ForkPostElectra} from "@lodestar/params"; +import {ForkBlobs, ForkExecution, ForkPostElectra, ForkExecutionPreEpbs} from "@lodestar/params"; import { BlockContents, SignedBeaconBlock, @@ -24,7 +24,7 @@ export function isExecutionPayload( return (payload as ExecutionPayload).transactions !== undefined; } -export function isExecutionPayloadHeader( +export function isExecutionPayloadHeader( payload: ExecutionPayload | ExecutionPayloadHeader ): payload is ExecutionPayloadHeader { // we just check transactionsRoot for determining as it the base field @@ -44,16 +44,16 @@ export function isBlindedBeaconBlock( return (block as BeaconBlock).body !== null && isBlindedBeaconBlockBody((block as BeaconBlock).body); } -export function isBlindedSignedBeaconBlock( +export function isBlindedSignedBeaconBlock( signedBlock: SignedBeaconBlock | SignedBeaconBlockOrContents ): signedBlock is SignedBlindedBeaconBlock { return (signedBlock as SignedBlindedBeaconBlock).message.body.executionPayloadHeader !== undefined; } -export function isBlindedBeaconBlockBody( +export function isBlindedBeaconBlockBody( body: BeaconBlockBody | BlindedBeaconBlockBody ): body is BlindedBeaconBlockBody { - return (body as BlindedBeaconBlockBody).executionPayloadHeader !== undefined; + return (body as BlindedBeaconBlockBody).executionPayloadHeader !== undefined; } export function isBlockContents( diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index 6d6705f512df..d8419a31ece4 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -74,6 +74,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record Date: Mon, 9 Sep 2024 16:12:09 +0530 Subject: [PATCH 2/3] rebase fixes --- packages/params/src/forkName.ts | 6 +++--- packages/types/src/types.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/params/src/forkName.ts b/packages/params/src/forkName.ts index 11648a9cb462..ed2d70c4af8a 100644 --- a/packages/params/src/forkName.ts +++ b/packages/params/src/forkName.ts @@ -97,10 +97,10 @@ export function isForkPostElectra(fork: ForkName): fork is ForkPostElectra { } // TODO add electra type in ForkPreEpbs -export type ForkPreEpbs = ForkPreBlobs | ForkName.deneb | ForkName.electra; +export type ForkPreEpbs = ForkPreElectra | ForkName.electra; export type ForkExecutionPreEpbs = Exclude; export const forkExecutionPreEpbs = [ForkName.bellatrix, ForkName.capella, ForkName.deneb, ForkName.electra]; -export type ForkEpbs = Exclude; +export type ForkEpbs = Exclude; export const forkEpbs = exclude(forkAll, [ ForkName.phase0, ForkName.altair, @@ -110,5 +110,5 @@ export const forkEpbs = exclude(forkAll, [ ForkName.electra, ]); export function isForkEpbs(fork: ForkName): fork is ForkEpbs { - return isForkBlobs(fork) && fork !== ForkName.deneb && fork !== ForkName.electra; + return isForkPostElectra(fork) && fork !== ForkName.electra; } diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index 13ed10ed2f42..fdda9a4b4395 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -232,12 +232,12 @@ type TypesByFork = { Contents: deneb.Contents; SyncCommittee: altair.SyncCommittee; SyncAggregate: altair.SyncAggregate; - Attestation: phase0.Attestation; - IndexedAttestation: phase0.IndexedAttestation; - IndexedAttestationBigint: phase0.IndexedAttestationBigint; - AttesterSlashing: phase0.AttesterSlashing; - AggregateAndProof: phase0.AggregateAndProof; - SignedAggregateAndProof: phase0.SignedAggregateAndProof; + Attestation: electra.Attestation; + IndexedAttestation: electra.IndexedAttestation; + IndexedAttestationBigint: electra.IndexedAttestationBigint; + AttesterSlashing: electra.AttesterSlashing; + AggregateAndProof: electra.AggregateAndProof; + SignedAggregateAndProof: electra.SignedAggregateAndProof; }; }; From 8ac76d05ff2926c2a80ebf76db476726fd1e24dc Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:23:37 -0700 Subject: [PATCH 3/3] ebps -> epbs --- .../test/spec/presets/fork.test.ts | 2 +- .../test/spec/presets/transition.test.ts | 4 +- .../upgradeLightClientHeader.test.ts | 18 ++++---- .../test/unit/network/fork.test.ts | 16 +++---- packages/beacon-node/test/utils/config.ts | 4 +- .../config/src/chainConfig/configs/mainnet.ts | 6 +-- .../config/src/chainConfig/configs/minimal.ts | 6 +-- packages/config/src/chainConfig/types.ts | 12 ++--- packages/config/src/forkConfig/index.ts | 12 ++--- packages/light-client/src/spec/utils.ts | 2 +- packages/params/src/forkName.ts | 4 +- packages/params/src/index.ts | 2 +- packages/params/src/presets/mainnet.ts | 2 +- packages/params/src/presets/minimal.ts | 2 +- packages/params/src/types.ts | 4 +- .../test/unit/upgradeState.test.ts | 4 +- packages/types/src/{ebps => epbs}/index.ts | 0 packages/types/src/{ebps => epbs}/sszTypes.ts | 3 +- packages/types/src/{ebps => epbs}/types.ts | 0 packages/types/src/sszTypes.ts | 6 +-- packages/types/src/types.ts | 46 +++++++++---------- packages/validator/src/util/params.ts | 8 ++-- .../test/unit/utils/interopConfigs.ts | 4 +- 23 files changed, 84 insertions(+), 83 deletions(-) rename packages/types/src/{ebps => epbs}/index.ts (100%) rename packages/types/src/{ebps => epbs}/sszTypes.ts (98%) rename packages/types/src/{ebps => epbs}/types.ts (100%) diff --git a/packages/beacon-node/test/spec/presets/fork.test.ts b/packages/beacon-node/test/spec/presets/fork.test.ts index efcf75166207..a1d937d7ed78 100644 --- a/packages/beacon-node/test/spec/presets/fork.test.ts +++ b/packages/beacon-node/test/spec/presets/fork.test.ts @@ -38,7 +38,7 @@ const fork: TestRunnerFn = (forkNext) => { return slotFns.upgradeStateToDeneb(preState as CachedBeaconStateCapella); case ForkName.electra: return slotFns.upgradeStateToElectra(preState as CachedBeaconStateDeneb); - case ForkName.ebps: + case ForkName.epbs: throw Error("not Implemented"); } }, diff --git a/packages/beacon-node/test/spec/presets/transition.test.ts b/packages/beacon-node/test/spec/presets/transition.test.ts index 41619b5bed48..02aa5324cb4d 100644 --- a/packages/beacon-node/test/spec/presets/transition.test.ts +++ b/packages/beacon-node/test/spec/presets/transition.test.ts @@ -110,14 +110,14 @@ function getTransitionConfig(fork: ForkName, forkEpoch: number): Partial${toFork}`, function () { lcHeaderByFork[fromFork].beacon.slot = testSlots[fromFork]; @@ -80,8 +80,8 @@ describe("UpgradeLightClientHeader", function () { }); } - // Since ebps is not implemented for loop is till deneb (Object.values(ForkName).length-1) - // Once ebps is implemnted run for loop till Object.values(ForkName).length + // Since epbs is not implemented for loop is till deneb (Object.values(ForkName).length-1) + // Once epbs is implemnted run for loop till Object.values(ForkName).length // for (let i = ForkSeq.altair; i < Object.values(ForkName).length; i++) { diff --git a/packages/beacon-node/test/unit/network/fork.test.ts b/packages/beacon-node/test/unit/network/fork.test.ts index 101d4eed0a23..691cb34e272a 100644 --- a/packages/beacon-node/test/unit/network/fork.test.ts +++ b/packages/beacon-node/test/unit/network/fork.test.ts @@ -10,7 +10,7 @@ function getForkConfig({ capella, deneb, electra, - ebps, + epbs, }: { phase0: number; altair: number; @@ -18,7 +18,7 @@ function getForkConfig({ capella: number; deneb: number; electra: number; - ebps: number; + epbs: number; }): BeaconConfig { const forks: Record = { phase0: { @@ -69,10 +69,10 @@ function getForkConfig({ prevVersion: Buffer.from([0, 0, 0, 4]), prevForkName: ForkName.deneb, }, - ebps: { - name: ForkName.ebps, - seq: ForkSeq.ebps, - epoch: ebps, + epbs: { + name: ForkName.epbs, + seq: ForkSeq.epbs, + epoch: epbs, version: Buffer.from([0, 0, 0, 9]), prevVersion: Buffer.from([0, 0, 0, 5]), prevForkName: ForkName.electra, @@ -154,10 +154,10 @@ for (const testScenario of testScenarios) { const {phase0, altair, bellatrix, capella, testCases} = testScenario; const deneb = Infinity; const electra = Infinity; - const ebps = Infinity; + const epbs = Infinity; describe(`network / fork: phase0: ${phase0}, altair: ${altair}, bellatrix: ${bellatrix} capella: ${capella}`, () => { - const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, ebps}); + const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, epbs}); 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 930ec3dfcf28..e0651b4bab2f 100644 --- a/packages/beacon-node/test/utils/config.ts +++ b/packages/beacon-node/test/utils/config.ts @@ -39,14 +39,14 @@ export function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig { DENEB_FORK_EPOCH: 0, ELECTRA_FORK_EPOCH: forkEpoch, }); - case ForkName.ebps: + case ForkName.epbs: return createChainForkConfig({ ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, CAPELLA_FORK_EPOCH: 0, DENEB_FORK_EPOCH: 0, ELECTRA_FORK_EPOCH: 0, - EBPS_FORK_EPOCH: forkEpoch, + EPBS_FORK_EPOCH: forkEpoch, }); } } diff --git a/packages/config/src/chainConfig/configs/mainnet.ts b/packages/config/src/chainConfig/configs/mainnet.ts index 705d65c492c4..6eff6a0f8d5d 100644 --- a/packages/config/src/chainConfig/configs/mainnet.ts +++ b/packages/config/src/chainConfig/configs/mainnet.ts @@ -53,9 +53,9 @@ export const chainConfig: ChainConfig = { ELECTRA_FORK_VERSION: b("0x05000000"), ELECTRA_FORK_EPOCH: Infinity, - // Ebps - EBPS_FORK_VERSION: b("0x09000000"), - EBPS_FORK_EPOCH: Infinity, + // epbs + EPBS_FORK_VERSION: b("0x09000000"), + EPBS_FORK_EPOCH: Infinity, // Time parameters // --------------------------------------------------------------- diff --git a/packages/config/src/chainConfig/configs/minimal.ts b/packages/config/src/chainConfig/configs/minimal.ts index 5f8b28c178d5..0b8131af4ffa 100644 --- a/packages/config/src/chainConfig/configs/minimal.ts +++ b/packages/config/src/chainConfig/configs/minimal.ts @@ -49,9 +49,9 @@ export const chainConfig: ChainConfig = { ELECTRA_FORK_VERSION: b("0x05000001"), ELECTRA_FORK_EPOCH: Infinity, - // Ebps - EBPS_FORK_VERSION: b("0x05000001"), - EBPS_FORK_EPOCH: Infinity, + // epbs + EPBS_FORK_VERSION: b("0x05000001"), + EPBS_FORK_EPOCH: Infinity, // Time parameters // --------------------------------------------------------------- diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index 781d26cde2bd..ea949971bdfa 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -43,9 +43,9 @@ export type ChainConfig = { // ELECTRA ELECTRA_FORK_VERSION: Uint8Array; ELECTRA_FORK_EPOCH: number; - // EBPS - EBPS_FORK_VERSION: Uint8Array; - EBPS_FORK_EPOCH: number; + // EPBS + EPBS_FORK_VERSION: Uint8Array; + EPBS_FORK_EPOCH: number; // Time parameters SECONDS_PER_SLOT: number; @@ -110,9 +110,9 @@ export const chainConfigTypes: SpecTypes = { // ELECTRA ELECTRA_FORK_VERSION: "bytes", ELECTRA_FORK_EPOCH: "number", - // EBPS - EBPS_FORK_VERSION: "bytes", - EBPS_FORK_EPOCH: "number", + // epbs + EPBS_FORK_VERSION: "bytes", + EPBS_FORK_EPOCH: "number", // Time parameters SECONDS_PER_SLOT: "number", diff --git a/packages/config/src/forkConfig/index.ts b/packages/config/src/forkConfig/index.ts index 3349ab536a73..51a12f1daefc 100644 --- a/packages/config/src/forkConfig/index.ts +++ b/packages/config/src/forkConfig/index.ts @@ -67,18 +67,18 @@ export function createForkConfig(config: ChainConfig): ForkConfig { prevVersion: config.DENEB_FORK_VERSION, prevForkName: ForkName.deneb, }; - const ebps: ForkInfo = { - name: ForkName.ebps, - seq: ForkSeq.ebps, - epoch: config.EBPS_FORK_EPOCH, - version: config.EBPS_FORK_VERSION, + const epbs: ForkInfo = { + name: ForkName.epbs, + seq: ForkSeq.epbs, + epoch: config.EPBS_FORK_EPOCH, + version: config.EPBS_FORK_VERSION, prevVersion: config.ELECTRA_FORK_VERSION, prevForkName: ForkName.electra, }; /** Forks in order order of occurence, `phase0` first */ // Note: Downstream code relies on proper ordering. - const forks = {phase0, altair, bellatrix, capella, deneb, electra, ebps}; + const forks = {phase0, altair, bellatrix, capella, deneb, electra, epbs}; // Prevents allocating an array on every getForkInfo() call const forksAscendingEpochOrder = Object.values(forks); diff --git a/packages/light-client/src/spec/utils.ts b/packages/light-client/src/spec/utils.ts index b2a2803aa2ca..8dfbcde0129c 100644 --- a/packages/light-client/src/spec/utils.ts +++ b/packages/light-client/src/spec/utils.ts @@ -126,7 +126,7 @@ export function upgradeLightClientHeader( if (ForkSeq[targetFork] <= ForkSeq.electra) break; // eslint-disable-next-line no-fallthrough - case ForkName.ebps: + case ForkName.epbs: throw Error("Not Implemented"); } return upgradedHeader; diff --git a/packages/params/src/forkName.ts b/packages/params/src/forkName.ts index ed2d70c4af8a..3cabf7014e84 100644 --- a/packages/params/src/forkName.ts +++ b/packages/params/src/forkName.ts @@ -8,7 +8,7 @@ export enum ForkName { capella = "capella", deneb = "deneb", electra = "electra", - ebps = "ebps", + epbs = "epbs", } /** @@ -21,7 +21,7 @@ export enum ForkSeq { capella = 3, deneb = 4, electra = 5, - ebps = 6, + epbs = 6, } function exclude(coll: T[], val: U[]): Exclude[] { diff --git a/packages/params/src/index.ts b/packages/params/src/index.ts index 129cc6b23055..4c07b39fd138 100644 --- a/packages/params/src/index.ts +++ b/packages/params/src/index.ts @@ -274,7 +274,7 @@ export const NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA = 6; export const FINALIZED_ROOT_DEPTH_ELECTRA = 7; export const FINALIZED_ROOT_INDEX_ELECTRA = 169; -// ebps +// epbs export const PAYLOAD_ABSENT = 0; export const PAYLOAD_PRESENT = 1; export const PAYLOAD_WITHHELD = 2; diff --git a/packages/params/src/presets/mainnet.ts b/packages/params/src/presets/mainnet.ts index 869223c2fedf..6fc455b592dd 100644 --- a/packages/params/src/presets/mainnet.ts +++ b/packages/params/src/presets/mainnet.ts @@ -136,7 +136,7 @@ export const mainnetPreset: BeaconPreset = { MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096, - // ebps - EIP-7732 + // epbs - EIP-7732 // uint64(2**9) = 512 PTC_SIZE: 512, // 2**2 = 4 diff --git a/packages/params/src/presets/minimal.ts b/packages/params/src/presets/minimal.ts index e19278431799..cbd8c8d00c1c 100644 --- a/packages/params/src/presets/minimal.ts +++ b/packages/params/src/presets/minimal.ts @@ -137,7 +137,7 @@ export const minimalPreset: BeaconPreset = { MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096, - // ebps - EIP-7732 + // epbs - EIP-7732 // uint64(2**9) = 512 PTC_SIZE: 512, // 2**2 = 4 diff --git a/packages/params/src/types.ts b/packages/params/src/types.ts index 82222b1ac32f..8cd5a9e193ad 100644 --- a/packages/params/src/types.ts +++ b/packages/params/src/types.ts @@ -98,7 +98,7 @@ export type BeaconPreset = { MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: number; WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: number; - // EBPS + // EPBS PTC_SIZE: number; MAX_PAYLOAD_ATTESTATIONS: number; }; @@ -202,7 +202,7 @@ export const beaconPresetTypes: BeaconPresetTypes = { MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: "number", WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: "number", - // EBPS + // EPBS PTC_SIZE: "number", MAX_PAYLOAD_ATTESTATIONS: "number", }; diff --git a/packages/state-transition/test/unit/upgradeState.test.ts b/packages/state-transition/test/unit/upgradeState.test.ts index f09e843dcf5c..92bf2904a417 100644 --- a/packages/state-transition/test/unit/upgradeState.test.ts +++ b/packages/state-transition/test/unit/upgradeState.test.ts @@ -79,14 +79,14 @@ function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig { DENEB_FORK_EPOCH: 0, ELECTRA_FORK_EPOCH: forkEpoch, }); - case ForkName.ebps: + case ForkName.epbs: return createChainForkConfig({ ALTAIR_FORK_EPOCH: 0, BELLATRIX_FORK_EPOCH: 0, CAPELLA_FORK_EPOCH: 0, DENEB_FORK_EPOCH: 0, ELECTRA_FORK_EPOCH: 0, - EBPS_FORK_EPOCH: forkEpoch, + EPBS_FORK_EPOCH: forkEpoch, }); } } diff --git a/packages/types/src/ebps/index.ts b/packages/types/src/epbs/index.ts similarity index 100% rename from packages/types/src/ebps/index.ts rename to packages/types/src/epbs/index.ts diff --git a/packages/types/src/ebps/sszTypes.ts b/packages/types/src/epbs/sszTypes.ts similarity index 98% rename from packages/types/src/ebps/sszTypes.ts rename to packages/types/src/epbs/sszTypes.ts index 5a7cf9c1b8c9..13dd52d0e6ae 100644 --- a/packages/types/src/ebps/sszTypes.ts +++ b/packages/types/src/epbs/sszTypes.ts @@ -5,6 +5,7 @@ import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; import {ssz as capellaSsz} from "../capella/index.js"; import {ssz as denebSsz} from "../deneb/index.js"; +import {ssz as electraSsz} from "../electra/index.js"; const {BLSSignature, Root, Slot, Uint8, ValidatorIndex, Gwei, Boolean, UintNum64} = primitiveSsz; @@ -48,7 +49,7 @@ export const IndexedPayloadAttestation = new ContainerType( export const ExecutionPayload = new ContainerType( { - ...denebSsz.ExecutionPayload.fields, + ...electraSsz.ExecutionPayload.fields, }, {typeName: "ExecutionPayload", jsonCase: "eth2"} ); diff --git a/packages/types/src/ebps/types.ts b/packages/types/src/epbs/types.ts similarity index 100% rename from packages/types/src/ebps/types.ts rename to packages/types/src/epbs/types.ts diff --git a/packages/types/src/sszTypes.ts b/packages/types/src/sszTypes.ts index e17d5e80a4ce..4b8a04b3a9f7 100644 --- a/packages/types/src/sszTypes.ts +++ b/packages/types/src/sszTypes.ts @@ -6,10 +6,10 @@ 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 electra} from "./electra/index.js"; -import {ssz as ebps} from "./ebps/index.js"; +import {ssz as epbs} from "./epbs/index.js"; export * from "./primitive/sszTypes.js"; -export {phase0, altair, bellatrix, capella, deneb, electra, ebps}; +export {phase0, altair, bellatrix, capella, deneb, electra, epbs}; /** * Index the ssz types that differ by fork @@ -22,7 +22,7 @@ const typesByFork = { [ForkName.capella]: {...phase0, ...altair, ...bellatrix, ...capella}, [ForkName.deneb]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb}, [ForkName.electra]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra}, - [ForkName.ebps]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra, ...ebps}, + [ForkName.epbs]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra, ...epbs}, }; /** diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index fdda9a4b4395..78c5994e454c 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -5,7 +5,7 @@ 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 electra} from "./electra/index.js"; -import {ts as ebps} from "./ebps/index.js"; +import {ts as epbs} from "./epbs/index.js"; import {Slot} from "./primitive/types.js"; export * from "./primitive/types.js"; @@ -15,7 +15,7 @@ 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 electra} from "./electra/index.js"; -export {ts as ebps} from "./ebps/index.js"; +export {ts as epbs} from "./epbs/index.js"; /** Common non-spec type to represent roots as strings */ export type RootHex = string; @@ -202,30 +202,30 @@ type TypesByFork = { AggregateAndProof: electra.AggregateAndProof; SignedAggregateAndProof: electra.SignedAggregateAndProof; }; - [ForkName.ebps]: { + [ForkName.epbs]: { BeaconBlockHeader: phase0.BeaconBlockHeader; SignedBeaconBlockHeader: phase0.SignedBeaconBlockHeader; - BeaconBlock: ebps.BeaconBlock; - BeaconBlockBody: ebps.BeaconBlockBody; - BeaconState: ebps.BeaconState; - SignedBeaconBlock: ebps.SignedBeaconBlock; + BeaconBlock: epbs.BeaconBlock; + BeaconBlockBody: epbs.BeaconBlockBody; + BeaconState: epbs.BeaconState; + SignedBeaconBlock: epbs.SignedBeaconBlock; Metadata: altair.Metadata; - LightClientHeader: ebps.LightClientHeader; - LightClientBootstrap: ebps.LightClientBootstrap; - LightClientUpdate: ebps.LightClientUpdate; - LightClientFinalityUpdate: ebps.LightClientFinalityUpdate; - LightClientOptimisticUpdate: ebps.LightClientOptimisticUpdate; - LightClientStore: ebps.LightClientStore; - BlindedBeaconBlock: ebps.BlindedBeaconBlock; - BlindedBeaconBlockBody: ebps.BlindedBeaconBlockBody; - SignedBlindedBeaconBlock: ebps.SignedBlindedBeaconBlock; - ExecutionPayload: ebps.ExecutionPayload; - ExecutionPayloadHeader: ebps.ExecutionPayloadHeader; - BuilderBid: ebps.BuilderBid; - SignedBuilderBid: ebps.SignedBuilderBid; - SSEPayloadAttributes: ebps.SSEPayloadAttributes; - BlockContents: ebps.BlockContents; - SignedBlockContents: ebps.SignedBlockContents; + LightClientHeader: epbs.LightClientHeader; + LightClientBootstrap: epbs.LightClientBootstrap; + LightClientUpdate: epbs.LightClientUpdate; + LightClientFinalityUpdate: epbs.LightClientFinalityUpdate; + LightClientOptimisticUpdate: epbs.LightClientOptimisticUpdate; + LightClientStore: epbs.LightClientStore; + BlindedBeaconBlock: epbs.BlindedBeaconBlock; + BlindedBeaconBlockBody: epbs.BlindedBeaconBlockBody; + SignedBlindedBeaconBlock: epbs.SignedBlindedBeaconBlock; + ExecutionPayload: epbs.ExecutionPayload; + ExecutionPayloadHeader: epbs.ExecutionPayloadHeader; + BuilderBid: epbs.BuilderBid; + SignedBuilderBid: epbs.SignedBuilderBid; + SSEPayloadAttributes: epbs.SSEPayloadAttributes; + BlockContents: epbs.BlockContents; + SignedBlockContents: epbs.SignedBlockContents; ExecutionPayloadAndBlobsBundle: deneb.ExecutionPayloadAndBlobsBundle; BlobsBundle: deneb.BlobsBundle; diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index d8419a31ece4..43b39813cc3f 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -74,7 +74,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record