diff --git a/.gitignore b/.gitignore index 723ef36..a9518fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -.idea \ No newline at end of file +.idea +.history +vendor +.vscode diff --git a/Makefile b/Makefile index c7a6887..3159171 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PROJECT_NAME := "go-tezos" VERSION := "v3.0.0" -PKG := "github.com/goat-systems/$(PROJECT_NAME)" +PKG := "github.com/completium/$(PROJECT_NAME)" PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/) GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go) diff --git a/README.md b/README.md index ef6a70a..54355d2 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,18 @@ -[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/goat-systems/go-tezos/v4) +[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/completium/go-tezos/v4) + +# Foreword + +This package is a fork from https://github.com/completium/go-tezos + # A Tezos Go Library Go Tezos is a GoLang driven library for your Tezos node. This library has received a grant from the Tezos Foundation to ensure it's continuous development through 2020. ## Installation -Get GoTezos +Get GoTezos ``` -go get github.com/goat-systems/go-tezos/v4 +go get github.com/completium/go-tezos/v4 ``` ### Getting A Block @@ -17,7 +22,7 @@ package main import ( "fmt" - goTezos "github.com/goat-systems/go-tezos/v4/rpc" + goTezos "github.com/completium/go-tezos/v4/rpc" ) func main() { @@ -47,12 +52,12 @@ func main() { ### More Examples You can find more examples by looking through the unit tests and integration tests in each package. [Here](example/transaction/transaction.go) is an example on -how to forge and inject an operation. +how to forge and inject an operation. ## Contributing ### The Makefile -The makefile is there as a helper to run quality code checks. To run vet and staticchecks please run: +The makefile is there as a helper to run quality code checks. To run vet and staticchecks please run: ``` make checks ``` diff --git a/example/transaction/transaction.go b/example/transaction/transaction.go index 1931043..be08fb1 100644 --- a/example/transaction/transaction.go +++ b/example/transaction/transaction.go @@ -6,9 +6,9 @@ import ( "os" "strconv" - "github.com/goat-systems/go-tezos/v4/forge" - "github.com/goat-systems/go-tezos/v4/keys" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/forge" + "github.com/completium/go-tezos/v4/keys" + "github.com/completium/go-tezos/v4/rpc" ) func main() { @@ -57,7 +57,7 @@ func main() { os.Exit(1) } - signature, err := key.SignHex(op) + signature, err := key.SignGeneric(op) if err != nil { fmt.Printf("failed to sign operation: %s\n", err.Error()) os.Exit(1) diff --git a/forge/forge.go b/forge/forge.go index f9079f6..354acfe 100644 --- a/forge/forge.go +++ b/forge/forge.go @@ -8,14 +8,13 @@ import ( "fmt" "math" "math/big" - "strconv" "strings" "time" "github.com/btcsuite/btcutil/base58" + "github.com/completium/go-tezos/v4/internal/crypto" + "github.com/completium/go-tezos/v4/rpc" validator "github.com/go-playground/validator/v10" - "github.com/goat-systems/go-tezos/v4/internal/crypto" - "github.com/goat-systems/go-tezos/v4/rpc" "github.com/pkg/errors" "github.com/valyala/fastjson" "golang.org/x/crypto/blake2b" @@ -173,6 +172,15 @@ func primTags(prim string) byte { return tags[prim] } +func StringToBigInt(input string) (*big.Int, error) { + i := new(big.Int) + i, ok := i.SetString(input, 10) + if !ok { + return nil, fmt.Errorf("cannot StringToBigInt: %s", input) + } + return i, nil +} + /* Encode forges an operation locally. GoTezos does not use the RPC or a trusted source to forge operations. All operations are supported: @@ -840,6 +848,17 @@ func forgeInt32(value int, l int) []byte { return bigE } +// func forgeNat(value string) ([]byte, error) { +// b, err := StringToBigInt(value) +// if b.Sign() < 0 { +// return nil, fmt.Errorf("nat value (%s) cannot be negative", value) +// } +// if err != nil { +// return nil, err +// } +// return forgeInt(b), nil +// } + func forgeNat(value string) ([]byte, error) { var z big.Int _, ok := z.SetString(string(value), 10) @@ -965,47 +984,53 @@ func forgeArray(value []byte, l int) []byte { return bytes } -func forgeInt(value int) []byte { - binary := strconv.FormatInt(int64(math.Abs(float64(value))), 2) - lenBin := len(binary) - - pad := 6 - if (lenBin-6)%7 == 0 { - pad = lenBin - } else if lenBin > 6 { - pad = lenBin + 7 - (lenBin-6)%7 - } +func forgeInt(value *big.Int) []byte { + if value.Cmp(big.NewInt(0)) == 0 { + return []byte{00} + } else { + sign := value.Sign() + binary := fmt.Sprintf("%b", value.Abs(value)) + lenBin := len(binary) + + pad := 6 + if (lenBin-6)%7 == 0 { + pad = lenBin + } else if lenBin > 6 { + pad = lenBin + 7 - (lenBin-6)%7 + } - binary = fmt.Sprintf("%0*s", pad, binary) - septets := []string{} + binary = fmt.Sprintf("%0*s", pad, binary) + septets := []string{} - for i := 0; i <= pad/7; i++ { - index := 7 * i - length := int(math.Min(7, float64(pad-7*i))) - septets = append(septets, binary[index:(index+length)]) - } + for i := 0; i <= pad/7; i++ { + index := 7 * i + length := int(math.Min(7, float64(pad-7*i))) + septets = append(septets, binary[index:(index+length)]) + } - septets = reverseStrings(septets) - if value >= 0 { - septets[0] = fmt.Sprintf("0%s", septets[0]) - } else { - septets[0] = fmt.Sprintf("1%s", septets[0]) - } + septets = reverseStrings(septets) + if sign >= 0 { + septets[0] = fmt.Sprintf("0%s", septets[0]) + } else { + septets[0] = fmt.Sprintf("1%s", septets[0]) + } - buf := bytes.NewBuffer([]byte{}) + buf := bytes.NewBuffer([]byte{}) - for i := 0; i < len(septets); i++ { + for i := 0; i < len(septets); i++ { - prefix := "1" - if i == len(septets)-1 { - prefix = "0" + prefix := "1" + if i == len(septets)-1 { + prefix = "0" + } + n := new(big.Int) + n.SetString(prefix+septets[i], 2) + buf.Write(n.Bytes()) } - n := new(big.Int) - n.SetString(prefix+septets[i], 2) - buf.Write(n.Bytes()) + + return buf.Bytes() } - return buf.Bytes() } func forgePublicKey(value string) ([]byte, error) { @@ -1180,9 +1205,9 @@ func forgeMicheline(micheline *fastjson.Value) ([]byte, error) { } else if obj.Get("int") != nil { buf.WriteByte(0x00) - i, err := strconv.Atoi(strings.Trim(obj.Get("int").String(), "\"")) + i, err := StringToBigInt(strings.Trim(obj.Get("int").String(), "\"")) if err != nil { - return []byte{}, errors.New("failed to forge \"int\"") + return []byte{}, errors.New(fmt.Sprintf("failed to forge \"int\": %s", err)) } buf.Write(forgeInt(i)) @@ -1204,8 +1229,8 @@ func prefixAndBase58Encode(hexPayload string, prefix []byte) (string, error) { } // IntExpression will pack and encode an integer to a script_expr -func IntExpression(i int) (string, error) { - v, err := blakeHash(fmt.Sprintf("0500%s", hex.EncodeToString(forgeInt(i)))) +func IntExpression(i *big.Int) (string, error) { + v, err := BlakeHash(fmt.Sprintf("0500%s", hex.EncodeToString(forgeInt(i)))) if err != nil { return "", errors.Wrap(err, "failed to pack int") } @@ -1214,17 +1239,17 @@ func IntExpression(i int) (string, error) { } // NatExpression will pack and encode a nat to a script_expr -func NatExpression(i int) (string, error) { - if i < 0 { +func NatExpression(i *big.Int) (string, error) { + if i.Sign() < 0 { return "", errors.New("failed to pack nat: nat must be positive") } - v, err := forgeNat(strconv.Itoa(i)) + v, err := forgeNat(i.String()) if err != nil { return "", errors.Wrap(err, "failed to pack nat") } - v, err = blakeHash(fmt.Sprintf("0500%s", hex.EncodeToString(v))) + v, err = BlakeHash(fmt.Sprintf("0500%s", hex.EncodeToString(v))) if err != nil { return "", errors.Wrap(err, "failed to pack nat") } @@ -1234,7 +1259,7 @@ func NatExpression(i int) (string, error) { // StringExpression will pack and encode a string to a script_expr func StringExpression(value string) (string, error) { - v, err := blakeHash(fmt.Sprintf("0501%s%s", dataLength(len(value)), hex.EncodeToString([]byte(value)))) + v, err := BlakeHash(fmt.Sprintf("0501%s%s", dataLength(len(value)), hex.EncodeToString([]byte(value)))) if err != nil { return "", errors.Wrap(err, "failed to pack string") } @@ -1250,7 +1275,7 @@ func KeyHashExpression(hash string) (string, error) { } hash = hex.EncodeToString(v) - v, err = blakeHash(fmt.Sprintf("050a%s%s", dataLength(len(hash)/2), hex.EncodeToString(v))) + v, err = BlakeHash(fmt.Sprintf("050a%s%s", dataLength(len(hash)/2), hex.EncodeToString(v))) if err != nil { return "", errors.Wrap(err, "failed to pack key hash") } @@ -1265,7 +1290,7 @@ func AddressExpression(address string) (string, error) { return "", errors.Wrap(err, "failed to pack address") } - v, err = blakeHash(fmt.Sprintf("050a%s%s", dataLength(len(address)/2), hex.EncodeToString(v))) + v, err = BlakeHash(fmt.Sprintf("050a%s%s", dataLength(len(address)/2), hex.EncodeToString(v))) if err != nil { return "", errors.Wrap(err, "failed to pack address") } @@ -1276,7 +1301,7 @@ func AddressExpression(address string) (string, error) { // BytesExpression will pack and encode bytes to a script_expr func BytesExpression(v []byte) (string, error) { h := hex.EncodeToString(v) - v, err := blakeHash(fmt.Sprintf("050a%s%s", dataLength(len(h)/2), h)) + v, err := BlakeHash(fmt.Sprintf("050a%s%s", dataLength(len(h)/2), h)) if err != nil { return "", errors.Wrap(err, "failed to pack bytes") } @@ -1295,7 +1320,7 @@ func MichelineExpression(micheline string) (string, error) { return "", errors.Wrap(err, "failed to pack micheline") } - hash, err := blakeHash(fmt.Sprintf("05%s", hex.EncodeToString(x))) + hash, err := BlakeHash(fmt.Sprintf("05%s", hex.EncodeToString(x))) if err != nil { return "", errors.Wrap(err, "failed to pack micheline") } @@ -1312,7 +1337,7 @@ func dataLength(val int) string { return x } -func blakeHash(hexStr string) ([]byte, error) { +func BlakeHash(hexStr string) ([]byte, error) { v := []byte{} for i := 0; i < len(hexStr); i += 2 { elem, err := hex.DecodeString(hexStr[i:(i + 2)]) diff --git a/forge/forge_test.go b/forge/forge_test.go index cf5fa87..95ba767 100644 --- a/forge/forge_test.go +++ b/forge/forge_test.go @@ -3,10 +3,11 @@ package forge import ( "encoding/hex" "encoding/json" + "math/big" "testing" - "github.com/goat-systems/go-tezos/v4/internal/testutils" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/internal/testutils" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) @@ -748,17 +749,17 @@ func Test_Forge_Reveal(t *testing.T) { } func Test_IntExpression(t *testing.T) { - val, err := IntExpression(9) + val, err := IntExpression(big.NewInt(9)) testutils.CheckErr(t, false, "", err) assert.Equal(t, "exprtvAzqNE9zfpBLL9nKEaY1Dd2rznyG9iTFtECJvDkuub1bj3XvW", val) - val, err = IntExpression(-9) + val, err = IntExpression(big.NewInt(-9)) testutils.CheckErr(t, false, "", err) assert.Equal(t, "exprvH9jru3NJN4ZTNwwkCdC1PPLkWLWCoe6JxhcJ3a39mD5Bd4NH4", val) } func Test_NatExpression(t *testing.T) { - val, err := NatExpression(9) + val, err := NatExpression(big.NewInt(9)) testutils.CheckErr(t, false, "", err) assert.Equal(t, "exprtvAzqNE9zfpBLL9nKEaY1Dd2rznyG9iTFtECJvDkuub1bj3XvW", val) } @@ -794,3 +795,33 @@ func Test_MichelineExpression(t *testing.T) { testutils.CheckErr(t, false, "", err) assert.Equal(t, "exprupozG51AtT7yZUy5sg6VbJQ4b9omAE1PKD2PXvqi2YBuZqoKG3", val) } + +func Test_ForgeNat2(t *testing.T) { + v64, _ := forgeNat("63") + v := hex.EncodeToString(v64) + assert.Equal(t, "3f", v) +} + +func Test_ForgeNat3(t *testing.T) { + v64, _ := forgeNat("64") + v := hex.EncodeToString(v64) + assert.Equal(t, "40", v) +} + +func Test_NatExpression0(t *testing.T) { + val, err := NatExpression(big.NewInt(9)) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, "exprtvAzqNE9zfpBLL9nKEaY1Dd2rznyG9iTFtECJvDkuub1bj3XvW", val) +} + +func Test_NatExpression00(t *testing.T) { + val, err := IntExpression(big.NewInt(0)) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, "exprtZBwZUeYYYfUs9B9Rg2ywHezVHnCCnmF9WsDQVrs582dSK63dC", val) +} + +func Test_Blake2B(t *testing.T) { + val, err := BlakeHash("050000") + testutils.CheckErr(t, false, "", err) + assert.Equal(t, "053f610929e2b6ea458c54dfd8b29716d379c13f5c8fd82d5c793a9e31271743", hex.EncodeToString(val)) +} diff --git a/go.mod b/go.mod index d5d8fb1..d980b10 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,19 @@ -module github.com/goat-systems/go-tezos/v4 +module github.com/completium/go-tezos/v4 go 1.14 require ( + github.com/btcsuite/btcd v0.20.1-beta github.com/btcsuite/btcutil v1.0.2 - github.com/ethereum/go-ethereum v1.9.23 + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-playground/validator/v10 v10.2.0 github.com/go-resty/resty/v2 v2.3.0 + github.com/kr/pretty v0.1.0 // indirect github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.5.1 github.com/tyler-smith/go-bip39 v1.0.2 github.com/valyala/fastjson v1.5.4 - golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a + golang.org/x/crypto v0.0.0-20211202192323-5770296d904e + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect ) diff --git a/go.sum b/go.sum index 77c5a59..1ba8d4a 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,4 @@ -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= @@ -35,35 +10,11 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/ethereum/go-ethereum v1.9.23 h1:SIKhg/z4Q7AbvqcxuPYvMxf36che/Rq/Pp0IdYEkbtw= -github.com/ethereum/go-ethereum v1.9.23/go.mod h1:JIfVb6esrqALTExdz9hRYvrP0xBDf6wCncIu1hNwHpM= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -74,177 +25,70 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So= github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= -github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/fastjson v1.5.4 h1:r8gpiVwdzDU09NrlN38OyL5dUFpdwGQR5RQEBqY+hLg= github.com/valyala/fastjson v1.5.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8= +golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 h1:AvbQYmiaaaza3cW3QXRyPo5kYgpFIzOAfeAAN7m3qQ4= golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/internal/crypto/crypto.go b/internal/crypto/crypto.go index 492d2a9..92323f2 100644 --- a/internal/crypto/crypto.go +++ b/internal/crypto/crypto.go @@ -21,9 +21,15 @@ func B58cencode(payload []byte, prefix []byte) string { } // B58cdecode - -func B58cdecode(payload string, prefix []byte) []byte { - b58c, _ := Decode(payload) - return b58c[len(prefix):] +func B58cdecode(payload string, prefix []byte) ([]byte, error) { + b58c, err := Decode(payload) + if err != nil { + return nil, err + } + if len(b58c) < len(prefix) { + return nil, errors.New("B58cdecode : invalid length") + } + return b58c[len(prefix):], nil } // Encode - diff --git a/keys/curve.go b/keys/curve.go index 7bf53c4..74d9626 100644 --- a/keys/curve.go +++ b/keys/curve.go @@ -25,6 +25,7 @@ type iCurve interface { getPrivateKey(v []byte) []byte getPublicKey(privateKey []byte) ([]byte, error) sign(msg []byte, privateKey []byte) (Signature, error) + checkSignature(pubKey []byte, msg []byte, sig []byte) (bool, error) } func getCurve(kind ECKind) iCurve { diff --git a/keys/ed25519.go b/keys/ed25519.go index e837b75..f25809e 100644 --- a/keys/ed25519.go +++ b/keys/ed25519.go @@ -64,3 +64,7 @@ func (e *ed25519Curve) sign(msg []byte, privateKey []byte) (Signature, error) { prefix: e.signaturePrefix(), }, nil } + +func (e *ed25519Curve) checkSignature(pubKey []byte, hash []byte, signature []byte) (bool, error) { + return ed25519.Verify(pubKey, hash, signature), nil +} diff --git a/keys/integration_test.go b/keys/integration_test.go index 15ff623..a8b5487 100644 --- a/keys/integration_test.go +++ b/keys/integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration package keys @@ -7,9 +8,9 @@ import ( "strconv" "testing" - "github.com/goat-systems/go-tezos/v4/forge" - "github.com/goat-systems/go-tezos/v4/internal/testutils" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/forge" + "github.com/completium/go-tezos/v4/internal/testutils" + "github.com/completium/go-tezos/v4/rpc" ) func Test_OperationWithKey(t *testing.T) { @@ -46,7 +47,7 @@ func Test_OperationWithKey(t *testing.T) { rpchost := os.Getenv("GOTEZOS_TEST_RPC_HOST") r, _ := rpc.New(rpchost) - key, err := FromBase58(tt.input.sk, tt.input.kind) + key, err := FromBase58(tt.input.sk) testutils.CheckErr(t, tt.wantErr, "", err) head, _ := r.Head() diff --git a/keys/key.go b/keys/key.go index 3d3647d..6da3cd3 100644 --- a/keys/key.go +++ b/keys/key.go @@ -7,9 +7,10 @@ import ( "encoding/hex" "fmt" - tzcrypt "github.com/goat-systems/go-tezos/v4/internal/crypto" + tzcrypt "github.com/completium/go-tezos/v4/internal/crypto" "github.com/pkg/errors" "github.com/tyler-smith/go-bip39" + "golang.org/x/crypto/blake2b" "golang.org/x/crypto/nacl/secretbox" "golang.org/x/crypto/pbkdf2" ) @@ -58,7 +59,7 @@ func FromBase64(privKey string, kind ECKind) (*Key, error) { } // FromBase58 returns a new key from a private key in base58 form -func FromBase58(privKey string, kind ECKind) (*Key, error) { +func FromBase58(privKey string) (*Key, error) { if len(privKey) < 4 { return nil, errors.New("failed to import key: invalid key length") } @@ -68,7 +69,42 @@ func FromBase58(privKey string, kind ECKind) (*Key, error) { return nil, errors.Wrap(err, "failed to import key") } - return key(tzcrypt.B58cdecode(privKey, curve.privateKeyPrefix()), curve.getECKind()) + b58, err := tzcrypt.B58cdecode(privKey, curve.privateKeyPrefix()) + if err != nil { + return nil, errors.Wrap(err, "failed B58cdecode") + } + return key(b58, curve.getECKind()) +} + +func FromBase58Pk(pubKey string) (*PubKey, error) { + if len(pubKey) < 4 { + return nil, errors.New("failed to import pub key: invalid key length") + } + + curve, err := getCurveByPrefix(pubKey[0:4]) + if err != nil { + return nil, errors.Wrap(err, "failed to import key") + } + pk, err := tzcrypt.B58cdecode(pubKey, curve.publicKeyPrefix()) + if err != nil { + return nil, errors.Wrap(err, "failed B58cdecode") + } + + hash, err := blake2b.New(20, []byte{}) + if err != nil { + return nil, errors.Wrapf(err, "failed to import pub key: failed to generate public hash from public key %s", string(pk)) + } + _, err = hash.Write(pk) + if err != nil { + return nil, errors.Wrapf(err, "failed to import pub key: failed to generate public hash from public key %s", string(pk)) + } + + return &PubKey{ + curve: curve, + pubKey: pk, + address: tzcrypt.B58cencode(hash.Sum(nil), curve.addressPrefix()), + }, nil + } // FromEncryptedSecret returns a new key from an encrypted private key @@ -147,27 +183,194 @@ func (k *Key) GetSecretKey() string { return tzcrypt.B58cencode(k.privKey, k.curve.privateKeyPrefix()) } -// SignHex will sign a hex encoded string -func (k *Key) SignHex(msg string) (Signature, error) { +// SignHex will sign a hex encoded string for operation, add 0x03 magic bytes +func (k *Key) SignGeneric(msg string) (Signature, error) { bytes, err := hex.DecodeString(msg) if err != nil { return Signature{}, errors.Wrap(err, "failed to hex decode message") } - return k.curve.sign(checkAndAddWaterMark(bytes), k.privKey) + return k.SignData(bytes, []byte{3}) +} + +// SignBytes will sign a byte message for operation +func (k *Key) SignData(msg []byte, magic_bytes []byte) (Signature, error) { + if msg != nil && magic_bytes != nil { + msg = append(magic_bytes, msg...) + } + + return k.curve.sign(msg, k.privKey) } // SignBytes will sign a byte message -func (k *Key) SignBytes(msg []byte) (Signature, error) { - return k.curve.sign(checkAndAddWaterMark(msg), k.privKey) +func (k *Key) SignDataRaw(msg []byte) (Signature, error) { + return k.SignData(msg, []byte{}) +} + +// SignBytes will sign a string in hex message +func (k *Key) SignHexRaw(msg string) (Signature, error) { + bytes, err := hex.DecodeString(msg) + if err != nil { + return Signature{}, errors.Wrap(err, "failed to hex decode message") + } + + return k.SignData(bytes, []byte{}) +} + +func GetPkhFromBytes(b []byte) (string, error) { + + curve := iCurve(nil) + if b[0] == 0 && b[1] == 0 { + curve = getCurve(Ed25519) + } else if b[0] == 0 && b[1] == 1 { + curve = getCurve(Secp256k1) + } else if b[0] == 0 && b[1] == 2 { + curve = getCurve(NistP256) + } + + if curve != nil { + input := b[2:22] + return tzcrypt.B58cencode(input, curve.addressPrefix()), nil + } else if b[0] == 1 && b[21] == 0 { + input := b[1:21] + return tzcrypt.B58cencode(input, []byte{2, 90, 121}), nil + } + + return "", errors.New("GetPkhFromBytes: Unknown hash") } -func checkAndAddWaterMark(v []byte) []byte { - if v != nil { - if v[0] != byte(3) { - v = append([]byte{3}, v...) +// SignBytes will sign a byte message for operation +func (pk *PubKey) CheckSignature(data string, signature string) (bool, error) { + if len(signature) < 5 { + return false, errors.New("failed to check signature: invalid signature length") + } + + curve, err := getCurveByPrefix(signature[:5]) + if err != nil { + return false, err + } + sig, err := tzcrypt.B58cdecode(signature, curve.signaturePrefix()) + if err != nil { + return false, errors.New("CheckSignature: fail B58cdecode") + } + + msg, err := hex.DecodeString(data) + if err != nil { + return false, errors.New("CheckSignature: cannot decode data") + } + + hash, err := blake2b.New(32, []byte{}) + if err != nil { + return false, err + } + + i, err := hash.Write(msg) + if err != nil { + return false, errors.Wrap(err, "failed to sign operation bytes") + } + if i != len(msg) { + return false, errors.Errorf("failed to sign operation: generic hash length %d does not match bytes length %d", i, len(msg)) + } + + res, err := pk.curve.checkSignature(pk.pubKey, hash.Sum(nil), sig) + if err != nil { + return false, err + } + + return res, nil +} + +func IsValidPkh(pkh string) bool { + if len(pkh) < 3 { + return false + } + + prefix := pkh[:3] + if prefix != "tz1" && prefix != "tz2" && prefix != "tz3" && prefix != "KT1" { + return false + } + + a, err := tzcrypt.Decode(pkh) + if err != nil { + return false + } + + return len(a) == 23 +} + +func IsValidSignature(input string) bool { + if len(input) == 99 { + + if input[:5] != "edsig" && input[:6] != "spsig1" { + return false + } + + } else if len(input) == 98 { + + if input[:5] != "p2sig" { + return false } + + } else { + return false } - return v + _, err := tzcrypt.Decode(input) + return err == nil +} + +func IsValidPk(pk string) bool { + if len(pk) < 4 { + return false + } + + prefix := pk[:4] + if prefix != "edpk" && prefix != "sppk" && prefix != "p2pk" { + return false + } + + var l = 0 + switch prefix { + case "edpk": + l = 36 + default: + l = 37 + } + + a, err := tzcrypt.Decode(pk) + if err != nil { + return false + } + + return len(a) == l +} + +func IsValidBlockHash(input string) bool { + if len(input) != 51 { + return false + } + + prefix := input[:1] + if prefix != "B" { + return false + } + + _, err := tzcrypt.Decode(input) + + return err == nil +} + +func IsValidOperationHash(input string) bool { + if len(input) != 51 { + return false + } + + prefix := input[:1] + if prefix != "o" { + return false + } + + _, err := tzcrypt.Decode(input) + + return err == nil } diff --git a/keys/key_test.go b/keys/key_test.go index f4ffa71..7b25c1d 100644 --- a/keys/key_test.go +++ b/keys/key_test.go @@ -4,8 +4,8 @@ import ( "encoding/hex" "testing" - tzcrypt "github.com/goat-systems/go-tezos/v4/internal/crypto" - "github.com/goat-systems/go-tezos/v4/internal/testutils" + tzcrypt "github.com/completium/go-tezos/v4/internal/crypto" + "github.com/completium/go-tezos/v4/internal/testutils" "github.com/stretchr/testify/assert" ) @@ -150,13 +150,21 @@ func Test_FromHex(t *testing.T) { func Test_FromBase58(t *testing.T) { privKey := "edskRsPBsKuULoLTEQV2R9UbvSZbzFqvoESvp1mYyQJU8xi9mJamt88r5uTXbWQpVHjSiPWWtnoyqTCuSLQLxbEKUXfwwTccsF" - key, err := FromBase58(privKey, Ed25519) + key, err := FromBase58(privKey) testutils.CheckErr(t, false, "", err) assert.Equal(t, "edskRsPBsKuULoLTEQV2R9UbvSZbzFqvoESvp1mYyQJU8xi9mJamt88r5uTXbWQpVHjSiPWWtnoyqTCuSLQLxbEKUXfwwTccsF", key.GetSecretKey()) assert.Equal(t, "edpkuHMDkMz46HdRXYwom3xRwqk3zQ5ihWX4j8dwo2R2h8o4gPcbN5", key.PubKey.GetPublicKey()) assert.Equal(t, "tz1L8fUQLuwRuywTZUP5JUw9LL3kJa8LMfoo", key.PubKey.GetAddress()) } +func Test_FromBase58Pk(t *testing.T) { + pubKey := "edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn" + pk, err := FromBase58Pk(pubKey) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, "edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn", pk.GetPublicKey()) + assert.Equal(t, "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", pk.GetAddress()) +} + func Test_FromMnemonic(t *testing.T) { type want struct { wantErr bool @@ -206,3 +214,126 @@ func Test_FromMnemonic(t *testing.T) { }) } } + +func Test_Sign(t *testing.T) { + k, _ := FromBase58("edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq") + sigHex, _ := k.SignData([]byte{0, 0}, []byte{5}) + sigBytes, _ := k.SignDataRaw([]byte{5, 0, 0}) + assert.Equal(t, "edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W8vG", sigHex.ToBase58()) + assert.Equal(t, "edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W8vG", sigBytes.ToBase58()) +} + +func Test_Pkh(t *testing.T) { + inputtz1, _ := hex.DecodeString("00009ecba6b6222ce85e64290ba325271857ded2e646") + pkhtz1, _ := GetPkhFromBytes(inputtz1) + assert.Equal(t, "tz1a7fRN1NZt84fuwGMpgrS4WYYiAbQEEozy", pkhtz1) + + inputKT1, _ := hex.DecodeString("013c783e38e2abe1c1d8f49d1851a4151f0573916b00") + pkhKT1, _ := GetPkhFromBytes(inputKT1) + assert.Equal(t, "KT1E6W9ugnHT1rsmTz8sERYpeSMFJnzQmPL6", pkhKT1) +} + +func Test_isValidPkh(t *testing.T) { + assert.Equal(t, true, IsValidPkh("tz1a7fRN1NZt84fuwGMpgrS4WYYiAbQEEozy")) + assert.Equal(t, true, IsValidPkh("tz2BFTyPeYRzxd5aiBchbXN3WCZhx7BqbMBq")) + assert.Equal(t, true, IsValidPkh("tz3hFR7NZtjT2QtzgMQnWb4xMuD6yt2YzXUt")) + assert.Equal(t, true, IsValidPkh("KT1RXgG7X3wvx1GWv7aGdaALwbMsuDj8cXQe")) + assert.Equal(t, false, IsValidPkh("blabla")) + assert.Equal(t, false, IsValidPkh("tz1a7fRN1NZt84fuwGMpgrS4WYYiAbQE")) // bad size + assert.Equal(t, false, IsValidPkh("tz1a7fRN1NZt84fuwGMpgrS4WYYiAbQEEozl")) // invalid char +} + +func Test_isValidPk(t *testing.T) { + assert.Equal(t, true, IsValidPk("edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn")) + assert.Equal(t, true, IsValidPk("sppk7bcmsCiZmrzrfGpPHnZMx73s6pUC4Tf1zdASQ3rgXfq8uGP3wgV")) + assert.Equal(t, true, IsValidPk("p2pk66tTYL5EvahKAXncbtbRPBkAnxo3CszzUho5wPCgWauBMyvybuB")) + assert.Equal(t, false, IsValidPk("edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhj")) + assert.Equal(t, false, IsValidPk("edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrp")) // bad size + assert.Equal(t, false, IsValidPk("edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjl")) // invalid char +} + +func Test_isValidSignature(t *testing.T) { + assert.Equal(t, true, IsValidSignature("edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W8vG")) + assert.Equal(t, true, IsValidSignature("spsig1VrEwwc2UC4v9v3oYJ96VwiKwdVKK7ZYdMs4JVWNtfj11sRz9RkvPBtCHMiG1LEp44PJBXDh7bAzpDjGoX4bH7heoPuGqa")) + assert.Equal(t, true, IsValidSignature("p2sigZehGEs7pMMZCYhxDzRBbZkyWhBX26ctJ4BPCwGEV1CnEDpVq6DjbcUAxThDj6KKoMxpwTqvvaKs38pJb2mnb5rB8U3G9o")) + assert.Equal(t, false, IsValidSignature("edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W8v")) + assert.Equal(t, false, IsValidSignature("edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W")) // bad size + assert.Equal(t, false, IsValidSignature("edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W8vl")) // invalid char +} + +func Test_isValidBlockHash(t *testing.T) { + assert.Equal(t, true, IsValidBlockHash("BLLqDP5o6xTWzi9WEUJSxXw9qwW8qHd9jTCA9GeepPRmbV71Xxm")) + assert.Equal(t, false, IsValidBlockHash("BLLqDP5o6xTWzi9WEUJSxXw9qwW8qHd9jTCA9GeepPRmbV71Xx")) // bad size + assert.Equal(t, false, IsValidBlockHash("BLLqDP5o6xTWzi9WEUJSxXw9qwW8qHd9jTCA9GeepPRmbV71Xx0")) // invalid char +} + +func Test_isValidOperationHash(t *testing.T) { + assert.Equal(t, true, IsValidOperationHash("op32G4toHNqGwDdEV9ZqwnrfdF244rjyZRfxrmx3zFxHwQCkwxv")) + assert.Equal(t, true, IsValidOperationHash("oo5cw72WCRvfF2kCYPDYBGtPq4MjjprWruD9M2BLHuvGtpPcc8v")) + assert.Equal(t, true, IsValidOperationHash("ootpLxzp6bQ8qXzayY6tMKEzJoMbC8Y4GHZW4PaG6FvyPTBRmnz")) + assert.Equal(t, true, IsValidOperationHash("onws3e5BJPmCo8jGoLNFMmeLLmhkBjYdBPQUmsXweof3qtKmzGg")) + assert.Equal(t, false, IsValidOperationHash("onws3e5BJPmCo8jGoLNFMmeLLmhkBjYdBPQUmsXweof3qtKmzG")) // bad size + assert.Equal(t, false, IsValidOperationHash("onws3e5BJPmCo8jGoLNFMmeLLmhkBjYdBPQUmsXweof3qtKmzG0")) // invalid char +} + +func Test_CheckSignatureTz1(t *testing.T) { + data := "050000" + + pk, _ := FromBase58Pk("edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn") + + sig := "edsigthXYBNW7i5E1WNd87fBRJKacJjK5amJVKcyXd6fGxmnQo2ESmmdgN6qJXgbUVJDXha8xi96r9GqjsPorWWpPEwXNG3W8vG" + res, err := pk.CheckSignature(data, sig) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, true, res) + + // Same user, different data + sigErr0 := "edsigu4S83X6eLC2e7pWsAHeGsd8bqFM3ADuroq7kHDCFLYG53hsWLJjxzaoT3uHhD2z29hdQmJHWsWnfhhXSH46msWtdzFHd3T" + resErr0, err := pk.CheckSignature(data, sigErr0) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, false, resErr0) + + // Different user, same data + sigErr1 := "edsigtqAGRMDM8hR4aGewGKfMei6eHkqUFMeCg7qitcyrQTCCYLVn5AJnPCj5JoFL4zzQmw6BnM25UmrpWvk9V31cUHWcS13ba2" + resErr1, err := pk.CheckSignature(data, sigErr1) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, false, resErr1) + + // Different user, same data + sigErr2 := "edsigu2116oViTzotNYHEHAzuNW5mVdHn4KPVJoJ2mu8QZz1buE8xtmDCtpL7bwrYPWJiNAt3uWfNpp8GDxxdpJEJb4qpG9gQ9" + _, err = pk.CheckSignature("e8f0a371-4d7f-46a4-9d3d-c6e58de96ac6", sigErr2) + testutils.CheckErr(t, true, "", err) +} + +func Test_CheckSignatureTz2(t *testing.T) { + data := "050000" + + pk, _ := FromBase58Pk("sppk7b4TURq2T9rhPLFaSz6mkBCzKzfiBjctQSMorvLD5GSgCduvKuf") + + sig := "spsig1VrEwwc2UC4v9v3oYJ96VwiKwdVKK7ZYdMs4JVWNtfj11sRz9RkvPBtCHMiG1LEp44PJBXDh7bAzpDjGoX4bH7heoPuGqa" + res, err := pk.CheckSignature(data, sig) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, true, res) + + // Same user, different data + sigErr0 := "spsig179FXkSPGX3ng3AH2tdDP4u8TcgXnHY2b1tj5vVmWFdRcG5KmgqvSCynxYJ7Gs8BBM2NW5z6raq7Up4hkSpBjQ2cPrVBzy" + resErr0, err := pk.CheckSignature(data, sigErr0) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, false, resErr0) +} + +func Test_CheckSignatureTz3(t *testing.T) { + data := "050000" + + pk, _ := FromBase58Pk("p2pk65zwHGP9MdvANKkp267F4VzoKqL8DMNpPfTHUNKbm8S9DUqqdpw") + + sig := "p2sigZehGEs7pMMZCYhxDzRBbZkyWhBX26ctJ4BPCwGEV1CnEDpVq6DjbcUAxThDj6KKoMxpwTqvvaKs38pJb2mnb5rB8U3G9o" + res, err := pk.CheckSignature(data, sig) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, true, res) + + // Same user, different data + sigErr0 := "p2sigt6h7tWxS5Pz7D1qgfkRVemy4XuYGWw9Vo94kv7R6YVxfdtHSWeZ8QvkUfJbnmzqmK13fbBVQ89m7Tu11FpwDtEdH7jckY" + resErr0, err := pk.CheckSignature(data, sigErr0) + testutils.CheckErr(t, false, "", err) + assert.Equal(t, false, resErr0) +} diff --git a/keys/nistP256.go b/keys/nistP256.go index f402f40..eb517ee 100644 --- a/keys/nistP256.go +++ b/keys/nistP256.go @@ -44,18 +44,19 @@ func (n *nistP256Curve) getPublicKey(privateKey []byte) ([]byte, error) { privKey.PublicKey.Curve = elliptic.P256() privKey.PublicKey.X, privKey.PublicKey.Y = privKey.PublicKey.Curve.ScalarBaseMult(privKey.D.Bytes()) - var pref []byte - if privKey.PublicKey.Y.Bytes()[31]%2 == 0 { - pref = []byte{2} + pubKeyBytes := make([]byte, 33) + + bY := privKey.PublicKey.Y.Bytes() + if bY[len(bY)-1]%2 == 0 { + pubKeyBytes[0] = 2 } else { - pref = []byte{3} + pubKeyBytes[0] = 3 } - // 32 padded 0's - pad := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - pad = append(pad, privKey.PublicKey.X.Bytes()...) + // Fill pubKeyBytes[1:] with 0-padded PublicKey.X + privKey.PublicKey.X.FillBytes(pubKeyBytes[1:]) - return append(pref, pad[len(pad)-32:]...), nil + return pubKeyBytes, nil } func (n *nistP256Curve) sign(msg []byte, privateKey []byte) (Signature, error) { @@ -89,3 +90,7 @@ func (n *nistP256Curve) sign(msg []byte, privateKey []byte) (Signature, error) { prefix: n.signaturePrefix(), }, nil } + +func (n *nistP256Curve) checkSignature(pubKey []byte, hash []byte, signature []byte) (bool, error) { + return false, errors.New("checkSignature nistP256: not implemented") +} diff --git a/keys/pubKey.go b/keys/pubKey.go index c9e59b8..158ea4d 100644 --- a/keys/pubKey.go +++ b/keys/pubKey.go @@ -1,7 +1,7 @@ package keys import ( - tzcrypt "github.com/goat-systems/go-tezos/v4/internal/crypto" + tzcrypt "github.com/completium/go-tezos/v4/internal/crypto" "github.com/pkg/errors" "golang.org/x/crypto/blake2b" ) diff --git a/keys/secp256k1.go b/keys/secp256k1.go index e3e23de..b74f56f 100644 --- a/keys/secp256k1.go +++ b/keys/secp256k1.go @@ -5,7 +5,7 @@ import ( "crypto/rand" "math/big" - ethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/btcsuite/btcd/btcec" "github.com/pkg/errors" "golang.org/x/crypto/blake2b" ) @@ -49,23 +49,21 @@ func (s *secp256k1Curve) getPrivateKey(v []byte) []byte { } func (s *secp256k1Curve) getPublicKey(privateKey []byte) ([]byte, error) { - privKey, err := ethcrypto.ToECDSA(privateKey) - if err != nil { - return []byte{}, err - } + privKey, pubKey := btcec.PrivKeyFromBytes(btcec.S256(), privateKey) - var pref []byte - if privKey.PublicKey.Y.Bytes()[31]%2 == 0 { - pref = []byte{2} + pubKeyBytes := make([]byte, 33) + + bY := pubKey.Y.Bytes() + if bY[len(bY)-1]%2 == 0 { + pubKeyBytes[0] = 2 } else { - pref = []byte{3} + pubKeyBytes[0] = 3 } - // 32 padded 0's - pad := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - pad = append(pad, privKey.PublicKey.X.Bytes()...) + // Fill pubKeyBytes[1:] with 0-padded PublicKey.X + privKey.PublicKey.X.FillBytes(pubKeyBytes[1:]) - return append(pref, pad[len(pad)-32:]...), nil + return pubKeyBytes, nil } func (s *secp256k1Curve) sign(msg []byte, privateKey []byte) (Signature, error) { @@ -82,12 +80,9 @@ func (s *secp256k1Curve) sign(msg []byte, privateKey []byte) (Signature, error) return Signature{}, errors.Errorf("failed to sign operation: generic hash length %d does not match bytes length %d", i, len(msg)) } - privKey, err := ethcrypto.ToECDSA(privateKey) - if err != nil { - return Signature{}, err - } + privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), privateKey) - r, ss, err := ecdsa.Sign(rand.Reader, privKey, hash.Sum([]byte{})) + r, ss, err := ecdsa.Sign(rand.Reader, privKey.ToECDSA(), hash.Sum([]byte{})) if err != nil { return Signature{}, err } @@ -102,3 +97,23 @@ func (s *secp256k1Curve) sign(msg []byte, privateKey []byte) (Signature, error) prefix: s.signaturePrefix(), }, nil } + +func (sec *secp256k1Curve) checkSignature(pubKey []byte, hash []byte, signature []byte) (bool, error) { + + rb := signature[0:32] + sb := signature[32:64] + + r := new(big.Int) + r.SetBytes(rb) + + s := new(big.Int) + s.SetBytes(sb) + + pk, err := btcec.ParsePubKey(pubKey, btcec.S256()) + if err != nil { + return false, err + } + + res := ecdsa.Verify(pk.ToECDSA(), hash, r, s) + return res, nil +} diff --git a/keys/secp256k1_test.go b/keys/secp256k1_test.go new file mode 100644 index 0000000..65a5c25 --- /dev/null +++ b/keys/secp256k1_test.go @@ -0,0 +1,60 @@ +package keys + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func Test_secp256k1Curve_getPublicKey(t *testing.T) { + curve := &secp256k1Curve{} + + type want struct { + wantErr bool + pubKey []byte + } + + type input struct { + privateKey []byte + } + + cases := []struct { + name string + input input + want want + }{ + { + "is successful", + input{ + privateKey: []byte{162, 200, 103, 46, 138, 63, 231, 67, 94, 53, 150, 55, 123, 94, 78, 228, 227, 233, 72, 38, 31, 241, 95, 29, 235, 93, 26, 31, 30, 196, 220, 216}, + }, + want{ + wantErr: false, + pubKey: []byte{3, 42, 15, 71, 222, 26, 129, 217, 176, 186, 177, 3, 70, 82, 109, 165, 209, 229, 84, 16, 19, 204, 162, 50, 54, 112, 26, 46, 177, 5, 182, 129, 255}, + }, + }, + { + "is successful with len(Y) < 32", + input{ + privateKey: []byte{214, 48, 92, 109, 221, 55, 16, 27, 97, 225, 74, 13, 58, 195, 209, 210, 104, 89, 190, 164, 218, 10, 252, 244, 194, 205, 248, 176, 147, 7, 128, 245}, + }, + want{ + wantErr: false, + // len(pubKey.Y.Bytes()) == 30 + pubKey: []byte{3, 98, 55, 112, 26, 254, 221, 136, 82, 122, 229, 227, 42, 115, 73, 116, 184, 103, 48, 130, 181, 65, 165, 59, 153, 186, 194, 175, 153, 207, 206, 92, 18}, + }, + }, + } + + for _, tt := range cases { + t.Run(tt.name, func(t *testing.T) { + pubKey, err := curve.getPublicKey(tt.input.privateKey) + if tt.want.wantErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + assert.Equal(t, tt.want.pubKey, pubKey) + }) + } +} diff --git a/keys/signature.go b/keys/signature.go index 964d509..996f64e 100644 --- a/keys/signature.go +++ b/keys/signature.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "fmt" - "github.com/goat-systems/go-tezos/v4/internal/crypto" + "github.com/completium/go-tezos/v4/internal/crypto" ) // Signature represents the signature of an operation diff --git a/rpc/block.go b/rpc/block.go index e529f95..370314f 100644 --- a/rpc/block.go +++ b/rpc/block.go @@ -192,7 +192,9 @@ type OperationResult struct { BalanceUpdates []BalanceUpdates `json:"balance_updates"` OriginatedContracts []string `json:"originated_contracts"` ConsumedGas string `json:"consumed_gas,omitempty"` + ConsumedMilliGas string `json:"consumed_milligas,omitempty"` StorageSize string `json:"storage_size,omitempty"` + PaidStorageSizeDiff string `json:"paid_storage_size_diff,omitempty"` AllocatedDestinationContract bool `json:"allocated_destination_contract,omitempty"` Errors []ResultError `json:"errors,omitempty"` } @@ -210,6 +212,7 @@ type Operations struct { Branch string `json:"branch"` Contents Contents `json:"contents"` Signature string `json:"signature,omitempty"` + Id string `json:"id,omitempty"` } /* @@ -418,6 +421,7 @@ type OperationResults struct { BalanceUpdates []BalanceUpdates `json:"balance_updates,omitempty"` OriginatedContracts []string `json:"originated_contracts,omitempty"` ConsumedGas string `json:"consumed_gas,omitempty"` + ConsumedMilliGas string `json:"consumed_milligas,omitempty"` StorageSize string `json:"storage_size,omitempty"` PaidStorageSizeDiff string `json:"paid_storage_size_diff,omitempty"` Errors []ResultError `json:"errors,omitempty"` @@ -1349,11 +1353,8 @@ type InternalOperationResults struct { Balance string `json:"balance,omitempty"` Delegate string `json:"delegate,omitempty"` Script ScriptedContracts `json:"script,omitempty"` - Parameters struct { - Entrypoint string `json:"entrypoint"` - Value *json.RawMessage `json:"value"` - } `json:"paramaters,omitempty"` - Result OperationResult `json:"result"` + Parameters Parameters `json:"parameters,omitempty"` + Result OperationResult `json:"result"` } /* diff --git a/rpc/block_integration_test.go b/rpc/block_integration_test.go index 86ad477..b8c67da 100644 --- a/rpc/block_integration_test.go +++ b/rpc/block_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration package rpc_test @@ -5,7 +6,7 @@ package rpc_test import ( "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/block_test.go b/rpc/block_test.go index ea0202d..e862ed8 100644 --- a/rpc/block_test.go +++ b/rpc/block_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) @@ -1307,7 +1307,7 @@ func Test_TransactionEntrypoints(t *testing.T) { } ], [ - + ] ] }, @@ -1365,7 +1365,7 @@ func Test_TransactionEntrypoints(t *testing.T) { } ], [ - + ] ] }, @@ -1450,7 +1450,7 @@ func Test_TransactionEntrypoints(t *testing.T) { } ], [ - + ] ] }, diff --git a/rpc/client.go b/rpc/client.go index 62cf828..ad79bdc 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -77,6 +77,10 @@ func New(host string) (*Client, error) { return c, nil } +func (c *Client) SetRetryCount(counter int) { + c.client.SetRetryCount(counter) +} + // SetChain sets the chain for the rpc func (c *Client) SetChain(chain string) { c.chain = chain diff --git a/rpc/client_test.go b/rpc/client_test.go index 4332065..330a5e9 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/context_integration_test.go b/rpc/context_integration_test.go index 52ebbb0..57e41ab 100644 --- a/rpc/context_integration_test.go +++ b/rpc/context_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration package rpc_test @@ -6,8 +7,8 @@ import ( "math/rand" "testing" - "github.com/goat-systems/go-tezos/v4/forge" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/forge" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/context_test.go b/rpc/context_test.go index 0f8967e..5756584 100644 --- a/rpc/context_test.go +++ b/rpc/context_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/fa12_test.go b/rpc/fa12_test.go index 83e8559..1f2beab 100644 --- a/rpc/fa12_test.go +++ b/rpc/fa12_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/helpers.go b/rpc/helpers.go index 53ae7c3..96d6276 100644 --- a/rpc/helpers.go +++ b/rpc/helpers.go @@ -8,9 +8,9 @@ import ( "strconv" "time" + "github.com/completium/go-tezos/v4/internal/crypto" validator "github.com/go-playground/validator/v10" "github.com/go-resty/resty/v2" - "github.com/goat-systems/go-tezos/v4/internal/crypto" "github.com/pkg/errors" ) diff --git a/rpc/helpers_integration_test.go b/rpc/helpers_integration_test.go index f190bec..c678dab 100644 --- a/rpc/helpers_integration_test.go +++ b/rpc/helpers_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration package rpc_test @@ -5,7 +6,7 @@ package rpc_test import ( "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/helpers_test.go b/rpc/helpers_test.go index 3a2cbdf..1262eb0 100644 --- a/rpc/helpers_test.go +++ b/rpc/helpers_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/iface_test.go b/rpc/iface_test.go index a0396dd..5cf85c2 100644 --- a/rpc/iface_test.go +++ b/rpc/iface_test.go @@ -4,7 +4,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/independent_test.go b/rpc/independent_test.go index f0270b8..2b39690 100644 --- a/rpc/independent_test.go +++ b/rpc/independent_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/mocks_test.go b/rpc/mocks_test.go index 1ccac86..a3f38c5 100644 --- a/rpc/mocks_test.go +++ b/rpc/mocks_test.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/votes_integration_test.go b/rpc/votes_integration_test.go index 6ffb0fa..01c8935 100644 --- a/rpc/votes_integration_test.go +++ b/rpc/votes_integration_test.go @@ -3,7 +3,7 @@ package rpc_test import ( "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" ) diff --git a/rpc/votes_test.go b/rpc/votes_test.go index 5cf2209..c9e7366 100644 --- a/rpc/votes_test.go +++ b/rpc/votes_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/goat-systems/go-tezos/v4/rpc" + "github.com/completium/go-tezos/v4/rpc" "github.com/stretchr/testify/assert" )