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

fix: build properly when using libsecp256k1 #195

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ ifeq ($(LEDGER_ENABLED),true)
endif
endif

# DB backend selection
ifeq (,$(filter $(LBM_BUILD_OPTIONS), cleveldb rocksdb boltdb badgerdb))
# DB backend and secp256k1 implementation selection
ifeq (,$(filter $(LBM_BUILD_OPTIONS), cleveldb rocksdb boltdb badgerdb libsecp256k1))
wetcod marked this conversation as resolved.
Show resolved Hide resolved
BUILD_TAGS += goleveldb
DB_BACKEND = goleveldb
else
Expand All @@ -64,6 +64,10 @@ else
BUILD_TAGS += boltdb
DB_BACKEND = boltdb
endif
ifeq (libsecp256k1,$(findstring libsecp256k1,$(LBM_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += libsecp256k1
endif
endif

build_tags += $(BUILD_TAGS)
Expand Down
2 changes: 1 addition & 1 deletion crypto/keys/secp256k1/secp256k1_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) {

// VerifySignature validates the signature.
// The msg will be hashed prior to signature verification.
func (pubKey *PrivKey) VerifySignature(msg []byte, sig []byte) bool {
func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool {
return secp256k1.VerifySignature(pubKey.Key, crypto.Sha256(msg), sig)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/line/iavl/v2 v2.0.0-init.1.0.20210507092458-8331d3daef36
github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d
github.com/line/ostracon v0.34.9-0.20210512045543-6c7ab0535e10
github.com/line/tm-db/v2 v2.0.0-init.1.0.20210413083915-5bb60e117524
github.com/magiconair/properties v1.8.4
github.com/mattn/go-isatty v0.0.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
Expand Down Expand Up @@ -337,8 +336,9 @@ github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55 h1:cXVtMiJkvQ4kn0px
github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55/go.mod h1:DHRJroSL7NaRkpvocRx3OtRsleXVsYSxBI9SfHFlTQ0=
github.com/line/iavl/v2 v2.0.0-init.1.0.20210507092458-8331d3daef36 h1:811bq0lFSv91AsR9mikOs+ArELnxVeNuYWh8QYUkL6k=
github.com/line/iavl/v2 v2.0.0-init.1.0.20210507092458-8331d3daef36/go.mod h1:0Xz+0i1nlB9lrjUDEwpDRhcmjfEAkOjd20dRb40FBso=
github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d h1:/6vnjrk3SpCUUiIDBv8UzbYexabZBYXxkwyc3Bp9hPo=
github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d/go.mod h1:ttnbq+yQJMQ9a2MT5SEisOoa/+pOgh2KenTiK/rVdiw=
github.com/line/ostracon v0.34.9-0.20210512045543-6c7ab0535e10 h1:Ab+t7zJRhoHYZlQTtdwOSNUyl+FKGXBj0zKf3658baI=
github.com/line/ostracon v0.34.9-0.20210512045543-6c7ab0535e10/go.mod h1:ttnbq+yQJMQ9a2MT5SEisOoa/+pOgh2KenTiK/rVdiw=
github.com/line/tm-db/v2 v2.0.0-init.1.0.20210413083915-5bb60e117524 h1:eKXXnUm1SblC0AIXAMNDaSyvIbQ50yXqFbh9+Q8Kjvg=
github.com/line/tm-db/v2 v2.0.0-init.1.0.20210413083915-5bb60e117524/go.mod h1:wmkyPabXjtVZ1dvRofmurjaceghywtCSYGqFuFS+TbI=
github.com/line/wasmvm v0.14.0-0.4.0 h1:XvJZ0HO7xNtQ/+IEjF2WtK93PC1e+dT0McomCwRTZnQ=
Expand Down