Skip to content

Commit

Permalink
Add 6110 epoch to chain config
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Sep 12, 2023
1 parent 26ce156 commit 9a9ab52
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
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,
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

0 comments on commit 9a9ab52

Please sign in to comment.