Skip to content

Conversation

@jonasnick
Copy link
Contributor

Instead of providing CTX directly, pass a cmp_data object containing CTX. Otherwise, memory sanitizer fails with "use-of-uninitialized-value".

Instead of providing CTX directly, pass a cmp_data object containing CTX.
Otherwise, memory sanitizer fails with "use-of-uninitialized-value".
Copy link
Collaborator

@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.

utACK 83d0fa2

secp256k1_pubkey_sort(CTX, pk_ptr, 5);
for (j = 1; j < 5; j++) {
CHECK(secp256k1_pubkey_sort_cmp(&pk_ptr[j - 1], &pk_ptr[j], CTX) <= 0);
secp256k1_pubkey_sort_cmp_data cmp_data;
Copy link
Contributor

Choose a reason for hiding this comment

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

I confirmed that declaring the cmp_data variable at the beginning of the function does not cause any issues. This means we do not need to create a new instance for each iteration.

I reviewed the secp256k1_pubkey_sort_cmp function, and it appears that the ctx variable is not utilized within the secp256k1_pubkey_load function. My understanding of this usage is limited, so please correct me if I am mistaken.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's correct that ctx is never used (which is why the old, incorrect code could pass the tests).

As for scoping, IMO we should keep cmp_data as tightly scoped as we can, because it makes the code easier to read.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, thanks!

Copy link
Contributor

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 83d0fa2; successfully ran local tests

@apoelstra
Copy link
Contributor

I'm gonna go ahead and merge this -- I can't imagine the CI failures are the fault of this PR.

@apoelstra apoelstra merged commit f9a04ae into BlockstreamResearch:master Sep 9, 2025
79 of 107 checks passed
@BEULAHEVANJALIN
Copy link
Contributor

Follow-up opened in #303 to fix the remaining CI failures in. This should stabilize ci and unblock FROST (#278)

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.

4 participants