Skip to content

Commit

Permalink
Update spec tests to v1.2.0-rc.3 skipping not yet supported testcases (
Browse files Browse the repository at this point in the history
…#4456)

* Update spec tests to v1.2.0-rc.3 skipping not yet supported testcases

* disable LightClientUpdate completely for now
  • Loading branch information
g11tech authored Aug 19, 2022
1 parent e63aad1 commit 619dec6
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 8 deletions.
3 changes: 3 additions & 0 deletions packages/beacon-node/test/spec/presets/epoch_processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const epochProcessing: TestRunnerFn<EpochProcessingTestCase, BeaconStateA
expectFunc: (testCase, expected, actual) => {
expectEqualBeaconState(fork, expected, actual);
},
shouldSkip: (_testcase, name, _index) => {
return name.includes("invalid_large_withdrawable_epoch");
},
},
};
};
3 changes: 3 additions & 0 deletions packages/beacon-node/test/spec/presets/fork_choice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ export const forkChoiceTest: TestRunnerFn<ForkChoiceTestCase, void> = (fork) =>
timeout: 10000,
// eslint-disable-next-line @typescript-eslint/no-empty-function
expectFunc: () => {},
shouldSkip: (_testCase, name, _index) => {
return name.includes("discard_equivocations");
},
},
};
};
Expand Down
3 changes: 3 additions & 0 deletions packages/beacon-node/test/spec/presets/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ 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");
},
},
};
};
7 changes: 7 additions & 0 deletions packages/beacon-node/test/spec/presets/ssz_static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ type Types = Record<string, Type<any>>;
//

export const sszStatic = (fork: ForkName, typeName: string, testSuite: string, testSuiteDirpath: string): void => {
if (["LightClientBootstrap", "LightClientFinalityUpdate", "LightClientOptimisticUpdate"].includes(typeName)) {
// We don't have sszTypes for these typeNames yet, renable them as we add
return;
}
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
const sszType = (ssz[fork] as Types)[typeName] || (ssz.altair as Types)[typeName] || (ssz.phase0 as Types)[typeName];
if (!sszType) {
Expand All @@ -45,6 +49,9 @@ export const sszStatic = (fork: ForkName, typeName: string, testSuite: string, t
const sszTypeNoUint = replaceUintTypeWithUintBigintType(sszType);

for (const testCase of fs.readdirSync(testSuiteDirpath)) {
if (testSuiteDirpath.includes("LightClientUpdate")) {
continue;
}
it(testCase, function () {
// Mainnet must deal with big full states and hash each one multiple times
if (ACTIVE_PRESET === "mainnet") {
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/test/spec/specTestVersioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ import {fileURLToPath} from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));

export const SPEC_TEST_REPO_URL = "https://github.com/ethereum/consensus-spec-tests";
export const SPEC_TEST_VERSION = "v1.1.10";
export const SPEC_TEST_VERSION = "v1.2.0-rc.3";
// Target directory is the host package root: 'packages/*/spec-tests'
export const SPEC_TEST_LOCATION = path.join(__dirname, "../../spec-tests");
3 changes: 0 additions & 3 deletions packages/beacon-node/test/spec/utils/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export function getConfig(fork: ForkName): IChainForkConfig {
return createIChainForkConfig({
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
TERMINAL_TOTAL_DIFFICULTY: BigInt(
"115792089237316195423570985008687907853269984665640564039457584007913129638912"
),
});
}
}
9 changes: 8 additions & 1 deletion packages/beacon-node/test/spec/utils/specTestIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@ export function specTestIterator(configName: string, testRunners: Record<string,

const configDirpath = path.join(specTestsTestPath, configName);
for (const forkStr of readdirSyncSpec(configDirpath)) {
// TODO enable capella
if (forkStr === "capella") {
continue;
}
const fork = ForkName[forkStr as ForkName];
if (fork === undefined) {
throw Error(`Unknown fork ${forkStr}`);
}

const forkDirpath = path.join(configDirpath, fork);
for (const testRunnerName of readdirSyncSpec(forkDirpath)) {
// We don't have runner for light client yet
if (testRunnerName === "light_client") {
continue;
}
const testRunnerDirpath = path.join(forkDirpath, testRunnerName);

const testRunner = testRunners[testRunnerName];
Expand All @@ -65,7 +73,6 @@ export function specTestIterator(configName: string, testRunners: Record<string,
for (const testSuite of readdirSyncSpec(testHandlerDirpath)) {
const testId = `${configName}/${fork}/${testRunnerName}/${testHandler}/${testSuite}`;
const testSuiteDirpath = path.join(testHandlerDirpath, testSuite);

// Specific logic for ssz_static since it has one extra level of directories
if (testRunner.type === RunnerType.custom) {
describe(testId, () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/chainConfig/presets/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const chainConfig: IChainConfig = {

// Transition
// 2**256-2**10 for testing minimal network
TERMINAL_TOTAL_DIFFICULTY: BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),
TERMINAL_TOTAL_DIFFICULTY: BigInt("115792089237316195423570985008687907853269984665640564039457584007913129638912"),
TERMINAL_BLOCK_HASH: b("0x0000000000000000000000000000000000000000000000000000000000000000"),
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: Infinity,

Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/presets/mainnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {phase0} from "./phase0.js";
import {altair} from "./altair.js";
import {bellatrix} from "./bellatrix.js";

export const commit = "v1.1.9";
export const commit = "v1.2.0-rc.3";

export const preset: BeaconPreset = {
...phase0,
Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/presets/minimal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {phase0} from "./phase0.js";
import {altair} from "./altair.js";
import {bellatrix} from "./bellatrix.js";

export const commit = "v1.1.9";
export const commit = "v1.2.0-rc.3";

export const preset: BeaconPreset = {
...phase0,
Expand Down

0 comments on commit 619dec6

Please sign in to comment.