Modify the `regenerate` script to be more user-friendly.
This now takes the generation type or 'all' as the first argument, and then the generator or 'all' as the second argument. File extensions are detemined automatically from the generation type.
This commit is contained in:
parent
580dc95437
commit
346740a680
|
@ -11,13 +11,10 @@ jobs:
|
||||||
kind: ['rust', 'json', 'zcash']
|
kind: ['rust', 'json', 'zcash']
|
||||||
include:
|
include:
|
||||||
- kind: 'rust'
|
- kind: 'rust'
|
||||||
extension: 'rs'
|
|
||||||
name: 'Rust'
|
name: 'Rust'
|
||||||
- kind: 'json'
|
- kind: 'json'
|
||||||
extension: 'json'
|
|
||||||
name: 'JSON'
|
name: 'JSON'
|
||||||
- kind: 'zcash'
|
- kind: 'zcash'
|
||||||
extension: 'json'
|
|
||||||
name: 'Bitcoin-flavoured JSON'
|
name: 'Bitcoin-flavoured JSON'
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
|
@ -34,7 +31,7 @@ jobs:
|
||||||
run: poetry install --no-root
|
run: poetry install --no-root
|
||||||
|
|
||||||
- name: Regenerate test vectors
|
- name: Regenerate test vectors
|
||||||
run: ./regenerate.sh ${{ matrix.kind }} ${{ matrix.extension }}
|
run: ./regenerate.sh ${{ matrix.kind }} all
|
||||||
|
|
||||||
- name: Verify there are no changes
|
- name: Verify there are no changes
|
||||||
run: git diff; git ls-files --others --exclude-standard; test -z "$(git status --porcelain)"
|
run: git diff; git ls-files --others --exclude-standard; test -z "$(git status --porcelain)"
|
||||||
|
|
107
regenerate.sh
107
regenerate.sh
|
@ -1,37 +1,80 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
tv_scripts=(
|
case "$1" in
|
||||||
bip_0032
|
"rust" )
|
||||||
f4jumble
|
gen_types=(rust)
|
||||||
f4jumble_long
|
;;
|
||||||
orchard_empty_roots
|
"zcash" )
|
||||||
orchard_generators
|
gen_types=(zcash)
|
||||||
orchard_group_hash
|
;;
|
||||||
orchard_key_components
|
"json")
|
||||||
orchard_map_to_curve
|
gen_types=(json)
|
||||||
orchard_merkle_tree
|
;;
|
||||||
orchard_note_encryption
|
"all")
|
||||||
orchard_poseidon
|
gen_types=(rust zcash json)
|
||||||
orchard_poseidon_hash
|
;;
|
||||||
orchard_sinsemilla
|
*)
|
||||||
orchard_zip32
|
echo "Unexpected generation type: $1"
|
||||||
sapling_generators
|
exit 1
|
||||||
sapling_key_components
|
;;
|
||||||
sapling_note_encryption
|
esac
|
||||||
sapling_signatures
|
|
||||||
sapling_zip32
|
|
||||||
sapling_zip32_hard
|
|
||||||
unified_address
|
|
||||||
unified_full_viewing_keys
|
|
||||||
unified_incoming_viewing_keys
|
|
||||||
zip_0143
|
|
||||||
zip_0243
|
|
||||||
zip_0244
|
|
||||||
zip_0316
|
|
||||||
zip_0320)
|
|
||||||
|
|
||||||
for generator in "${tv_scripts[@]}"
|
case "$2" in
|
||||||
|
"all" )
|
||||||
|
tv_scripts=(
|
||||||
|
bip_0032
|
||||||
|
f4jumble
|
||||||
|
f4jumble_long
|
||||||
|
orchard_empty_roots
|
||||||
|
orchard_generators
|
||||||
|
orchard_group_hash
|
||||||
|
orchard_key_components
|
||||||
|
orchard_map_to_curve
|
||||||
|
orchard_merkle_tree
|
||||||
|
orchard_note_encryption
|
||||||
|
orchard_poseidon
|
||||||
|
orchard_poseidon_hash
|
||||||
|
orchard_sinsemilla
|
||||||
|
orchard_zip32
|
||||||
|
sapling_generators
|
||||||
|
sapling_key_components
|
||||||
|
sapling_note_encryption
|
||||||
|
sapling_signatures
|
||||||
|
sapling_zip32
|
||||||
|
sapling_zip32_hard
|
||||||
|
unified_address
|
||||||
|
unified_full_viewing_keys
|
||||||
|
unified_incoming_viewing_keys
|
||||||
|
zip_0143
|
||||||
|
zip_0243
|
||||||
|
zip_0244
|
||||||
|
zip_0316
|
||||||
|
zip_0320)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tv_scripts=($2)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for gen_type in "${gen_types[@]}"
|
||||||
do
|
do
|
||||||
echo "# $generator"
|
echo "Generating $gen_type test vectors..."
|
||||||
poetry run $generator -t $1 >test-vectors/$1/$generator.$2
|
case "$gen_type" in
|
||||||
|
"rust" )
|
||||||
|
extension="rs"
|
||||||
|
;;
|
||||||
|
"zcash" )
|
||||||
|
extension="json"
|
||||||
|
;;
|
||||||
|
"json")
|
||||||
|
extension="json"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for generator in "${tv_scripts[@]}"
|
||||||
|
do
|
||||||
|
echo "# $generator"
|
||||||
|
poetry run $generator -t $gen_type >test-vectors/$gen_type/$generator.$extension
|
||||||
|
done
|
||||||
|
echo "Finished $gen_type."
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue