[WIP] Add wrapper for BLS from Chia Network #72
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was wrong?
Fixes #71. I will use "BLS chia" as the alias of Chia network's BLS implementation, along with its python bindings in the following paragraphs.
How was it fixed?
sign
,privtopub
,verify
,aggregate_signatures
,aggregate_pubkeys
,aggregate_multiple
with BLS chia.tests/test_bls.py
totests/test_bls_chia.py
and test with those functions.scripts/benchmark_api.py
, which is mostly inspired by Benchmark #69.Problems
1
.RuntimeError: Caught an unknown exception!
if the source signatures are initialized withblspy.Signature.from_bytes
. This issue is really hard to debug since no further information is printed from the C++ side. Currently, I workaround it through adding a_sig_map: Dict[bytes, bls_chia.Signature] = {}
, which memoizes all signatures generated throughsign
andaggregate_signatures
, to avoid the issue resulting fromSignature.from_bytes
. Ref: Potential bug in Signature deserialization and aggregation using Python Chia-Network/bls-signatures#54Example benchmark
Run
number=100
times withtimeit
, with20
keys and signatures aggregated. Need to further try the other parameters, and understand the meanings of the result.To make use of the script with custom implementations:
api.py
with functionsprivtopub
,verify
,aggregate_signatures
,aggregate_pubkeys
,verify_multiple
.api.py
under a package with your custom name, says "bls_another", underpy_ecc
, sopy_ecc/bls_another/api.py
.python py_ecc/scripts/benchmark_api.py bls_another
.Cute Animal Picture