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

bindings/go: make it work with upcoming go1.24. #247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dot-asm
Copy link
Collaborator

@dot-asm dot-asm commented Dec 20, 2024

In an unexpected turn of events go1.24 reclassified import "C" non-local, which rendered C.blst_* type aliases defunct. The only working solution appears to be to wrap them into structs. Since all the C.blst_* types were opaque, the wrapping shouldn't affect applications. In the sense that the shell struct won't obstruct anything, because nothing was visible.

In an unexpected turn of events go1.24 reclassified import "C" non-local,
which rendered C.blst_* type aliases defunct. The only working solution
appears to be to wrap them into structs. Since all the C.blst_* types
were opaque, the wrapping shouldn't affect applications. In the sense
that the shell struct won't obstruct anything, because nothing was visible.
@mark-rushakoff
Copy link

Thanks for the quick turnaround @dot-asm. I can confirm that with this change, I am able to successfully build my project using the blst Go bindings, whether I am still using go1.23, go1.24rc1, or with Go tip.

mark-rushakoff added a commit to gordian-engine/gordian that referenced this pull request Jan 8, 2025
This uses the supranational/blst package for an implementation of BLS
signatures. We use the minimized signature form, hence the package name.

The package includes a BLS-backed gcrypto.PubKey implementation and a
CommonMessageSignatureProof implementation. There are likely some
missing details in the BLS setup, at least in adding configurability for
the signatures' salt. I think the domain separation tag is correct.

I cannot find the whitepaper or technical document that introduced me to
the concept, but the model of arranging the validators in a tree for key
and signature aggregation is based on the concept that the leftmost
validators are trustworthy and likely to be online, while the rightmost
validators are the least expected to vote. See further documentation on
the SignatureProof type.

It has not been fully integrated yet, but we have tests around the usage
of both of those types.

Next up are some slight interface changes that will affect the ed25519
implementation too. And I think we may need some special handling such
that the signature committed to chain is a "final aggregation" of keys
that would not normally be aggregated together. For instance, if there
are only four validators, then during consensus gossip, we would pair
0-1 and 2-3, but never 0-2 or 1-3. If the final votes were only from 0,
1, and 3 -- that is to say validator 2 was absent or perhaps voted nil
-- then we would commit with the aggregated signaure 0-1-3, to minimize
space used for signatures.

This also removes the gmerkle package, which was left in for
specifically this use case, but which turned out to be an incorrect fit.

Note that with the introduction of this package, we have a dependency on
supranational/blst, which is a C dependency; and there is currently the
outstanding issue supranational/blst#245 which prevents building blst
with Go 1.24. However, supranational/blst#247 is an open PR that fixes
the build for Go 1.24 and Go tip.
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