Skip to content

Instantly share code, notes, and snippets.

@chappjc
Created April 7, 2022 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chappjc/25460b3e4785cfbf54782c9509c2788d to your computer and use it in GitHub Desktop.
Save chappjc/25460b3e4785cfbf54782c9509c2788d to your computer and use it in GitHub Desktop.
diff --git a/Makefile b/Makefile
index 34144f3..6b927fc 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,8 @@
ADDLICENSE_INSTALL=go install github.com/google/addlicense@latest
ADDLICENSE_CMD=addlicense
ADDLICENCE_SCRIPT=${ADDLICENSE_CMD} -c "Coinbase, Inc." -l "apache" -v
-GOIMPORTS_CMD=go run golang.org/x/tools/cmd/goimports
+GOIMPORTS_INSTALL=go install golang.org/x/tools/cmd/goimports@latest
+GOIMPORTS_CMD=goimports
GOLINES_INSTALL=go install github.com/segmentio/golines@latest
GOLINES_CMD=golines
GOVERALLS_INSTALL=go install github.com/mattn/goveralls@latest
@@ -22,7 +23,7 @@ TEST_SCRIPT=go test ${GO_PACKAGES}
LINT_SETTINGS=golint,misspell,gocyclo,gocritic,whitespace,goconst,gocognit,bodyclose,unconvert,lll,unparam
deps:
- go get ./...
+ go build ./...
gen:
./codegen.sh;
@@ -45,10 +46,12 @@ lint: | lint-examples
format:
gofmt -s -w -l .
+ ${GOIMPORTS_INSTALL}
${GOIMPORTS_CMD} -w .
check-format:
! gofmt -s -l . | read;
+ ! ${GOIMPORTS_INSTALL} | read;
! ${GOIMPORTS_CMD} -l . | read;
test:
diff --git a/codegen.sh b/codegen.sh
index 6cf47b5..fdcf03c 100755
--- a/codegen.sh
+++ b/codegen.sh
@@ -212,7 +212,7 @@ done
# Format client generated code
FORMAT_GEN="gofmt -w /local/types; gofmt -w /local/client; gofmt -w /local/server"
-GOLANG_VERSION=1.16
+GOLANG_VERSION=1.17
docker run --rm -v "${PWD}":/local \
golang:${GOLANG_VERSION} sh -c \
"cd /local; make deps; ${FORMAT_GEN}; make add-license; make shorten-lines; make fix-imports; go mod tidy;"
diff --git a/go.mod b/go.mod
index c4c31d8..bb4bbf0 100644
--- a/go.mod
+++ b/go.mod
@@ -1,17 +1,17 @@
module github.com/coinbase/rosetta-sdk-go
-go 1.16
+go 1.17
require (
github.com/DataDog/zstd v1.5.0
github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6
- github.com/btcsuite/btcd v0.22.0-beta
+ github.com/btcsuite/btcd/btcec/v2 v2.1.2
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coinbase/kryptology v1.8.0
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/dgraph-io/ristretto v0.0.3 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
- github.com/ethereum/go-ethereum v1.10.16
+ github.com/ethereum/go-ethereum v1.10.17
github.com/fatih/color v1.13.0
github.com/gorilla/mux v1.8.0
github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77
@@ -27,3 +27,28 @@ require (
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
google.golang.org/protobuf v1.25.0 // indirect
)
+
+require (
+ filippo.io/edwards25519 v1.0.0-rc.1 // indirect
+ github.com/btcsuite/btcd v0.22.0-beta // indirect
+ github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
+ github.com/bwesterb/go-ristretto v1.2.0 // indirect
+ github.com/cespare/xxhash v1.1.0 // indirect
+ github.com/consensys/gnark-crypto v0.5.3 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
+ github.com/dustin/go-humanize v1.0.0 // indirect
+ github.com/golang/protobuf v1.4.3 // indirect
+ github.com/golang/snappy v0.0.4 // indirect
+ github.com/klauspost/compress v1.12.3 // indirect
+ github.com/mattn/go-colorable v0.1.9 // indirect
+ github.com/mattn/go-isatty v0.0.14 // indirect
+ github.com/pkg/errors v0.9.1 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/stretchr/objx v0.1.1 // indirect
+ github.com/tidwall/match v1.1.1 // indirect
+ github.com/tidwall/pretty v1.2.0 // indirect
+ github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
+ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
+ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
+)
diff --git a/imports.sh b/imports.sh
index d217c9b..fcaa604 100755
--- a/imports.sh
+++ b/imports.sh
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-go get github.com/incu6us/goimports-reviser/v2;
+go install -v github.com/incu6us/goimports-reviser/v2@latest
while IFS= read -r -d '' FILE
do
diff --git a/keys/keys.go b/keys/keys.go
index 22a1564..99ebd55 100644
--- a/keys/keys.go
+++ b/keys/keys.go
@@ -23,7 +23,7 @@ import (
"fmt"
"math/big"
- "github.com/btcsuite/btcd/btcec"
+ "github.com/btcsuite/btcd/btcec/v2"
"github.com/coinbase/kryptology/pkg/signatures/schnorr/mina"
"github.com/coinbase/rosetta-sdk-go/asserter"
@@ -70,7 +70,7 @@ func ImportPrivateKey(privKeyHex string, curve types.CurveType) (*KeyPair, error
var keyPair *KeyPair
switch curve {
case types.Secp256k1:
- rawPrivKey, rawPubKey := btcec.PrivKeyFromBytes(btcec.S256(), privKey)
+ rawPrivKey, rawPubKey := btcec.PrivKeyFromBytes(privKey)
pubKey := &types.PublicKey{
Bytes: rawPubKey.SerializeCompressed(),
@@ -152,7 +152,7 @@ func GenerateKeypair(curve types.CurveType) (*KeyPair, error) {
switch curve {
case types.Secp256k1:
- rawPrivKey, err := btcec.NewPrivateKey(btcec.S256())
+ rawPrivKey, err := btcec.NewPrivateKey()
if err != nil {
return nil, fmt.Errorf("%w: %v", ErrKeyGenSecp256k1Failed, err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment