Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce EIP-6110 epoch and version in ChainConfig #5953

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/config/src/chainConfig/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export function chainConfigToJson(config: ChainConfig): Record<string, string> {

for (const key of Object.keys(chainConfigTypes) as (keyof ChainConfig)[]) {
const value = config[key];
if (value !== undefined) {
json[key] = serializeSpecValue(value, chainConfigTypes[key]);
const targetType = chainConfigTypes[key];
if (value !== undefined && targetType) {
json[key] = serializeSpecValue(value, targetType);
}
}

Expand All @@ -21,8 +22,9 @@ export function chainConfigFromJson(json: Record<string, unknown>): ChainConfig

for (const key of Object.keys(chainConfigTypes) as (keyof ChainConfig)[]) {
const value = json[key];
if (value !== undefined) {
config[key] = deserializeSpecValue(json[key], chainConfigTypes[key], key) as never;
const targetType = chainConfigTypes[key];
if (value !== undefined && targetType) {
config[key] = deserializeSpecValue(json[key], targetType, key) as never;
}
}

Expand Down
6 changes: 6 additions & 0 deletions packages/config/src/chainConfig/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export type ChainConfig = {
// DENEB
DENEB_FORK_VERSION: Uint8Array;
DENEB_FORK_EPOCH: number;
// EIP6110 - Experimental fork
EIP6110_FORK_VERSION?: Uint8Array,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to make it optional, in the corresponding mainnet spec, add it and set its epoch to infinity

EIP6110_FORK_EPOCH?: number,

// Time parameters
SECONDS_PER_SLOT: number;
Expand Down Expand Up @@ -92,6 +95,9 @@ export const chainConfigTypes: SpecTypes<ChainConfig> = {
// DENEB
DENEB_FORK_VERSION: "bytes",
DENEB_FORK_EPOCH: "number",
// EIP6110
EIP6110_FORK_VERSION: "bytes",
EIP6110_FORK_EPOCH: "number",

// Time parameters
SECONDS_PER_SLOT: "number",
Expand Down
4 changes: 4 additions & 0 deletions packages/validator/src/util/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record<keyof ConfigWit
const bellatrixForkRelevant = localConfig.BELLATRIX_FORK_EPOCH < Infinity;
const capellaForkRelevant = localConfig.CAPELLA_FORK_EPOCH < Infinity;
const denebForkRelevant = localConfig.DENEB_FORK_EPOCH < Infinity;
const eip6110ForkRelevant = (localConfig.EIP6110_FORK_EPOCH ?? Infinity) < Infinity;

return {
// # Config
Expand Down Expand Up @@ -105,6 +106,9 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record<keyof ConfigWit
// Deneb
DENEB_FORK_VERSION: denebForkRelevant,
DENEB_FORK_EPOCH: denebForkRelevant,
// EIP6110
EIP6110_FORK_VERSION: eip6110ForkRelevant,
EIP6110_FORK_EPOCH: eip6110ForkRelevant,

// Time parameters
SECONDS_PER_SLOT: true,
Expand Down
Loading