Skip to content

Commit

Permalink
fix: sigh JS... sigh.... its all async... but its not
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Oct 28, 2024
1 parent 99cecc1 commit 54267e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ impl Task for AsyncAggregateWithRandomness {
for sig in &self.sigs {
let result = sig.validate(true);
if let Err(blst_error) = result {
println!(">>>\n>>>\n>>>found and error yo!!!\n>>>\n>>>\n>>>");
return Err(blst_to_napi_err(blst_error));
}
}
Expand All @@ -441,10 +440,6 @@ impl Task for AsyncAggregateWithRandomness {
sig: Signature::into_reference(Signature(output.1), env)?,
})
}

fn reject(&mut self, _env: Env, err: Error) -> napi::Result<Self::JsValue> {
Err(err)
}
}

#[napi]
Expand Down
13 changes: 8 additions & 5 deletions test/unit/aggregateWithRandomness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,18 @@ describe("Aggregate With Randomness", () => {
expect(() => asyncAggregateWithRandomness([{pk: sets[0].pk, sig: "bar" as any}])).to.throw();
});
});
it("should throw for invalid serialized", () => {
expect(() =>
asyncAggregateWithRandomness(
it("should throw for invalid serialized", async () => {
try {
await asyncAggregateWithRandomness(
sets.concat({
pk: sets[0].pk,
sig: G2_POINT_AT_INFINITY, //TODO: (@matthewkeil) this throws error "Public key is infinity" not signature
} as any)
)
).to.throw();
);
expect.fail("should not get here");
} catch (err) {
expect((err as Error).message).to.contain("Public key is infinity");
}
});
it("should return a {pk: PublicKey, sig: Signature} object", async () => {
const aggPromise = asyncAggregateWithRandomness(sets);
Expand Down

0 comments on commit 54267e0

Please sign in to comment.