CI: Add workflow to verify test vectors are up-to-date

It will also help us to avoid unintentional modifications to existing
test vectors.
This commit is contained in:
Jack Grigg 2022-01-07 22:08:44 +00:00
parent 290218811f
commit ffd11d94ec
2 changed files with 62 additions and 0 deletions

36
.github/workflows/test_vectors.yml vendored Normal file
View File

@ -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

26
regenerate.sh Executable file
View File

@ -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