Skip to content

Commit

Permalink
chore: fix and add workaround on params e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 authored and nflaig committed Oct 18, 2024
1 parent 2edf7a2 commit 832820d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions packages/params/test/e2e/ensure-config-is-synced.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import {loadConfigYaml} from "../yaml.js";
// Not e2e, but slow. Run with e2e tests

/** https://github.com/ethereum/consensus-specs/releases */
const specConfigCommit = "v1.5.0-alpha.3";
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,22 @@ 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 832820d

Please sign in to comment.