Skip to content

feat(crypto/bls12381): change to minimal-signature-size#3627

Merged
melekes merged 7 commits intomainfrom
3624-crypto-bls-sig-size
Aug 6, 2024
Merged

feat(crypto/bls12381): change to minimal-signature-size#3627
melekes merged 7 commits intomainfrom
3624-crypto-bls-sig-size

Conversation

@melekes
Copy link
Collaborator

@melekes melekes commented Aug 5, 2024

Closes #3624


PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments
  • Title follows the Conventional Commits spec

@melekes melekes self-assigned this Aug 5, 2024
@melekes melekes added crypto Cryptography-related breaking A breaking change backport-to-v1.x labels Aug 5, 2024
@melekes melekes marked this pull request as ready for review August 5, 2024 16:40
@melekes melekes requested a review from a team as a code owner August 5, 2024 16:40
@melekes melekes requested a review from a team August 5, 2024 16:40

// 4 bytes for field tags + 1 byte for signature LEN + 1 byte for
// validator address LEN + 1 byte for timestamp LEN.
maxCommitSigProtoEncOverhead = 4 + 1 + 1 + 1 + 3 // 3 ???
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

still don't know where 3 bytes are coming from

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

message CommitSig {
  BlockIDFlag               block_id_flag     = 1;
  bytes                     validator_address = 2;
  google.protobuf.Timestamp timestamp         = 3
      [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  bytes signature = 4;
}

Copy link

Choose a reason for hiding this comment

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

Protobuf overhead?

We really need a way to compute that properly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Protobuf overhead?

Yes, but it's unclear from where. varints of 3 fields shouldn't take more than 1 byte because they are all very small.

@melekes melekes removed the breaking A breaking change label Aug 6, 2024
@melekes melekes changed the title feat(bls12381)!: change to minimal-signature-size feat(crypto/bls12381): change to minimal-signature-size Aug 6, 2024
Copy link

@cason cason left a comment

Choose a reason for hiding this comment

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

Legit.

But we need a better solution for defining the maximum payload size for a block, depending on the signing algorithm adopted.

// XXX: secp256k1 does not have Size nor MaxSize defined.
var MaxSignatureSize = cmtmath.MaxInt(ed25519.SignatureSize, cmtmath.MaxInt(bls12381.SignatureLength, 64))
// XXX: secp256k1 does not have max signature size defined.
var MaxSignatureSize = cmtmath.MaxInt(
Copy link

Choose a reason for hiding this comment

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

The problem of this approach is that blocks produced using different signing algorithms will have different maximum payload size. We need to re-think this way of computing the maximum payload size, as it depends on the signing algorithm we are using...

@melekes melekes added this pull request to the merge queue Aug 6, 2024
Merged via the queue into main with commit 7a5eb45 Aug 6, 2024
@melekes melekes deleted the 3624-crypto-bls-sig-size branch August 6, 2024 09:40
mergify bot pushed a commit that referenced this pull request Aug 6, 2024
Closes #3624

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 7a5eb45)
melekes added a commit that referenced this pull request Aug 6, 2024
…) (#3631)

Closes #3624

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #3627 done by
[Mergify](https://mergify.com).

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
itsdevbear pushed a commit to itsdevbear/cometbft that referenced this pull request Aug 20, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 26, 2024
because it's not Ethereum compatible and breaks Berachain

Reverts #3627

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
mergify bot pushed a commit that referenced this pull request Aug 26, 2024
because it's not Ethereum compatible and breaks Berachain

Reverts #3627

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments

(cherry picked from commit e67223f)
melekes added a commit that referenced this pull request Aug 26, 2024
because it's not Ethereum compatible and breaks Berachain

Reverts #3627



---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
<hr>This is an automatic backport of pull request #3860 done by
[Mergify](https://mergify.com).

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
aljo242 pushed a commit that referenced this pull request Sep 4, 2025
Closes #3624

---

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
aljo242 pushed a commit that referenced this pull request Sep 15, 2025
because it's not Ethereum compatible and breaks Berachain

Reverts #3627

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crypto Cryptography-related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crypto/bls12381: change to minimal-signature-size

2 participants