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

Remove BLS functionality from the mainstream #541

Merged

Conversation

torao
Copy link
Contributor

@torao torao commented Jan 12, 2023

Description

This PR removes the BLS functionality from the Ostracon mainstream.

Problem settings

There are unresolved issues with signature aggregation in the current Tendermint design. Ostracon has struggled with this issue for a long time, but to improve source compatibility with Tendermint v0.34.19, we are removing support for the BLS key and its signature aggregation until a plan can be developed to avoid this issue.

The followings are a summary of the problems with applying BLS and other signature aggregation algorithm to Ostracon (and Tendermint).

  1. The light clients can recognize a block as correct if 2/3+ signature verification pass, even if some of the Validator's public keys are missing. However, for aggregated signatures, the public keys of all Validators are required, and if even one is missing, the verification cannot be achieved. Therefore, each light client must always have the public keys of all Validators, but the current light client of Tendermint isn't designed with such as assumption.
  2. BLS signature aggregation can reduce the space complexity of the signature from $O(n)$ to $O(1)$, where $n$ is the number of Voters. However, it takes about 10 times longer than ed25519 to generate and verify the BLS signature respectively and the computational complexity remains $O(n)$ unless used in conjunction with public key aggregation.

Changes

This PR removes the BLS functionality from Ostracon and the same time indicates where Tendermint needs to be modified to support signature aggregation and different key algorithms on the same blockchain instance.

The following external interfaces are affected by this change.

  • [cli] The option --priv_key_type has been removed from all ostracon subcommands such as init.
  • [protobuf] CompositePubKey type and Commit.aggregated_signature field are removed.

More internally, the following relevant codes are removed or changed.

  • Structure definition of BLS key and composite key.
  • Fields and procedures related to BLS signature aggregation in struct and ProtocolBuffers.
  • Identifiers used to identify the type of key.
  • Size or hash value of the structure being tested.
  • A few trivial fixes, comments, imports, and docs.

The following points are helpful when reintroducing the BLS signature algorithms or other ones.

  • To clarify the identification of the algorithm, we should add the name of the curve to the identifier, e.g., BLS12-381 or bls12381.
  • The word composite is the name of the structure for the synthetic key and not the name of the signature algorithm. Thus, the name of structure CompositeKey is fine, but the composite specified in the command-line option should be changed to an algorithm name such as bls.
  • It should be tested to work correctly with any key algorithm. However, since it's not practical to verify all key algorithm variations in every unit-test case at this time, it's better to specify the target key algorithm when unit tests are run and ensure that all tests work with that default key.

Closes: #XXX

@torao torao added the C: enhancement Classification: New feature or its request, or improvement in maintainability of code label Jan 12, 2023
@torao torao self-assigned this Jan 12, 2023
- Definition of BLS key and composite key.
- Fields and procedures related to BLS signature aggregation in struct and ProtocolBuffers.
- Identifiers used to identify the type of key.
- Size or hash value of the structure being tested.
@torao torao force-pushed the feature/remove_bls_keys_and_signature_aggregation branch from 5565e19 to 438bb06 Compare January 12, 2023 10:57
@codecov
Copy link

codecov bot commented Jan 12, 2023

Codecov Report

Merging #541 (7ccf0fb) into main (220fd05) will decrease coverage by 0.05%.
The diff coverage is 80.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #541      +/-   ##
==========================================
- Coverage   66.30%   66.24%   -0.06%     
==========================================
  Files         281      279       -2     
  Lines       38170    37593     -577     
==========================================
- Hits        25307    24904     -403     
+ Misses      11053    10920     -133     
+ Partials     1810     1769      -41     
Impacted Files Coverage Δ
abci/example/kvstore/persistent_kvstore.go 50.00% <ø> (-1.99%) ⬇️
cmd/ostracon/commands/gen_validator.go 0.00% <0.00%> (-30.00%) ⬇️
cmd/ostracon/commands/testnet.go 18.37% <ø> (-0.78%) ⬇️
config/config.go 78.64% <ø> (+0.27%) ⬆️
config/toml.go 74.19% <ø> (ø)
crypto/ed25519/ed25519.go 46.34% <ø> (+1.21%) ⬆️
crypto/encoding/codec.go 47.61% <ø> (-10.16%) ⬇️
state/execution.go 67.46% <0.00%> (ø)
types/protobuf.go 81.70% <ø> (ø)
types/vote.go 89.31% <ø> (+0.79%) ⬆️
... and 38 more

@torao torao requested a review from ulbqb January 12, 2023 11:32
@torao torao marked this pull request as ready for review January 12, 2023 11:36
Copy link
Member

@tnasu tnasu left a comment

Choose a reason for hiding this comment

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

I think the PR of #335 also needs to revert. The others look good to me.

@torao torao marked this pull request as draft January 13, 2023 01:07
@torao
Copy link
Contributor Author

torao commented Jan 13, 2023

I'm reverting to the draft because Ostracon documents also need to be corrected.

@torao
Copy link
Contributor Author

torao commented Jan 13, 2023

@tnasu
From the looks of #335, most of the fixes made to BLS and CompositeKey in it have already been removed. Do I need to make any additional fixes to the BLS, CompositeKey, or signature aggregation?

@torao torao force-pushed the feature/remove_bls_keys_and_signature_aggregation branch from a6c2bfe to 32e705e Compare January 13, 2023 09:06
@torao torao force-pushed the feature/remove_bls_keys_and_signature_aggregation branch from 32e705e to 7ccf0fb Compare January 13, 2023 09:23
@torao torao requested a review from tnasu January 16, 2023 01:45
@torao torao marked this pull request as ready for review January 16, 2023 01:57
Copy link
Contributor

@Kynea0b Kynea0b left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: enhancement Classification: New feature or its request, or improvement in maintainability of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants