Skip to content

Commit

Permalink
build(crypto/secp256k1): Update btcec/v2 to v2.3.4 (#3728)
Browse files Browse the repository at this point in the history
Running a `go get` should consistently build this project as per the
README. However, the latest patch release of `btcec/v2` is not a proper
Semantic Versioning patch. It removes an error return value from
`ecdsa.SignCompact` function (btcsuite/btcd@e5d15fd). This is
functionally a no-op, as the underlying function was hardcoded to always
return `nil` as error. However, this is still a breaking change
(compiler/build error) for all consumers of this function, as they
historically expected two return values, but now only get one.

Ref: btcsuite/btcd#2211
Ref: #3531
Ref: #3536

---

#### PR checklist

- [ ] 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

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
sigv and mergify[bot] authored Aug 19, 2024
1 parent 4c598bf commit 17abb80
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .changelog/unreleased/dependencies/3728-update-btcec-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `[crypto/secp256k1]` Adjust to breaking interface changes in
`btcec/v2` latest release, while avoiding breaking changes to
local CometBFT functions
([\#3728](https://github.com/cometbft/cometbft/pull/3728))
5 changes: 1 addition & 4 deletions crypto/secp256k1/secp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ func (privKey PrivKey) Sign(msg []byte) ([]byte, error) {
priv, _ := secp256k1.PrivKeyFromBytes(privKey)

sum := sha256.Sum256(msg)
sig, err := ecdsa.SignCompact(priv, sum[:], false)
if err != nil {
return nil, err
}
sig := ecdsa.SignCompact(priv, sum[:], false)

// remove the first byte which is compactSigRecoveryCode
return sig[1:], nil
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/btcsuite/btcd/btcec/v2 v2.3.3
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.6
github.com/cometbft/cometbft-db v0.14.0
github.com/cometbft/cometbft-load-test v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY=
github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
Expand Down

0 comments on commit 17abb80

Please sign in to comment.