Skip to content

Commit

Permalink
Workaround on params e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Oct 17, 2024
1 parent afdd557 commit 76cd887
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/params/test/e2e/ensure-config-is-synced.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import {loadConfigYaml} from "../yaml.js";

/** https://github.com/ethereum/consensus-specs/releases */
const specConfigCommit = "v1.5.0-alpha.8";
/**
* Fields that we filter from local config when doing comparison.
* Ideally this should be empty as it is not spec compliant
* For `MAX_BLOBS_PER_BLOCK`, see https://github.com/ChainSafe/lodestar/issues/7172
*/
const ignoredLocalPresetFields: (keyof BeaconPreset)[] = ["MAX_BLOBS_PER_BLOCK"];

describe("Ensure config is synced", () => {
vi.setConfig({testTimeout: 60 * 1000});
Expand All @@ -25,12 +31,19 @@ describe("Ensure config is synced", () => {
});

function assertCorrectPreset(localPreset: BeaconPreset, remotePreset: BeaconPreset): void {
const filteredLocalPreset: Partial<BeaconPreset> = Object.keys(localPreset)
.filter((key) => !ignoredLocalPresetFields.includes(key as keyof BeaconPreset))
.reduce((acc, key) => {
acc[key as keyof BeaconPreset] = localPreset[key as keyof BeaconPreset];
return acc;
}, {} as Partial<BeaconPreset>);

// Check each key for better debuggability
for (const key of Object.keys(remotePreset) as (keyof BeaconPreset)[]) {
expect(localPreset[key]).toBe(remotePreset[key]);
expect(filteredLocalPreset[key]).toBe(remotePreset[key]);
}

expect(localPreset).toEqual(remotePreset);
expect(filteredLocalPreset).toEqual(remotePreset);
}

async function downloadRemoteConfig(preset: "mainnet" | "minimal", commit: string): Promise<BeaconPreset> {
Expand Down

0 comments on commit 76cd887

Please sign in to comment.