diff --git a/packages/config/src/chainConfig/networks/mainnet.ts b/packages/config/src/chainConfig/networks/mainnet.ts index bcf20874f2f9..633161328009 100644 --- a/packages/config/src/chainConfig/networks/mainnet.ts +++ b/packages/config/src/chainConfig/networks/mainnet.ts @@ -19,28 +19,4 @@ export const mainnetChainConfig: IChainConfig = { GENESIS_DELAY: 604800, // MUST NOT use `GENESIS_FORK_VERSION` here so for `minimal` networks the preset value of 0x00000001 take prevalence // GENESIS_FORK_VERSION: "0x00000000", - - // Transition - // --------------------------------------------------------------- - // Estimated: Sept 15, 2022 - TERMINAL_TOTAL_DIFFICULTY: BigInt("58750000000000000000000"), - TERMINAL_BLOCK_HASH: b("0x0000000000000000000000000000000000000000000000000000000000000000"), - TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: Infinity, - - // Forking - // --------------------------------------------------------------- - // Altair - ALTAIR_FORK_VERSION: b("0x01000000"), - ALTAIR_FORK_EPOCH: 74240, // Oct 27, 2021, 10:56:23am UTC - // Bellatrix - BELLATRIX_FORK_VERSION: b("0x02000000"), - BELLATRIX_FORK_EPOCH: 144896, // Sept 6, 2022, 11:34:47am UTC - - // Capella - CAPELLA_FORK_VERSION: b("0x03000000"), - CAPELLA_FORK_EPOCH: Infinity, - - // EIP4844 - EIP4844_FORK_VERSION: b("0x04000000"), - EIP4844_FORK_EPOCH: Infinity, }; diff --git a/packages/config/src/chainConfig/presets/mainnet.ts b/packages/config/src/chainConfig/presets/mainnet.ts index 4b270e71d1e4..900450e236b8 100644 --- a/packages/config/src/chainConfig/presets/mainnet.ts +++ b/packages/config/src/chainConfig/presets/mainnet.ts @@ -36,9 +36,11 @@ export const chainConfig: IChainConfig = { // Bellatrix BELLATRIX_FORK_VERSION: b("0x02000000"), BELLATRIX_FORK_EPOCH: 144896, // Sept 6, 2022, 11:34:47am UTC + // Capella CAPELLA_FORK_VERSION: b("0x03000000"), CAPELLA_FORK_EPOCH: Infinity, + // EIP-4844 EIP4844_FORK_VERSION: b("0x04000000"), EIP4844_FORK_EPOCH: Infinity, diff --git a/packages/params/src/presets/minimal/eip4844.ts b/packages/params/src/presets/minimal/eip4844.ts index 0eccfce28cfb..853e762bbbe5 100644 --- a/packages/params/src/presets/minimal/eip4844.ts +++ b/packages/params/src/presets/minimal/eip4844.ts @@ -4,12 +4,7 @@ import {EIP4844Preset} from "../../interface/eip4844.js"; /* eslint-disable @typescript-eslint/naming-convention */ export const eip4844: EIP4844Preset = { - // `uint64(4096)` - //////////////////////////////////////////////////////////////////////// - // TODO EIP-4844: See https://github.com/Inphi/eip4844-interop/issues/65 - // Can't customize this value, but otherwise the interop tests fail - //////////////////////////////////////////////////////////////////////// - FIELD_ELEMENTS_PER_BLOB: 4096, + FIELD_ELEMENTS_PER_BLOB: 4, // `uint64(2**4)` (= 16) MAX_BLOBS_PER_BLOCK: 16, }; diff --git a/packages/params/src/presets/minimal/phase0.ts b/packages/params/src/presets/minimal/phase0.ts index 33aed03443af..9ecafe48323f 100644 --- a/packages/params/src/presets/minimal/phase0.ts +++ b/packages/params/src/presets/minimal/phase0.ts @@ -38,11 +38,7 @@ export const phase0: Phase0Preset = { // 2**0 (= 1) slots 6 seconds MIN_ATTESTATION_INCLUSION_DELAY: 1, // [customized] fast epochs - //////////////////////////////////////////////////////////////////////// - // TODO EIP-4844: See https://github.com/Inphi/eip4844-interop/issues/65 - // Can't customize this value, but otherwise the interop tests fail - //////////////////////////////////////////////////////////////////////// - SLOTS_PER_EPOCH: 3, + SLOTS_PER_EPOCH: 8, // 2**0 (= 1) epochs MIN_SEED_LOOKAHEAD: 1, // 2**2 (= 4) epochs diff --git a/packages/types/src/eip4844/sszTypes.ts b/packages/types/src/eip4844/sszTypes.ts index 569ac7556591..9f791827af64 100644 --- a/packages/types/src/eip4844/sszTypes.ts +++ b/packages/types/src/eip4844/sszTypes.ts @@ -1,4 +1,4 @@ -import {ContainerType, ListCompositeType, ByteVectorType, Type, UintBigintType} from "@chainsafe/ssz"; +import {ContainerType, ListCompositeType, ByteVectorType} from "@chainsafe/ssz"; import { HISTORICAL_ROOTS_LIMIT, FIELD_ELEMENTS_PER_BLOB, @@ -11,12 +11,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"; -const {UintNum64, Slot, Root, BLSSignature, Bytes32, Bytes48, Bytes96} = primitiveSsz; - -type FAny = Record>; - -export class ExcessDataGasType extends UintBigintType {} -const ExcessDataGas = new ExcessDataGasType(32); +const {UintNum64, Slot, Root, BLSSignature, UintBn256, Bytes32, Bytes48, Bytes96} = primitiveSsz; // Polynomial commitments // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md @@ -50,8 +45,7 @@ export const Polynomial = new ListCompositeType(BLSFieldElement, FIELD_ELEMENTS_ // class BlobsAndCommitments(Container): // blobs: List[Blob, MAX_BLOBS_PER_BLOCK] // kzg_commitments: List[KZGCommitment, MAX_BLOBS_PER_BLOCK] -export class BlobsAndCommitmentsEip4844Type extends ContainerType {} -export const BlobsAndCommitments = new BlobsAndCommitmentsEip4844Type( +export const BlobsAndCommitments = new ContainerType( { blobs: Blobs, kzgCommitments: BlobKzgCommitments, @@ -85,36 +79,33 @@ export const BeaconBlockAndBlobsSidecarByRootRequest = new ListCompositeType(Roo // Beacon Chain types // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/beacon-chain.md#containers -export class ExecutionPayloadEip4844Type extends ContainerType {} -export const ExecutionPayload = new ExecutionPayloadEip4844Type( + +export const ExecutionPayload = new ContainerType( { ...capellaSsz.ExecutionPayload.fields, - excessDataGas: ExcessDataGas, // New in EIP-4844 + excessDataGas: UintBn256, // New in EIP-4844 }, {typeName: "ExecutionPayload", jsonCase: "eth2"} ); -export class ExecutionPayloadHeaderEip4844Type extends ContainerType {} -export const ExecutionPayloadHeader = new ExecutionPayloadHeaderEip4844Type( +export const BlindedExecutionPayload = new ContainerType( { ...capellaSsz.ExecutionPayloadHeader.fields, - excessDataGas: ExcessDataGas, // New in EIP-4844 + excessDataGas: UintBn256, // New in EIP-4844 }, - {typeName: "ExecutionPayloadHeader", jsonCase: "eth2"} + {typeName: "BlindedExecutionPayload", jsonCase: "eth2"} ); -export class BlindedExecutionPayloadEip4844Type extends ContainerType {} -export const BlindedExecutionPayload = new BlindedExecutionPayloadEip4844Type( +export const ExecutionPayloadHeader = new ContainerType( { - ...capellaSsz.BlindedExecutionPayload.fields, - excessDataGas: ExcessDataGas, // New in EIP-4844 + ...capellaSsz.ExecutionPayloadHeader.fields, + excessDataGas: UintBn256, // New in EIP-4844 }, - {typeName: "BlindedExecutionPayload", jsonCase: "eth2"} + {typeName: "ExecutionPayloadHeader", jsonCase: "eth2"} ); // We have to preserve Fields ordering while changing the type of ExecutionPayload -export class BeaconBlockBodyEip4844Type extends ContainerType {} -export const BeaconBlockBody = new BeaconBlockBodyEip4844Type( +export const BeaconBlockBody = new ContainerType( { ...altairSsz.BeaconBlockBody.fields, executionPayload: ExecutionPayload, // Modified in EIP-4844 @@ -124,8 +115,7 @@ export const BeaconBlockBody = new BeaconBlockBodyEip4844Type( {typeName: "BeaconBlockBody", jsonCase: "eth2", cachePermanentRootStruct: true} ); -export class BeaconBlockEip4844Type extends ContainerType {} -export const BeaconBlock = new BeaconBlockEip4844Type( +export const BeaconBlock = new ContainerType( { ...capellaSsz.BeaconBlock.fields, body: BeaconBlockBody, // Modified in EIP-4844 @@ -133,8 +123,7 @@ export const BeaconBlock = new BeaconBlockEip4844Type( {typeName: "BeaconBlock", jsonCase: "eth2", cachePermanentRootStruct: true} ); -export class SignedBeaconBlockEip4844Type extends ContainerType {} -export const SignedBeaconBlock = new SignedBeaconBlockEip4844Type( +export const SignedBeaconBlock = new ContainerType( { message: BeaconBlock, // Modified in EIP-4844 signature: BLSSignature, @@ -142,8 +131,7 @@ export const SignedBeaconBlock = new SignedBeaconBlockEip4844Type( {typeName: "SignedBeaconBlock", jsonCase: "eth2"} ); -export class BlobsSidecarType extends ContainerType {} -export const BlobsSidecar = new BlobsSidecarType( +export const BlobsSidecar = new ContainerType( { beaconBlockRoot: Root, beaconBlockSlot: Slot, @@ -153,8 +141,7 @@ export const BlobsSidecar = new BlobsSidecarType( {typeName: "BlobsSidecar", jsonCase: "eth2"} ); -export class SignedBeaconBlockAndBlobsSidecarType extends ContainerType {} -export const SignedBeaconBlockAndBlobsSidecar = new SignedBeaconBlockAndBlobsSidecarType( +export const SignedBeaconBlockAndBlobsSidecar = new ContainerType( { beaconBlock: SignedBeaconBlock, blobsSidecar: BlobsSidecar, @@ -188,8 +175,7 @@ export const SignedBlindedBeaconBlock = new ContainerType( // We don't spread capella.BeaconState fields since we need to replace // latestExecutionPayloadHeader and we cannot keep order doing that -export class BeaconStateType extends ContainerType {} -export const BeaconState = new BeaconStateType( +export const BeaconState = new ContainerType( { genesisTime: UintNum64, genesisValidatorsRoot: Root,