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

feat(crypto/bls12381): signature aggregation #11

Open
wants to merge 125 commits into
base: bera-v1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
ecaeb63
feat(crypto/bls12381): signature aggregation
melekes Jan 7, 2025
ca71e12
add a test for MakeBLSCommit
melekes Jan 7, 2025
36b7c72
fix TestDifferByTimestamp
melekes Jan 7, 2025
654bc38
actually verify the commit
melekes Jan 7, 2025
4511acd
do not check the 2nd sig if it's empty
melekes Jan 7, 2025
a535f96
Merge branch 'bera-v1.x' into melekes/bls-signature-aggregation
melekes Jan 7, 2025
4b2afec
fix linter errors
melekes Jan 7, 2025
fcb300b
attempt to verify agg commits first
melekes Jan 8, 2025
80d8359
add sergio comment
melekes Jan 8, 2025
141d1a2
refactor verifyAggregatedCommit
melekes Jan 8, 2025
94b8fd6
allow empty signatures
melekes Jan 8, 2025
f3b1bb7
guard against nil PubKey
melekes Jan 8, 2025
6b0b06e
leave the possibility of using vote extensions
melekes Jan 8, 2025
f752e1e
add separate blockid flags
melekes Jan 8, 2025
0c7153f
remove tags from generator and runner targets
melekes Jan 8, 2025
0800a7e
comment out test
melekes Jan 8, 2025
12c0ad1
remove Timestamp from Vote and CommitSig
melekes Jan 9, 2025
8f82994
fix TestPrivvalVectors
melekes Jan 9, 2025
7ed479b
fix evidence tests and add reserved field
melekes Jan 9, 2025
0093df8
fix TestEvidencePoolBasic, TestEvidenceVectors
melekes Jan 9, 2025
cd6f8ad
reserve field
melekes Jan 9, 2025
e5932a4
check we have signatures for nil before verifying
melekes Jan 9, 2025
089d45e
allow BLS keys for execution
melekes Jan 9, 2025
ae6c643
change key_type to bls12_381 in ci.toml
melekes Jan 9, 2025
a2e8326
add bls12381 tag to runner
melekes Jan 9, 2025
c925031
Updated `go-git` dep to address vulnerabilities.
alesforz Jan 9, 2025
427e875
fix Ci err
melekes Jan 9, 2025
87e3312
fix
melekes Jan 9, 2025
38f96e3
Merge branch 'melekes/bls-signature-aggregation' of github.com:meleke…
alesforz Jan 9, 2025
092cb5b
updated e2e Dockerfile to fix pkg download error
alesforz Jan 9, 2025
b56a29e
validation.go functions panic if keys aren't BLS12_381
alesforz Jan 9, 2025
fb07cde
deleted dead code in validation.go
alesforz Jan 9, 2025
2b2d2d5
removed bls1381 build flag
alesforz Jan 9, 2025
1fd3cd1
added more panics if keys aren't BLS12-381
alesforz Jan 9, 2025
12ba08a
Removed skipping verification
jmalicevic Jan 9, 2025
87fd68b
Added ifs before panic
jmalicevic Jan 9, 2025
8d7ce78
Re-introduce timestamp in Vote
jmalicevic Jan 9, 2025
5905680
Partially removed fromtests
jmalicevic Jan 10, 2025
9c90795
Fixed more tests
jmalicevic Jan 10, 2025
a9349b3
Revert "Fixed more tests"
melekes Jan 10, 2025
71458b0
Revert "Partially removed fromtests"
melekes Jan 10, 2025
641d6ac
Revert "Added ifs before panic"
melekes Jan 10, 2025
21a0137
Revert "added more panics if keys aren't BLS12-381"
melekes Jan 10, 2025
97cf653
Revert "deleted dead code in validation.go"
melekes Jan 10, 2025
edc92e2
Revert "validation.go functions panic if keys aren't BLS12_381"
melekes Jan 10, 2025
3881bf3
only allow ed25519 in tests
melekes Jan 10, 2025
6677c0c
fix tests
melekes Jan 10, 2025
c66534e
fix remaining tests
melekes Jan 10, 2025
f53d1ca
fix remaining comments
melekes Jan 10, 2025
b24e14c
fix TestConsMsgsVectors
melekes Jan 10, 2025
b01383a
comment out lunatic attack tests
melekes Jan 10, 2025
ab29251
updated Makefile for ARM architectures
alesforz Jan 10, 2025
6a9e7bd
Update light/client.go
melekes Jan 10, 2025
5463386
Apply suggestions from code review
melekes Jan 10, 2025
c8ccadf
set default key to bls12381
melekes Jan 10, 2025
0792f63
return err if aggregated commit didn't pass isAggregatedCommit
melekes Jan 10, 2025
5605bca
guard against dup sigs
melekes Jan 10, 2025
40f5816
types: apply Timestamp check to all sigs
melekes Jan 10, 2025
8139212
fix(e2e): fix BLS-related failures (#3726)
sergio-mena Aug 16, 2024
95455d5
Disabled ARM from build process
alesforz Jan 10, 2025
de99d54
bls12381 Pubkey() now returns a pointer
alesforz Jan 10, 2025
1f478ec
Fix syntax to please the linter
alesforz Jan 10, 2025
4fffebf
fixed TestPubKey_MarshalJSON panic
alesforz Jan 10, 2025
256a329
Fixed panicing tests because of incorrect signature timestamp
alesforz Jan 10, 2025
3c4c3a8
Revert "bls12381 Pubkey() now returns a pointer"
alesforz Jan 10, 2025
c71b2cc
Fixed panicing tests because of incorrect PubKey type
alesforz Jan 10, 2025
82930be
Revert "fixed TestPubKey_MarshalJSON panic"
alesforz Jan 10, 2025
0203b88
Disabled vote extension in ci.toml
alesforz Jan 10, 2025
701204d
Added bool flag to enable/disable signature verification when convert…
alesforz Jan 10, 2025
c4a6f43
Revert "Added bool flag to enable/disable signature verification when…
sergio-mena Jan 11, 2025
46423c8
First part: adapt structures to support commits as
sergio-mena Jan 11, 2025
1a36a1b
Added Commit message and send this instead of Vote when aggregated co…
jmalicevic Jan 11, 2025
b9c5a03
revert log level and script change
jmalicevic Jan 11, 2025
2670544
Fixed block_test and validation_test
jmalicevic Jan 11, 2025
b48a625
Implement AddCommit in Consensus state
sergio-mena Jan 11, 2025
42d65c8
Call AddCommit when a new commit comes in during catchup
jmalicevic Jan 11, 2025
5293186
address comment. fixed missing enterNewRound
sergio-mena Jan 11, 2025
d0de97d
register json CommitMessage
sergio-mena Jan 11, 2025
d3c58c7
Block marshal test and addressed PR comments
jmalicevic Jan 11, 2025
236829e
Merge branch 'melekes/bls-signature-aggregation' of github.com:meleke…
jmalicevic Jan 11, 2025
cfed49b
Removed commit validation from message receive function
jmalicevic Jan 11, 2025
8650f2d
Commented out added
jmalicevic Jan 11, 2025
81fc562
minor changes
sergio-mena Jan 11, 2025
303a6be
Added validation
jmalicevic Jan 11, 2025
10d7cd9
Merge branch 'melekes/bls-signature-aggregation' of github.com:meleke…
jmalicevic Jan 11, 2025
2e27d2d
check commit is aggregated
sergio-mena Jan 11, 2025
d98fefc
fix PBTS on e2e generator
sergio-mena Jan 11, 2025
9739076
use the right aggregated commit checker
sergio-mena Jan 11, 2025
6266c88
Fixed race condition in Commit; fixed wrong cast check to BLS pub key
sergio-mena Jan 11, 2025
15e1cfc
remove some TODOs addressed
sergio-mena Jan 11, 2025
3caca93
get uts to compile
jmalicevic Jan 11, 2025
ebfba32
reduce log verbosity
sergio-mena Jan 11, 2025
ff1a813
fixed bug: unaggregated commit at the end of Consensus
sergio-mena Jan 11, 2025
c30e164
Fixed JSON Marshalling
jmalicevic Jan 11, 2025
9af3d65
Merge branch 'melekes/bls-signature-aggregation' of github.com:meleke…
jmalicevic Jan 11, 2025
f314951
Fixed bug: late nodes overwhelmed with Commits, and they verify all o…
sergio-mena Jan 12, 2025
b4e8af3
Revert "Fixed JSON Marshalling"
sergio-mena Jan 12, 2025
af1d05f
Fixed consensus dump RPC
sergio-mena Jan 12, 2025
eb5a08d
Fixed TestReactorValidatorSetChanges
sergio-mena Jan 12, 2025
1217b48
More UT fixes
sergio-mena Jan 12, 2025
4cead62
Fixed WALCrashTest and properly set genesis file ot use bls
jmalicevic Jan 12, 2025
fe2b097
Merge branch 'melekes/bls-signature-aggregation' of github.com:meleke…
jmalicevic Jan 12, 2025
d53342f
revert test timout wait time
jmalicevic Jan 12, 2025
4f7bd20
More UT fixes
sergio-mena Jan 12, 2025
603ac3c
TestConsensusParamsUpdate_EnableHeight
jmalicevic Jan 12, 2025
b44473b
TestConsensusParamsUpdate`
jmalicevic Jan 12, 2025
9d7c8a3
Fix TestProtoUpgrade
jmalicevic Jan 12, 2025
78b03f6
Deleted TestLastCommitJSON`
jmalicevic Jan 12, 2025
d0c6115
Deleted TestLastCommitJSON`
jmalicevic Jan 12, 2025
804d022
Fixed TestBasicGenesisDoc
jmalicevic Jan 12, 2025
ffbba5e
Fix more UTs
sergio-mena Jan 12, 2025
bf4c3b5
one more UT
sergio-mena Jan 12, 2025
68ffc1b
One more
sergio-mena Jan 12, 2025
1ac3231
more UTs
sergio-mena Jan 12, 2025
2183f4e
one more UT
sergio-mena Jan 12, 2025
15b4667
two more UTs
sergio-mena Jan 12, 2025
faedd63
Appease linter
sergio-mena Jan 12, 2025
27ccb72
fix build
sergio-mena Jan 12, 2025
8893054
Appease linter part II
sergio-mena Jan 12, 2025
c3341da
fix abci tests
sergio-mena Jan 12, 2025
0253b40
Appease linter part III
sergio-mena Jan 12, 2025
4dea906
Use bls in validator update of kvstore
jmalicevic Jan 12, 2025
12195a8
Merge branch 'melekes/bls-signature-aggregation' of github.com:meleke…
jmalicevic Jan 12, 2025
9bb2dfc
removed unused import
jmalicevic Jan 12, 2025
156f344
reduce verbosity
sergio-mena Jan 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
goarch: ["arm", "amd64"]
goarch: ["amd64"]
goos: ["linux"]
timeout-minutes: 5
steps:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ linters-settings:
- github.com/syndtr/goleveldb
- github.com/mitchellh/mapstructure
- github.com/decred/dcrd/dcrec/secp256k1/v4
- github.com/supranational/blst/bindings/go
test:
files:
- "$test"
Expand All @@ -133,6 +134,7 @@ linters-settings:
- github.com/spf13
- github.com/stretchr/testify
- github.com/decred/dcrd/dcrec/secp256k1/v4
- github.com/supranational/blst/bindings/go

revive:
enable-all-rules: true
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ GOARM ?=
ifeq (linux/arm,$(findstring linux/arm,$(TARGETPLATFORM)))
GOOS=linux
GOARCH=arm
CC=arm-linux-gnueabi-gcc
GOARM=7
endif

ifeq (linux/arm/v6,$(findstring linux/arm/v6,$(TARGETPLATFORM)))
GOOS=linux
GOARCH=arm
CC=arm-linux-gnueabi-gcc
GOARM=6
endif

Expand Down
8 changes: 6 additions & 2 deletions abci/example/kvstore/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ import (
"strings"

"github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/crypto/bls12381"
cmtrand "github.com/cometbft/cometbft/internal/rand"
)

// RandVal creates one random validator, with a key derived
// from the input value.
func RandVal() types.ValidatorUpdate {
pubkey := ed25519.GenPrivKey().PubKey()
privKey, err := bls12381.GenPrivKey()
if err != nil {
panic("failed to generate private key")
}
pubkey := privKey.PubKey()
power := cmtrand.Uint16() + 1
return types.ValidatorUpdate{Power: int64(power), PubKeyType: pubkey.Type(), PubKeyBytes: pubkey.Bytes()}
}
Expand Down
9 changes: 9 additions & 0 deletions api/cometbft/consensus/v1/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func (m *Vote) Wrap() proto.Message {
return cm
}

func (m *Commit) Wrap() proto.Message {
cm := &Message{}
cm.Sum = &Message_Commit{Commit: m}
return cm
}

func (m *BlockPart) Wrap() proto.Message {
cm := &Message{}
cm.Sum = &Message_BlockPart{BlockPart: m}
Expand Down Expand Up @@ -88,6 +94,9 @@ func (m *Message) Unwrap() (proto.Message, error) {
case *Message_Vote:
return m.GetVote(), nil

case *Message_Commit:
return m.GetCommit(), nil

case *Message_HasVote:
return m.GetHasVote(), nil

Expand Down
388 changes: 326 additions & 62 deletions api/cometbft/consensus/v1/types.pb.go

Large diffs are not rendered by default.

130 changes: 40 additions & 90 deletions api/cometbft/types/v1/canonical.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading