Updates the spec tests and code to remove all JS glue code that was being implemented to get specs to pass. Originally this repo was based on the SWIG version of the code which was not editable. To accommodate the specs some try/catch and conditionals were added to get things compliant.
This PR removed all the glue code in the testing files and ensured that all conditions are handled directly by the native code.
These changes were driven by the removal of bls from lodestar. There was some glue code in there in addition to the spec tests.
Now all functions take the spec data input and pass it directly to the function calls. All output is also directly taken and passed to the expectation to ensure the base layer is 100% compliant with the spec.
In order to DRY the code and make it easier to maintain the two async functions were refactored so that there is only one implementation for both sync and async versions. Makes it easier to ensure that the code for both is identical and that changes made to comply with specs were applied equally. Also makes sure that only need to test sync version but with surety that the async versions will work identically.
IMPORTANT NOTE
The spec-test-utils and test-utils in lodestar are esm only. Was not able to import them directly. Have a PR almost ready to do dual module exports for the utils so they can be used here. Several of the files in the PR will be deleted once those modules are ready. Please ignore them in this review. They are copy/paste directly from lodestar.
utils/downloadTests.ts
utils/errors.ts
utils/retry.ts
utils/sleep.ts
Description of Inclusions
Update process/code for downloading spec tests
Include additional spec tests for bls that were originally found in lodestar. Now they are in this repo as well.
Update version of specs that are being tested against
DRY aggregateVerify/asyncAggregateVerify and verifyMulitpleAggregateSignature/asyncVerifyMulitpleAggregateSignature by creating one implementation for each that gets used by both versions
Fix a couple of small things to make sure specs passed
Instead of throwing error for deserialization of invalid PK and Sig just return false from verifications
Check for infinite key in aggregatePublicKeys was not working as expected because of the JS glue code in the spec tests. Ensure works from native layer now
Change order of JS->native conversion for publicKey and messages in aggregate verify so the public key cases happen first before the message error threw (one spec test passed a key but not a message so wrong error was showing up)
Split into #144, #145 and #146
Motivations
Updates the spec tests and code to remove all JS glue code that was being implemented to get specs to pass. Originally this repo was based on the SWIG version of the code which was not editable. To accommodate the specs some try/catch and conditionals were added to get things compliant.
This PR removed all the glue code in the testing files and ensured that all conditions are handled directly by the native code.
These changes were driven by the removal of bls from lodestar. There was some glue code in there in addition to the spec tests.
Now all functions take the spec data
input
and pass it directly to the function calls. All output is also directly taken and passed to the expectation to ensure the base layer is 100% compliant with the spec.In order to DRY the code and make it easier to maintain the two async functions were refactored so that there is only one implementation for both sync and async versions. Makes it easier to ensure that the code for both is identical and that changes made to comply with specs were applied equally. Also makes sure that only need to test sync version but with surety that the async versions will work identically.
IMPORTANT NOTE The
spec-test-utils
andtest-utils
in lodestar are esm only. Was not able to import them directly. Have a PR almost ready to do dual module exports for the utils so they can be used here. Several of the files in the PR will be deleted once those modules are ready. Please ignore them in this review. They are copy/paste directly from lodestar.utils/downloadTests.ts
utils/errors.ts
utils/retry.ts
utils/sleep.ts
Description of Inclusions
aggregateVerify/asyncAggregateVerify
andverifyMulitpleAggregateSignature/asyncVerifyMulitpleAggregateSignature
by creating one implementation for each that gets used by both versions