bls12-381-tests icon indicating copy to clipboard operation
bls12-381-tests copied to clipboard

BLS 12-381 tests

This repository provides a test-suite for the BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_ ciphersuite (following draft 4), as used in Ethereum 2.0 BLS Signature APIs, as well as common extensions such as signature-sets (batch aggregate verification) and serialization.

The test suite is generated with python, and can be downloaded via the releases. We suggest the following for integration into your testing pipeline:

mkdir -p destination/bls-tests
TESTS_VERSION=v0.1.0
wget https://github.com/ethereum/bls12-381-tests/releases/download/${TESTS_VERSION}/bls_tests_json.tar.gz -O - | tar -xz -C destination/bls-tests
# bls_tests_yaml.tar.gz is also available: same tests, formatted as YAML

Resources

Test format

The BLS test suite runner has the following handlers:

  • aggregate_verify
  • aggregate
  • fast_aggregate_verify
  • batch_verify
  • sign
  • verify
  • hash_to_G2
  • deserialization_G1
  • deserialization_G2

Test generation

# Create a virtual environment
python -m venv venv
# Activate the environment
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create output dir
mkdir out
# Run test generator
python main.py --output-dir=out --encoding=yaml

License

CC0 1.0 Universal, see LICENSE file.