Skip to content

Commit

Permalink
fix(beacon-light-client/circom/test/run_snarkit2_tests): Erradicate r…
Browse files Browse the repository at this point in the history
…eliance on CWD
  • Loading branch information
PetarKirov committed Mar 22, 2024
1 parent d5f9c66 commit af22403
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions beacon-light-client/circom/test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssz_num_uint*/
14 changes: 8 additions & 6 deletions beacon-light-client/circom/test/gen_ssz_num_positive_tests.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import * as fs from 'fs';
import * as path from 'path';
import * as yaml from 'js-yaml';
import { groupBy } from '../../../libs/typescript/ts-utils/common-utils';
import { formatHex } from '../../solidity/test/utils/bls';

const sszTestCasesDir = path.resolve(
__dirname,
'../../../vendor/eth2.0-tests/ssz',
);

// circom prime is 254 bits
const testCasesBounds = readTestCases(
'../../../vendor/eth2.0-tests/ssz/uint_bounds.yaml',
)
const testCasesBounds = readTestCases(`${sszTestCasesDir}/uint_bounds.yaml`)
.filter(x => x.valid)
.filter(x => getBitsNumberFromType(x.type) <= 248);

const testCasesRandom = readTestCases(
'../../../vendor/eth2.0-tests/ssz/uint_random.yaml',
)
const testCasesRandom = readTestCases(`${sszTestCasesDir}/uint_random.yaml`)
.filter(x => x.valid)
.filter(x => getBitsNumberFromType(x.type) <= 248);

Expand Down
5 changes: 4 additions & 1 deletion beacon-light-client/circom/test/run_snarkit2_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ else
fi

# generate the ssz_num test cases
yarn ts-node gen_ssz_num_positive_tests.ts
(
cd "$DENDRETH_DIR/beacon-light-client/circom/test"
yarn tsx ./gen_ssz_num_positive_tests.ts
)

# Get the list of all directories one level deep inside the "test" folder
folders=$(find ${DENDRETH_DIR}/beacon-light-client/circom/test/* -maxdepth 0 -type d)
Expand Down

0 comments on commit af22403

Please sign in to comment.