From 9a9ab52a66bf2e16779ddf08fe80b2968a98b5d0 Mon Sep 17 00:00:00 2001 From: naviechan Date: Tue, 12 Sep 2023 17:39:35 +0800 Subject: [PATCH] Add 6110 epoch to chain config --- packages/config/src/chainConfig/json.ts | 10 ++++++---- packages/config/src/chainConfig/types.ts | 6 ++++++ packages/validator/src/util/params.ts | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/config/src/chainConfig/json.ts b/packages/config/src/chainConfig/json.ts index 4e61333cbdee..fc6420ab40ab 100644 --- a/packages/config/src/chainConfig/json.ts +++ b/packages/config/src/chainConfig/json.ts @@ -8,8 +8,9 @@ export function chainConfigToJson(config: ChainConfig): Record { 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); } } @@ -21,8 +22,9 @@ export function chainConfigFromJson(json: Record): 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; } } diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index b2568d6fba57..33b844f802c4 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -40,6 +40,9 @@ export type ChainConfig = { // DENEB DENEB_FORK_VERSION: Uint8Array; DENEB_FORK_EPOCH: number; + // EIP6110 - Experimental fork + EIP6110_FORK_VERSION?: Uint8Array, + EIP6110_FORK_EPOCH?: number, // Time parameters SECONDS_PER_SLOT: number; @@ -92,6 +95,9 @@ export const chainConfigTypes: SpecTypes = { // DENEB DENEB_FORK_VERSION: "bytes", DENEB_FORK_EPOCH: "number", + // EIP6110 + EIP6110_FORK_VERSION: "bytes", + EIP6110_FORK_EPOCH: "number", // Time parameters SECONDS_PER_SLOT: "number", diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index 61034c133028..508c9a428981 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -73,6 +73,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record