Skip to content

feat: Add bls12381 signing provider - #214

Merged
rnbguy merged 15 commits into
informalsystems:mainfrom
garrysg:dev/bls_support
Feb 10, 2026
Merged

feat: Add bls12381 signing provider#214
rnbguy merged 15 commits into
informalsystems:mainfrom
garrysg:dev/bls_support

Conversation

@garrysg

@garrysg garrysg commented Feb 6, 2026

Copy link
Copy Markdown
Contributor
  • add generic bls12381 signing (min-sig + min-pk)
  • add tests using test vectors from ethereum's repo

@garrysg
garrysg requested a review from a team as a code owner February 6, 2026 09:12

@rnbguy rnbguy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for the PR 🙌🏼 Left few comments. Please add a test that generates a private key, signs a message, and verifies the signature with the public key.

Would appreciate if you filled in bls12381_min_pk.rs too.

Would be great if you could merge these two structs Bls12381<T> and have two implementations at Bls12381<MinPk> and Bls12381<MinSig>.

Comment thread types/src/signing/bls12381.rs Outdated
Comment thread types/src/signing/bls12381.rs Outdated
Comment thread types/src/signing/bls12381.rs Outdated
Comment thread types/src/signing/bls12381.rs
Comment thread types/src/signing/bls12381.rs Outdated
Comment thread types/src/signing/bls12381.rs Outdated
Comment thread types/src/signing/mod.rs
@rnbguy rnbguy changed the title Add bls12381 signing provider feat: Add bls12381 signing provider Feb 6, 2026
Comment thread types/src/signing/bls12381.rs Outdated
…imal-public-key variants using a type-parameterized generic design
@garrysg

garrysg commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

@rnbguy has refactored BLS12-381 signature scheme support with minimal-signature and minimal-public-key variants using a type-parameterized generic design

@rnbguy

rnbguy commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

can we have something like this ?

// bls12381.rs
pub trait BlsVariant: Copy + 'static {
    type SecretKey; type PublicKey: Clone; type Signature: Clone;
    const PK_LEN: usize;
    const SIG_LEN: usize;
    const DST: &'static [u8];
    fn verify(sig: &Self::Signature, msg: &[u8], pk: &Self::PublicKey) -> BLST_ERROR;
    // + from_bytes/to_bytes for each type
}

// impl `SigningScheme` for any `Bls12381<V: BlsVariant>`
impl<V: BlsVariant> SigningScheme for Bls12381<V> {
    type Signature = Signature<V>;
    type PublicKey = PublicKey<V>;
    // ...
}

// impl `SigningProvier` for `BlsProvider<V: BlsVariant>`
impl<C, V: BlsVariant> SigningProvider<C> for BlsProvider<V> ... { ... }

impl BlsVariant for MinPk { /* PK=48, SIG=96, blst::min_pk::* */ }
impl BlsVariant for MinSig { /* PK=96, SIG=48, blst::min_sig::* */ }

then we can directly use,

// minpk
type Bls12381MinPkScheme = Bls12381<MinPk>;
type Bls12381MinPkProvier = BlsProvider<MinPk>;

…ts, eliminating duplication while keeping MinSig/MinPk type-safe and ergonomic
@garrysg

garrysg commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

@rnbguy Refactor BLS signing to a generic BlsVariant/Bls12381 with shared tests, eliminating duplication while keeping MinSig/MinPk type-safe and ergonomic.

@rnbguy rnbguy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR 🙏🏼

@rnbguy
rnbguy merged commit 683b7a9 into informalsystems:main Feb 10, 2026
6 checks passed
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