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

update rc/v1.6.0 dependencies #403

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.7
uses: actions/setup-go@v2
with:
go-version: 1.17.6
go-version: 1.20.7
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
name: Unit
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.7
uses: actions/setup-go@v2
with:
go-version: 1.17.6
go-version: 1.20.7
id: go

- name: Check out code
Expand Down
18 changes: 9 additions & 9 deletions api/groups/baseBlockGroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"

"github.com/gin-gonic/gin"
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/outport"
apiErrors "github.com/multiversx/mx-chain-proxy-go/api/errors"
"github.com/multiversx/mx-chain-proxy-go/api/groups"
"github.com/multiversx/mx-chain-proxy-go/api/mock"
Expand Down Expand Up @@ -329,11 +329,11 @@ func TestGetAlteredAccountsByNonce(t *testing.T) {
t.Run("should work", func(t *testing.T) {
t.Parallel()

alteredAcc1 := &outport.AlteredAccount{
alteredAcc1 := &alteredAccount.AlteredAccount{
Address: "addr1",
Balance: "1000",
Nonce: 4,
Tokens: []*outport.AccountTokenData{
Tokens: []*alteredAccount.AccountTokenData{
{
Identifier: "token1",
Balance: "10000",
Expand All @@ -342,15 +342,15 @@ func TestGetAlteredAccountsByNonce(t *testing.T) {
},
},
}
alteredAcc2 := &outport.AlteredAccount{
alteredAcc2 := &alteredAccount.AlteredAccount{
Address: "addr2",
Balance: "4444",
Nonce: 3333,
Tokens: nil,
}
expectedApiResponse := &data.AlteredAccountsApiResponse{
Data: data.AlteredAccountsPayload{
Accounts: []*outport.AlteredAccount{alteredAcc1, alteredAcc2},
Accounts: []*alteredAccount.AlteredAccount{alteredAcc1, alteredAcc2},
},
Error: "",
Code: "success",
Expand Down Expand Up @@ -425,11 +425,11 @@ func TestGetAlteredAccountsByHash(t *testing.T) {
t.Run("should work", func(t *testing.T) {
t.Parallel()

alteredAcc1 := &outport.AlteredAccount{
alteredAcc1 := &alteredAccount.AlteredAccount{
Address: "addr1",
Balance: "1000",
Nonce: 4,
Tokens: []*outport.AccountTokenData{
Tokens: []*alteredAccount.AccountTokenData{
{
Identifier: "token1",
Balance: "10000",
Expand All @@ -438,15 +438,15 @@ func TestGetAlteredAccountsByHash(t *testing.T) {
},
},
}
alteredAcc2 := &outport.AlteredAccount{
alteredAcc2 := &alteredAccount.AlteredAccount{
Address: "addr2",
Balance: "4444",
Nonce: 3333,
Tokens: nil,
}
expectedApiResponse := &data.AlteredAccountsApiResponse{
Data: data.AlteredAccountsPayload{
Accounts: []*outport.AlteredAccount{alteredAcc1, alteredAcc2},
Accounts: []*alteredAccount.AlteredAccount{alteredAcc1, alteredAcc2},
},
Error: "",
Code: "success",
Expand Down
2 changes: 1 addition & 1 deletion cmd/proxy/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@

[[Observers]]
ShardId = 4294967295
Address = "http://127.0.0.1:8083
Address = "http://127.0.0.1:8083"
IsFallback = false
12 changes: 8 additions & 4 deletions cmd/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ const (
logFilePrefix = "mx-chain-proxy-go"
logFileLifeSpanInSec = 86400
logFileMaxSizeInMB = 1024
addressHRP = "erd"
)

// commitID and appVersion should be populated at build time using ldflags
//
// Usage examples:
// linux/mac:
// go build -i -v -ldflags="-X main.appVersion=$(git describe --tags --long --dirty) -X main.commitID=$(git rev-parse HEAD)"
//
// go build -i -v -ldflags="-X main.appVersion=$(git describe --tags --long --dirty) -X main.commitID=$(git rev-parse HEAD)"
//
// windows:
// for /f %i in ('git describe --tags --long --dirty') do set VERS=%i
// go build -i -v -ldflags="-X main.appVersion=%VERS%"
//
// for /f %i in ('git describe --tags --long --dirty') do set VERS=%i
// go build -i -v -ldflags="-X main.appVersion=%VERS%"
var commitID = common.UndefinedCommitString
var appVersion = common.UnVersionedAppString

Expand Down Expand Up @@ -419,7 +423,7 @@ func createVersionsRegistry(
apiConfigDirectoryPath string,
closableComponents *data.ClosableComponentsHandler,
) (data.VersionsRegistryHandler, error) {
pubKeyConverter, err := pubkeyConverter.NewBech32PubkeyConverter(cfg.AddressPubkeyConverter.Length, log)
pubKeyConverter, err := pubkeyConverter.NewBech32PubkeyConverter(cfg.AddressPubkeyConverter.Length, addressHRP)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions data/block.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package data

import (
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/outport"
)

// AtlasBlock is a block, as required by BlockAtlas
Expand Down Expand Up @@ -92,5 +92,5 @@ type AlteredAccountsApiResponse struct {

// AlteredAccountsPayload wraps altered accounts payload
type AlteredAccountsPayload struct {
Accounts []*outport.AlteredAccount `json:"accounts"`
Accounts []*alteredAccount.AlteredAccount `json:"accounts"`
}
21 changes: 19 additions & 2 deletions data/mock/pubKeyConverterMock.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package mock

import (
"encoding/hex"

"github.com/multiversx/mx-chain-core-go/core"
)

// PubkeyConverterMock -
// PubKeyConverterMock -
type PubKeyConverterMock struct {
len int
}
Expand All @@ -15,7 +17,22 @@ func (pcm *PubKeyConverterMock) Decode(humanReadable string) ([]byte, error) {
}

// Encode -
func (pcm *PubKeyConverterMock) Encode(pkBytes []byte) string {
func (pcm *PubKeyConverterMock) Encode(pkBytes []byte) (string, error) {
return hex.EncodeToString(pkBytes), nil
}

// EncodeSlice -
func (pcm *PubKeyConverterMock) EncodeSlice(pkBytesSlice [][]byte) ([]string, error) {
results := make([]string, 0)
for _, pk := range pkBytesSlice {
results = append(results, hex.EncodeToString(pk))
}

return results, nil
}

// SilentEncode -
func (pcm *PubKeyConverterMock) SilentEncode(pkBytes []byte, _ core.Logger) string {
return hex.EncodeToString(pkBytes)
}

Expand Down
3 changes: 1 addition & 2 deletions facade/baseFacade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
crypto "github.com/multiversx/mx-chain-crypto-go"
"github.com/multiversx/mx-chain-crypto-go/signing"
"github.com/multiversx/mx-chain-crypto-go/signing/ed25519"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/multiversx/mx-chain-proxy-go/common"
"github.com/multiversx/mx-chain-proxy-go/data"
"github.com/multiversx/mx-chain-proxy-go/facade"
Expand All @@ -25,7 +24,7 @@ type testStruct struct {
Hash string
}

var publicKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(32, logger.GetOrCreate("facade_test"))
var publicKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(32, "erd")

func TestNewProxyFacade_NilActionsProcShouldErr(t *testing.T) {
t.Parallel()
Expand Down
19 changes: 18 additions & 1 deletion faucet/mock/pubKeyConverterMock.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package mock

import (
"encoding/hex"

"github.com/multiversx/mx-chain-core-go/core"
)

// PubKeyConverterMock -
Expand All @@ -15,7 +17,22 @@ func (pcm *PubKeyConverterMock) Decode(humanReadable string) ([]byte, error) {
}

// Encode -
func (pcm *PubKeyConverterMock) Encode(pkBytes []byte) string {
func (pcm *PubKeyConverterMock) Encode(pkBytes []byte) (string, error) {
return hex.EncodeToString(pkBytes), nil
}

// EncodeSlice -
func (pcm *PubKeyConverterMock) EncodeSlice(pkBytesSlice [][]byte) ([]string, error) {
results := make([]string, 0)
for _, pk := range pkBytesSlice {
results = append(results, hex.EncodeToString(pk))
}

return results, nil
}

// SilentEncode -
func (pcm *PubKeyConverterMock) SilentEncode(pkBytes []byte, _ core.Logger) string {
return hex.EncodeToString(pkBytes)
}

Expand Down
11 changes: 5 additions & 6 deletions faucet/privateKeysLoader_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package faucet_test

import (
"io/ioutil"
"os"
"strings"
"testing"
Expand All @@ -13,7 +12,7 @@ import (

func TestNewPrivateKeysLoader_NilShardCoordinatorShouldErr(t *testing.T) {
pemFileName := "testWallet.pem"
err := ioutil.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
err := os.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
require.Nil(t, err)
defer func() {
_ = os.Remove(pemFileName)
Expand All @@ -36,7 +35,7 @@ func TestNewPrivateKeysLoader_PemFileNotFoundShouldErr(t *testing.T) {

func TestNewPrivateKeysLoader_NilPubKeyConverterShouldErr(t *testing.T) {
pemFileName := "testWallet.pem"
err := ioutil.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
err := os.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
require.Nil(t, err)
defer func() {
_ = os.Remove(pemFileName)
Expand All @@ -49,7 +48,7 @@ func TestNewPrivateKeysLoader_NilPubKeyConverterShouldErr(t *testing.T) {

func TestNewPrivateKeysLoader_OkValsShouldWork(t *testing.T) {
pemFileName := "testWallet.pem"
err := ioutil.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
err := os.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
require.Nil(t, err)
defer func() {
_ = os.Remove(pemFileName)
Expand All @@ -62,7 +61,7 @@ func TestNewPrivateKeysLoader_OkValsShouldWork(t *testing.T) {

func TestPrivateKeysLoader_MapOfPrivateKeysByShardInvalidPemFileContentShouldErr(t *testing.T) {
pemFileName := "wrong-test.pem"
err := ioutil.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
err := os.WriteFile(pemFileName, []byte(getWrongPemFileContent()), 0644)
require.Nil(t, err)
defer func() {
_ = os.Remove(pemFileName)
Expand All @@ -82,7 +81,7 @@ func TestPrivateKeysLoader_MapOfPrivateKeysByShardInvalidPemFileContentShouldErr

func TestPrivateKeysLoader_MapOfPrivateKeysByShardShouldWork(t *testing.T) {
pemFileName := "test.pem"
err := ioutil.WriteFile(pemFileName, []byte(getTestPemFileContent()), 0644)
err := os.WriteFile(pemFileName, []byte(getTestPemFileContent()), 0644)
require.Nil(t, err)
defer func() {
_ = os.Remove(pemFileName)
Expand Down
52 changes: 29 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
module github.com/multiversx/mx-chain-proxy-go

go 1.17
go 1.20

require (
github.com/elastic/go-elasticsearch/v7 v7.12.0
github.com/gin-contrib/cors v0.0.0-20190301062745-f9e10995c85a
github.com/gin-contrib/cors v1.4.0
github.com/gin-contrib/pprof v1.4.0
github.com/gin-contrib/static v0.0.1
github.com/gin-gonic/gin v1.8.1
github.com/multiversx/mx-chain-core-go v1.1.37
github.com/multiversx/mx-chain-crypto-go v1.2.6
github.com/multiversx/mx-chain-es-indexer-go v1.3.7
github.com/multiversx/mx-chain-logger-go v1.0.11
github.com/gin-gonic/gin v1.9.1
github.com/multiversx/mx-chain-core-go v1.2.16
github.com/multiversx/mx-chain-crypto-go v1.2.9
github.com/multiversx/mx-chain-es-indexer-go v1.4.13
github.com/multiversx/mx-chain-logger-go v1.0.13
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.4
github.com/urfave/cli v1.22.10
gopkg.in/go-playground/validator.v8 v8.18.2
)

require (
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading