Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: async implementation #179

Merged
merged 16 commits into from
Apr 22, 2024
Merged

Conversation

matthewkeil
Copy link
Member

@matthewkeil matthewkeil commented Apr 20, 2024

There was a hard import of @chainsafe/blst at the head of functional.ts that was causing issues with tree shaking.

  • Removed implementation specific code from isomorphic files
  • Made async versions of the functions on the respective class interfaces
  • Widened types to allow both serialized and deserialized objects as function arguments
  • Moved herumi specific implementation details into the herumi classes
  • Moved blst-native specific implementation details into the blst-native classes
  • Re-implemented functional.ts to take advantage of the above and simplify the isomorphic code
  • Remove webpack config that was added because of the unnoticed import of blst to get the web tests to work
  • Minor version bump because some types on public API were widened. Non-breaking though and also not a patch methinks

@matthewkeil matthewkeil requested a review from a team as a code owner April 20, 2024 16:21
@@ -75,27 +57,12 @@ export function functionalInterfaceFactory({
*/
function verifyAggregate(publicKeys: PublicKeyArg[], message: Uint8Array, signature: SignatureArg): boolean {
try {
validateBytes(message, "message");

const pks: PublicKey[] = [];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not necessary to validateByutes for public keys anymore?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it's implemented for PublicKey.convertToPublicKeyType of herumi but not for blst-native

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Exactly. This was the optimization I made. For serialized objects we were parsing the bytes both here in JS land and in the native code as well. I removed this so that the herumi specific parse is off the main code path and only gets executed for herumi.

src/herumi/signature.ts Outdated Show resolved Hide resolved
src/functional.ts Outdated Show resolved Hide resolved
Copy link

@twoeths twoeths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change makes sense, dropped some comments

@matthewkeil matthewkeil requested a review from twoeths April 22, 2024 07:28
@matthewkeil matthewkeil merged commit 3b4db7d into master Apr 22, 2024
5 checks passed
@matthewkeil matthewkeil deleted the mkeil/fix-async-implementation branch April 22, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants