Skip to content

ecmult: fix definition of STRAUSS_SCRATCH_OBJECTS#1004

Merged
real-or-random merged 1 commit intobitcoin-core:masterfrom
jonasnick:fix-strauss
Dec 2, 2021
Merged

ecmult: fix definition of STRAUSS_SCRATCH_OBJECTS#1004
real-or-random merged 1 commit intobitcoin-core:masterfrom
jonasnick:fix-strauss

Conversation

@jonasnick
Copy link
Contributor

This bug was introduced in 7506e06 by adding
an allocation but not updating the constant.

@real-or-random
Copy link
Contributor

Good to move this to a separate PR.

Unfortunately the constants are highly coupled with the allocation code. Can you add a comment to the allocation code that says that the constant must be updated when this is changed (also for pippenger)? Otherwise I bet we'll get this wrong again in the future.

@robot-dreams
Copy link
Contributor

robot-dreams commented Nov 28, 2021

Thanks for catching this. Looks good to me—I confirmed that:

  • secp256k1_ecmult_strauss_batch now has 7 calls to secp256k1_scratch_alloc instead of 6
  • What matters for STRAUSS_SCRATCH_OBJECTS is the number of allocations (not the total size being allocated), since it's used to account for per-allocation alignment padding

I agree with @real-or-random 's suggestion. In addition, do the functions secp256k1_strauss_scratch_size and secp256k1_pippenger_scratch_size also need to be kept in sync when allocations are updated?

This bug was introduced in 7506e06 by adding
an allocation but not updating the constant.
@jonasnick
Copy link
Contributor Author

Good idea. Added comments.

Copy link
Contributor

@real-or-random real-or-random left a comment

Choose a reason for hiding this comment

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

ACK 60bf889

@real-or-random
Copy link
Contributor

@robot-dreams Want give a final review here?

@robot-dreams
Copy link
Contributor

ACK 60bf889

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.

3 participants