Skip to content

Commit

Permalink
Remove unwanted diff
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Dec 7, 2022
1 parent d8e9657 commit 8c739dd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 68 deletions.
24 changes: 0 additions & 24 deletions packages/config/src/chainConfig/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
2 changes: 2 additions & 0 deletions packages/config/src/chainConfig/presets/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions packages/params/src/presets/minimal/eip4844.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
6 changes: 1 addition & 5 deletions packages/params/src/presets/minimal/phase0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 19 additions & 33 deletions packages/types/src/eip4844/sszTypes.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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<string, Type<unknown>>;

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
Expand Down Expand Up @@ -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<F extends FAny> extends ContainerType<F> {}
export const BlobsAndCommitments = new BlobsAndCommitmentsEip4844Type(
export const BlobsAndCommitments = new ContainerType(
{
blobs: Blobs,
kzgCommitments: BlobKzgCommitments,
Expand Down Expand Up @@ -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<F extends FAny> extends ContainerType<F> {}
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<F extends FAny> extends ContainerType<F> {}
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<F extends FAny> extends ContainerType<F> {}
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<F extends FAny> extends ContainerType<F> {}
export const BeaconBlockBody = new BeaconBlockBodyEip4844Type(
export const BeaconBlockBody = new ContainerType(
{
...altairSsz.BeaconBlockBody.fields,
executionPayload: ExecutionPayload, // Modified in EIP-4844
Expand All @@ -124,26 +115,23 @@ export const BeaconBlockBody = new BeaconBlockBodyEip4844Type(
{typeName: "BeaconBlockBody", jsonCase: "eth2", cachePermanentRootStruct: true}
);

export class BeaconBlockEip4844Type<F extends FAny> extends ContainerType<F> {}
export const BeaconBlock = new BeaconBlockEip4844Type(
export const BeaconBlock = new ContainerType(
{
...capellaSsz.BeaconBlock.fields,
body: BeaconBlockBody, // Modified in EIP-4844
},
{typeName: "BeaconBlock", jsonCase: "eth2", cachePermanentRootStruct: true}
);

export class SignedBeaconBlockEip4844Type<F extends FAny> extends ContainerType<F> {}
export const SignedBeaconBlock = new SignedBeaconBlockEip4844Type(
export const SignedBeaconBlock = new ContainerType(
{
message: BeaconBlock, // Modified in EIP-4844
signature: BLSSignature,
},
{typeName: "SignedBeaconBlock", jsonCase: "eth2"}
);

export class BlobsSidecarType<F extends FAny> extends ContainerType<F> {}
export const BlobsSidecar = new BlobsSidecarType(
export const BlobsSidecar = new ContainerType(
{
beaconBlockRoot: Root,
beaconBlockSlot: Slot,
Expand All @@ -153,8 +141,7 @@ export const BlobsSidecar = new BlobsSidecarType(
{typeName: "BlobsSidecar", jsonCase: "eth2"}
);

export class SignedBeaconBlockAndBlobsSidecarType<F extends FAny> extends ContainerType<F> {}
export const SignedBeaconBlockAndBlobsSidecar = new SignedBeaconBlockAndBlobsSidecarType(
export const SignedBeaconBlockAndBlobsSidecar = new ContainerType(
{
beaconBlock: SignedBeaconBlock,
blobsSidecar: BlobsSidecar,
Expand Down Expand Up @@ -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<F extends FAny> extends ContainerType<F> {}
export const BeaconState = new BeaconStateType(
export const BeaconState = new ContainerType(
{
genesisTime: UintNum64,
genesisValidatorsRoot: Root,
Expand Down

0 comments on commit 8c739dd

Please sign in to comment.