Skip to content

Commit 9d9c19c

Browse files
authored
fix(crypto): bls compilation (#22717)
1 parent f350775 commit 9d9c19c

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

Diff for: .github/workflows/build.yml

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ jobs:
5555
- name: Build with rocksdb backend
5656
if: matrix.go-arch == 'amd64'
5757
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS="rocksdb" make build
58+
- name: Build with BLS12381
59+
if: matrix.go-arch == 'amd64'
60+
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS="bls12381" make build
61+
- name: Build with Secp_cgo
62+
if: matrix.go-arch == 'amd64'
63+
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS="secp" make build
5864
###################
5965
## Build Tooling ##
6066
###################

Diff for: crypto/keys/bls12_381/key_cgo.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ package bls12_381
44

55
import (
66
"bytes"
7-
"crypto/sha256"
87
"errors"
98
"fmt"
109

1110
"github.com/cometbft/cometbft/crypto"
12-
"github.com/cometbft/cometbft/crypto/tmhash"
1311
"github.com/cometbft/cometbft/crypto/bls12381"
12+
"github.com/cometbft/cometbft/crypto/tmhash"
1413

1514
"github.com/cosmos/cosmos-sdk/codec"
1615
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
@@ -84,11 +83,6 @@ func (privKey PrivKey) Sign(msg []byte) ([]byte, error) {
8483
return nil, err
8584
}
8685

87-
if len(msg) > bls12381.MaxMsgLen {
88-
hash := sha256.Sum256(msg)
89-
return secretKey.Sign(hash[:])
90-
}
91-
9286
return secretKey.Sign(msg)
9387
}
9488

@@ -151,11 +145,6 @@ func (pubKey PubKey) VerifySignature(msg, sig []byte) bool {
151145
return false
152146
}
153147

154-
if len(msg) > bls12381.MaxMsgLen {
155-
hash := sha256.Sum256(msg)
156-
msg = hash[:]
157-
}
158-
159148
return pubK.VerifySignature(msg, sig)
160149
}
161150

Diff for: scripts/build/build.mk

-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ ifeq (v2,$(findstring v2,$(COSMOS_BUILD_OPTIONS)))
5858
endif
5959

6060
# DB backend selection
61-
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
62-
build_tags += gcc
63-
endif
64-
ifeq (badgerdb,$(findstring badgerdb,$(COSMOS_BUILD_OPTIONS)))
65-
build_tags += badgerdb
66-
endif
6761
# handle rocksdb
6862
ifeq (rocksdb,$(findstring rocksdb,$(COSMOS_BUILD_OPTIONS)))
6963
CGO_ENABLED=1

0 commit comments

Comments
 (0)