diff --git a/.github/workflows/test_vectors.yml b/.github/workflows/test_vectors.yml new file mode 100644 index 0000000..c29e58f --- /dev/null +++ b/.github/workflows/test_vectors.yml @@ -0,0 +1,36 @@ +name: Check test vectors + +on: pull_request + +jobs: + verify: + name: ${{ matrix.name }} + runs-on: ubuntu-latest + strategy: + matrix: + kind: ['rust', 'json', 'zcash'] + include: + - kind: 'rust' + extension: 'rs' + name: 'Rust' + - kind: 'json' + extension: 'json' + name: 'JSON' + - kind: 'zcash' + extension: 'rs' + name: 'Bitcoin-flavoured JSON' + + steps: + - uses: actions/checkout@v2 + + - name: Install poetry + run: pip install --user poetry + + - name: Install dependencies + run: poetry install --no-root + + - name: Regenerate test vectors + run: ./regenerate.sh ${{ matrix.kind }} ${{ matrix.extension }} + + - name: Verify there are no changes + run: git diff -s --exit-code diff --git a/regenerate.sh b/regenerate.sh new file mode 100755 index 0000000..b984c4f --- /dev/null +++ b/regenerate.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +tv_scripts=( + f4jumble_long + f4jumble + orchard_empty_roots + orchard_generators + orchard_group_hash + orchard_key_components + orchard_map_to_curve + orchard_merkle_tree + orchard_note_encryption + orchard_poseidon_hash + orchard_poseidon + orchard_sinsemilla + sapling_generators + sapling_key_components + sapling_note_encryption + sapling_signatures + sapling_zip32) + +for generator in "${tv_scripts[@]}" +do + echo "# $generator" + poetry run python ./$generator.py -t $1 >test-vectors/$1/$generator.$2 +done