From 4f84ab5e8cf10ca76129c2151cd034d1511e4c22 Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Wed, 31 May 2023 14:17:12 +0300 Subject: [PATCH 1/2] - new go SDK version --- clients/multiversx/interface.go | 7 +- clients/multiversx/transactionHandler.go | 12 ++-- clients/multiversx/transactionHandler_test.go | 9 +-- go.mod | 25 ++++---- go.sum | 64 ++++++++++--------- integrationTests/mock/multiversXChainMock.go | 15 +++-- .../mock/multiversXContractStateMock.go | 13 ++-- .../bridge/nonceTransactionsHandlerStub.go | 6 +- testsCommon/interactors/proxyStub.go | 9 +-- 9 files changed, 86 insertions(+), 74 deletions(-) diff --git a/clients/multiversx/interface.go b/clients/multiversx/interface.go index a290fe1d..83d96374 100644 --- a/clients/multiversx/interface.go +++ b/clients/multiversx/interface.go @@ -3,6 +3,7 @@ package multiversx import ( "context" + "github.com/multiversx/mx-chain-core-go/data/transaction" "github.com/multiversx/mx-sdk-go/builders" "github.com/multiversx/mx-sdk-go/core" "github.com/multiversx/mx-sdk-go/data" @@ -11,8 +12,8 @@ import ( // Proxy defines the behavior of a proxy able to serve MultiversX blockchain requests type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) - SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) - SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) + SendTransaction(ctx context.Context, tx *transaction.FrontendTransaction) (string, error) + SendTransactions(ctx context.Context, txs []*transaction.FrontendTransaction) ([]string, error) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) GetAccount(ctx context.Context, address core.AddressHandler) (*data.Account, error) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) @@ -23,7 +24,7 @@ type Proxy interface { // NonceTransactionsHandler represents the interface able to handle the current nonce and the transactions resend mechanism type NonceTransactionsHandler interface { GetNonce(ctx context.Context, address core.AddressHandler) (uint64, error) - SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) + SendTransaction(ctx context.Context, tx *transaction.FrontendTransaction) (string, error) Close() error } diff --git a/clients/multiversx/transactionHandler.go b/clients/multiversx/transactionHandler.go index 7d9befbd..c6b43fa6 100644 --- a/clients/multiversx/transactionHandler.go +++ b/clients/multiversx/transactionHandler.go @@ -5,10 +5,10 @@ import ( "encoding/hex" "encoding/json" + "github.com/multiversx/mx-chain-core-go/data/transaction" crypto "github.com/multiversx/mx-chain-crypto-go" "github.com/multiversx/mx-sdk-go/builders" "github.com/multiversx/mx-sdk-go/core" - "github.com/multiversx/mx-sdk-go/data" ) type transactionHandler struct { @@ -34,7 +34,7 @@ func (txHandler *transactionHandler) SendTransactionReturnHash(ctx context.Conte return txHandler.nonceTxHandler.SendTransaction(context.Background(), tx) } -func (txHandler *transactionHandler) signTransaction(ctx context.Context, builder builders.TxDataBuilder, gasLimit uint64) (*data.Transaction, error) { +func (txHandler *transactionHandler) signTransaction(ctx context.Context, builder builders.TxDataBuilder, gasLimit uint64) (*transaction.FrontendTransaction, error) { networkConfig, err := txHandler.proxy.GetNetworkConfig(ctx) if err != nil { return nil, err @@ -50,15 +50,15 @@ func (txHandler *transactionHandler) signTransaction(ctx context.Context, builde return nil, err } - tx := &data.Transaction{ + tx := &transaction.FrontendTransaction{ ChainID: networkConfig.ChainID, Version: networkConfig.MinTransactionVersion, GasLimit: gasLimit, GasPrice: networkConfig.MinGasPrice, Nonce: nonce, Data: dataBytes, - SndAddr: txHandler.relayerAddress.AddressAsBech32String(), - RcvAddr: txHandler.multisigAddressAsBech32, + Sender: txHandler.relayerAddress.AddressAsBech32String(), + Receiver: txHandler.multisigAddressAsBech32, Value: "0", } @@ -71,7 +71,7 @@ func (txHandler *transactionHandler) signTransaction(ctx context.Context, builde } // signTransactionWithPrivateKey signs a transaction with the client's private key -func (txHandler *transactionHandler) signTransactionWithPrivateKey(tx *data.Transaction) error { +func (txHandler *transactionHandler) signTransactionWithPrivateKey(tx *transaction.FrontendTransaction) error { tx.Signature = "" bytes, err := json.Marshal(&tx) if err != nil { diff --git a/clients/multiversx/transactionHandler_test.go b/clients/multiversx/transactionHandler_test.go index f3302f9b..7aa9cef0 100644 --- a/clients/multiversx/transactionHandler_test.go +++ b/clients/multiversx/transactionHandler_test.go @@ -10,6 +10,7 @@ import ( cryptoMock "github.com/multiversx/mx-bridge-eth-go/testsCommon/crypto" "github.com/multiversx/mx-bridge-eth-go/testsCommon/interactors" "github.com/multiversx/mx-bridge-eth-go/testsCommon/roleProviders" + "github.com/multiversx/mx-chain-core-go/data/transaction" "github.com/multiversx/mx-chain-crypto-go" "github.com/multiversx/mx-chain-crypto-go/signing/ed25519/singlesig" "github.com/multiversx/mx-sdk-go/builders" @@ -106,7 +107,7 @@ func TestTransactionHandler_SendTransactionReturnHash(t *testing.T) { }, } txHandlerInstance.nonceTxHandler = &bridgeTests.NonceTransactionsHandlerStub{ - SendTransactionCalled: func(ctx context.Context, tx *data.Transaction) (string, error) { + SendTransactionCalled: func(ctx context.Context, tx *transaction.FrontendTransaction) (string, error) { wasSendTransactionCalled = true return "", nil }, @@ -146,10 +147,10 @@ func TestTransactionHandler_SendTransactionReturnHash(t *testing.T) { return 0, errors.New("unexpected address to fetch the nonce") }, - SendTransactionCalled: func(ctx context.Context, tx *data.Transaction) (string, error) { + SendTransactionCalled: func(ctx context.Context, tx *transaction.FrontendTransaction) (string, error) { sendWasCalled = true - assert.Equal(t, relayerAddress, tx.SndAddr) - assert.Equal(t, testMultisigAddress, tx.RcvAddr) + assert.Equal(t, relayerAddress, tx.Sender) + assert.Equal(t, testMultisigAddress, tx.Receiver) assert.Equal(t, nonce, tx.Nonce) assert.Equal(t, "0", tx.Value) assert.Equal(t, "function@62756666@16", string(tx.Data)) diff --git a/go.mod b/go.mod index aaf09d8b..676c44b2 100644 --- a/go.mod +++ b/go.mod @@ -8,12 +8,12 @@ require ( github.com/gin-contrib/cors v1.4.0 github.com/gin-contrib/pprof v1.4.0 github.com/gin-gonic/gin v1.8.1 - github.com/multiversx/mx-chain-core-go v1.1.30 + github.com/multiversx/mx-chain-core-go v1.1.33 github.com/multiversx/mx-chain-crypto-go v1.2.5 - github.com/multiversx/mx-chain-go v1.4.4 + github.com/multiversx/mx-chain-go v1.4.15 github.com/multiversx/mx-chain-logger-go v1.0.11 github.com/multiversx/mx-chain-p2p-go v1.0.10 - github.com/multiversx/mx-sdk-go v1.2.5 + github.com/multiversx/mx-sdk-go v1.3.1-0.20230531105616-c4dd3e07ac14 github.com/stretchr/testify v1.8.1 github.com/urfave/cli v1.22.10 ) @@ -57,19 +57,19 @@ require ( github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect - github.com/herumi/bls-go-binary v1.0.0 // indirect github.com/huin/goupnp v1.0.3 // indirect - github.com/ipfs/go-cid v0.2.0 // indirect + github.com/ipfs/go-cid v0.3.2 // indirect github.com/ipfs/go-datastore v0.5.1 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-ipns v0.2.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/ipld/go-ipld-prime v0.9.0 // indirect + github.com/ipld/go-ipld-prime v0.19.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/klauspost/compress v1.15.1 // indirect github.com/klauspost/cpuid/v2 v2.1.0 // indirect github.com/koron/go-ssdp v0.0.3 // indirect @@ -112,13 +112,13 @@ require ( github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.1.1 // indirect - github.com/multiformats/go-multicodec v0.5.0 // indirect + github.com/multiformats/go-multicodec v0.6.0 // indirect github.com/multiformats/go-multihash v0.2.1 // indirect github.com/multiformats/go-multistream v0.3.3 // indirect github.com/multiformats/go-varint v0.0.6 // indirect github.com/multiversx/concurrent-map v0.1.4 // indirect github.com/multiversx/mx-chain-storage-go v1.0.7 // indirect - github.com/multiversx/mx-chain-vm-common-go v1.3.36 // indirect + github.com/multiversx/mx-chain-vm-common-go v1.3.37 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/opencontainers/runtime-spec v1.0.2 // indirect @@ -129,7 +129,7 @@ require ( github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 // indirect + github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect @@ -138,6 +138,7 @@ require ( github.com/rjeczalik/notify v0.9.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/smartystreets/assertions v1.13.1 // indirect github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect @@ -154,10 +155,10 @@ require ( go.uber.org/zap v1.22.0 // indirect golang.org/x/crypto v0.3.0 // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/net v0.2.0 // indirect + golang.org/x/net v0.5.0 // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect golang.org/x/tools v0.1.12 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect diff --git a/go.sum b/go.sum index 5871e274..67d9de8e 100644 --- a/go.sum +++ b/go.sum @@ -199,7 +199,6 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/go-elasticsearch/v7 v7.12.0 h1:j4tvcMrZJLp39L2NYvBb7f+lHKPqPHSL3nvB8+/DV+s= github.com/elastic/go-elasticsearch/v7 v7.12.0/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= @@ -221,6 +220,8 @@ github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/ github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= 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/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= @@ -349,8 +350,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -381,7 +383,6 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= @@ -432,8 +433,9 @@ github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUP github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= +github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= +github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= github.com/ipfs/go-datastore v0.1.0/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw= github.com/ipfs/go-datastore v0.4.1/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= @@ -466,8 +468,9 @@ github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Ax github.com/ipfs/go-log/v2 v2.5.0/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= -github.com/ipld/go-ipld-prime v0.9.0 h1:N2OjJMb+fhyFPwPnVvJcWU/NsumP8etal+d2v3G4eww= github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= +github.com/ipld/go-ipld-prime v0.19.0 h1:5axC7rJmPc17Emw6TelxGwnzALk0PdupZ2oj2roDj04= +github.com/ipld/go-ipld-prime v0.19.0/go.mod h1:Q9j3BaVXwaA3o5JUDNvptDDr/x8+F7FG6XJ8WI3ILg4= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= @@ -720,8 +723,9 @@ github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPw github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI= github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ= -github.com/multiformats/go-multicodec v0.5.0 h1:EgU6cBe/D7WRwQb1KmnBvU7lrcFGMggZVTPtOW9dDHs= github.com/multiformats/go-multicodec v0.5.0/go.mod h1:DiY2HFaEp5EhEXb/iYzVAunmyX/aSFMxq2KMKfWEues= +github.com/multiformats/go-multicodec v0.6.0 h1:KhH2kSuCARyuJraYMFxrNO3DqIaYhOdS039kbhgVwpE= +github.com/multiformats/go-multicodec v0.6.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.9/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= @@ -740,14 +744,15 @@ github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2 github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUYwbO0993uPI= github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o= -github.com/multiversx/mx-chain-core-go v1.1.30 h1:BtURR4I6HU1OnSbxcPMTQSQXNqtOuH3RW6bg5N7FSM0= github.com/multiversx/mx-chain-core-go v1.1.30/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk= +github.com/multiversx/mx-chain-core-go v1.1.31/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk= +github.com/multiversx/mx-chain-core-go v1.1.33 h1:qk+TlaOhHpu+9VncL3yowjY4KU8uJ0oSdPfU7SgVDnk= +github.com/multiversx/mx-chain-core-go v1.1.33/go.mod h1:8gGEQv6BWuuJwhd25qqhCOZbBSv9mk+hLeKvinSaSMk= github.com/multiversx/mx-chain-crypto-go v1.2.5 h1:tuq3BUNMhKud5DQbZi9DiVAAHUXypizy8zPH0NpTGZk= github.com/multiversx/mx-chain-crypto-go v1.2.5/go.mod h1:teqhNyWEqfMPgNn8sgWXlgtJ1a36jGCnhs/tRpXW6r4= -github.com/multiversx/mx-chain-es-indexer-go v1.3.8 h1:OvdOoBUQKkTaZsFPiBp1WCvDRN9ReQJUfy9Ac06rguM= -github.com/multiversx/mx-chain-es-indexer-go v1.3.8/go.mod h1:IV42GfhkqQ5vVO0OzGaF/ejp8TQrLkNo4LSB3TPnVhg= -github.com/multiversx/mx-chain-go v1.4.4 h1:sM0UlXj+JWpr9l9BMsFpwck+nSAF/8BThpR0mhiWeOw= -github.com/multiversx/mx-chain-go v1.4.4/go.mod h1:PREgsJ97g7a9yd5BUqfp8FpM2VSIFpYIt3VTVXBMUks= +github.com/multiversx/mx-chain-es-indexer-go v1.3.14/go.mod h1:IV42GfhkqQ5vVO0OzGaF/ejp8TQrLkNo4LSB3TPnVhg= +github.com/multiversx/mx-chain-go v1.4.15 h1:uQgAW+O493dEh/Tf5AfUkjp3xCoraTLyaOKMIi38rP4= +github.com/multiversx/mx-chain-go v1.4.15/go.mod h1:KxHY/qUXQCcjloGEsk5i69YJ21y0c//C354aPcDSPBk= github.com/multiversx/mx-chain-logger-go v1.0.11 h1:DFsHa+sc5fKwhDR50I8uBM99RTDTEW68ESyr5ALRDwE= github.com/multiversx/mx-chain-logger-go v1.0.11/go.mod h1:1srDkP0DQucWQ+rYfaq0BX2qLnULsUdRPADpYUTM6dA= github.com/multiversx/mx-chain-p2p-go v1.0.10 h1:CYCuI0SP8Pt9K0TcJjUyxK7ByvWi2FXNUihy0iCEVIA= @@ -755,18 +760,15 @@ github.com/multiversx/mx-chain-p2p-go v1.0.10/go.mod h1:j9Ueo2ptCnL7TQvQg6KS/KWA github.com/multiversx/mx-chain-storage-go v1.0.7 h1:UqLo/OLTD3IHiE/TB/SEdNRV1GG2f1R6vIP5ehHwCNw= github.com/multiversx/mx-chain-storage-go v1.0.7/go.mod h1:gtKoV32Cg2Uy8deHzF8Ud0qAl0zv92FvWgPSYIP0Zmg= github.com/multiversx/mx-chain-vm-common-go v1.3.34/go.mod h1:sZ2COLCxvf2GxAAJHGmGqWybObLtFuk2tZUyGqnMXE8= -github.com/multiversx/mx-chain-vm-common-go v1.3.36 h1:9TViMK+vqTHss9cnGKtzOWzsxI/LWIetAYzrgf4H/w0= github.com/multiversx/mx-chain-vm-common-go v1.3.36/go.mod h1:sZ2COLCxvf2GxAAJHGmGqWybObLtFuk2tZUyGqnMXE8= -github.com/multiversx/mx-chain-vm-v1_2-go v1.2.49 h1:Qbe+QvpUzodoOJEu+j6uK/erhnLfQBwNGiAEyP1XlQI= -github.com/multiversx/mx-chain-vm-v1_2-go v1.2.49/go.mod h1:+2IkboTtZ75oZ2Lzx7gNWbLP6BQ5GYa1MJQXPcfzu60= -github.com/multiversx/mx-chain-vm-v1_3-go v1.3.50 h1:+JlYeStjpPqyRGzfLCwnR4Zya3nA34SJjj/1DP1HtXk= -github.com/multiversx/mx-chain-vm-v1_3-go v1.3.50/go.mod h1:+rdIrpLS4NOAA3DNwXQHxXKO6cPnU3DF8+l0AbjV27E= -github.com/multiversx/mx-chain-vm-v1_4-go v1.4.74 h1:qr86QIn+u9zjRNa6/aDJ0nNgKk6Cb2FGB0RvltCcJhE= -github.com/multiversx/mx-chain-vm-v1_4-go v1.4.74/go.mod h1:EInFuruY4smF2XZczFcOM8W607x3T6KanTJ5mjYHY4Y= -github.com/multiversx/mx-components-big-int v0.1.1 h1:695mYPKYOrmGEGgRH4/pZruDoe3CPP1LHrBxKfvj5l4= +github.com/multiversx/mx-chain-vm-common-go v1.3.37 h1:KeK6JCjeNUOHC5Z12/CTQIa8Z1at0dnnL9hY1LNrHS8= +github.com/multiversx/mx-chain-vm-common-go v1.3.37/go.mod h1:sZ2COLCxvf2GxAAJHGmGqWybObLtFuk2tZUyGqnMXE8= +github.com/multiversx/mx-chain-vm-v1_2-go v1.2.50/go.mod h1:e3uYdgoKzs3puaznbmSjDcRisJc5Do4tpg7VqyYwoek= +github.com/multiversx/mx-chain-vm-v1_3-go v1.3.51/go.mod h1:oKj32V2nkd+KGNOL6emnwVkDRPpciwHHDqBmeorcL8k= +github.com/multiversx/mx-chain-vm-v1_4-go v1.4.77/go.mod h1:3IaAOHc1JfxL5ywQZIrcaHQu5+CVdZNDaoY64NGOtUE= github.com/multiversx/mx-components-big-int v0.1.1/go.mod h1:0QrcFdfeLgJ/am10HGBeH0G0DNF+0Qx1E4DS/iozQls= -github.com/multiversx/mx-sdk-go v1.2.5 h1:bszJpl9GzLBOZJyS6hlHEZQA3uJMgiAqCwBjveewo+4= -github.com/multiversx/mx-sdk-go v1.2.5/go.mod h1:FJKGGFHC+wcvMJoY2wROboCxyx1mf2YiKoWyCX/7H6w= +github.com/multiversx/mx-sdk-go v1.3.1-0.20230531105616-c4dd3e07ac14 h1:S/+vkLn8znu1cHCTuuEF7QYhpZNiYORoZA8++B1+Dm8= +github.com/multiversx/mx-sdk-go v1.3.1-0.20230531105616-c4dd3e07ac14/go.mod h1:xVDCcASI456+TQDYGPdaD8GLzLhDVVXfnlrANSiRmz8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= @@ -825,8 +827,9 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= 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/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 h1:CskT+S6Ay54OwxBGB0R3Rsx4Muto6UnEYTyKJbyRIAI= github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= +github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e h1:ZOcivgkkFRnjfoTcGsDq3UQYiBmekwLA+qg0OjyB/ls= +github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -909,8 +912,9 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.13.1 h1:Ef7KhSmjZcK6AVf9YbJdvPYG9avaF0ZxudX+ThRdWfU= +github.com/smartystreets/assertions v1.13.1/go.mod h1:cXr/IwVfSo/RbCSPhoAPv73p3hlSdrBH/b3SdnW/LMY= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= @@ -952,11 +956,8 @@ github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpP github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tidwall/gjson v1.14.0 h1:6aeJ0bzojgWLa82gDQHcx3S0Lr/O51I9bJ5nv6JFx5w= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tklauser/go-sysconf v0.3.4/go.mod h1:Cl2c8ZRWfHD5IrfHo9VN+FX9kCFjIOyVklgXycLB6ek= @@ -987,6 +988,7 @@ github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE= +github.com/warpfork/go-testmark v0.10.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= @@ -1174,8 +1176,9 @@ golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1284,12 +1287,14 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1299,8 +1304,9 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/integrationTests/mock/multiversXChainMock.go b/integrationTests/mock/multiversXChainMock.go index 92d3a0ad..91f525ad 100644 --- a/integrationTests/mock/multiversXChainMock.go +++ b/integrationTests/mock/multiversXChainMock.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/multiversx/mx-bridge-eth-go/integrationTests" "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/data/transaction" logger "github.com/multiversx/mx-chain-logger-go" sdkCore "github.com/multiversx/mx-sdk-go/core" "github.com/multiversx/mx-sdk-go/data" @@ -21,7 +22,7 @@ var log = logger.GetOrCreate("integrationTests/mock") type MultiversXChainMock struct { *multiversXContractStateMock mutState sync.RWMutex - sentTransactions map[string]*data.Transaction + sentTransactions map[string]*transaction.FrontendTransaction accounts *multiversXAccountsMock } @@ -29,7 +30,7 @@ type MultiversXChainMock struct { func NewMultiversXChainMock() *MultiversXChainMock { return &MultiversXChainMock{ multiversXContractStateMock: newMultiversXContractStateMock(), - sentTransactions: make(map[string]*data.Transaction), + sentTransactions: make(map[string]*transaction.FrontendTransaction), accounts: newMultiversXAccountsMock(), } } @@ -55,12 +56,12 @@ func (mock *MultiversXChainMock) GetShardOfAddress(_ context.Context, _ string) } // SendTransaction - -func (mock *MultiversXChainMock) SendTransaction(_ context.Context, transaction *data.Transaction) (string, error) { +func (mock *MultiversXChainMock) SendTransaction(_ context.Context, transaction *transaction.FrontendTransaction) (string, error) { if transaction == nil { panic("nil transaction") } - addrAsBech32 := transaction.SndAddr + addrAsBech32 := transaction.Sender addressHandler, err := data.NewAddressFromBech32String(addrAsBech32) if err != nil { panic(fmt.Sprintf("%v while creating address handler for string %s", err, addrAsBech32)) @@ -85,7 +86,7 @@ func (mock *MultiversXChainMock) SendTransaction(_ context.Context, transaction } // SendTransactions - -func (mock *MultiversXChainMock) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { +func (mock *MultiversXChainMock) SendTransactions(ctx context.Context, txs []*transaction.FrontendTransaction) ([]string, error) { hashes := make([]string, 0, len(txs)) for _, tx := range txs { hash, _ := mock.SendTransaction(ctx, tx) @@ -96,11 +97,11 @@ func (mock *MultiversXChainMock) SendTransactions(ctx context.Context, txs []*da } // GetAllSentTransactions - -func (mock *MultiversXChainMock) GetAllSentTransactions(_ context.Context) map[string]*data.Transaction { +func (mock *MultiversXChainMock) GetAllSentTransactions(_ context.Context) map[string]*transaction.FrontendTransaction { mock.mutState.RLock() defer mock.mutState.RUnlock() - txs := make(map[string]*data.Transaction) + txs := make(map[string]*transaction.FrontendTransaction) for hash, tx := range mock.sentTransactions { txs[hash] = tx } diff --git a/integrationTests/mock/multiversXContractStateMock.go b/integrationTests/mock/multiversXContractStateMock.go index 7dfe0bc6..2df2e30f 100644 --- a/integrationTests/mock/multiversXContractStateMock.go +++ b/integrationTests/mock/multiversXContractStateMock.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/multiversx/mx-bridge-eth-go/integrationTests" "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/data/transaction" "github.com/multiversx/mx-chain-core-go/data/vm" sdkCore "github.com/multiversx/mx-sdk-go/core" "github.com/multiversx/mx-sdk-go/data" @@ -85,7 +86,7 @@ func (mock *multiversXContractStateMock) cleanState() { mock.pendingBatch = nil } -func (mock *multiversXContractStateMock) processTransaction(tx *data.Transaction) { +func (mock *multiversXContractStateMock) processTransaction(tx *transaction.FrontendTransaction) { dataSplit := strings.Split(string(tx.Data), "@") funcName := dataSplit[0] switch funcName { @@ -111,13 +112,13 @@ func (mock *multiversXContractStateMock) processTransaction(tx *data.Transaction panic("can not execute transaction that calls function: " + funcName) } -func (mock *multiversXContractStateMock) proposeEsdtSafeSetCurrentTransactionBatchStatus(dataSplit []string, _ *data.Transaction) { +func (mock *multiversXContractStateMock) proposeEsdtSafeSetCurrentTransactionBatchStatus(dataSplit []string, _ *transaction.FrontendTransaction) { status, hash := mock.createProposedStatus(dataSplit) mock.proposedStatus[hash] = status } -func (mock *multiversXContractStateMock) proposeMultiTransferEsdtBatch(dataSplit []string, _ *data.Transaction) { +func (mock *multiversXContractStateMock) proposeMultiTransferEsdtBatch(dataSplit []string, _ *transaction.FrontendTransaction) { transfer, hash := mock.createProposedTransfer(dataSplit) mock.proposedTransfers[hash] = transfer @@ -306,7 +307,7 @@ func (mock *multiversXContractStateMock) vmRequestGetStatusesAfterExecution(_ *d return createOkVmResponse(args) } -func (mock *multiversXContractStateMock) sign(dataSplit []string, tx *data.Transaction) { +func (mock *multiversXContractStateMock) sign(dataSplit []string, tx *transaction.FrontendTransaction) { actionID := getActionIDFromString(dataSplit[1]) if !mock.actionIDExists(actionID) { panic(fmt.Sprintf("attempted to sign on a missing action ID: %v as big int, raw: %s", actionID, dataSplit[1])) @@ -317,10 +318,10 @@ func (mock *multiversXContractStateMock) sign(dataSplit []string, tx *data.Trans m = make(map[string]struct{}) mock.signedActionIDs[actionID.String()] = m } - m[tx.SndAddr] = struct{}{} + m[tx.Sender] = struct{}{} } -func (mock *multiversXContractStateMock) performAction(dataSplit []string, _ *data.Transaction) { +func (mock *multiversXContractStateMock) performAction(dataSplit []string, _ *transaction.FrontendTransaction) { actionID := getActionIDFromString(dataSplit[1]) if !mock.actionIDExists(actionID) { panic(fmt.Sprintf("attempted to perform on a missing action ID: %v as big int, raw: %s", actionID, dataSplit[1])) diff --git a/testsCommon/bridge/nonceTransactionsHandlerStub.go b/testsCommon/bridge/nonceTransactionsHandlerStub.go index 5d07cff8..1177a79b 100644 --- a/testsCommon/bridge/nonceTransactionsHandlerStub.go +++ b/testsCommon/bridge/nonceTransactionsHandlerStub.go @@ -3,14 +3,14 @@ package bridge import ( "context" + "github.com/multiversx/mx-chain-core-go/data/transaction" "github.com/multiversx/mx-sdk-go/core" - "github.com/multiversx/mx-sdk-go/data" ) // NonceTransactionsHandlerStub - type NonceTransactionsHandlerStub struct { GetNonceCalled func(ctx context.Context, address core.AddressHandler) (uint64, error) - SendTransactionCalled func(ctx context.Context, tx *data.Transaction) (string, error) + SendTransactionCalled func(ctx context.Context, tx *transaction.FrontendTransaction) (string, error) CloseCalled func() error } @@ -24,7 +24,7 @@ func (stub *NonceTransactionsHandlerStub) GetNonce(ctx context.Context, address } // SendTransaction - -func (stub *NonceTransactionsHandlerStub) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { +func (stub *NonceTransactionsHandlerStub) SendTransaction(ctx context.Context, tx *transaction.FrontendTransaction) (string, error) { if stub.SendTransactionCalled != nil { return stub.SendTransactionCalled(ctx, tx) } diff --git a/testsCommon/interactors/proxyStub.go b/testsCommon/interactors/proxyStub.go index 4bd9e3d6..c7545487 100644 --- a/testsCommon/interactors/proxyStub.go +++ b/testsCommon/interactors/proxyStub.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/multiversx/mx-chain-core-go/data/transaction" "github.com/multiversx/mx-sdk-go/core" "github.com/multiversx/mx-sdk-go/data" ) @@ -11,8 +12,8 @@ import ( // ProxyStub - type ProxyStub struct { GetNetworkConfigCalled func(ctx context.Context) (*data.NetworkConfig, error) - SendTransactionCalled func(ctx context.Context, transaction *data.Transaction) (string, error) - SendTransactionsCalled func(ctx context.Context, txs []*data.Transaction) ([]string, error) + SendTransactionCalled func(ctx context.Context, transaction *transaction.FrontendTransaction) (string, error) + SendTransactionsCalled func(ctx context.Context, txs []*transaction.FrontendTransaction) ([]string, error) ExecuteVMQueryCalled func(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) GetAccountCalled func(ctx context.Context, address core.AddressHandler) (*data.Account, error) GetNetworkStatusCalled func(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) @@ -29,7 +30,7 @@ func (eps *ProxyStub) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig } // SendTransaction - -func (eps *ProxyStub) SendTransaction(ctx context.Context, transaction *data.Transaction) (string, error) { +func (eps *ProxyStub) SendTransaction(ctx context.Context, transaction *transaction.FrontendTransaction) (string, error) { if eps.SendTransactionCalled != nil { return eps.SendTransactionCalled(ctx, transaction) } @@ -38,7 +39,7 @@ func (eps *ProxyStub) SendTransaction(ctx context.Context, transaction *data.Tra } // SendTransactions - -func (eps *ProxyStub) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { +func (eps *ProxyStub) SendTransactions(ctx context.Context, txs []*transaction.FrontendTransaction) ([]string, error) { if eps.SendTransactionCalled != nil { return eps.SendTransactionsCalled(ctx, txs) } From c313c938c0107e3e54121e7d1c7ce848756536ec Mon Sep 17 00:00:00 2001 From: jules01 Date: Wed, 31 May 2023 16:34:39 +0300 Subject: [PATCH 2/2] - proper release & minor test fix --- go.mod | 2 +- go.sum | 4 ++-- p2p/broadcaster_test.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 676c44b2..38b0ea0b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/multiversx/mx-chain-go v1.4.15 github.com/multiversx/mx-chain-logger-go v1.0.11 github.com/multiversx/mx-chain-p2p-go v1.0.10 - github.com/multiversx/mx-sdk-go v1.3.1-0.20230531105616-c4dd3e07ac14 + github.com/multiversx/mx-sdk-go v1.3.2 github.com/stretchr/testify v1.8.1 github.com/urfave/cli v1.22.10 ) diff --git a/go.sum b/go.sum index 67d9de8e..1934b749 100644 --- a/go.sum +++ b/go.sum @@ -767,8 +767,8 @@ github.com/multiversx/mx-chain-vm-v1_2-go v1.2.50/go.mod h1:e3uYdgoKzs3puaznbmSj github.com/multiversx/mx-chain-vm-v1_3-go v1.3.51/go.mod h1:oKj32V2nkd+KGNOL6emnwVkDRPpciwHHDqBmeorcL8k= github.com/multiversx/mx-chain-vm-v1_4-go v1.4.77/go.mod h1:3IaAOHc1JfxL5ywQZIrcaHQu5+CVdZNDaoY64NGOtUE= github.com/multiversx/mx-components-big-int v0.1.1/go.mod h1:0QrcFdfeLgJ/am10HGBeH0G0DNF+0Qx1E4DS/iozQls= -github.com/multiversx/mx-sdk-go v1.3.1-0.20230531105616-c4dd3e07ac14 h1:S/+vkLn8znu1cHCTuuEF7QYhpZNiYORoZA8++B1+Dm8= -github.com/multiversx/mx-sdk-go v1.3.1-0.20230531105616-c4dd3e07ac14/go.mod h1:xVDCcASI456+TQDYGPdaD8GLzLhDVVXfnlrANSiRmz8= +github.com/multiversx/mx-sdk-go v1.3.2 h1:eMp2YszrNoPSBQWpVFL/w+dRdMeZsTVzYq4teCdk/8Q= +github.com/multiversx/mx-sdk-go v1.3.2/go.mod h1:xVDCcASI456+TQDYGPdaD8GLzLhDVVXfnlrANSiRmz8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= diff --git a/p2p/broadcaster_test.go b/p2p/broadcaster_test.go index f7c1a666..6b65a296 100644 --- a/p2p/broadcaster_test.go +++ b/p2p/broadcaster_test.go @@ -410,7 +410,8 @@ func TestBroadcaster_ProcessReceivedMessage(t *testing.T) { processedMessages := make([]*core.SignedMessage, 0) b, err := NewBroadcaster(args) - print(err) + require.Nil(t, err) + _ = b.AddBroadcastClient(&testsCommon.BroadcastClientStub{ ProcessNewMessageCalled: func(msg *core.SignedMessage, ethMsg *core.EthereumSignature) { processedMessages = append(processedMessages, msg)