Skip to content

Conversation

@figtracer
Copy link

@figtracer figtracer commented Nov 28, 2025

Issue

this bug happens because we are computing the flag is_infinity before branching, but the correct is_infinity value depends on the branch.

let's say that self is empty and we add an infinity signature (so other is AggSig::infinity()):

  1. self.is_infinity starts as false
  2. other.is_infinity is true
  3. flag immediately updates to false && true = false incorrectly because we will then branch to else where we effectively add infinity + infinity; hence the flag should be true && true = true

to fix this:

  1. we move the logical operator into the inner if statement: self.is_infinity flag is only set to true if both are points at infinity
  2. we write self.is_infinity = other.is_infinity; if we branch to else, essentially we're adding infinity to whatever other is, so if other is infinity, self.is_infinity = trueelse self.is_infinity = false

Test Results

before the fix:

---- blst::empty_aggregate_plus_infinity_should_be_infinity stdout ----

thread 'blst::empty_aggregate_plus_infinity_should_be_infinity' (454378) panicked at crypto/bls/tests/tests.rs:545:5:
is_infinity flag should be true after adding infinity to empty
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

after:

test blst::empty_aggregate_plus_infinity_should_be_infinity ... ok
(...)

test result: ok. 38 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

fixes #8491

@cla-assistant
Copy link

cla-assistant bot commented Nov 28, 2025

CLA assistant check
All committers have signed the CLA.

@cla-assistant
Copy link

cla-assistant bot commented Nov 28, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

1 participant