Skip to content

Commit

Permalink
fix the chain config for operations runner
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Aug 20, 2022
1 parent c152e43 commit 4ddf2ae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions packages/beacon-node/test/spec/presets/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> =
return {
testFunction: (testcase) => {
const state = testcase.pre.clone();
const cachedState = createCachedBeaconStateTest(state, getConfig(fork));
const epoch = (state.fork as phase0.Fork).epoch;
const cachedState = createCachedBeaconStateTest(state, getConfig(fork, epoch));

operationFn(cachedState, testcase);
state.commit();
return state;
Expand All @@ -117,9 +119,6 @@ export const operations: TestRunnerFn<OperationsTestCase, BeaconStateAllForks> =
expectFunc: (testCase, expected, actual) => {
expectEqualBeaconState(fork, expected, actual);
},
shouldSkip: (_testcase, name, _index) => {
return !name.includes("voluntary_exit_with_previous_fork_version_is_before_fork_epoch__valid");
},
},
};
};
6 changes: 3 additions & 3 deletions packages/beacon-node/test/spec/utils/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import {IChainForkConfig, createIChainForkConfig} from "@lodestar/config";

/* eslint-disable @typescript-eslint/naming-convention */

export function getConfig(fork: ForkName): IChainForkConfig {
export function getConfig(fork: ForkName, forkEpoch = 0): IChainForkConfig {
switch (fork) {
case ForkName.phase0:
return config;
case ForkName.altair:
return createIChainForkConfig({ALTAIR_FORK_EPOCH: 0});
return createIChainForkConfig({ALTAIR_FORK_EPOCH: forkEpoch});
case ForkName.bellatrix:
return createIChainForkConfig({
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: forkEpoch,
});
}
}
2 changes: 1 addition & 1 deletion packages/beacon-node/test/spec/utils/specTestIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function specTestIterator(configName: string, testRunners: Record<string,
const forkDirpath = path.join(configDirpath, fork);
for (const testRunnerName of readdirSyncSpec(forkDirpath)) {
// We don't have runner for light client yet
if (testRunnerName !== "operations") {
if (testRunnerName === "light_client") {
continue;
}
const testRunnerDirpath = path.join(forkDirpath, testRunnerName);
Expand Down

0 comments on commit 4ddf2ae

Please sign in to comment.