From ebcb5a6e963bd447fe5b8a9364c9b5b38ff0b5ab Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 12:05:48 +0200 Subject: [PATCH 01/15] rebranding + usage of mx-chain-go v1.4.4 --- aggregator/api/gin/httpServer.go | 2 +- aggregator/api/gin/httpServer_test.go | 6 +- aggregator/api/gin/webServer.go | 10 +-- aggregator/api/gin/webServer_test.go | 2 +- aggregator/computers_test.go | 2 +- aggregator/fetchers/binance.go | 2 +- aggregator/fetchers/bitfinex.go | 2 +- aggregator/fetchers/cryptocom.go | 2 +- aggregator/fetchers/factory.go | 2 +- aggregator/fetchers/factory_test.go | 2 +- aggregator/fetchers/fetchers_test.go | 6 +- aggregator/fetchers/gemini.go | 2 +- aggregator/fetchers/hitbtc.go | 2 +- aggregator/fetchers/huobi.go | 2 +- aggregator/fetchers/kraken.go | 2 +- aggregator/fetchers/maiar.go | 2 +- aggregator/fetchers/okex.go | 2 +- aggregator/graphqlResponseGetter.go | 4 +- aggregator/graphqlResponseGetter_test.go | 2 +- aggregator/httpResponseGetter_test.go | 2 +- aggregator/mock/priceNotifeeStub.go | 2 +- aggregator/notifees/elrondNotifee.go | 12 +-- aggregator/notifees/elrondNotifee_test.go | 18 ++--- aggregator/notifees/interface.go | 4 +- aggregator/pair_test.go | 2 +- aggregator/priceAggregator.go | 4 +- aggregator/priceAggregator_test.go | 6 +- aggregator/priceNotifier.go | 2 +- aggregator/priceNotifier_test.go | 6 +- authentication/native.go | 8 +- authentication/native_test.go | 6 +- blockchain/addressGenerator.go | 30 ++++---- blockchain/addressGenerator_test.go | 2 +- .../cryptoProvider/cryptoComponentsHolder.go | 6 +- .../cryptoComponentsHolder_test.go | 8 +- blockchain/cryptoProvider/signer.go | 10 +-- blockchain/cryptoProvider/signer_test.go | 12 +-- blockchain/elrondBaseProxy.go | 8 +- blockchain/elrondBaseProxy_test.go | 10 +-- .../endpointProviders/nodeEndpointProvider.go | 2 +- .../nodeEndpointProvider_test.go | 4 +- .../proxyEndpointProvider.go | 2 +- .../proxyEndpointProvider_test.go | 6 +- blockchain/factory/factory.go | 6 +- blockchain/factory/factory_test.go | 6 +- blockchain/factory/interface.go | 4 +- .../disabledFinalityProvider_test.go | 2 +- blockchain/finalityProvider/interface.go | 2 +- .../finalityProvider/nodeFinalityProvider.go | 4 +- .../nodeFinalityProvider_test.go | 6 +- .../finalityProvider/proxyFinalityProvider.go | 8 +- .../proxyFinalityProvider_test.go | 8 +- blockchain/interface.go | 4 +- blockchain/proxy.go | 14 ++-- blockchain/proxy_test.go | 16 ++-- blockchain/shardCoordinator.go | 6 +- builders/baseBuilder.go | 4 +- builders/interface.go | 6 +- builders/relayedTxV1Builder.go | 6 +- builders/relayedTxV1Builder_test.go | 10 +-- builders/relayedTxV2Builder.go | 4 +- builders/relayedTxV2Builder_test.go | 2 +- builders/txBuilder.go | 12 +-- builders/txBuilder_test.go | 14 ++-- builders/txDataBuilder.go | 2 +- builders/txDataBuilder_test.go | 4 +- builders/vmQueryBuilder.go | 4 +- builders/vmQueryBuilder_test.go | 4 +- core/http/clientWrapper.go | 2 +- core/http/clientWrapper_test.go | 2 +- core/interface.go | 2 +- core/polling/pollingHandler.go | 4 +- core/polling/pollingHandler_test.go | 6 +- core/variables.go | 4 +- data/address.go | 2 +- data/enableEpochsConfig.go | 2 +- data/nodeConfig.go | 2 +- data/transaction.go | 2 +- data/vmValues.go | 2 +- disabled/accounts.go | 6 +- disabled/blockchain.go | 2 +- disabled/blockchainHookCounter.go | 7 +- disabled/builtInFunctionContainer.go | 2 +- disabled/datapool.go | 4 +- disabled/enableEpochsHandler.go | 10 +++ disabled/epochNotifier.go | 4 +- disabled/epochStartNotifier.go | 2 +- disabled/fallbackHeaderValidator.go | 2 +- disabled/gasScheduleNotifier.go | 2 +- disabled/nodeTypeProvider.go | 2 +- disabled/simpleESDTNFTStorageHandler.go | 6 +- disabled/storageService.go | 4 +- disabled/storer.go | 2 +- examples/examplesAccount/main.go | 10 +-- examples/examplesBlock/main.go | 8 +- examples/examplesFlowWalletTracker/main.go | 18 ++--- examples/examplesHeaderCheck/main.go | 12 +-- examples/examplesPriceAggregator/main.go | 26 +++---- examples/examplesTransaction/main.go | 18 ++--- examples/examplesVMQuery/main.go | 10 +-- examples/examplesWallet/main.go | 4 +- go.mod | 26 +++---- go.sum | 76 +++++++++---------- headerCheck/export_test.go | 2 +- headerCheck/factory/coreComponents.go | 26 +++---- headerCheck/factory/cryptoComponents.go | 14 ++-- headerCheck/factory/nodesCoordinator.go | 18 ++--- headerCheck/headerCheck.go | 10 +-- headerCheck/headerCheckFactory.go | 12 +-- headerCheck/headerCheck_test.go | 12 +-- headerCheck/interface.go | 6 +- headerCheck/rawHeaderHandler.go | 14 ++-- headerCheck/rawHeaderHandler_test.go | 10 +-- interactors/interface.go | 4 +- .../nonceHandlerV1/addressNonceHandler.go | 8 +- .../nonceTransactionsHandler.go | 10 +-- .../nonceTransactionsHandler_test.go | 8 +- .../nonceHandlerV2/addressNonceHandler.go | 10 +-- .../addressNonceHandlerCreator.go | 4 +- .../addressNonceHandlerCreator_test.go | 4 +- .../addressNonceHandler_test.go | 8 +- interactors/nonceHandlerV2/export_test.go | 8 +- .../nonceTransactionsHandler.go | 10 +-- .../nonceTransactionsHandler_test.go | 10 +-- .../singleTransactionAddressNonceHandler.go | 10 +-- ...leTransactionAddressNonceHandlerCreator.go | 4 +- ...nsactionAddressNonceHandlerCreator_test.go | 4 +- ...ngleTransactionAddressNonceHandler_test.go | 8 +- interactors/transaction.go | 6 +- interactors/transaction_test.go | 6 +- interactors/wallet.go | 8 +- interactors/wallet_test.go | 2 +- libraries/libbls/libbls.go | 6 +- libraries/libbls/libbls.h | 2 +- serde/deserializer_test.go | 2 +- storage/mapCacher.go | 2 +- testsCommon/cryptoComponentsHolderStub.go | 4 +- testsCommon/headerSigVerifierStub.go | 2 +- .../addressNonceHandlerCreatorStub.go | 4 +- testsCommon/nodesCoordinatorStub.go | 4 +- testsCommon/privateKeyStub.go | 2 +- testsCommon/proxyStub.go | 8 +- testsCommon/publicKeyStub.go | 2 +- testsCommon/rawHeaderHandlerStub.go | 4 +- testsCommon/signerStub.go | 4 +- testsCommon/txBuilderStub.go | 4 +- testsCommon/txNonceHandlerV1Stub.go | 4 +- testsCommon/txNonceHandlerV2Stub.go | 4 +- workflows/interface.go | 4 +- workflows/moveBalanceHandler.go | 10 +-- workflows/walletsTracker.go | 6 +- 151 files changed, 508 insertions(+), 505 deletions(-) diff --git a/aggregator/api/gin/httpServer.go b/aggregator/api/gin/httpServer.go index de095ae4..3b0afea3 100644 --- a/aggregator/api/gin/httpServer.go +++ b/aggregator/api/gin/httpServer.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - apiErrors "github.com/ElrondNetwork/elrond-go/api/errors" + apiErrors "github.com/multiversx/mx-chain-go/api/errors" ) type httpServer struct { diff --git a/aggregator/api/gin/httpServer_test.go b/aggregator/api/gin/httpServer_test.go index d2083c1d..58c0c61f 100644 --- a/aggregator/api/gin/httpServer_test.go +++ b/aggregator/api/gin/httpServer_test.go @@ -6,9 +6,9 @@ import ( "net/http" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - apiErrors "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/api/errors" - testsServer "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon/server" + "github.com/multiversx/mx-chain-core-go/core/check" + apiErrors "github.com/multiversx/mx-sdk-go/aggregator/api/errors" + testsServer "github.com/multiversx/mx-sdk-go/testsCommon/server" "github.com/stretchr/testify/assert" ) diff --git a/aggregator/api/gin/webServer.go b/aggregator/api/gin/webServer.go index f628da61..048507d8 100644 --- a/aggregator/api/gin/webServer.go +++ b/aggregator/api/gin/webServer.go @@ -5,14 +5,14 @@ import ( "net/http" "sync" - "github.com/ElrondNetwork/elrond-go-core/marshal" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-go/api/logs" - elrondShared "github.com/ElrondNetwork/elrond-go/api/shared" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" + "github.com/multiversx/mx-chain-core-go/marshal" + "github.com/multiversx/mx-chain-go/api/logs" + elrondShared "github.com/multiversx/mx-chain-go/api/shared" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/core" ) var log = logger.GetOrCreate("api") diff --git a/aggregator/api/gin/webServer_test.go b/aggregator/api/gin/webServer_test.go index f2b1fcd3..071c4c64 100644 --- a/aggregator/api/gin/webServer_test.go +++ b/aggregator/api/gin/webServer_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/multiversx/mx-chain-core-go/core/check" "github.com/stretchr/testify/assert" ) diff --git a/aggregator/computers_test.go b/aggregator/computers_test.go index 35a8b43b..3f3a1173 100644 --- a/aggregator/computers_test.go +++ b/aggregator/computers_test.go @@ -3,7 +3,7 @@ package aggregator_test import ( "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" "github.com/stretchr/testify/assert" ) diff --git a/aggregator/fetchers/binance.go b/aggregator/fetchers/binance.go index 98f60468..930c16b6 100644 --- a/aggregator/fetchers/binance.go +++ b/aggregator/fetchers/binance.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/bitfinex.go b/aggregator/fetchers/bitfinex.go index 13b6446d..aef55d97 100644 --- a/aggregator/fetchers/bitfinex.go +++ b/aggregator/fetchers/bitfinex.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/cryptocom.go b/aggregator/fetchers/cryptocom.go index 96e5a551..1b0051e9 100644 --- a/aggregator/fetchers/cryptocom.go +++ b/aggregator/fetchers/cryptocom.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/factory.go b/aggregator/fetchers/factory.go index 3091cf0f..4fd8adcc 100644 --- a/aggregator/fetchers/factory.go +++ b/aggregator/fetchers/factory.go @@ -3,7 +3,7 @@ package fetchers import ( "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) // MaiarTokensPair defines a base-quote pair of ids used by maiar exchange diff --git a/aggregator/fetchers/factory_test.go b/aggregator/fetchers/factory_test.go index 1e08ec0f..14a58b61 100644 --- a/aggregator/fetchers/factory_test.go +++ b/aggregator/fetchers/factory_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/mock" + "github.com/multiversx/mx-sdk-go/aggregator/mock" "github.com/stretchr/testify/assert" ) diff --git a/aggregator/fetchers/fetchers_test.go b/aggregator/fetchers/fetchers_test.go index 5211ccbe..e6ee2f1c 100644 --- a/aggregator/fetchers/fetchers_test.go +++ b/aggregator/fetchers/fetchers_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/mock" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/aggregator/fetchers/gemini.go b/aggregator/fetchers/gemini.go index 17614fb2..e45872c0 100644 --- a/aggregator/fetchers/gemini.go +++ b/aggregator/fetchers/gemini.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/hitbtc.go b/aggregator/fetchers/hitbtc.go index 871f5ae3..69b821db 100644 --- a/aggregator/fetchers/hitbtc.go +++ b/aggregator/fetchers/hitbtc.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/huobi.go b/aggregator/fetchers/huobi.go index 5708a144..ee1a25f0 100644 --- a/aggregator/fetchers/huobi.go +++ b/aggregator/fetchers/huobi.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/kraken.go b/aggregator/fetchers/kraken.go index edeeff28..54616576 100644 --- a/aggregator/fetchers/kraken.go +++ b/aggregator/fetchers/kraken.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/maiar.go b/aggregator/fetchers/maiar.go index 31391acc..a8e92c27 100644 --- a/aggregator/fetchers/maiar.go +++ b/aggregator/fetchers/maiar.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/fetchers/okex.go b/aggregator/fetchers/okex.go index e3e76bd0..b95d4c39 100644 --- a/aggregator/fetchers/okex.go +++ b/aggregator/fetchers/okex.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) const ( diff --git a/aggregator/graphqlResponseGetter.go b/aggregator/graphqlResponseGetter.go index 25bfa3e4..e9e87994 100644 --- a/aggregator/graphqlResponseGetter.go +++ b/aggregator/graphqlResponseGetter.go @@ -6,8 +6,8 @@ import ( "io" "strings" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/authentication" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/authentication" "golang.org/x/oauth2" ) diff --git a/aggregator/graphqlResponseGetter_test.go b/aggregator/graphqlResponseGetter_test.go index d4d83f93..5952e535 100644 --- a/aggregator/graphqlResponseGetter_test.go +++ b/aggregator/graphqlResponseGetter_test.go @@ -6,7 +6,7 @@ import ( "net/url" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/authentication/mock" + "github.com/multiversx/mx-sdk-go/authentication/mock" "github.com/stretchr/testify/require" ) diff --git a/aggregator/httpResponseGetter_test.go b/aggregator/httpResponseGetter_test.go index 45165795..40a3eb7f 100644 --- a/aggregator/httpResponseGetter_test.go +++ b/aggregator/httpResponseGetter_test.go @@ -8,7 +8,7 @@ import ( "net/url" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" "github.com/stretchr/testify/require" ) diff --git a/aggregator/mock/priceNotifeeStub.go b/aggregator/mock/priceNotifeeStub.go index a25467eb..b2527f82 100644 --- a/aggregator/mock/priceNotifeeStub.go +++ b/aggregator/mock/priceNotifeeStub.go @@ -3,7 +3,7 @@ package mock import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator" ) // PriceNotifeeStub - diff --git a/aggregator/notifees/elrondNotifee.go b/aggregator/notifees/elrondNotifee.go index 24fa35e8..b8e72e16 100644 --- a/aggregator/notifees/elrondNotifee.go +++ b/aggregator/notifees/elrondNotifee.go @@ -3,12 +3,12 @@ package notifees import ( "context" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/builders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/aggregator" + "github.com/multiversx/mx-sdk-go/builders" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) const zeroString = "0" diff --git a/aggregator/notifees/elrondNotifee_test.go b/aggregator/notifees/elrondNotifee_test.go index e07d3bc0..3eec68c6 100644 --- a/aggregator/notifees/elrondNotifee_test.go +++ b/aggregator/notifees/elrondNotifee_test.go @@ -9,15 +9,15 @@ import ( "strings" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/builders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-crypto-go/signing" + "github.com/multiversx/mx-chain-crypto-go/signing/ed25519" + "github.com/multiversx/mx-sdk-go/aggregator" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/builders" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/aggregator/notifees/interface.go b/aggregator/notifees/interface.go index 7da8c745..6d71c500 100644 --- a/aggregator/notifees/interface.go +++ b/aggregator/notifees/interface.go @@ -3,8 +3,8 @@ package notifees import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // TxBuilder defines the component able to build & sign a transaction diff --git a/aggregator/pair_test.go b/aggregator/pair_test.go index 7d63377e..3f2102a1 100644 --- a/aggregator/pair_test.go +++ b/aggregator/pair_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/multiversx/mx-chain-core-go/core/check" "github.com/stretchr/testify/assert" ) diff --git a/aggregator/priceAggregator.go b/aggregator/priceAggregator.go index 32804a53..3c4366c7 100644 --- a/aggregator/priceAggregator.go +++ b/aggregator/priceAggregator.go @@ -6,8 +6,8 @@ import ( "strings" "sync" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" ) const minResultsNum = 1 diff --git a/aggregator/priceAggregator_test.go b/aggregator/priceAggregator_test.go index 6f38e857..4554d522 100644 --- a/aggregator/priceAggregator_test.go +++ b/aggregator/priceAggregator_test.go @@ -5,9 +5,9 @@ import ( "errors" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/mock" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator/mock" "github.com/stretchr/testify/assert" ) diff --git a/aggregator/priceNotifier.go b/aggregator/priceNotifier.go index ef78a02a..d2f14107 100644 --- a/aggregator/priceNotifier.go +++ b/aggregator/priceNotifier.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/multiversx/mx-chain-core-go/core/check" ) const epsilon = 0.0001 diff --git a/aggregator/priceNotifier_test.go b/aggregator/priceNotifier_test.go index 8362f5aa..b5edeaaf 100644 --- a/aggregator/priceNotifier_test.go +++ b/aggregator/priceNotifier_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/mock" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/authentication/native.go b/authentication/native.go index ac1b8832..fe0bc57c 100644 --- a/authentication/native.go +++ b/authentication/native.go @@ -7,10 +7,10 @@ import ( "fmt" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/builders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/workflows" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/builders" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/workflows" ) // ArgsNativeAuthClient is the DTO used in the native auth client constructor diff --git a/authentication/native_test.go b/authentication/native_test.go index 2b16b84c..227f7052 100644 --- a/authentication/native_test.go +++ b/authentication/native_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/require" ) diff --git a/blockchain/addressGenerator.go b/blockchain/addressGenerator.go index 5ef42287..f8e07c42 100644 --- a/blockchain/addressGenerator.go +++ b/blockchain/addressGenerator.go @@ -3,19 +3,19 @@ package blockchain import ( "bytes" - elrondCore "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-core/data/typeConverters/uint64ByteSlice" - "github.com/ElrondNetwork/elrond-go-core/hashing" - "github.com/ElrondNetwork/elrond-go-core/hashing/keccak" - "github.com/ElrondNetwork/elrond-go-core/marshal" - "github.com/ElrondNetwork/elrond-go/process" - "github.com/ElrondNetwork/elrond-go/process/factory" - "github.com/ElrondNetwork/elrond-go/process/smartContract/hooks" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/disabled" - "github.com/ElrondNetwork/elrond-sdk-erdgo/storage" + elrondCore "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-core-go/data/typeConverters/uint64ByteSlice" + "github.com/multiversx/mx-chain-core-go/hashing" + "github.com/multiversx/mx-chain-core-go/hashing/keccak" + "github.com/multiversx/mx-chain-core-go/marshal" + "github.com/multiversx/mx-chain-go/process" + "github.com/multiversx/mx-chain-go/process/factory" + "github.com/multiversx/mx-chain-go/process/smartContract/hooks" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/disabled" + "github.com/multiversx/mx-sdk-go/storage" ) const accountStartNonce = uint64(0) @@ -74,7 +74,7 @@ func (ag *addressGenerator) CompatibleDNSAddress(shardId byte) (core.AddressHand shardInBytes := []byte{0, shardId} newDNSPk := string(initialDNSAddress[:(addressLen-elrondCore.ShardIdentiferLen)]) + string(shardInBytes) - newDNSAddress, err := ag.blockChainHook.NewAddress([]byte(newDNSPk), accountStartNonce, factory.ArwenVirtualMachine) + newDNSAddress, err := ag.blockChainHook.NewAddress([]byte(newDNSPk), accountStartNonce, factory.WasmVirtualMachine) if err != nil { return nil, err } @@ -96,7 +96,7 @@ func (ag *addressGenerator) ComputeArwenScAddress(address core.AddressHandler, n return nil, ErrNilAddress } - scAddressBytes, err := ag.blockChainHook.NewAddress(address.AddressBytes(), nonce, factory.ArwenVirtualMachine) + scAddressBytes, err := ag.blockChainHook.NewAddress(address.AddressBytes(), nonce, factory.WasmVirtualMachine) if err != nil { return nil, err } diff --git a/blockchain/addressGenerator_test.go b/blockchain/addressGenerator_test.go index 1e58c3ba..0abb6c96 100644 --- a/blockchain/addressGenerator_test.go +++ b/blockchain/addressGenerator_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/data" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/blockchain/cryptoProvider/cryptoComponentsHolder.go b/blockchain/cryptoProvider/cryptoComponentsHolder.go index 9776db88..db1fc123 100644 --- a/blockchain/cryptoProvider/cryptoComponentsHolder.go +++ b/blockchain/cryptoProvider/cryptoComponentsHolder.go @@ -1,9 +1,9 @@ package cryptoProvider import ( - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) type cryptoComponentsHolder struct { diff --git a/blockchain/cryptoProvider/cryptoComponentsHolder_test.go b/blockchain/cryptoProvider/cryptoComponentsHolder_test.go index be6a81cf..af2d3032 100644 --- a/blockchain/cryptoProvider/cryptoComponentsHolder_test.go +++ b/blockchain/cryptoProvider/cryptoComponentsHolder_test.go @@ -4,10 +4,10 @@ import ( "encoding/hex" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-go/testscommon/cryptoMocks" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core/check" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-chain-go/testscommon/cryptoMocks" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/require" ) diff --git a/blockchain/cryptoProvider/signer.go b/blockchain/cryptoProvider/signer.go index 311d22d9..a8610a14 100644 --- a/blockchain/cryptoProvider/signer.go +++ b/blockchain/cryptoProvider/signer.go @@ -4,11 +4,11 @@ import ( "encoding/json" "strconv" - "github.com/ElrondNetwork/elrond-go-core/hashing/keccak" - "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519/singlesig" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/hashing/keccak" + "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-chain-crypto-go/signing/ed25519/singlesig" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/data" ) var ( diff --git a/blockchain/cryptoProvider/signer_test.go b/blockchain/cryptoProvider/signer_test.go index 38d97f64..97a008f0 100644 --- a/blockchain/cryptoProvider/signer_test.go +++ b/blockchain/cryptoProvider/signer_test.go @@ -5,12 +5,12 @@ import ( "errors" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-crypto-go/signing" + "github.com/multiversx/mx-chain-crypto-go/signing/ed25519" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/examples" + "github.com/multiversx/mx-sdk-go/interactors" "github.com/stretchr/testify/require" ) diff --git a/blockchain/elrondBaseProxy.go b/blockchain/elrondBaseProxy.go index b84fc795..a759925a 100644 --- a/blockchain/elrondBaseProxy.go +++ b/blockchain/elrondBaseProxy.go @@ -9,10 +9,10 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/blockchain") diff --git a/blockchain/elrondBaseProxy_test.go b/blockchain/elrondBaseProxy_test.go index b3045bfd..66a6417a 100644 --- a/blockchain/elrondBaseProxy_test.go +++ b/blockchain/elrondBaseProxy_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/endpointProviders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/blockchain/endpointProviders" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/blockchain/endpointProviders/nodeEndpointProvider.go b/blockchain/endpointProviders/nodeEndpointProvider.go index a0c89de3..3fad9fa1 100644 --- a/blockchain/endpointProviders/nodeEndpointProvider.go +++ b/blockchain/endpointProviders/nodeEndpointProvider.go @@ -3,7 +3,7 @@ package endpointProviders import ( "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-sdk-go/core" ) const ( diff --git a/blockchain/endpointProviders/nodeEndpointProvider_test.go b/blockchain/endpointProviders/nodeEndpointProvider_test.go index 6f5cbd7f..8ec1a4a7 100644 --- a/blockchain/endpointProviders/nodeEndpointProvider_test.go +++ b/blockchain/endpointProviders/nodeEndpointProvider_test.go @@ -3,8 +3,8 @@ package endpointProviders import ( "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/core" "github.com/stretchr/testify/assert" ) diff --git a/blockchain/endpointProviders/proxyEndpointProvider.go b/blockchain/endpointProviders/proxyEndpointProvider.go index cd861dd6..5021b33e 100644 --- a/blockchain/endpointProviders/proxyEndpointProvider.go +++ b/blockchain/endpointProviders/proxyEndpointProvider.go @@ -3,7 +3,7 @@ package endpointProviders import ( "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-sdk-go/core" ) const ( diff --git a/blockchain/endpointProviders/proxyEndpointProvider_test.go b/blockchain/endpointProviders/proxyEndpointProvider_test.go index 5816524b..adb169ac 100644 --- a/blockchain/endpointProviders/proxyEndpointProvider_test.go +++ b/blockchain/endpointProviders/proxyEndpointProvider_test.go @@ -3,9 +3,9 @@ package endpointProviders import ( "testing" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + erdgoCore "github.com/multiversx/mx-sdk-go/core" "github.com/stretchr/testify/assert" ) diff --git a/blockchain/factory/factory.go b/blockchain/factory/factory.go index ea1b13eb..38de40bd 100644 --- a/blockchain/factory/factory.go +++ b/blockchain/factory/factory.go @@ -3,9 +3,9 @@ package factory import ( "fmt" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/endpointProviders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/finalityProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-sdk-go/blockchain/endpointProviders" + "github.com/multiversx/mx-sdk-go/blockchain/finalityProvider" + "github.com/multiversx/mx-sdk-go/core" ) // CreateEndpointProvider creates a new instance of EndpointProvider diff --git a/blockchain/factory/factory_test.go b/blockchain/factory/factory_test.go index c3e4e12b..22a7e9c3 100644 --- a/blockchain/factory/factory_test.go +++ b/blockchain/factory/factory_test.go @@ -5,9 +5,9 @@ import ( "fmt" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" ) diff --git a/blockchain/factory/interface.go b/blockchain/factory/interface.go index 716544a1..927d4129 100644 --- a/blockchain/factory/interface.go +++ b/blockchain/factory/interface.go @@ -3,8 +3,8 @@ package factory import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) type proxy interface { diff --git a/blockchain/finalityProvider/disabledFinalityProvider_test.go b/blockchain/finalityProvider/disabledFinalityProvider_test.go index 31bbe08f..303d1289 100644 --- a/blockchain/finalityProvider/disabledFinalityProvider_test.go +++ b/blockchain/finalityProvider/disabledFinalityProvider_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/multiversx/mx-chain-core-go/core/check" "github.com/stretchr/testify/assert" ) diff --git a/blockchain/finalityProvider/interface.go b/blockchain/finalityProvider/interface.go index 5f36c139..b7a4800f 100644 --- a/blockchain/finalityProvider/interface.go +++ b/blockchain/finalityProvider/interface.go @@ -3,7 +3,7 @@ package finalityProvider import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/data" ) type proxy interface { diff --git a/blockchain/finalityProvider/nodeFinalityProvider.go b/blockchain/finalityProvider/nodeFinalityProvider.go index 13865326..7f593728 100644 --- a/blockchain/finalityProvider/nodeFinalityProvider.go +++ b/blockchain/finalityProvider/nodeFinalityProvider.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/core" ) type nonces struct { diff --git a/blockchain/finalityProvider/nodeFinalityProvider_test.go b/blockchain/finalityProvider/nodeFinalityProvider_test.go index 111a9019..2bb93515 100644 --- a/blockchain/finalityProvider/nodeFinalityProvider_test.go +++ b/blockchain/finalityProvider/nodeFinalityProvider_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" ) diff --git a/blockchain/finalityProvider/proxyFinalityProvider.go b/blockchain/finalityProvider/proxyFinalityProvider.go index 89da6091..fa5ada83 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider.go +++ b/blockchain/finalityProvider/proxyFinalityProvider.go @@ -6,10 +6,10 @@ import ( "math/big" "strings" - elrondCore "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + elrondCore "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/core" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/blockchain/finalityprovider") diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 24e7dd72..51b0c237 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -6,10 +6,10 @@ import ( "strings" "testing" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" ) diff --git a/blockchain/interface.go b/blockchain/interface.go index 069be61e..91d21ed8 100644 --- a/blockchain/interface.go +++ b/blockchain/interface.go @@ -3,8 +3,8 @@ package blockchain import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // Proxy holds the primitive functions that the elrond proxy engine supports & implements diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 205c7e3c..0901e308 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -9,13 +9,13 @@ import ( "sort" "time" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go/state" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/factory" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - erdgoHttp "github.com/ElrondNetwork/elrond-sdk-erdgo/core/http" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-go/state" + "github.com/multiversx/mx-sdk-go/blockchain/factory" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + erdgoHttp "github.com/multiversx/mx-sdk-go/core/http" + "github.com/multiversx/mx-sdk-go/data" ) const ( diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index 44056669..1c0669c9 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -13,14 +13,14 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go/config" - "github.com/ElrondNetwork/elrond-go/state" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - erdgoHttp "github.com/ElrondNetwork/elrond-sdk-erdgo/core/http" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-go/config" + "github.com/multiversx/mx-chain-go/state" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + erdgoHttp "github.com/multiversx/mx-sdk-go/core/http" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/blockchain/shardCoordinator.go b/blockchain/shardCoordinator.go index d3398fc4..3b00cc45 100644 --- a/blockchain/shardCoordinator.go +++ b/blockchain/shardCoordinator.go @@ -1,9 +1,9 @@ package blockchain import ( - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go/sharding" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-go/sharding" + erdgoCore "github.com/multiversx/mx-sdk-go/core" ) type shardCoordinator struct { diff --git a/builders/baseBuilder.go b/builders/baseBuilder.go index 01489741..ce6764be 100644 --- a/builders/baseBuilder.go +++ b/builders/baseBuilder.go @@ -5,8 +5,8 @@ import ( "fmt" "math/big" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/core" ) type baseBuilder struct { diff --git a/builders/interface.go b/builders/interface.go index a40de388..a56a3640 100644 --- a/builders/interface.go +++ b/builders/interface.go @@ -3,9 +3,9 @@ package builders import ( "math/big" - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // TxDataBuilder defines the behavior of a transaction data builder diff --git a/builders/relayedTxV1Builder.go b/builders/relayedTxV1Builder.go index e8107342..ec669b70 100644 --- a/builders/relayedTxV1Builder.go +++ b/builders/relayedTxV1Builder.go @@ -5,9 +5,9 @@ import ( "encoding/json" "math/big" - "github.com/ElrondNetwork/elrond-go-core/data/transaction" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/data/transaction" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) type relayedTxV1Builder struct { diff --git a/builders/relayedTxV1Builder_test.go b/builders/relayedTxV1Builder_test.go index 7d12e8bf..09e8c063 100644 --- a/builders/relayedTxV1Builder_test.go +++ b/builders/relayedTxV1Builder_test.go @@ -5,11 +5,11 @@ import ( "encoding/json" "testing" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-crypto-go/signing" + "github.com/multiversx/mx-chain-crypto-go/signing/ed25519" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" "github.com/stretchr/testify/require" ) diff --git a/builders/relayedTxV2Builder.go b/builders/relayedTxV2Builder.go index ad99f2cb..e8d13f18 100644 --- a/builders/relayedTxV2Builder.go +++ b/builders/relayedTxV2Builder.go @@ -5,8 +5,8 @@ import ( "fmt" "math/big" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) type relayedTxV2Builder struct { diff --git a/builders/relayedTxV2Builder_test.go b/builders/relayedTxV2Builder_test.go index 7ac9c5b4..8b007fbe 100644 --- a/builders/relayedTxV2Builder_test.go +++ b/builders/relayedTxV2Builder_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/data" "github.com/stretchr/testify/require" ) diff --git a/builders/txBuilder.go b/builders/txBuilder.go index 127a5b3e..e01a0f9c 100644 --- a/builders/txBuilder.go +++ b/builders/txBuilder.go @@ -4,12 +4,12 @@ import ( "encoding/hex" "math/big" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-core/data/transaction" - "github.com/ElrondNetwork/elrond-go-core/hashing/blake2b" - "github.com/ElrondNetwork/elrond-go-core/marshal" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-core-go/data/transaction" + "github.com/multiversx/mx-chain-core-go/hashing/blake2b" + "github.com/multiversx/mx-chain-core-go/marshal" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) var ( diff --git a/builders/txBuilder_test.go b/builders/txBuilder_test.go index f15b30ee..5505a3f5 100644 --- a/builders/txBuilder_test.go +++ b/builders/txBuilder_test.go @@ -6,13 +6,13 @@ import ( "math/big" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core/check" + 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" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/builders/txDataBuilder.go b/builders/txDataBuilder.go index d21b0bc5..c4f51bc0 100644 --- a/builders/txDataBuilder.go +++ b/builders/txDataBuilder.go @@ -4,7 +4,7 @@ import ( "math/big" "strings" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + "github.com/multiversx/mx-sdk-go/core" ) const dataSeparator = "@" diff --git a/builders/txDataBuilder_test.go b/builders/txDataBuilder_test.go index b6ad3643..35ee03c2 100644 --- a/builders/txDataBuilder_test.go +++ b/builders/txDataBuilder_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/data" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/builders/vmQueryBuilder.go b/builders/vmQueryBuilder.go index a7d5fbe5..eed853d0 100644 --- a/builders/vmQueryBuilder.go +++ b/builders/vmQueryBuilder.go @@ -3,8 +3,8 @@ package builders import ( "math/big" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) type vmQueryBuilder struct { diff --git a/builders/vmQueryBuilder_test.go b/builders/vmQueryBuilder_test.go index 2ee1cb64..bb1dd9ad 100644 --- a/builders/vmQueryBuilder_test.go +++ b/builders/vmQueryBuilder_test.go @@ -6,8 +6,8 @@ import ( "math/big" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-sdk-go/data" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/core/http/clientWrapper.go b/core/http/clientWrapper.go index e63debe8..4d048996 100644 --- a/core/http/clientWrapper.go +++ b/core/http/clientWrapper.go @@ -7,7 +7,7 @@ import ( "io/ioutil" "net/http" - "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/multiversx/mx-chain-core-go/core/check" ) const ( diff --git a/core/http/clientWrapper_test.go b/core/http/clientWrapper_test.go index 049f1f1a..152ffb92 100644 --- a/core/http/clientWrapper_test.go +++ b/core/http/clientWrapper_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" + "github.com/multiversx/mx-chain-core-go/core/check" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/core/interface.go b/core/interface.go index 641b364d..76394db8 100644 --- a/core/interface.go +++ b/core/interface.go @@ -1,6 +1,6 @@ package core -import crypto "github.com/ElrondNetwork/elrond-go-crypto" +import crypto "github.com/multiversx/mx-chain-crypto-go" // AddressHandler will handle different implementations of an address type AddressHandler interface { diff --git a/core/polling/pollingHandler.go b/core/polling/pollingHandler.go index 87e97d36..13f204a1 100644 --- a/core/polling/pollingHandler.go +++ b/core/polling/pollingHandler.go @@ -6,8 +6,8 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" ) const minimumPollingInterval = time.Millisecond diff --git a/core/polling/pollingHandler_test.go b/core/polling/pollingHandler_test.go index e2d2d53a..a40bf1a0 100644 --- a/core/polling/pollingHandler_test.go +++ b/core/polling/pollingHandler_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core/polling/mock" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/core/polling/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/core/variables.go b/core/variables.go index 7a3f2f59..f317a61e 100644 --- a/core/variables.go +++ b/core/variables.go @@ -1,8 +1,8 @@ package core import ( - "github.com/ElrondNetwork/elrond-go-core/core/pubkeyConverter" - logger "github.com/ElrondNetwork/elrond-go-logger" + "github.com/multiversx/mx-chain-core-go/core/pubkeyConverter" + logger "github.com/multiversx/mx-chain-logger-go" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/core") diff --git a/data/address.go b/data/address.go index 8ea4a60f..a33a97ef 100644 --- a/data/address.go +++ b/data/address.go @@ -1,6 +1,6 @@ package data -import "github.com/ElrondNetwork/elrond-sdk-erdgo/core" +import "github.com/multiversx/mx-sdk-go/core" type address struct { bytes []byte diff --git a/data/enableEpochsConfig.go b/data/enableEpochsConfig.go index 0d2fa5de..cb9f5a51 100644 --- a/data/enableEpochsConfig.go +++ b/data/enableEpochsConfig.go @@ -1,6 +1,6 @@ package data -import "github.com/ElrondNetwork/elrond-go/config" +import "github.com/multiversx/mx-chain-go/config" // EnableEpochsConfigResponse holds the enable epochs config endpoint response type EnableEpochsConfigResponse struct { diff --git a/data/nodeConfig.go b/data/nodeConfig.go index e3463fe4..7e29c6b8 100644 --- a/data/nodeConfig.go +++ b/data/nodeConfig.go @@ -1,6 +1,6 @@ package data -import "github.com/ElrondNetwork/elrond-go/state" +import "github.com/multiversx/mx-chain-go/state" // GenesisNodesResponse holds the network genesis nodes endpoint reponse type GenesisNodesResponse struct { diff --git a/data/transaction.go b/data/transaction.go index 456341b7..c221a8b4 100644 --- a/data/transaction.go +++ b/data/transaction.go @@ -1,6 +1,6 @@ package data -import "github.com/ElrondNetwork/elrond-go-core/data/transaction" +import "github.com/multiversx/mx-chain-core-go/data/transaction" // SendTransactionResponse holds the response received from the network when broadcasting a transaction type SendTransactionResponse struct { diff --git a/data/vmValues.go b/data/vmValues.go index 3c480729..f966c2d1 100644 --- a/data/vmValues.go +++ b/data/vmValues.go @@ -1,7 +1,7 @@ package data import ( - "github.com/ElrondNetwork/elrond-go-core/data/vm" + "github.com/multiversx/mx-chain-core-go/data/vm" ) // VmValuesResponseData follows the format of the data field in an API response for a VM values query diff --git a/disabled/accounts.go b/disabled/accounts.go index 9ba03da0..9c3566d0 100644 --- a/disabled/accounts.go +++ b/disabled/accounts.go @@ -3,9 +3,9 @@ package disabled import ( "context" - "github.com/ElrondNetwork/elrond-go/common" - "github.com/ElrondNetwork/elrond-go/state" - vmcommon "github.com/ElrondNetwork/elrond-vm-common" + "github.com/multiversx/mx-chain-go/common" + "github.com/multiversx/mx-chain-go/state" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) // Accounts is a disabled implementation of the AccountAdapter interface diff --git a/disabled/blockchain.go b/disabled/blockchain.go index 137f1c2d..57b8e6f1 100644 --- a/disabled/blockchain.go +++ b/disabled/blockchain.go @@ -1,7 +1,7 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/multiversx/mx-chain-core-go/data" ) // Blockchain is a disabled implementation of the ChainHandler interface diff --git a/disabled/blockchainHookCounter.go b/disabled/blockchainHookCounter.go index f082cf9c..49e9596b 100644 --- a/disabled/blockchainHookCounter.go +++ b/disabled/blockchainHookCounter.go @@ -1,6 +1,6 @@ package disabled -import vmcommon "github.com/ElrondNetwork/elrond-vm-common" +import vmcommon "github.com/multiversx/mx-chain-vm-common-go" // BlockChainHookCounter is a disabled implementation of BlockChainHookCounter interface type BlockChainHookCounter struct { @@ -24,6 +24,11 @@ func (bhc *BlockChainHookCounter) ResetCounters() { func (bhc *BlockChainHookCounter) SetMaximumValues(_ map[string]uint64) { } +// GetCounterValues - +func (bhc *BlockChainHookCounter) GetCounterValues() map[string]uint64 { + return make(map[string]uint64) +} + // IsInterfaceNil returns true if there is no value under the interface func (bhc *BlockChainHookCounter) IsInterfaceNil() bool { return bhc == nil diff --git a/disabled/builtInFunctionContainer.go b/disabled/builtInFunctionContainer.go index 47f1e1d7..707aabe8 100644 --- a/disabled/builtInFunctionContainer.go +++ b/disabled/builtInFunctionContainer.go @@ -3,7 +3,7 @@ package disabled import ( "errors" - vmcommon "github.com/ElrondNetwork/elrond-vm-common" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) var errNotImplemented = errors.New("not implemented") diff --git a/disabled/datapool.go b/disabled/datapool.go index 4d9ace68..249f72ce 100644 --- a/disabled/datapool.go +++ b/disabled/datapool.go @@ -1,8 +1,8 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go/dataRetriever" - "github.com/ElrondNetwork/elrond-go/storage" + "github.com/multiversx/mx-chain-go/dataRetriever" + "github.com/multiversx/mx-chain-go/storage" ) // DataPool is the disabled implementation of a PoolsHolder interface diff --git a/disabled/enableEpochsHandler.go b/disabled/enableEpochsHandler.go index b4fc3d5d..db449389 100644 --- a/disabled/enableEpochsHandler.go +++ b/disabled/enableEpochsHandler.go @@ -548,6 +548,16 @@ func (eeh *EnableEpochsHandler) IsRuntimeMemStoreLimitEnabled() bool { return false } +// IsWipeSingleNFTLiquidityDecreaseEnabled - +func (eeh *EnableEpochsHandler) IsWipeSingleNFTLiquidityDecreaseEnabled() bool { + return false +} + +// IsAlwaysSaveTokenMetaDataEnabled - +func (eeh *EnableEpochsHandler) IsAlwaysSaveTokenMetaDataEnabled() bool { + return false +} + // IsInterfaceNil returns true if there is no value under the interface func (eeh *EnableEpochsHandler) IsInterfaceNil() bool { return eeh == nil diff --git a/disabled/epochNotifier.go b/disabled/epochNotifier.go index af4ba104..3dc0d655 100644 --- a/disabled/epochNotifier.go +++ b/disabled/epochNotifier.go @@ -1,8 +1,8 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go-core/data" - vmcommon "github.com/ElrondNetwork/elrond-vm-common" + "github.com/multiversx/mx-chain-core-go/data" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) // EpochNotifier is a disabled implementation of EpochNotifier interface diff --git a/disabled/epochStartNotifier.go b/disabled/epochStartNotifier.go index 6780697c..7701845a 100644 --- a/disabled/epochStartNotifier.go +++ b/disabled/epochStartNotifier.go @@ -1,7 +1,7 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go/epochStart" + "github.com/multiversx/mx-chain-go/epochStart" ) // EpochStartNotifier is a disabled implementation of EpochStartEventNotifier interface diff --git a/disabled/fallbackHeaderValidator.go b/disabled/fallbackHeaderValidator.go index e3bb1131..56e2dcc1 100644 --- a/disabled/fallbackHeaderValidator.go +++ b/disabled/fallbackHeaderValidator.go @@ -1,7 +1,7 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go-core/data" + "github.com/multiversx/mx-chain-core-go/data" ) // FallBackHeaderValidator is a disabled implementation of FallBackHeaderValidator interface diff --git a/disabled/gasScheduleNotifier.go b/disabled/gasScheduleNotifier.go index d5d72357..52545faa 100644 --- a/disabled/gasScheduleNotifier.go +++ b/disabled/gasScheduleNotifier.go @@ -1,6 +1,6 @@ package disabled -import "github.com/ElrondNetwork/elrond-go-core/core" +import "github.com/multiversx/mx-chain-core-go/core" // GasScheduleNotifier - type GasScheduleNotifier struct { diff --git a/disabled/nodeTypeProvider.go b/disabled/nodeTypeProvider.go index 8416ee52..189aa18d 100644 --- a/disabled/nodeTypeProvider.go +++ b/disabled/nodeTypeProvider.go @@ -1,7 +1,7 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go-core/core" + "github.com/multiversx/mx-chain-core-go/core" ) // NodeTypeProvider is a disabled implementation of NodeTypeProviderHandler interface diff --git a/disabled/simpleESDTNFTStorageHandler.go b/disabled/simpleESDTNFTStorageHandler.go index af2bbe39..fa80fc5c 100644 --- a/disabled/simpleESDTNFTStorageHandler.go +++ b/disabled/simpleESDTNFTStorageHandler.go @@ -1,9 +1,9 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go-core/data" - "github.com/ElrondNetwork/elrond-go-core/data/esdt" - vmcommon "github.com/ElrondNetwork/elrond-vm-common" + "github.com/multiversx/mx-chain-core-go/data" + "github.com/multiversx/mx-chain-core-go/data/esdt" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) // SimpleESDTNFTStorageHandler is a disabled implementation of SimpleESDTNFTStorageHandler interface diff --git a/disabled/storageService.go b/disabled/storageService.go index 136be702..feff79c0 100644 --- a/disabled/storageService.go +++ b/disabled/storageService.go @@ -1,8 +1,8 @@ package disabled import ( - "github.com/ElrondNetwork/elrond-go/dataRetriever" - "github.com/ElrondNetwork/elrond-go/storage" + "github.com/multiversx/mx-chain-go/dataRetriever" + "github.com/multiversx/mx-chain-go/storage" ) // StorageService is a disabled implementation of the StorageService interface diff --git a/disabled/storer.go b/disabled/storer.go index 15fc218d..1dde1c0d 100644 --- a/disabled/storer.go +++ b/disabled/storer.go @@ -1,6 +1,6 @@ package disabled -import "github.com/ElrondNetwork/elrond-go-core/storage" +import "github.com/multiversx/mx-chain-core-go/storage" // Storer is a disabled implementation of Storer interface type Storer struct { diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index 0134ecf2..f55c0691 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -5,11 +5,11 @@ import ( "fmt" "time" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/examples" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesAccount") diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index ef6f27d2..b32e37f6 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -5,10 +5,10 @@ import ( "encoding/json" "time" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/examples" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesBlock") diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index a67af9eb..be059b5a 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -9,15 +9,15 @@ import ( "strings" "time" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/builders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples/examplesFlowWalletTracker/mock" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" - "github.com/ElrondNetwork/elrond-sdk-erdgo/workflows" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/builders" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/examples" + "github.com/multiversx/mx-sdk-go/examples/examplesFlowWalletTracker/mock" + "github.com/multiversx/mx-sdk-go/interactors" + "github.com/multiversx/mx-sdk-go/workflows" ) const timeToExecuteRequest = time.Second diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index 87a8c0a4..b7a83115 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -4,12 +4,12 @@ import ( "context" "time" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-go/config" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" - "github.com/ElrondNetwork/elrond-sdk-erdgo/headerCheck" + "github.com/multiversx/mx-chain-go/config" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/examples" + "github.com/multiversx/mx-sdk-go/headerCheck" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesHeaderCheck") diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index f29fa911..d723e1f9 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -7,19 +7,19 @@ import ( "os/signal" "time" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/fetchers" - "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/mock" - "github.com/ElrondNetwork/elrond-sdk-erdgo/authentication" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core/polling" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "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-sdk-go/aggregator" + "github.com/multiversx/mx-sdk-go/aggregator/fetchers" + "github.com/multiversx/mx-sdk-go/aggregator/mock" + "github.com/multiversx/mx-sdk-go/authentication" + "github.com/multiversx/mx-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/core/polling" + "github.com/multiversx/mx-sdk-go/examples" + "github.com/multiversx/mx-sdk-go/interactors" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesPriceAggregator") diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 72475768..05f5421f 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -4,15 +4,15 @@ import ( "context" "time" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/builders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "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-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/builders" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/examples" + "github.com/multiversx/mx-sdk-go/interactors" ) var ( diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index e3ea09a1..dfa57909 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -4,11 +4,11 @@ import ( "context" "time" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/examples" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/blockchain" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/examples" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesVMQuery") diff --git a/examples/examplesWallet/main.go b/examples/examplesWallet/main.go index 54849936..31aee691 100644 --- a/examples/examplesWallet/main.go +++ b/examples/examplesWallet/main.go @@ -1,8 +1,8 @@ package main import ( - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/interactors" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesWallet") diff --git a/go.mod b/go.mod index b362cd75..83c7a3dd 100644 --- a/go.mod +++ b/go.mod @@ -1,27 +1,24 @@ -module github.com/ElrondNetwork/elrond-sdk-erdgo +module github.com/multiversx/mx-sdk-go go 1.17 require ( - github.com/ElrondNetwork/elrond-go v1.4.1-0.20221209102744-b2d7dbb950b4 - github.com/ElrondNetwork/elrond-go-core v1.1.26 - github.com/ElrondNetwork/elrond-go-crypto v1.2.2 - github.com/ElrondNetwork/elrond-go-logger v1.0.10 - github.com/ElrondNetwork/elrond-vm-common v1.3.30 github.com/gin-contrib/cors v1.4.0 github.com/gin-gonic/gin v1.8.1 github.com/gorilla/websocket v1.5.0 + github.com/multiversx/mx-chain-core-go v1.1.30 + github.com/multiversx/mx-chain-crypto-go v1.2.5 + github.com/multiversx/mx-chain-go v1.4.4 + github.com/multiversx/mx-chain-logger-go v1.0.11 + github.com/multiversx/mx-chain-vm-common-go v1.3.36 github.com/pborman/uuid v1.2.1 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 github.com/tyler-smith/go-bip39 v1.1.0 golang.org/x/crypto v0.3.0 golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b ) require ( - github.com/ElrondNetwork/concurrent-map v0.1.3 // indirect - github.com/ElrondNetwork/elrond-go-p2p v1.0.5 // indirect - github.com/ElrondNetwork/elrond-go-storage v1.0.4 // indirect github.com/beevik/ntp v0.3.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -114,6 +111,9 @@ require ( 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-p2p-go v1.0.10 // indirect + github.com/multiversx/mx-chain-storage-go v1.0.7 // 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 @@ -157,8 +157,4 @@ require ( lukechampine.com/blake3 v1.1.7 // indirect ) -replace github.com/ElrondNetwork/arwen-wasm-vm/v1_2 v1.2.41 => github.com/ElrondNetwork/arwen-wasm-vm v1.2.41 - -replace github.com/ElrondNetwork/arwen-wasm-vm/v1_3 v1.3.41 => github.com/ElrondNetwork/arwen-wasm-vm v1.3.41 - -replace github.com/ElrondNetwork/arwen-wasm-vm/v1_4 v1.4.58 => github.com/ElrondNetwork/arwen-wasm-vm v1.4.58 +replace github.com/gogo/protobuf => github.com/multiversx/protobuf v1.3.2 diff --git a/go.sum b/go.sum index abfd1367..ab3b1586 100644 --- a/go.sum +++ b/go.sum @@ -42,35 +42,6 @@ github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOv github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= 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/ElrondNetwork/big-int-util v0.1.0 h1:vTMoJ5azhVmr7jhpSD3JUjQdkdyXoEPVkOvhdw1RjV4= -github.com/ElrondNetwork/big-int-util v0.1.0/go.mod h1:96viBvoTXLjZOhEvE0D+QnAwg1IJLPAK6GVHMbC7Aw4= -github.com/ElrondNetwork/concurrent-map v0.1.3 h1:j2LtPrNJuerannC1cQDE79STvi/P04gd61sNYo04Zf0= -github.com/ElrondNetwork/concurrent-map v0.1.3/go.mod h1:3XwSwn4JHI0lrKxWLZvtp53Emr8BXYTmNQGwcukHJEE= -github.com/ElrondNetwork/elastic-indexer-go v1.3.3 h1:RgJ043yt92PUWMbSAQHRrC+GiyNnFdwdM/kseHlpLoo= -github.com/ElrondNetwork/elastic-indexer-go v1.3.3/go.mod h1:E3VO5712GkGSGYnOTJ+0wxW74JXgjV6XCRPlcHiTTK0= -github.com/ElrondNetwork/elrond-go v1.4.1-0.20221209102744-b2d7dbb950b4 h1:Z2WIuaC5Y2i1NiOAu9/BcTmeFJhq5aWJRj0nBYUwI6w= -github.com/ElrondNetwork/elrond-go v1.4.1-0.20221209102744-b2d7dbb950b4/go.mod h1:Wu2Zfw1UjbFT4E47SlF2rfYnn9UTB9CWosa4oar7NQY= -github.com/ElrondNetwork/elrond-go-core v1.1.26 h1:5syiJMlkWlH7HHnuiOafJJzeI+oUfYqL8mXREqrFerY= -github.com/ElrondNetwork/elrond-go-core v1.1.26/go.mod h1:N/RI++YU2M6OlnD1GSZepc1wPhI84ykRDQ1IyD3B0wk= -github.com/ElrondNetwork/elrond-go-crypto v1.2.2 h1:Q59dZUeyibuskq5vjgk3ng/87ifOcd9YZMTnlYJAuIU= -github.com/ElrondNetwork/elrond-go-crypto v1.2.2/go.mod h1:MyQPKUKti7Axnx/eihhL0F2jLTalvSV/Ytv1mIxvYyM= -github.com/ElrondNetwork/elrond-go-logger v1.0.10 h1:2xQOWZErcHW5sl9qSRO+7mGNw+QhFhqiUlLLtOgvuuk= -github.com/ElrondNetwork/elrond-go-logger v1.0.10/go.mod h1:+rMODFw4yQptTi5WuLUBzvl/AE26V+2YJtc52wX30Eg= -github.com/ElrondNetwork/elrond-go-p2p v1.0.5 h1:XzuieXEKrVSQ9gKKO3sq60RRZC29IRYgmn7RsPmgUOA= -github.com/ElrondNetwork/elrond-go-p2p v1.0.5/go.mod h1:yCdKTQWNHNKrrQAK5xx1uQT02BEiumjz88I/fk5m1f8= -github.com/ElrondNetwork/elrond-go-storage v1.0.2/go.mod h1:SRsv4hUtL1BCiQe0eADth3C0EZH9baijzIJDCUitR34= -github.com/ElrondNetwork/elrond-go-storage v1.0.4 h1:esyXbHQvlR6m4HGeC86Nq0xAJ74+QG9EnUgfG+wQDYQ= -github.com/ElrondNetwork/elrond-go-storage v1.0.4/go.mod h1:SRsv4hUtL1BCiQe0eADth3C0EZH9baijzIJDCUitR34= -github.com/ElrondNetwork/elrond-vm-common v1.3.27/go.mod h1:3GKLv9hUFYEVxoBgtaCmaZo9HMNfKN9mM/O/xX83Rbw= -github.com/ElrondNetwork/elrond-vm-common v1.3.28/go.mod h1:3GKLv9hUFYEVxoBgtaCmaZo9HMNfKN9mM/O/xX83Rbw= -github.com/ElrondNetwork/elrond-vm-common v1.3.30 h1:nLMORp46GcvK9qwx/Iiz+8h/MB5qlPppaX+VJikOz8I= -github.com/ElrondNetwork/elrond-vm-common v1.3.30/go.mod h1:3GKLv9hUFYEVxoBgtaCmaZo9HMNfKN9mM/O/xX83Rbw= -github.com/ElrondNetwork/wasm-vm-v1_2 v1.2.48 h1:il52OCaEpYDQFRkUtlsBwBqnbpkoN9S2FAnjF4z3VHk= -github.com/ElrondNetwork/wasm-vm-v1_2 v1.2.48/go.mod h1:xcs02SDXqF//9zFUcgzBY3jpGQKJ4AiO2pTa8ZgS6zs= -github.com/ElrondNetwork/wasm-vm-v1_3 v1.3.48 h1:jgR6oWmbXGFDdAoPSny1ibRsm9/JRQIc/hbtl8JcYsA= -github.com/ElrondNetwork/wasm-vm-v1_3 v1.3.48/go.mod h1:ZyuArzcU3qq34mrW06QPTU2w1xcla6tj+BcTQtcanP4= -github.com/ElrondNetwork/wasm-vm-v1_4 v1.4.68 h1:fVasWb4cE1DbmE1Eq0yit3yu0zq6V4G5M9anEgLAZ3s= -github.com/ElrondNetwork/wasm-vm-v1_4 v1.4.68/go.mod h1:LM/5+DfBaI36NL77Xp1XyH+8ozuGOEPJlOAaDtiKW8g= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -99,8 +70,9 @@ github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= @@ -237,12 +209,6 @@ github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -417,9 +383,7 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= @@ -623,6 +587,35 @@ github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= 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-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-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= +github.com/multiversx/mx-chain-p2p-go v1.0.10/go.mod h1:j9Ueo2ptCnL7TQvQg6KS/KWAoJEJpjkPgE5ZTaqEAn4= +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-components-big-int v0.1.1/go.mod h1:0QrcFdfeLgJ/am10HGBeH0G0DNF+0Qx1E4DS/iozQls= +github.com/multiversx/protobuf v1.3.2 h1:RaNkxvGTGbA0lMcnHAN24qE1G1i+Xs5yHA6MDvQ4mSM= +github.com/multiversx/protobuf v1.3.2/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= 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/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= @@ -759,6 +752,7 @@ github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 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= @@ -766,8 +760,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= 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= @@ -1086,7 +1081,6 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb 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= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1132,12 +1126,10 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= diff --git a/headerCheck/export_test.go b/headerCheck/export_test.go index a56e1cb3..eb1cd263 100644 --- a/headerCheck/export_test.go +++ b/headerCheck/export_test.go @@ -3,7 +3,7 @@ package headerCheck import ( "context" - coreData "github.com/ElrondNetwork/elrond-go-core/data" + coreData "github.com/multiversx/mx-chain-core-go/data" ) func (hch *headerVerifier) FetchHeaderByHashAndShard(ctx context.Context, shardId uint32, hash string) (coreData.HeaderHandler, error) { diff --git a/headerCheck/factory/coreComponents.go b/headerCheck/factory/coreComponents.go index 02df0785..d1477528 100644 --- a/headerCheck/factory/coreComponents.go +++ b/headerCheck/factory/coreComponents.go @@ -1,19 +1,19 @@ package factory import ( - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/pubkeyConverter" - "github.com/ElrondNetwork/elrond-go-core/hashing" - hasherFactory "github.com/ElrondNetwork/elrond-go-core/hashing/factory" - "github.com/ElrondNetwork/elrond-go-core/marshal" - marshalizerFactory "github.com/ElrondNetwork/elrond-go-core/marshal/factory" - "github.com/ElrondNetwork/elrond-go/common" - "github.com/ElrondNetwork/elrond-go/common/enablers" - "github.com/ElrondNetwork/elrond-go/config" - "github.com/ElrondNetwork/elrond-go/process/rating" - "github.com/ElrondNetwork/elrond-go/sharding/nodesCoordinator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/disabled" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/pubkeyConverter" + "github.com/multiversx/mx-chain-core-go/hashing" + hasherFactory "github.com/multiversx/mx-chain-core-go/hashing/factory" + "github.com/multiversx/mx-chain-core-go/marshal" + marshalizerFactory "github.com/multiversx/mx-chain-core-go/marshal/factory" + "github.com/multiversx/mx-chain-go/common" + "github.com/multiversx/mx-chain-go/common/enablers" + "github.com/multiversx/mx-chain-go/config" + "github.com/multiversx/mx-chain-go/process/rating" + "github.com/multiversx/mx-chain-go/sharding/nodesCoordinator" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/disabled" ) const ( diff --git a/headerCheck/factory/cryptoComponents.go b/headerCheck/factory/cryptoComponents.go index e90921ae..5821a457 100644 --- a/headerCheck/factory/cryptoComponents.go +++ b/headerCheck/factory/cryptoComponents.go @@ -1,13 +1,13 @@ package factory import ( - "github.com/ElrondNetwork/elrond-go-core/hashing/blake2b" - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - disabledSig "github.com/ElrondNetwork/elrond-go-crypto/signing/disabled/singlesig" - "github.com/ElrondNetwork/elrond-go-crypto/signing/mcl" - mclMultiSig "github.com/ElrondNetwork/elrond-go-crypto/signing/mcl/multisig" - "github.com/ElrondNetwork/elrond-go-crypto/signing/multisig" + "github.com/multiversx/mx-chain-core-go/hashing/blake2b" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-chain-crypto-go/signing" + disabledSig "github.com/multiversx/mx-chain-crypto-go/signing/disabled/singlesig" + "github.com/multiversx/mx-chain-crypto-go/signing/mcl" + mclMultiSig "github.com/multiversx/mx-chain-crypto-go/signing/mcl/multisig" + "github.com/multiversx/mx-chain-crypto-go/signing/multisig" ) type cryptoComponents struct { diff --git a/headerCheck/factory/nodesCoordinator.go b/headerCheck/factory/nodesCoordinator.go index ef8775c7..c068865e 100644 --- a/headerCheck/factory/nodesCoordinator.go +++ b/headerCheck/factory/nodesCoordinator.go @@ -1,15 +1,15 @@ package factory import ( - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/data/endProcess" - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-go/common" - "github.com/ElrondNetwork/elrond-go/config" - "github.com/ElrondNetwork/elrond-go/dataRetriever/dataPool" - "github.com/ElrondNetwork/elrond-go/sharding/nodesCoordinator" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/disabled" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/data/endProcess" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-chain-go/common" + "github.com/multiversx/mx-chain-go/config" + "github.com/multiversx/mx-chain-go/dataRetriever/dataPool" + "github.com/multiversx/mx-chain-go/sharding/nodesCoordinator" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/disabled" ) const ( diff --git a/headerCheck/headerCheck.go b/headerCheck/headerCheck.go index c08e8868..31f1f018 100644 --- a/headerCheck/headerCheck.go +++ b/headerCheck/headerCheck.go @@ -3,11 +3,11 @@ package headerCheck import ( "context" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - coreData "github.com/ElrondNetwork/elrond-go-core/data" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-go/sharding/nodesCoordinator" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + coreData "github.com/multiversx/mx-chain-core-go/data" + "github.com/multiversx/mx-chain-go/sharding/nodesCoordinator" + logger "github.com/multiversx/mx-chain-logger-go" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/headerCheck") diff --git a/headerCheck/headerCheckFactory.go b/headerCheck/headerCheckFactory.go index 6c5674ca..ac626812 100644 --- a/headerCheck/headerCheckFactory.go +++ b/headerCheck/headerCheckFactory.go @@ -3,12 +3,12 @@ package headerCheck import ( "context" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go/factory/crypto" - "github.com/ElrondNetwork/elrond-go/process/headerCheck" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/disabled" - "github.com/ElrondNetwork/elrond-sdk-erdgo/headerCheck/factory" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-go/factory/crypto" + "github.com/multiversx/mx-chain-go/process/headerCheck" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/disabled" + "github.com/multiversx/mx-sdk-go/headerCheck/factory" ) // NewHeaderCheckHandler will create all components needed for header diff --git a/headerCheck/headerCheck_test.go b/headerCheck/headerCheck_test.go index c1200e3a..e1f68da3 100644 --- a/headerCheck/headerCheck_test.go +++ b/headerCheck/headerCheck_test.go @@ -5,12 +5,12 @@ import ( "errors" "testing" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-core/data" - "github.com/ElrondNetwork/elrond-go-core/data/block" - "github.com/ElrondNetwork/elrond-sdk-erdgo/headerCheck" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-core-go/data" + "github.com/multiversx/mx-chain-core-go/data/block" + "github.com/multiversx/mx-sdk-go/headerCheck" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/headerCheck/interface.go b/headerCheck/interface.go index 3c38ee35..a82c2b09 100644 --- a/headerCheck/interface.go +++ b/headerCheck/interface.go @@ -3,9 +3,9 @@ package headerCheck import ( "context" - coreData "github.com/ElrondNetwork/elrond-go-core/data" - "github.com/ElrondNetwork/elrond-go/state" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + coreData "github.com/multiversx/mx-chain-core-go/data" + "github.com/multiversx/mx-chain-go/state" + "github.com/multiversx/mx-sdk-go/data" ) // Proxy holds the behaviour needed for header verifier in order to interact with proxy diff --git a/headerCheck/rawHeaderHandler.go b/headerCheck/rawHeaderHandler.go index fce33d24..13638b39 100644 --- a/headerCheck/rawHeaderHandler.go +++ b/headerCheck/rawHeaderHandler.go @@ -3,13 +3,13 @@ package headerCheck import ( "context" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-core/data" - "github.com/ElrondNetwork/elrond-go-core/data/block" - "github.com/ElrondNetwork/elrond-go-core/marshal" - "github.com/ElrondNetwork/elrond-go/process" - "github.com/ElrondNetwork/elrond-go/state" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-core-go/data" + "github.com/multiversx/mx-chain-core-go/data/block" + "github.com/multiversx/mx-chain-core-go/marshal" + "github.com/multiversx/mx-chain-go/process" + "github.com/multiversx/mx-chain-go/state" ) type rawHeaderHandler struct { diff --git a/headerCheck/rawHeaderHandler_test.go b/headerCheck/rawHeaderHandler_test.go index 1d7fce84..67e82727 100644 --- a/headerCheck/rawHeaderHandler_test.go +++ b/headerCheck/rawHeaderHandler_test.go @@ -6,11 +6,11 @@ import ( "errors" "testing" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-core/data/block" - "github.com/ElrondNetwork/elrond-go/state" - "github.com/ElrondNetwork/elrond-sdk-erdgo/headerCheck" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-core-go/data/block" + "github.com/multiversx/mx-chain-go/state" + "github.com/multiversx/mx-sdk-go/headerCheck" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/interactors/interface.go b/interactors/interface.go index e4061968..94a8026a 100644 --- a/interactors/interface.go +++ b/interactors/interface.go @@ -3,8 +3,8 @@ package interactors import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // Proxy holds the primitive functions that the elrond proxy engine supports & implements diff --git a/interactors/nonceHandlerV1/addressNonceHandler.go b/interactors/nonceHandlerV1/addressNonceHandler.go index 514ca97b..9618594e 100644 --- a/interactors/nonceHandlerV1/addressNonceHandler.go +++ b/interactors/nonceHandlerV1/addressNonceHandler.go @@ -5,10 +5,10 @@ import ( "context" "sync" - "github.com/ElrondNetwork/elrond-go-core/core" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" ) // addressNonceHandler is the handler used for one address. It is able to handle the current diff --git a/interactors/nonceHandlerV1/nonceTransactionsHandler.go b/interactors/nonceHandlerV1/nonceTransactionsHandler.go index 30cda069..9f2059f4 100644 --- a/interactors/nonceHandlerV1/nonceTransactionsHandler.go +++ b/interactors/nonceHandlerV1/nonceTransactionsHandler.go @@ -6,11 +6,11 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" ) const minimumIntervalToResend = time.Second diff --git a/interactors/nonceHandlerV1/nonceTransactionsHandler_test.go b/interactors/nonceHandlerV1/nonceTransactionsHandler_test.go index b3cebe4c..e9debdb5 100644 --- a/interactors/nonceHandlerV1/nonceTransactionsHandler_test.go +++ b/interactors/nonceHandlerV1/nonceTransactionsHandler_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/interactors/nonceHandlerV2/addressNonceHandler.go b/interactors/nonceHandlerV2/addressNonceHandler.go index 704f6bf1..8f7dd9ca 100644 --- a/interactors/nonceHandlerV2/addressNonceHandler.go +++ b/interactors/nonceHandlerV2/addressNonceHandler.go @@ -5,11 +5,11 @@ import ( "context" "sync" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" ) //TODO EN-13182: create a baseAddressNonceHandler component that can remove the duplicate code as much as possible from the diff --git a/interactors/nonceHandlerV2/addressNonceHandlerCreator.go b/interactors/nonceHandlerV2/addressNonceHandlerCreator.go index 91438b87..a6f81b2d 100644 --- a/interactors/nonceHandlerV2/addressNonceHandlerCreator.go +++ b/interactors/nonceHandlerV2/addressNonceHandlerCreator.go @@ -1,8 +1,8 @@ package nonceHandlerV2 import ( - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/interactors" ) // AddressNonceHandlerCreator is used to create addressNonceHandler instances diff --git a/interactors/nonceHandlerV2/addressNonceHandlerCreator_test.go b/interactors/nonceHandlerV2/addressNonceHandlerCreator_test.go index 8228610b..8583a9ad 100644 --- a/interactors/nonceHandlerV2/addressNonceHandlerCreator_test.go +++ b/interactors/nonceHandlerV2/addressNonceHandlerCreator_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/require" ) diff --git a/interactors/nonceHandlerV2/addressNonceHandler_test.go b/interactors/nonceHandlerV2/addressNonceHandler_test.go index 75ce71cd..9dd3d82e 100644 --- a/interactors/nonceHandlerV2/addressNonceHandler_test.go +++ b/interactors/nonceHandlerV2/addressNonceHandler_test.go @@ -6,10 +6,10 @@ import ( "errors" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/interactors/nonceHandlerV2/export_test.go b/interactors/nonceHandlerV2/export_test.go index 120cd4ea..5291c776 100644 --- a/interactors/nonceHandlerV2/export_test.go +++ b/interactors/nonceHandlerV2/export_test.go @@ -1,10 +1,10 @@ package nonceHandlerV2 import ( - "github.com/ElrondNetwork/elrond-go-core/core/check" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core/check" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" ) // NewAddressNonceHandlerWithPrivateAccess - diff --git a/interactors/nonceHandlerV2/nonceTransactionsHandler.go b/interactors/nonceHandlerV2/nonceTransactionsHandler.go index e640ad2f..e4d68597 100644 --- a/interactors/nonceHandlerV2/nonceTransactionsHandler.go +++ b/interactors/nonceHandlerV2/nonceTransactionsHandler.go @@ -6,11 +6,11 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" ) const minimumIntervalToResend = time.Second diff --git a/interactors/nonceHandlerV2/nonceTransactionsHandler_test.go b/interactors/nonceHandlerV2/nonceTransactionsHandler_test.go index f36e4190..6d7b080a 100644 --- a/interactors/nonceHandlerV2/nonceTransactionsHandler_test.go +++ b/interactors/nonceHandlerV2/nonceTransactionsHandler_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" - testsInteractors "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon/interactors" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" + "github.com/multiversx/mx-sdk-go/testsCommon" + testsInteractors "github.com/multiversx/mx-sdk-go/testsCommon/interactors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler.go b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler.go index 06513b14..1a34c292 100644 --- a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler.go +++ b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler.go @@ -4,11 +4,11 @@ import ( "context" "sync" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go-core/core/check" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-core-go/core/check" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" ) type singleTransactionAddressNonceHandler struct { diff --git a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator.go b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator.go index b5f038fb..5f9b7b56 100644 --- a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator.go +++ b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator.go @@ -1,8 +1,8 @@ package nonceHandlerV2 import ( - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/interactors" ) // SingleTransactionAddressNonceHandlerCreator is used to create singleTransactionAddressNonceHandler instances diff --git a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator_test.go b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator_test.go index e62a7b4f..36e2f6e6 100644 --- a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator_test.go +++ b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandlerCreator_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/require" ) diff --git a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler_test.go b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler_test.go index 0ca80eec..25fc0510 100644 --- a/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler_test.go +++ b/interactors/nonceHandlerV2/singleTransactionAddressNonceHandler_test.go @@ -5,10 +5,10 @@ import ( "crypto/rand" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/interactors" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/interactors/transaction.go b/interactors/transaction.go index adaebde3..88f0f1a7 100644 --- a/interactors/transaction.go +++ b/interactors/transaction.go @@ -5,9 +5,9 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - logger "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/data" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors") diff --git a/interactors/transaction_test.go b/interactors/transaction_test.go index 48d8c87e..01df7dc8 100644 --- a/interactors/transaction_test.go +++ b/interactors/transaction_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/ElrondNetwork/elrond-sdk-erdgo/builders" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" - "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon" + "github.com/multiversx/mx-sdk-go/builders" + "github.com/multiversx/mx-sdk-go/data" + "github.com/multiversx/mx-sdk-go/testsCommon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/interactors/wallet.go b/interactors/wallet.go index e0054dde..d559e84a 100644 --- a/interactors/wallet.go +++ b/interactors/wallet.go @@ -16,10 +16,10 @@ import ( "io/ioutil" "os" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-crypto-go/signing" + "github.com/multiversx/mx-chain-crypto-go/signing/ed25519" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" "github.com/pborman/uuid" "github.com/tyler-smith/go-bip39" "golang.org/x/crypto/scrypt" diff --git a/interactors/wallet_test.go b/interactors/wallet_test.go index 9f01f399..280dee46 100644 --- a/interactors/wallet_test.go +++ b/interactors/wallet_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/data" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/libraries/libbls/libbls.go b/libraries/libbls/libbls.go index cc376346..be1323c7 100644 --- a/libraries/libbls/libbls.go +++ b/libraries/libbls/libbls.go @@ -4,9 +4,9 @@ import ( "encoding/hex" "log" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/mcl" - "github.com/ElrondNetwork/elrond-go-crypto/signing/mcl/singlesig" + "github.com/multiversx/mx-chain-crypto-go/signing" + "github.com/multiversx/mx-chain-crypto-go/signing/mcl" + "github.com/multiversx/mx-chain-crypto-go/signing/mcl/singlesig" ) var ( diff --git a/libraries/libbls/libbls.h b/libraries/libbls/libbls.h index ee1f1b37..2ae4d8a9 100644 --- a/libraries/libbls/libbls.h +++ b/libraries/libbls/libbls.h @@ -1,6 +1,6 @@ /* Code generated by cmd/cgo; DO NOT EDIT. */ -/* package github.com/ElrondNetwork/elrond-sdk-erdgo/libraries/libbls */ +/* package github.com/multiversx/mx-sdk-go/libraries/libbls */ #line 1 "cgo-builtin-export-prolog" diff --git a/serde/deserializer_test.go b/serde/deserializer_test.go index e227e56a..df8ebc66 100644 --- a/serde/deserializer_test.go +++ b/serde/deserializer_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - "github.com/ElrondNetwork/elrond-sdk-erdgo/serde/testingMocks" + "github.com/multiversx/mx-sdk-go/serde/testingMocks" "github.com/stretchr/testify/assert" ) diff --git a/storage/mapCacher.go b/storage/mapCacher.go index f56da1d2..cfa9b8cb 100644 --- a/storage/mapCacher.go +++ b/storage/mapCacher.go @@ -5,7 +5,7 @@ import ( "encoding/gob" "sync" - logger "github.com/ElrondNetwork/elrond-go-logger" + logger "github.com/multiversx/mx-chain-logger-go" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/storage") diff --git a/testsCommon/cryptoComponentsHolderStub.go b/testsCommon/cryptoComponentsHolderStub.go index f24a7bee..af584ea9 100644 --- a/testsCommon/cryptoComponentsHolderStub.go +++ b/testsCommon/cryptoComponentsHolderStub.go @@ -1,8 +1,8 @@ package testsCommon import ( - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-sdk-go/core" ) // CryptoComponentsHolderStub - diff --git a/testsCommon/headerSigVerifierStub.go b/testsCommon/headerSigVerifierStub.go index 07c3d8b4..befbb1f0 100644 --- a/testsCommon/headerSigVerifierStub.go +++ b/testsCommon/headerSigVerifierStub.go @@ -1,6 +1,6 @@ package testsCommon -import "github.com/ElrondNetwork/elrond-go-core/data" +import "github.com/multiversx/mx-chain-core-go/data" // HeaderSigVerifierStub - type HeaderSigVerifierStub struct { diff --git a/testsCommon/interactors/addressNonceHandlerCreatorStub.go b/testsCommon/interactors/addressNonceHandlerCreatorStub.go index 0b6edf4c..87a7dc9e 100644 --- a/testsCommon/interactors/addressNonceHandlerCreatorStub.go +++ b/testsCommon/interactors/addressNonceHandlerCreatorStub.go @@ -1,8 +1,8 @@ package interactors import ( - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/interactors" ) // AddressNonceHandlerCreatorStub - diff --git a/testsCommon/nodesCoordinatorStub.go b/testsCommon/nodesCoordinatorStub.go index 732bf447..5e8f6228 100644 --- a/testsCommon/nodesCoordinatorStub.go +++ b/testsCommon/nodesCoordinatorStub.go @@ -1,8 +1,8 @@ package testsCommon import ( - "github.com/ElrondNetwork/elrond-go/sharding/nodesCoordinator" - "github.com/ElrondNetwork/elrond-go/state" + "github.com/multiversx/mx-chain-go/sharding/nodesCoordinator" + "github.com/multiversx/mx-chain-go/state" ) // NodesCoordinatorStub - diff --git a/testsCommon/privateKeyStub.go b/testsCommon/privateKeyStub.go index c5d1aeac..e06aa4f5 100644 --- a/testsCommon/privateKeyStub.go +++ b/testsCommon/privateKeyStub.go @@ -1,6 +1,6 @@ package testsCommon -import "github.com/ElrondNetwork/elrond-go-crypto" +import "github.com/multiversx/mx-chain-crypto-go" // PrivateKeyStub - type PrivateKeyStub struct { diff --git a/testsCommon/proxyStub.go b/testsCommon/proxyStub.go index 3f748cd2..653349a7 100644 --- a/testsCommon/proxyStub.go +++ b/testsCommon/proxyStub.go @@ -3,10 +3,10 @@ package testsCommon import ( "context" - "github.com/ElrondNetwork/elrond-go-core/core" - "github.com/ElrondNetwork/elrond-go/state" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core" + "github.com/multiversx/mx-chain-go/state" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // ProxyStub - diff --git a/testsCommon/publicKeyStub.go b/testsCommon/publicKeyStub.go index f113e8cd..f57e21d8 100644 --- a/testsCommon/publicKeyStub.go +++ b/testsCommon/publicKeyStub.go @@ -1,6 +1,6 @@ package testsCommon -import "github.com/ElrondNetwork/elrond-go-crypto" +import "github.com/multiversx/mx-chain-crypto-go" // PublicKeyStub - type PublicKeyStub struct { diff --git a/testsCommon/rawHeaderHandlerStub.go b/testsCommon/rawHeaderHandlerStub.go index a06eeaf0..98e224bc 100644 --- a/testsCommon/rawHeaderHandlerStub.go +++ b/testsCommon/rawHeaderHandlerStub.go @@ -3,8 +3,8 @@ package testsCommon import ( "context" - "github.com/ElrondNetwork/elrond-go-core/data" - "github.com/ElrondNetwork/elrond-go/state" + "github.com/multiversx/mx-chain-core-go/data" + "github.com/multiversx/mx-chain-go/state" ) // RawHeaderHandlerStub - diff --git a/testsCommon/signerStub.go b/testsCommon/signerStub.go index 6181a76c..82411238 100644 --- a/testsCommon/signerStub.go +++ b/testsCommon/signerStub.go @@ -1,8 +1,8 @@ package testsCommon import ( - crypto "github.com/ElrondNetwork/elrond-go-crypto" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + crypto "github.com/multiversx/mx-chain-crypto-go" + "github.com/multiversx/mx-sdk-go/data" ) // SignerStub - diff --git a/testsCommon/txBuilderStub.go b/testsCommon/txBuilderStub.go index 1ffeba58..b3400d86 100644 --- a/testsCommon/txBuilderStub.go +++ b/testsCommon/txBuilderStub.go @@ -1,8 +1,8 @@ package testsCommon import ( - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // TxBuilderStub - diff --git a/testsCommon/txNonceHandlerV1Stub.go b/testsCommon/txNonceHandlerV1Stub.go index 88cc3702..058cbb6b 100644 --- a/testsCommon/txNonceHandlerV1Stub.go +++ b/testsCommon/txNonceHandlerV1Stub.go @@ -3,8 +3,8 @@ package testsCommon import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // TxNonceHandlerV1Stub - diff --git a/testsCommon/txNonceHandlerV2Stub.go b/testsCommon/txNonceHandlerV2Stub.go index d6ffbdfa..1b7005ba 100644 --- a/testsCommon/txNonceHandlerV2Stub.go +++ b/testsCommon/txNonceHandlerV2Stub.go @@ -3,8 +3,8 @@ package testsCommon import ( "context" - "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // TxNonceHandlerV2Stub - diff --git a/workflows/interface.go b/workflows/interface.go index 9b836151..7c9cb749 100644 --- a/workflows/interface.go +++ b/workflows/interface.go @@ -3,8 +3,8 @@ package workflows import ( "context" - erdgoCore "github.com/ElrondNetwork/elrond-sdk-erdgo/core" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + erdgoCore "github.com/multiversx/mx-sdk-go/core" + "github.com/multiversx/mx-sdk-go/data" ) // TrackableAddressesProvider defines the behavior for a component that can determine if one address is tracked or not diff --git a/workflows/moveBalanceHandler.go b/workflows/moveBalanceHandler.go index 13ecda36..db035da0 100644 --- a/workflows/moveBalanceHandler.go +++ b/workflows/moveBalanceHandler.go @@ -7,11 +7,11 @@ import ( "math/big" "sync" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-crypto/signing" - "github.com/ElrondNetwork/elrond-go-crypto/signing/ed25519" - "github.com/ElrondNetwork/elrond-sdk-erdgo/blockchain/cryptoProvider" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-crypto-go/signing" + "github.com/multiversx/mx-chain-crypto-go/signing/ed25519" + "github.com/multiversx/mx-sdk-go/blockchain/cryptoProvider" + "github.com/multiversx/mx-sdk-go/data" ) var ( diff --git a/workflows/walletsTracker.go b/workflows/walletsTracker.go index ff4006a4..855ef8d9 100644 --- a/workflows/walletsTracker.go +++ b/workflows/walletsTracker.go @@ -7,9 +7,9 @@ import ( "sync" "time" - "github.com/ElrondNetwork/elrond-go-core/core/check" - "github.com/ElrondNetwork/elrond-go-logger" - "github.com/ElrondNetwork/elrond-sdk-erdgo/data" + "github.com/multiversx/mx-chain-core-go/core/check" + "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-sdk-go/data" ) var log = logger.GetOrCreate("elrond-sdk-erdgo/workflows") From db237f477f58fb616fe5d7c2b3e898dfd2a2ff81 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 12:08:24 +0200 Subject: [PATCH 02/15] removed gogoproto replace --- go.mod | 2 -- go.sum | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 83c7a3dd..2a51a6d4 100644 --- a/go.mod +++ b/go.mod @@ -156,5 +156,3 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.1.7 // indirect ) - -replace github.com/gogo/protobuf => github.com/multiversx/protobuf v1.3.2 diff --git a/go.sum b/go.sum index ab3b1586..d99bd128 100644 --- a/go.sum +++ b/go.sum @@ -209,6 +209,12 @@ github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -383,7 +389,9 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= @@ -614,8 +622,6 @@ github.com/multiversx/mx-chain-vm-v1_4-go v1.4.74 h1:qr86QIn+u9zjRNa6/aDJ0nNgKk6 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-components-big-int v0.1.1/go.mod h1:0QrcFdfeLgJ/am10HGBeH0G0DNF+0Qx1E4DS/iozQls= -github.com/multiversx/protobuf v1.3.2 h1:RaNkxvGTGbA0lMcnHAN24qE1G1i+Xs5yHA6MDvQ4mSM= -github.com/multiversx/protobuf v1.3.2/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= 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/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= @@ -1081,6 +1087,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb 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= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1126,10 +1133,12 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= From 865a93c6be02ac77ace74077381edebec32c87ab Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 12:08:24 +0200 Subject: [PATCH 03/15] removed gogoproto replace --- go.mod | 2 -- go.sum | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 83c7a3dd..2a51a6d4 100644 --- a/go.mod +++ b/go.mod @@ -156,5 +156,3 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.1.7 // indirect ) - -replace github.com/gogo/protobuf => github.com/multiversx/protobuf v1.3.2 diff --git a/go.sum b/go.sum index ab3b1586..d99bd128 100644 --- a/go.sum +++ b/go.sum @@ -209,6 +209,12 @@ github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -383,7 +389,9 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= @@ -614,8 +622,6 @@ github.com/multiversx/mx-chain-vm-v1_4-go v1.4.74 h1:qr86QIn+u9zjRNa6/aDJ0nNgKk6 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-components-big-int v0.1.1/go.mod h1:0QrcFdfeLgJ/am10HGBeH0G0DNF+0Qx1E4DS/iozQls= -github.com/multiversx/protobuf v1.3.2 h1:RaNkxvGTGbA0lMcnHAN24qE1G1i+Xs5yHA6MDvQ4mSM= -github.com/multiversx/protobuf v1.3.2/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= 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/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= @@ -1081,6 +1087,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb 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= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1126,10 +1133,12 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= From 99e5b5de54cb0d1791f2acf6af9dd585bff009ae Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 12:36:48 +0200 Subject: [PATCH 04/15] replaced elrond to multiversX also in code --- aggregator/api/gin/webServer.go | 4 +- aggregator/api/gin/writers.go | 4 +- aggregator/notifees/elrondNotifee.go | 26 ++--- aggregator/notifees/elrondNotifee_test.go | 72 ++++++------ aggregator/notifees/interface.go | 2 +- aggregator/priceAggregator.go | 2 +- authentication/native.go | 2 +- blockchain/addressGenerator.go | 8 +- blockchain/cryptoProvider/signer.go | 2 +- blockchain/elrondBaseProxy.go | 36 +++--- blockchain/elrondBaseProxy_test.go | 104 ++++++++--------- .../endpointProviders/nodeEndpointProvider.go | 2 +- .../proxyEndpointProvider.go | 2 +- .../finalityProvider/proxyFinalityProvider.go | 8 +- .../proxyFinalityProvider_test.go | 2 +- blockchain/interface.go | 2 +- blockchain/proxy.go | 82 ++++++------- blockchain/proxy_test.go | 110 +++++++++--------- core/http/clientWrapper.go | 2 +- core/variables.go | 2 +- disabled/elrondShardCoordinator.go | 18 +-- examples/examplesAccount/main.go | 6 +- examples/examplesBlock/main.go | 6 +- examples/examplesFlowWalletTracker/main.go | 8 +- examples/examplesHeaderCheck/main.go | 6 +- examples/examplesPriceAggregator/main.go | 8 +- examples/examplesTransaction/main.go | 6 +- examples/examplesVMQuery/main.go | 6 +- examples/examplesWallet/main.go | 2 +- examples/networks.go | 4 +- headerCheck/headerCheck.go | 2 +- interactors/interface.go | 2 +- .../nonceTransactionsHandler.go | 2 +- .../nonceTransactionsHandler.go | 2 +- interactors/transaction.go | 2 +- storage/mapCacher.go | 2 +- workflows/walletsTracker.go | 2 +- 37 files changed, 279 insertions(+), 279 deletions(-) diff --git a/aggregator/api/gin/webServer.go b/aggregator/api/gin/webServer.go index 048507d8..71e1c955 100644 --- a/aggregator/api/gin/webServer.go +++ b/aggregator/api/gin/webServer.go @@ -10,7 +10,7 @@ import ( "github.com/gorilla/websocket" "github.com/multiversx/mx-chain-core-go/marshal" "github.com/multiversx/mx-chain-go/api/logs" - elrondShared "github.com/multiversx/mx-chain-go/api/shared" + mxChainShared "github.com/multiversx/mx-chain-go/api/shared" logger "github.com/multiversx/mx-chain-logger-go" "github.com/multiversx/mx-sdk-go/core" ) @@ -19,7 +19,7 @@ var log = logger.GetOrCreate("api") type webServer struct { sync.RWMutex - httpServer elrondShared.HttpServerCloser + httpServer mxChainShared.HttpServerCloser apiInterface string cancelFunc func() } diff --git a/aggregator/api/gin/writers.go b/aggregator/api/gin/writers.go index 8cc4a4c6..0e7f3dbb 100644 --- a/aggregator/api/gin/writers.go +++ b/aggregator/api/gin/writers.go @@ -5,7 +5,7 @@ import "bytes" type ginWriter struct { } -// Write will output the message using elrond-go-logger's logger +// Write will output the message using mx-chain-logger-go's logger func (gv *ginWriter) Write(p []byte) (n int, err error) { trimmed := bytes.TrimSpace(p) log.Trace("gin server", "message", string(trimmed)) @@ -16,7 +16,7 @@ func (gv *ginWriter) Write(p []byte) (n int, err error) { type ginErrorWriter struct { } -// Write will output the error using elrond-go-logger's logger +// Write will output the error using mx-chain-logger-go's logger func (gev *ginErrorWriter) Write(p []byte) (n int, err error) { trimmed := bytes.TrimSpace(p) log.Trace("gin server", "error", string(trimmed)) diff --git a/aggregator/notifees/elrondNotifee.go b/aggregator/notifees/elrondNotifee.go index b8e72e16..79468645 100644 --- a/aggregator/notifees/elrondNotifee.go +++ b/aggregator/notifees/elrondNotifee.go @@ -16,10 +16,10 @@ const txVersion = uint32(1) const function = "submitBatch" const minGasLimit = uint64(1) -var log = logger.GetOrCreate("elrond-sdk-erdgo/aggregator/notifees") +var log = logger.GetOrCreate("mx-sdk-go/aggregator/notifees") -// ArgsElrondNotifee is the argument DTO for the NewElrondNotifee function -type ArgsElrondNotifee struct { +// ArgsMultiversXNotifee is the argument DTO for the NewMultiversXNotifee function +type ArgsMultiversXNotifee struct { Proxy Proxy TxBuilder TxBuilder TxNonceHandler TransactionNonceHandler @@ -29,7 +29,7 @@ type ArgsElrondNotifee struct { GasLimitForEach uint64 } -type elrondNotifee struct { +type multiversXNotifee struct { proxy Proxy txBuilder TxBuilder txNonceHandler TransactionNonceHandler @@ -39,14 +39,14 @@ type elrondNotifee struct { cryptoHolder core.CryptoComponentsHolder } -// NewElrondNotifee will create a new instance of elrondNotifee -func NewElrondNotifee(args ArgsElrondNotifee) (*elrondNotifee, error) { - err := checkArgsElrondNotifee(args) +// NewMultiversXNotifee will create a new instance of multiversXNotifee +func NewMultiversXNotifee(args ArgsMultiversXNotifee) (*multiversXNotifee, error) { + err := checkArgsMultiversXNotifee(args) if err != nil { return nil, err } - notifee := &elrondNotifee{ + notifee := &multiversXNotifee{ proxy: args.Proxy, txBuilder: args.TxBuilder, txNonceHandler: args.TxNonceHandler, @@ -59,7 +59,7 @@ func NewElrondNotifee(args ArgsElrondNotifee) (*elrondNotifee, error) { return notifee, nil } -func checkArgsElrondNotifee(args ArgsElrondNotifee) error { +func checkArgsMultiversXNotifee(args ArgsMultiversXNotifee) error { if check.IfNil(args.Proxy) { return errNilProxy } @@ -88,9 +88,9 @@ func checkArgsElrondNotifee(args ArgsElrondNotifee) error { return nil } -// PriceChanged is the function that gets called by a price notifier. This function will assemble an Elrond +// PriceChanged is the function that gets called by a price notifier. This function will assemble a MultiversX // transaction, having the transaction's data field containing all the price changes information -func (en *elrondNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { +func (en *multiversXNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { txData, err := en.prepareTxData(priceChanges) if err != nil { return err @@ -132,7 +132,7 @@ func (en *elrondNotifee) PriceChanged(ctx context.Context, priceChanges []*aggre return nil } -func (en *elrondNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { +func (en *multiversXNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { txDataBuilder := builders.NewTxDataBuilder() txDataBuilder.Function(function) @@ -148,6 +148,6 @@ func (en *elrondNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChang } // IsInterfaceNil returns true if there is no value under the interface -func (en *elrondNotifee) IsInterfaceNil() bool { +func (en *multiversXNotifee) IsInterfaceNil() bool { return en == nil } diff --git a/aggregator/notifees/elrondNotifee_test.go b/aggregator/notifees/elrondNotifee_test.go index 3eec68c6..6de19854 100644 --- a/aggregator/notifees/elrondNotifee_test.go +++ b/aggregator/notifees/elrondNotifee_test.go @@ -27,8 +27,8 @@ var ( keyGen = signing.NewKeyGenerator(suite) ) -func createMockArgsElrondNotifee() ArgsElrondNotifee { - return ArgsElrondNotifee{ +func createMockArgsMultiversXNotifee() ArgsMultiversXNotifee { + return ArgsMultiversXNotifee{ Proxy: &testsCommon.ProxyStub{}, TxBuilder: &testsCommon.TxBuilderStub{}, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -39,7 +39,7 @@ func createMockArgsElrondNotifee() ArgsElrondNotifee { } } -func createMockArgsElrondNotifeeWithSomeRealComponents() ArgsElrondNotifee { +func createMockArgsMultiversXNotifeeWithSomeRealComponents() ArgsMultiversXNotifee { proxy := &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return &data.NetworkConfig{ @@ -54,7 +54,7 @@ func createMockArgsElrondNotifeeWithSomeRealComponents() ArgsElrondNotifee { holder, _ := cryptoProvider.NewCryptoComponentsHolder(keyGen, skBytes) txBuilder, _ := builders.NewTxBuilder(cryptoProvider.NewSigner()) - return ArgsElrondNotifee{ + return ArgsMultiversXNotifee{ Proxy: proxy, TxBuilder: txBuilder, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -84,15 +84,15 @@ func createMockPriceChanges() []*aggregator.ArgsPriceChanged { } } -func TestNewElrondNotifee(t *testing.T) { +func TestNewMultiversXNotifee(t *testing.T) { t.Parallel() t.Run("nil proxy should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.Proxy = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilProxy, err) @@ -100,9 +100,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil tx builder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.TxBuilder = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxBuilder, err) @@ -110,9 +110,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil tx nonce handler should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.TxNonceHandler = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxNonceHandler, err) @@ -120,9 +120,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.ContractAddress = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilContractAddressHandler, err) @@ -130,9 +130,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("invalid contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.ContractAddress = data.NewAddressFromBytes([]byte("invalid")) - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidContractAddress, err) @@ -140,9 +140,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil cryptoHlder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.CryptoHolder = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, builders.ErrNilCryptoComponentsHolder, err) @@ -150,9 +150,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("invalid base gas limit should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.BaseGasLimit = minGasLimit - 1 - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidBaseGasLimit, err) @@ -160,9 +160,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("invalid gas limit for each should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.GasLimitForEach = minGasLimit - 1 - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidGasLimitForEach, err) @@ -170,22 +170,22 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() - en, err := NewElrondNotifee(args) + args := createMockArgsMultiversXNotifee() + en, err := NewMultiversXNotifee(args) assert.False(t, check.IfNil(en)) assert.Nil(t, err) }) } -func TestElrondNotifee_PriceChanged(t *testing.T) { +func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() t.Run("get nonce errors", func(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { return expectedErr @@ -196,7 +196,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -206,7 +206,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Run("invalid price arguments", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -218,7 +218,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -230,7 +230,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.Proxy = &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return nil, expectedErr @@ -247,7 +247,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -258,7 +258,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -275,7 +275,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -286,7 +286,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -297,7 +297,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -309,7 +309,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { priceChanges := createMockPriceChanges() sentWasCalled := false - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -348,7 +348,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) err = en.PriceChanged(context.Background(), priceChanges) diff --git a/aggregator/notifees/interface.go b/aggregator/notifees/interface.go index 6d71c500..81d45c2e 100644 --- a/aggregator/notifees/interface.go +++ b/aggregator/notifees/interface.go @@ -13,7 +13,7 @@ type TxBuilder interface { IsInterfaceNil() bool } -// Proxy holds the primitive functions that the elrond proxy engine supports & implements +// Proxy holds the primitive functions that the multiversx proxy engine supports & implements // dependency inversion: blockchain package is considered inner business logic, this package is considered "plugin" type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) diff --git a/aggregator/priceAggregator.go b/aggregator/priceAggregator.go index 3c4366c7..b05a610a 100644 --- a/aggregator/priceAggregator.go +++ b/aggregator/priceAggregator.go @@ -12,7 +12,7 @@ import ( const minResultsNum = 1 -var log = logger.GetOrCreate("elrond-sdk-erdgo/aggregator") +var log = logger.GetOrCreate("mx-sdk-go/aggregator") // ArgsPriceAggregator is the DTO used in the NewPriceAggregator function type ArgsPriceAggregator struct { diff --git a/authentication/native.go b/authentication/native.go index fe0bc57c..55879ad0 100644 --- a/authentication/native.go +++ b/authentication/native.go @@ -68,7 +68,7 @@ func NewNativeAuthClient(args ArgsNativeAuthClient) (*nativeAuthClient, error) { }, nil } -// GetAccessToken returns an access token used for authentication into different elrond services +// GetAccessToken returns an access token used for authentication into different MultiversX services func (nac *nativeAuthClient) GetAccessToken() (string, error) { now := nac.getTimeHandler() noToken := nac.tokenExpire.IsZero() diff --git a/blockchain/addressGenerator.go b/blockchain/addressGenerator.go index f8e07c42..f3206f4d 100644 --- a/blockchain/addressGenerator.go +++ b/blockchain/addressGenerator.go @@ -3,7 +3,7 @@ package blockchain import ( "bytes" - elrondCore "github.com/multiversx/mx-chain-core-go/core" + mxChainCore "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-core-go/core/check" "github.com/multiversx/mx-chain-core-go/data/typeConverters/uint64ByteSlice" "github.com/multiversx/mx-chain-core-go/hashing" @@ -22,7 +22,7 @@ const accountStartNonce = uint64(0) var initialDNSAddress = bytes.Repeat([]byte{1}, 32) -// addressGenerator is used to generate some addresses based on elrond-go logic +// addressGenerator is used to generate some addresses based on mx-chain-go logic type addressGenerator struct { coordinator *shardCoordinator blockChainHook process.BlockChainHookHandler @@ -42,7 +42,7 @@ func NewAddressGenerator(coordinator *shardCoordinator) (*addressGenerator, erro PubkeyConv: core.AddressPublicKeyConverter, StorageService: &disabled.StorageService{}, BlockChain: &disabled.Blockchain{}, - ShardCoordinator: &disabled.ElrondShardCoordinator{}, + ShardCoordinator: &disabled.MultiversXShardCoordinator{}, Marshalizer: &marshal.JsonMarshalizer{}, Uint64Converter: uint64ByteSlice.NewBigEndianConverter(), BuiltInFunctions: builtInFuncs, @@ -73,7 +73,7 @@ func (ag *addressGenerator) CompatibleDNSAddress(shardId byte) (core.AddressHand addressLen := len(initialDNSAddress) shardInBytes := []byte{0, shardId} - newDNSPk := string(initialDNSAddress[:(addressLen-elrondCore.ShardIdentiferLen)]) + string(shardInBytes) + newDNSPk := string(initialDNSAddress[:(addressLen-mxChainCore.ShardIdentiferLen)]) + string(shardInBytes) newDNSAddress, err := ag.blockChainHook.NewAddress([]byte(newDNSPk), accountStartNonce, factory.WasmVirtualMachine) if err != nil { return nil, err diff --git a/blockchain/cryptoProvider/signer.go b/blockchain/cryptoProvider/signer.go index a8610a14..02e93d40 100644 --- a/blockchain/cryptoProvider/signer.go +++ b/blockchain/cryptoProvider/signer.go @@ -12,7 +12,7 @@ import ( ) var ( - signerLog = logger.GetOrCreate("elrond-sdk-erdgo/signer") + signerLog = logger.GetOrCreate("mx-sdk-go/signer") hasher = keccak.NewKeccak() singleSigner = &singlesig.Ed25519Signer{} messagePrefix = []byte("\x17Elrond Signed Message:\n") diff --git a/blockchain/elrondBaseProxy.go b/blockchain/elrondBaseProxy.go index a759925a..b6413753 100644 --- a/blockchain/elrondBaseProxy.go +++ b/blockchain/elrondBaseProxy.go @@ -15,19 +15,19 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/blockchain") +var log = logger.GetOrCreate("mx-sdk-go/blockchain") const ( minimumCachingInterval = time.Second ) -type argsElrondBaseProxy struct { +type argsMultiversXBaseProxy struct { expirationTime time.Duration httpClientWrapper httpClientWrapper endpointProvider EndpointProvider } -type elrondBaseProxy struct { +type multiversXBaseProxy struct { httpClientWrapper mut sync.RWMutex fetchedConfigs *data.NetworkConfig @@ -37,14 +37,14 @@ type elrondBaseProxy struct { endpointProvider EndpointProvider } -// newElrondBaseProxy will create a base elrond proxy with cache instance -func newElrondBaseProxy(args argsElrondBaseProxy) (*elrondBaseProxy, error) { +// newMultiversXBaseProxy will create a base multiversx proxy with cache instance +func newMultiversXBaseProxy(args argsMultiversXBaseProxy) (*multiversXBaseProxy, error) { err := checkArgsBaseProxy(args) if err != nil { return nil, err } - return &elrondBaseProxy{ + return &multiversXBaseProxy{ httpClientWrapper: args.httpClientWrapper, cacheExpiryDuration: args.expirationTime, endpointProvider: args.endpointProvider, @@ -52,7 +52,7 @@ func newElrondBaseProxy(args argsElrondBaseProxy) (*elrondBaseProxy, error) { }, nil } -func checkArgsBaseProxy(args argsElrondBaseProxy) error { +func checkArgsBaseProxy(args argsMultiversXBaseProxy) error { if args.expirationTime < minimumCachingInterval { return fmt.Errorf("%w, provided: %v, minimum: %v", ErrInvalidCacherDuration, args.expirationTime, minimumCachingInterval) } @@ -71,7 +71,7 @@ func since(t time.Time) time.Duration { } // GetNetworkConfig will return the cached network configs fetching new values and saving them if necessary -func (proxy *elrondBaseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *multiversXBaseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.RLock() cachedConfigs := proxy.getCachedConfigs() proxy.mut.RUnlock() @@ -83,7 +83,7 @@ func (proxy *elrondBaseProxy) GetNetworkConfig(ctx context.Context) (*data.Netwo return proxy.cacheConfigs(ctx) } -func (proxy *elrondBaseProxy) getCachedConfigs() *data.NetworkConfig { +func (proxy *multiversXBaseProxy) getCachedConfigs() *data.NetworkConfig { if proxy.sinceTimeHandler(proxy.lastFetchedTime) > proxy.cacheExpiryDuration { return nil } @@ -91,7 +91,7 @@ func (proxy *elrondBaseProxy) getCachedConfigs() *data.NetworkConfig { return proxy.fetchedConfigs } -func (proxy *elrondBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *multiversXBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.Lock() defer proxy.mut.Unlock() @@ -114,7 +114,7 @@ func (proxy *elrondBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkCo } // getNetworkConfigFromSource retrieves the network configuration from the proxy -func (proxy *elrondBaseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *multiversXBaseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { buff, code, err := proxy.GetHTTP(ctx, proxy.endpointProvider.GetNetworkConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -134,7 +134,7 @@ func (proxy *elrondBaseProxy) getNetworkConfigFromSource(ctx context.Context) (* // GetShardOfAddress returns the shard ID of a provided address by using a shardCoordinator object and querying the // network config route -func (proxy *elrondBaseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { +func (proxy *multiversXBaseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { addr, err := data.NewAddressFromBech32String(bech32Address) if err != nil { return 0, err @@ -154,7 +154,7 @@ func (proxy *elrondBaseProxy) GetShardOfAddress(ctx context.Context, bech32Addre } // GetNetworkStatus will return the network status of a provided shard -func (proxy *elrondBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *multiversXBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { endpoint := proxy.endpointProvider.GetNodeStatus(shardID) buff, code, err := proxy.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -172,7 +172,7 @@ func (proxy *elrondBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint return &data.NetworkStatus{}, ErrInvalidEndpointProvider } -func (proxy *elrondBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *multiversXBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NetworkStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -190,7 +190,7 @@ func (proxy *elrondBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*da return response.Data.Status, nil } -func (proxy *elrondBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *multiversXBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NodeStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -208,7 +208,7 @@ func (proxy *elrondBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data. return response.Data.Status, nil } -func (proxy *elrondBaseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { +func (proxy *multiversXBaseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { if networkStatus == nil { return fmt.Errorf("%w, requested from %d", ErrNilNetworkStatus, shardID) } @@ -223,11 +223,11 @@ func (proxy *elrondBaseProxy) checkReceivedNodeStatus(networkStatus *data.Networ } // GetRestAPIEntityType returns the REST API entity type that this implementation works with -func (proxy *elrondBaseProxy) GetRestAPIEntityType() core.RestAPIEntityType { +func (proxy *multiversXBaseProxy) GetRestAPIEntityType() core.RestAPIEntityType { return proxy.endpointProvider.GetRestAPIEntityType() } // IsInterfaceNil returns true if there is no value under the interface -func (proxy *elrondBaseProxy) IsInterfaceNil() bool { +func (proxy *multiversXBaseProxy) IsInterfaceNil() bool { return proxy == nil } diff --git a/blockchain/elrondBaseProxy_test.go b/blockchain/elrondBaseProxy_test.go index 66a6417a..8f4a9916 100644 --- a/blockchain/elrondBaseProxy_test.go +++ b/blockchain/elrondBaseProxy_test.go @@ -18,23 +18,23 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsElrondBaseProxy() argsElrondBaseProxy { - return argsElrondBaseProxy{ +func createMockArgsMultiversXBaseProxy() argsMultiversXBaseProxy { + return argsMultiversXBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, endpointProvider: endpointProviders.NewNodeEndpointProvider(), } } -func TestNewElrondBaseProxy(t *testing.T) { +func TestNewMultiversXBaseProxy(t *testing.T) { t.Parallel() t.Run("nil http client wrapper", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = nil - baseProxy, err := newElrondBaseProxy(args) + baseProxy, err := newMultiversXBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilHTTPClientWrapper)) @@ -42,9 +42,9 @@ func TestNewElrondBaseProxy(t *testing.T) { t.Run("invalid caching duration", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.expirationTime = time.Second - time.Nanosecond - baseProxy, err := newElrondBaseProxy(args) + baseProxy, err := newMultiversXBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -52,9 +52,9 @@ func TestNewElrondBaseProxy(t *testing.T) { t.Run("nil endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = nil - baseProxy, err := newElrondBaseProxy(args) + baseProxy, err := newMultiversXBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilEndpointProvider)) @@ -62,15 +62,15 @@ func TestNewElrondBaseProxy(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() - baseProxy, err := newElrondBaseProxy(args) + args := createMockArgsMultiversXBaseProxy() + baseProxy, err := newMultiversXBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) assert.Nil(t, err) }) } -func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { +func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { t.Parallel() expectedReturnedNetworkConfig := &data.NetworkConfig{ @@ -110,10 +110,10 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval } @@ -134,10 +134,10 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval*2 + time.Millisecond } @@ -159,9 +159,9 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusBadRequest, expectedErr } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -180,9 +180,9 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return []byte("malformed data"), http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -211,9 +211,9 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return erroredNetworkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -232,10 +232,10 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) baseProxy.fetchedConfigs = expectedReturnedNetworkConfig baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval @@ -249,20 +249,20 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { }) } -func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { +func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") t.Run("get errors", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return nil, http.StatusBadRequest, expectedErr }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -272,13 +272,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -288,14 +288,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -314,13 +314,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -339,14 +339,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -356,13 +356,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -372,14 +372,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -402,13 +402,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -430,13 +430,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { CrossCheckBlockHeight: "aaa", } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -458,14 +458,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, // this won't be tested in this test } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -495,7 +495,7 @@ func getNodeStatusBytes(status *data.NetworkStatus) []byte { return respBytes } -func TestElrondBaseProxy_GetShardOfAddress(t *testing.T) { +func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { t.Parallel() t.Run("invalid address", func(t *testing.T) { @@ -554,7 +554,7 @@ func TestElrondBaseProxy_GetShardOfAddress(t *testing.T) { }) } -func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *elrondBaseProxy { +func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *multiversXBaseProxy { expectedReturnedNetworkConfig := &data.NetworkConfig{ NumShardsWithoutMeta: numShards, } @@ -576,18 +576,18 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *elrond return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) return baseProxy } -func TestElrondBaseProxy_GetRestAPIEntityType(t *testing.T) { +func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() - baseProxy, _ := newElrondBaseProxy(args) + args := createMockArgsMultiversXBaseProxy() + baseProxy, _ := newMultiversXBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) } diff --git a/blockchain/endpointProviders/nodeEndpointProvider.go b/blockchain/endpointProviders/nodeEndpointProvider.go index 3fad9fa1..071d2da9 100644 --- a/blockchain/endpointProviders/nodeEndpointProvider.go +++ b/blockchain/endpointProviders/nodeEndpointProvider.go @@ -13,7 +13,7 @@ const ( nodeRawMiniBlockByHashEndpoint = "internal/raw/miniblock/by-hash/%s/epoch/%d" ) -// nodeEndpointProvider is suitable to work with an Elrond node (observer) +// nodeEndpointProvider is suitable to work with an multiversx node (observer) type nodeEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/endpointProviders/proxyEndpointProvider.go b/blockchain/endpointProviders/proxyEndpointProvider.go index 5021b33e..eecf5079 100644 --- a/blockchain/endpointProviders/proxyEndpointProvider.go +++ b/blockchain/endpointProviders/proxyEndpointProvider.go @@ -13,7 +13,7 @@ const ( proxyRawMiniBlockByHash = "internal/%d/raw/miniblock/by-hash/%s/epoch/%d" ) -// proxyEndpointProvider is suitable to work with an Elrond Proxy +// proxyEndpointProvider is suitable to work with an MultiversX Proxy type proxyEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/finalityProvider/proxyFinalityProvider.go b/blockchain/finalityProvider/proxyFinalityProvider.go index fa5ada83..4cd04d59 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider.go +++ b/blockchain/finalityProvider/proxyFinalityProvider.go @@ -6,13 +6,13 @@ import ( "math/big" "strings" - elrondCore "github.com/multiversx/mx-chain-core-go/core" + mxChainCore "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-core-go/core/check" logger "github.com/multiversx/mx-chain-logger-go" "github.com/multiversx/mx-sdk-go/core" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/blockchain/finalityprovider") +var log = logger.GetOrCreate("mx-sdk-go/blockchain/finalityprovider") type proxyFinalityProvider struct { proxy proxy @@ -36,7 +36,7 @@ func (provider *proxyFinalityProvider) CheckShardFinalization(ctx context.Contex if maxNoncesDelta < core.MinAllowedDeltaToFinal { return fmt.Errorf("%w, provided: %d, minimum: %d", ErrInvalidAllowedDeltaToFinal, maxNoncesDelta, core.MinAllowedDeltaToFinal) } - if targetShardID == elrondCore.MetachainShardId { + if targetShardID == mxChainCore.MetachainShardId { // we consider this final since the minAllowedDeltaToFinal is 1 return nil } @@ -62,7 +62,7 @@ func (provider *proxyFinalityProvider) CheckShardFinalization(ctx context.Contex } func (provider *proxyFinalityProvider) getNoncesFromMetaAndShard(ctx context.Context, targetShardID uint32) (uint64, uint64, error) { - networkStatusMeta, err := provider.proxy.GetNetworkStatus(ctx, elrondCore.MetachainShardId) + networkStatusMeta, err := provider.proxy.GetNetworkStatus(ctx, mxChainCore.MetachainShardId) if err != nil { return 0, 0, err } diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 51b0c237..5c008673 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -85,7 +85,7 @@ func TestExtractNonceOfShardID(t *testing.T) { }) } -func TestElrondBaseProxy_CheckShardFinalization(t *testing.T) { +func TestMultiversXBaseProxy_CheckShardFinalization(t *testing.T) { t.Parallel() t.Run("invalid maxNoncesDelta", func(t *testing.T) { diff --git a/blockchain/interface.go b/blockchain/interface.go index 91d21ed8..ee8ac971 100644 --- a/blockchain/interface.go +++ b/blockchain/interface.go @@ -7,7 +7,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -// Proxy holds the primitive functions that the elrond proxy engine supports & implements +// Proxy holds the primitive functions that the multiversx proxy engine supports & implements type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) GetAccount(ctx context.Context, address core.AddressHandler) (*data.Account, error) diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 0901e308..d49d9c06 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -22,8 +22,8 @@ const ( withResultsQueryParam = "?withResults=true" ) -// ArgsElrondProxy is the DTO used in the elrond proxy constructor -type ArgsElrondProxy struct { +// ArgsMultiversXProxy is the DTO used in the multiversx proxy constructor +type ArgsMultiversXProxy struct { ProxyURL string Client erdgoHttp.Client SameScState bool @@ -34,9 +34,9 @@ type ArgsElrondProxy struct { EntityType erdgoCore.RestAPIEntityType } -// elrondProxy implements basic functions for interacting with an Elrond Proxy -type elrondProxy struct { - *elrondBaseProxy +// multiversXProxy implements basic functions for interacting with a multiversx Proxy +type multiversXProxy struct { + *multiversXBaseProxy sameScState bool shouldBeSynced bool finalityCheck bool @@ -44,8 +44,8 @@ type elrondProxy struct { finalityProvider FinalityProvider } -// NewElrondProxy initializes and returns an ElrondProxy object -func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { +// NewMultiversXProxy initializes and returns an multiversXProxy object +func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { err := checkArgsProxy(args) if err != nil { return nil, err @@ -57,12 +57,12 @@ func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { } clientWrapper := erdgoHttp.NewHttpClientWrapper(args.Client, args.ProxyURL) - baseArgs := argsElrondBaseProxy{ + baseArgs := argsMultiversXBaseProxy{ httpClientWrapper: clientWrapper, expirationTime: args.CacheExpirationTime, endpointProvider: endpointProvider, } - baseProxy, err := newElrondBaseProxy(baseArgs) + baseProxy, err := newMultiversXBaseProxy(baseArgs) if err != nil { return nil, err } @@ -72,8 +72,8 @@ func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { return nil, err } - ep := &elrondProxy{ - elrondBaseProxy: baseProxy, + ep := &multiversXProxy{ + multiversXBaseProxy: baseProxy, sameScState: args.SameScState, shouldBeSynced: args.ShouldBeSynced, finalityCheck: args.FinalityCheck, @@ -84,7 +84,7 @@ func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { return ep, nil } -func checkArgsProxy(args ArgsElrondProxy) error { +func checkArgsProxy(args ArgsMultiversXProxy) error { if args.FinalityCheck { if args.AllowedDeltaToFinal < erdgoCore.MinAllowedDeltaToFinal { return fmt.Errorf("%w, provided: %d, minimum: %d", @@ -96,7 +96,7 @@ func checkArgsProxy(args ArgsElrondProxy) error { } // ExecuteVMQuery retrieves data from existing SC trie through the use of a VM -func (ep *elrondProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { +func (ep *multiversXProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { err := ep.checkFinalState(ctx, vmRequest.Address) if err != nil { return nil, err @@ -129,7 +129,7 @@ func (ep *elrondProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmVal return &response.Data, nil } -func (ep *elrondProxy) checkFinalState(ctx context.Context, address string) error { +func (ep *multiversXProxy) checkFinalState(ctx context.Context, address string) error { if !ep.finalityCheck { return nil } @@ -143,7 +143,7 @@ func (ep *elrondProxy) checkFinalState(ctx context.Context, address string) erro } // GetNetworkEconomics retrieves the network economics from the proxy -func (ep *elrondProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { +func (ep *multiversXProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetNetworkEconomics()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -162,7 +162,7 @@ func (ep *elrondProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEc } // GetDefaultTransactionArguments will prepare the transaction creation argument by querying the account's info -func (ep *elrondProxy) GetDefaultTransactionArguments( +func (ep *multiversXProxy) GetDefaultTransactionArguments( ctx context.Context, address erdgoCore.AddressHandler, networkConfigs *data.NetworkConfig, @@ -196,7 +196,7 @@ func (ep *elrondProxy) GetDefaultTransactionArguments( } // GetAccount retrieves an account info from the network (nonce, balance) -func (ep *elrondProxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { +func (ep *multiversXProxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { err := ep.checkFinalState(ctx, address.AddressAsBech32String()) if err != nil { return nil, err @@ -228,7 +228,7 @@ func (ep *elrondProxy) GetAccount(ctx context.Context, address erdgoCore.Address } // SendTransaction broadcasts a transaction to the network and returns the txhash if successful -func (ep *elrondProxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { +func (ep *multiversXProxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { jsonTx, err := json.Marshal(tx) if err != nil { return "", err @@ -251,7 +251,7 @@ func (ep *elrondProxy) SendTransaction(ctx context.Context, tx *data.Transaction } // SendTransactions broadcasts the provided transactions to the network and returns the txhashes if successful -func (ep *elrondProxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { +func (ep *multiversXProxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { jsonTx, err := json.Marshal(txs) if err != nil { return nil, err @@ -273,7 +273,7 @@ func (ep *elrondProxy) SendTransactions(ctx context.Context, txs []*data.Transac return ep.postProcessSendMultipleTxsResult(response) } -func (ep *elrondProxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { +func (ep *multiversXProxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { txHashes := make([]string, 0, len(response.Data.TxsHashes)) indexes := make([]int, 0, len(response.Data.TxsHashes)) for index := range response.Data.TxsHashes { @@ -292,7 +292,7 @@ func (ep *elrondProxy) postProcessSendMultipleTxsResult(response *data.SendTrans } // GetTransactionStatus retrieves a transaction's status from the network -func (ep *elrondProxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { +func (ep *multiversXProxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { endpoint := ep.endpointProvider.GetTransactionStatus(hash) buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -312,16 +312,16 @@ func (ep *elrondProxy) GetTransactionStatus(ctx context.Context, hash string) (s } // GetTransactionInfo retrieves a transaction's details from the network -func (ep *elrondProxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *multiversXProxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, false) } // GetTransactionInfoWithResults retrieves a transaction's details from the network with events -func (ep *elrondProxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *multiversXProxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, true) } -func (ep *elrondProxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { +func (ep *multiversXProxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { endpoint := ep.endpointProvider.GetTransactionInfo(hash) if withResults { endpoint += withResultsQueryParam @@ -345,7 +345,7 @@ func (ep *elrondProxy) getTransactionInfo(ctx context.Context, hash string, with } // RequestTransactionCost retrieves how many gas a transaction will consume -func (ep *elrondProxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { +func (ep *multiversXProxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { jsonTx, err := json.Marshal(tx) if err != nil { return nil, err @@ -368,7 +368,7 @@ func (ep *elrondProxy) RequestTransactionCost(ctx context.Context, tx *data.Tran } // GetLatestHyperBlockNonce retrieves the latest hyper block (metachain) nonce from the network -func (ep *elrondProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { +func (ep *multiversXProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, core.MetachainShardId) if err != nil { return 0, err @@ -378,20 +378,20 @@ func (ep *elrondProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, er } // GetHyperBlockByNonce retrieves a hyper block's info by nonce from the network -func (ep *elrondProxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { +func (ep *multiversXProxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByNonce(nonce) return ep.getHyperBlock(ctx, endpoint) } // GetHyperBlockByHash retrieves a hyper block's info by hash from the network -func (ep *elrondProxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { +func (ep *multiversXProxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByHash(hash) return ep.getHyperBlock(ctx, endpoint) } -func (ep *elrondProxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { +func (ep *multiversXProxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -410,27 +410,27 @@ func (ep *elrondProxy) getHyperBlock(ctx context.Context, endpoint string) (*dat } // GetRawBlockByHash retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { +func (ep *multiversXProxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByHash(shardId, hash) return ep.getRawBlock(ctx, endpoint) } // GetRawBlockByNonce retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { +func (ep *multiversXProxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByNonce(shardId, nonce) return ep.getRawBlock(ctx, endpoint) } // GetRawStartOfEpochMetaBlock retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { +func (ep *multiversXProxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawStartOfEpochMetaBlock(epoch) return ep.getRawBlock(ctx, endpoint) } -func (ep *elrondProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *multiversXProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -449,13 +449,13 @@ func (ep *elrondProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte } // GetRawMiniBlockByHash retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { +func (ep *multiversXProxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawMiniBlockByHash(shardId, hash, epoch) return ep.getRawMiniBlock(ctx, endpoint) } -func (ep *elrondProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *multiversXProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -474,7 +474,7 @@ func (ep *elrondProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([] } // GetNonceAtEpochStart retrieves the start of epoch nonce from hyper block (metachain) -func (ep *elrondProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { +func (ep *multiversXProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, shardId) if err != nil { return 0, err @@ -484,7 +484,7 @@ func (ep *elrondProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) } // GetRatingsConfig retrieves the ratings configuration from the proxy -func (ep *elrondProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { +func (ep *multiversXProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetRatingsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -503,7 +503,7 @@ func (ep *elrondProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfi } // GetEnableEpochsConfig retrieves the ratings configuration from the proxy -func (ep *elrondProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { +func (ep *multiversXProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetEnableEpochsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -522,7 +522,7 @@ func (ep *elrondProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableE } // GetGenesisNodesPubKeys retrieves genesis nodes configuration from proxy -func (ep *elrondProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { +func (ep *multiversXProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetGenesisNodesConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -541,7 +541,7 @@ func (ep *elrondProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.Genesi } // GetValidatorsInfoByEpoch retrieves the validators info by epoch -func (ep *elrondProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { +func (ep *multiversXProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetValidatorsInfo(epoch)) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -560,6 +560,6 @@ func (ep *elrondProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint3 } // IsInterfaceNil returns true if there is no value under the interface -func (ep *elrondProxy) IsInterfaceNil() bool { +func (ep *multiversXProxy) IsInterfaceNil() bool { return ep == nil } diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index 1c0669c9..90be805c 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -58,8 +58,8 @@ func createMockClientRespondingBytes(responseBytes []byte) *mockHTTPClient { } } -func createMockArgsElrondProxy(httpClient erdgoHttp.Client) ArgsElrondProxy { - return ArgsElrondProxy{ +func createMockArgsMultiversXProxy(httpClient erdgoHttp.Client) ArgsMultiversXProxy { + return ArgsMultiversXProxy{ ProxyURL: testHttpURL, Client: httpClient, SameScState: false, @@ -139,15 +139,15 @@ func handleRequestNetworkConfigAndStatus( }, handled, nil } -func TestNewElrondProxy(t *testing.T) { +func TestNewMultiversXProxy(t *testing.T) { t.Parallel() t.Run("invalid time cache should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) + args := createMockArgsMultiversXProxy(nil) args.CacheExpirationTime = time.Second - time.Nanosecond - proxy, err := NewElrondProxy(args) + proxy, err := NewMultiversXProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -155,10 +155,10 @@ func TestNewElrondProxy(t *testing.T) { t.Run("invalid nonce delta should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) + args := createMockArgsMultiversXProxy(nil) args.FinalityCheck = true args.AllowedDeltaToFinal = 0 - proxy, err := NewElrondProxy(args) + proxy, err := NewMultiversXProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidAllowedDeltaToFinal)) @@ -166,9 +166,9 @@ func TestNewElrondProxy(t *testing.T) { t.Run("should work with finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) + args := createMockArgsMultiversXProxy(nil) args.FinalityCheck = true - proxy, err := NewElrondProxy(args) + proxy, err := NewMultiversXProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -176,8 +176,8 @@ func TestNewElrondProxy(t *testing.T) { t.Run("should work without finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) - proxy, err := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(nil) + proxy, err := NewMultiversXProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -213,9 +213,9 @@ func TestGetAccount(t *testing.T) { }, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - proxy, _ := NewElrondProxy(args) + proxy, _ := NewMultiversXProxy(args) address, err := data.NewAddressFromBech32String("erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts") if err != nil { @@ -253,13 +253,13 @@ func TestGetAccount(t *testing.T) { }) } -func TestElrondProxy_GetNetworkEconomics(t *testing.T) { +func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) networkEconomics, err := ep.GetNetworkEconomics(context.Background()) require.Nil(t, err) @@ -274,13 +274,13 @@ func TestElrondProxy_GetNetworkEconomics(t *testing.T) { }, networkEconomics) } -func TestElrondProxy_RequestTransactionCost(t *testing.T) { +func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) tx := &data.Transaction{ Nonce: 1, @@ -300,13 +300,13 @@ func TestElrondProxy_RequestTransactionCost(t *testing.T) { }, txCost) } -func TestElrondProxy_GetTransactionInfoWithResults(t *testing.T) { +func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) tx, err := ep.GetTransactionInfoWithResults(context.Background(), "a40e5a6af4efe221608297a73459211756ab88b96896e6e331842807a138f343") require.Nil(t, err) @@ -315,14 +315,14 @@ func TestElrondProxy_GetTransactionInfoWithResults(t *testing.T) { fmt.Println(string(txBytes)) } -func TestElrondProxy_ExecuteVmQuery(t *testing.T) { +func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"data":{"returnData":["MC41LjU="],"returnCode":"ok","returnMessage":"","gasRemaining":18446744073685949187,"gasRefund":0,"outputAccounts":{"0000000000000000050033bb65a91ee17ab84c6f8a01846ef8644e15fb76696a":{"address":"erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt","nonce":0,"balance":null,"balanceDelta":0,"storageUpdates":{},"code":null,"codeMetaData":null,"outputTransfers":[],"callType":0}},"deletedAccounts":[],"touchedAccounts":[],"logs":[]}},"error":"","code":"successful"}`) t.Run("no finality check", func(t *testing.T) { httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -344,9 +344,9 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - ep, _ := NewElrondProxy(args) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -370,9 +370,9 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - ep, _ := NewElrondProxy(args) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "invalid", @@ -400,9 +400,9 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { }, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - ep, _ := NewElrondProxy(args) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -416,7 +416,7 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { }) } -func TestElrondProxy_GetRawBlockByHash(t *testing.T) { +func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -436,8 +436,8 @@ func TestElrondProxy_GetRawBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByHash(context.Background(), 0, "aaaa") require.Nil(t, err) @@ -448,7 +448,7 @@ func TestElrondProxy_GetRawBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestElrondProxy_GetRawBlockByNonce(t *testing.T) { +func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -466,8 +466,8 @@ func TestElrondProxy_GetRawBlockByNonce(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByNonce(context.Background(), 0, 10) require.Nil(t, err) @@ -478,7 +478,7 @@ func TestElrondProxy_GetRawBlockByNonce(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestElrondProxy_GetRawMiniBlockByHash(t *testing.T) { +func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -496,8 +496,8 @@ func TestElrondProxy_GetRawMiniBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawMiniBlockByHash(context.Background(), 0, "aaaa", 1) require.Nil(t, err) @@ -508,7 +508,7 @@ func TestElrondProxy_GetRawMiniBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestElrondProxy_GetNonceAtEpochStart(t *testing.T) { +func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { t.Parallel() expectedNonce := uint64(2) @@ -526,8 +526,8 @@ func TestElrondProxy_GetNonceAtEpochStart(t *testing.T) { statusResponseBytes, _ := json.Marshal(statusResponse) httpClient := createMockClientRespondingBytes(statusResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetNonceAtEpochStart(context.Background(), core.MetachainShardId) require.Nil(t, err) @@ -535,7 +535,7 @@ func TestElrondProxy_GetNonceAtEpochStart(t *testing.T) { require.Equal(t, expectedNonce, response) } -func TestElrondProxy_GetRatingsConfig(t *testing.T) { +func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { t.Parallel() expectedRatingsConfig := &data.RatingsConfig{ @@ -552,8 +552,8 @@ func TestElrondProxy_GetRatingsConfig(t *testing.T) { ratingsResponseBytes, _ := json.Marshal(ratingsResponse) httpClient := createMockClientRespondingBytes(ratingsResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRatingsConfig(context.Background()) require.Nil(t, err) @@ -561,7 +561,7 @@ func TestElrondProxy_GetRatingsConfig(t *testing.T) { require.Equal(t, expectedRatingsConfig, response) } -func TestElrondProxy_GetEnableEpochsConfig(t *testing.T) { +func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { t.Parallel() enableEpochs := config.EnableEpochs{ @@ -581,8 +581,8 @@ func TestElrondProxy_GetEnableEpochsConfig(t *testing.T) { enableEpochsResponseBytes, _ := json.Marshal(enableEpochsResponse) httpClient := createMockClientRespondingBytes(enableEpochsResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetEnableEpochsConfig(context.Background()) require.Nil(t, err) @@ -590,7 +590,7 @@ func TestElrondProxy_GetEnableEpochsConfig(t *testing.T) { require.Equal(t, expectedEnableEpochsConfig, response) } -func TestElrondProxy_GetGenesisNodesPubKeys(t *testing.T) { +func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { t.Parallel() expectedGenesisNodes := &data.GenesisNodes{ @@ -607,8 +607,8 @@ func TestElrondProxy_GetGenesisNodesPubKeys(t *testing.T) { genesisNodesResponseBytes, _ := json.Marshal(genesisNodesResponse) httpClient := createMockClientRespondingBytes(genesisNodesResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetGenesisNodesPubKeys(context.Background()) require.Nil(t, err) @@ -616,7 +616,7 @@ func TestElrondProxy_GetGenesisNodesPubKeys(t *testing.T) { require.Equal(t, expectedGenesisNodes, response) } -func TestElrondProxy_GetValidatorsInfoByEpoch(t *testing.T) { +func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { t.Parallel() expectedValidatorsInfo := []*state.ShardValidatorInfo{ @@ -635,8 +635,8 @@ func TestElrondProxy_GetValidatorsInfoByEpoch(t *testing.T) { validatorsInfoResponseBytes, _ := json.Marshal(validatorsInfoResponse) httpClient := createMockClientRespondingBytes(validatorsInfoResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetValidatorsInfoByEpoch(context.Background(), 1) require.Nil(t, err) diff --git a/core/http/clientWrapper.go b/core/http/clientWrapper.go index 4d048996..8a8f24a3 100644 --- a/core/http/clientWrapper.go +++ b/core/http/clientWrapper.go @@ -12,7 +12,7 @@ import ( const ( httpUserAgentKey = "User-Agent" - httpUserAgent = "Elrond go SDK / 1.0.0 " + httpUserAgent = "MultiversX go SDK / 1.0.0 " httpAcceptTypeKey = "Accept" httpAcceptType = "application/json" diff --git a/core/variables.go b/core/variables.go index f317a61e..6758ddaf 100644 --- a/core/variables.go +++ b/core/variables.go @@ -5,7 +5,7 @@ import ( logger "github.com/multiversx/mx-chain-logger-go" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/core") +var log = logger.GetOrCreate("mx-sdk-go/core") // AddressPublicKeyConverter represents the default address public key converter var AddressPublicKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(AddressBytesLen, log) diff --git a/disabled/elrondShardCoordinator.go b/disabled/elrondShardCoordinator.go index 1e6a6939..c05e5538 100644 --- a/disabled/elrondShardCoordinator.go +++ b/disabled/elrondShardCoordinator.go @@ -1,35 +1,35 @@ package disabled -// ElrondShardCoordinator is the disabled shard coordinator instance that satisfies the elrond.sharding.Coordinator interface -type ElrondShardCoordinator struct { +// MultiversXShardCoordinator is the disabled shard coordinator instance that satisfies the mx-chain-go.sharding.Coordinator interface +type MultiversXShardCoordinator struct { } // NumberOfShards returns 0 -func (esc *ElrondShardCoordinator) NumberOfShards() uint32 { +func (msc *MultiversXShardCoordinator) NumberOfShards() uint32 { return 0 } // ComputeId returns 0 -func (esc *ElrondShardCoordinator) ComputeId(_ []byte) uint32 { +func (msc *MultiversXShardCoordinator) ComputeId(_ []byte) uint32 { return 0 } // SelfId returns 0 -func (esc *ElrondShardCoordinator) SelfId() uint32 { +func (msc *MultiversXShardCoordinator) SelfId() uint32 { return 0 } // SameShard returns false -func (esc *ElrondShardCoordinator) SameShard(_, _ []byte) bool { +func (msc *MultiversXShardCoordinator) SameShard(_, _ []byte) bool { return false } // CommunicationIdentifier returns empty string -func (esc *ElrondShardCoordinator) CommunicationIdentifier(_ uint32) string { +func (msc *MultiversXShardCoordinator) CommunicationIdentifier(_ uint32) string { return "" } // IsInterfaceNil returns true if there is no value under the interface -func (esc *ElrondShardCoordinator) IsInterfaceNil() bool { - return esc == nil +func (msc *MultiversXShardCoordinator) IsInterfaceNil() bool { + return msc == nil } diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index f55c0691..f5fedf4a 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -12,10 +12,10 @@ import ( "github.com/multiversx/mx-sdk-go/examples" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesAccount") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesAccount") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index b32e37f6..7ce33f9f 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -11,10 +11,10 @@ import ( "github.com/multiversx/mx-sdk-go/examples" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesBlock") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesBlock") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index be059b5a..81f413f8 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -22,7 +22,7 @@ import ( const timeToExecuteRequest = time.Second -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesFlowWalletTracker") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesFlowWalletTracker") type moveBalanceHandler interface { GenerateMoveBalanceTransactions(ctx context.Context, addresses []string) @@ -51,7 +51,7 @@ func main() { } func runApp() error { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -60,7 +60,7 @@ func runApp() error { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { return err } @@ -91,7 +91,7 @@ func runApp() error { return err } - receiverAddress := "erd1zptg3eu7uw0qvzhnu009lwxupcn6ntjxptj5gaxt8curhxjqr9tsqpsnht" // /elrond-sdk-erdgo/interactors/testdata/test.pem + receiverAddress := "erd1zptg3eu7uw0qvzhnu009lwxupcn6ntjxptj5gaxt8curhxjqr9tsqpsnht" // /mx-sdk-go/interactors/testdata/test.pem txInteractor, err := interactors.NewTransactionInteractor(ep, txBuilder) if err != nil { return err diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index b7a83115..97b84966 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -12,10 +12,10 @@ import ( "github.com/multiversx/mx-sdk-go/headerCheck" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesHeaderCheck") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesHeaderCheck") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index d723e1f9..3d49391d 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -22,7 +22,7 @@ import ( "github.com/multiversx/mx-sdk-go/interactors" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesPriceAggregator") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesPriceAggregator") const base = "ETH" const quote = "USD" @@ -33,7 +33,7 @@ const minResultsNum = 3 const pollInterval = time.Second * 2 const autoSendInterval = time.Second * 10 -const networkAddress = "https://testnet-gateway.elrond.com" +const networkAddress = "https://testnet-gateway.multiversx.com" var ( suite = ed25519.NewEd25519() @@ -211,7 +211,7 @@ func createAuthClient() (authentication.AuthClient, error) { return nil, err } - argsProxy := blockchain.ArgsElrondProxy{ + argsProxy := blockchain.ArgsMultiversXProxy{ ProxyURL: networkAddress, SameScState: false, ShouldBeSynced: false, @@ -221,7 +221,7 @@ func createAuthClient() (authentication.AuthClient, error) { EntityType: core.RestAPIEntityType("Proxy"), } - proxy, err := blockchain.NewElrondProxy(argsProxy) + proxy, err := blockchain.NewMultiversXProxy(argsProxy) if err != nil { return nil, err } diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 05f5421f..8323ff64 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -18,13 +18,13 @@ import ( var ( suite = ed25519.NewEd25519() keyGen = signing.NewKeyGenerator(suite) - log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesTransaction") + log = logger.GetOrCreate("mx-sdk-go/examples/examplesTransaction") ) func main() { _ = logger.SetLogLevel("*:DEBUG") - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -33,7 +33,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index dfa57909..bffe0643 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -11,10 +11,10 @@ import ( "github.com/multiversx/mx-sdk-go/examples" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesVMQuery") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesVMQuery") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesWallet/main.go b/examples/examplesWallet/main.go index 31aee691..d6d87a9b 100644 --- a/examples/examplesWallet/main.go +++ b/examples/examplesWallet/main.go @@ -5,7 +5,7 @@ import ( "github.com/multiversx/mx-sdk-go/interactors" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesWallet") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesWallet") func main() { w := interactors.NewWallet() diff --git a/examples/networks.go b/examples/networks.go index 4d955221..05cc5d97 100644 --- a/examples/networks.go +++ b/examples/networks.go @@ -1,7 +1,7 @@ package examples // MainnetGateway represents the mainnet gateway address -const MainnetGateway = "https://gateway.elrond.com" +const MainnetGateway = "https://gateway.multiversx.com" // TestnetGateway represents the testnet gateway address -const TestnetGateway = "https://testnet-gateway.elrond.com" +const TestnetGateway = "https://testnet-gateway.multiversx.com" diff --git a/headerCheck/headerCheck.go b/headerCheck/headerCheck.go index 31f1f018..9ec57b6a 100644 --- a/headerCheck/headerCheck.go +++ b/headerCheck/headerCheck.go @@ -10,7 +10,7 @@ import ( logger "github.com/multiversx/mx-chain-logger-go" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/headerCheck") +var log = logger.GetOrCreate("mx-sdk-go/headerCheck") // ArgsHeaderVerifier holds all dependencies required by headerVerifier in // order to create a new instance diff --git a/interactors/interface.go b/interactors/interface.go index 94a8026a..6c7e4507 100644 --- a/interactors/interface.go +++ b/interactors/interface.go @@ -7,7 +7,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -// Proxy holds the primitive functions that the elrond proxy engine supports & implements +// Proxy holds the primitive functions that the multiversx proxy engine supports & implements // dependency inversion: blockchain package is considered inner business logic, this package is considered "plugin" type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) diff --git a/interactors/nonceHandlerV1/nonceTransactionsHandler.go b/interactors/nonceHandlerV1/nonceTransactionsHandler.go index 9f2059f4..84d5c9c8 100644 --- a/interactors/nonceHandlerV1/nonceTransactionsHandler.go +++ b/interactors/nonceHandlerV1/nonceTransactionsHandler.go @@ -15,7 +15,7 @@ import ( const minimumIntervalToResend = time.Second -var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors/nonceHandlerV1") +var log = logger.GetOrCreate("mx-sdk-go/interactors/nonceHandlerV1") // nonceTransactionsHandlerV1 is the handler used for an unlimited number of addresses. // It basically contains a map of addressNonceHandler, creating new entries on the first diff --git a/interactors/nonceHandlerV2/nonceTransactionsHandler.go b/interactors/nonceHandlerV2/nonceTransactionsHandler.go index e4d68597..a725864a 100644 --- a/interactors/nonceHandlerV2/nonceTransactionsHandler.go +++ b/interactors/nonceHandlerV2/nonceTransactionsHandler.go @@ -15,7 +15,7 @@ import ( const minimumIntervalToResend = time.Second -var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors/nonceHandlerV2") +var log = logger.GetOrCreate("mx-sdk-go/interactors/nonceHandlerV2") // ArgsNonceTransactionsHandlerV2 is the argument DTO for a nonce transactions handler component type ArgsNonceTransactionsHandlerV2 struct { diff --git a/interactors/transaction.go b/interactors/transaction.go index 88f0f1a7..2357227c 100644 --- a/interactors/transaction.go +++ b/interactors/transaction.go @@ -10,7 +10,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors") +var log = logger.GetOrCreate("mx-sdk-go/interactors") const defaultTimeBetweenBunches = time.Second diff --git a/storage/mapCacher.go b/storage/mapCacher.go index cfa9b8cb..d915b0ff 100644 --- a/storage/mapCacher.go +++ b/storage/mapCacher.go @@ -8,7 +8,7 @@ import ( logger "github.com/multiversx/mx-chain-logger-go" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/storage") +var log = logger.GetOrCreate("mx-sdk-go/storage") // mapCacher is the cacher implementation based on a map type mapCacher struct { diff --git a/workflows/walletsTracker.go b/workflows/walletsTracker.go index 855ef8d9..7595d5ff 100644 --- a/workflows/walletsTracker.go +++ b/workflows/walletsTracker.go @@ -12,7 +12,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/workflows") +var log = logger.GetOrCreate("mx-sdk-go/workflows") // WalletTrackerArgs is the argument DTO for the NewWalletTracker constructor function type WalletTrackerArgs struct { From 1f4257da023d7315fac21df2b68fad8ec826af5f Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 12:36:48 +0200 Subject: [PATCH 05/15] replaced elrond to multiversX also in code --- aggregator/api/gin/webServer.go | 4 +- aggregator/api/gin/writers.go | 4 +- aggregator/notifees/elrondNotifee.go | 26 ++--- aggregator/notifees/elrondNotifee_test.go | 72 ++++++------ aggregator/notifees/interface.go | 2 +- aggregator/priceAggregator.go | 2 +- authentication/native.go | 2 +- blockchain/addressGenerator.go | 8 +- blockchain/cryptoProvider/signer.go | 2 +- blockchain/elrondBaseProxy.go | 36 +++--- blockchain/elrondBaseProxy_test.go | 104 ++++++++--------- .../endpointProviders/nodeEndpointProvider.go | 2 +- .../proxyEndpointProvider.go | 2 +- .../finalityProvider/proxyFinalityProvider.go | 8 +- .../proxyFinalityProvider_test.go | 2 +- blockchain/interface.go | 2 +- blockchain/proxy.go | 82 ++++++------- blockchain/proxy_test.go | 110 +++++++++--------- core/http/clientWrapper.go | 2 +- core/variables.go | 2 +- disabled/elrondShardCoordinator.go | 18 +-- examples/examplesAccount/main.go | 6 +- examples/examplesBlock/main.go | 6 +- examples/examplesFlowWalletTracker/main.go | 8 +- examples/examplesHeaderCheck/main.go | 6 +- examples/examplesPriceAggregator/main.go | 8 +- examples/examplesTransaction/main.go | 6 +- examples/examplesVMQuery/main.go | 6 +- examples/examplesWallet/main.go | 2 +- examples/networks.go | 4 +- headerCheck/headerCheck.go | 2 +- interactors/interface.go | 2 +- .../nonceTransactionsHandler.go | 2 +- .../nonceTransactionsHandler.go | 2 +- interactors/transaction.go | 2 +- storage/mapCacher.go | 2 +- workflows/walletsTracker.go | 2 +- 37 files changed, 279 insertions(+), 279 deletions(-) diff --git a/aggregator/api/gin/webServer.go b/aggregator/api/gin/webServer.go index 048507d8..71e1c955 100644 --- a/aggregator/api/gin/webServer.go +++ b/aggregator/api/gin/webServer.go @@ -10,7 +10,7 @@ import ( "github.com/gorilla/websocket" "github.com/multiversx/mx-chain-core-go/marshal" "github.com/multiversx/mx-chain-go/api/logs" - elrondShared "github.com/multiversx/mx-chain-go/api/shared" + mxChainShared "github.com/multiversx/mx-chain-go/api/shared" logger "github.com/multiversx/mx-chain-logger-go" "github.com/multiversx/mx-sdk-go/core" ) @@ -19,7 +19,7 @@ var log = logger.GetOrCreate("api") type webServer struct { sync.RWMutex - httpServer elrondShared.HttpServerCloser + httpServer mxChainShared.HttpServerCloser apiInterface string cancelFunc func() } diff --git a/aggregator/api/gin/writers.go b/aggregator/api/gin/writers.go index 8cc4a4c6..0e7f3dbb 100644 --- a/aggregator/api/gin/writers.go +++ b/aggregator/api/gin/writers.go @@ -5,7 +5,7 @@ import "bytes" type ginWriter struct { } -// Write will output the message using elrond-go-logger's logger +// Write will output the message using mx-chain-logger-go's logger func (gv *ginWriter) Write(p []byte) (n int, err error) { trimmed := bytes.TrimSpace(p) log.Trace("gin server", "message", string(trimmed)) @@ -16,7 +16,7 @@ func (gv *ginWriter) Write(p []byte) (n int, err error) { type ginErrorWriter struct { } -// Write will output the error using elrond-go-logger's logger +// Write will output the error using mx-chain-logger-go's logger func (gev *ginErrorWriter) Write(p []byte) (n int, err error) { trimmed := bytes.TrimSpace(p) log.Trace("gin server", "error", string(trimmed)) diff --git a/aggregator/notifees/elrondNotifee.go b/aggregator/notifees/elrondNotifee.go index b8e72e16..79468645 100644 --- a/aggregator/notifees/elrondNotifee.go +++ b/aggregator/notifees/elrondNotifee.go @@ -16,10 +16,10 @@ const txVersion = uint32(1) const function = "submitBatch" const minGasLimit = uint64(1) -var log = logger.GetOrCreate("elrond-sdk-erdgo/aggregator/notifees") +var log = logger.GetOrCreate("mx-sdk-go/aggregator/notifees") -// ArgsElrondNotifee is the argument DTO for the NewElrondNotifee function -type ArgsElrondNotifee struct { +// ArgsMultiversXNotifee is the argument DTO for the NewMultiversXNotifee function +type ArgsMultiversXNotifee struct { Proxy Proxy TxBuilder TxBuilder TxNonceHandler TransactionNonceHandler @@ -29,7 +29,7 @@ type ArgsElrondNotifee struct { GasLimitForEach uint64 } -type elrondNotifee struct { +type multiversXNotifee struct { proxy Proxy txBuilder TxBuilder txNonceHandler TransactionNonceHandler @@ -39,14 +39,14 @@ type elrondNotifee struct { cryptoHolder core.CryptoComponentsHolder } -// NewElrondNotifee will create a new instance of elrondNotifee -func NewElrondNotifee(args ArgsElrondNotifee) (*elrondNotifee, error) { - err := checkArgsElrondNotifee(args) +// NewMultiversXNotifee will create a new instance of multiversXNotifee +func NewMultiversXNotifee(args ArgsMultiversXNotifee) (*multiversXNotifee, error) { + err := checkArgsMultiversXNotifee(args) if err != nil { return nil, err } - notifee := &elrondNotifee{ + notifee := &multiversXNotifee{ proxy: args.Proxy, txBuilder: args.TxBuilder, txNonceHandler: args.TxNonceHandler, @@ -59,7 +59,7 @@ func NewElrondNotifee(args ArgsElrondNotifee) (*elrondNotifee, error) { return notifee, nil } -func checkArgsElrondNotifee(args ArgsElrondNotifee) error { +func checkArgsMultiversXNotifee(args ArgsMultiversXNotifee) error { if check.IfNil(args.Proxy) { return errNilProxy } @@ -88,9 +88,9 @@ func checkArgsElrondNotifee(args ArgsElrondNotifee) error { return nil } -// PriceChanged is the function that gets called by a price notifier. This function will assemble an Elrond +// PriceChanged is the function that gets called by a price notifier. This function will assemble a MultiversX // transaction, having the transaction's data field containing all the price changes information -func (en *elrondNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { +func (en *multiversXNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { txData, err := en.prepareTxData(priceChanges) if err != nil { return err @@ -132,7 +132,7 @@ func (en *elrondNotifee) PriceChanged(ctx context.Context, priceChanges []*aggre return nil } -func (en *elrondNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { +func (en *multiversXNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { txDataBuilder := builders.NewTxDataBuilder() txDataBuilder.Function(function) @@ -148,6 +148,6 @@ func (en *elrondNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChang } // IsInterfaceNil returns true if there is no value under the interface -func (en *elrondNotifee) IsInterfaceNil() bool { +func (en *multiversXNotifee) IsInterfaceNil() bool { return en == nil } diff --git a/aggregator/notifees/elrondNotifee_test.go b/aggregator/notifees/elrondNotifee_test.go index 3eec68c6..6de19854 100644 --- a/aggregator/notifees/elrondNotifee_test.go +++ b/aggregator/notifees/elrondNotifee_test.go @@ -27,8 +27,8 @@ var ( keyGen = signing.NewKeyGenerator(suite) ) -func createMockArgsElrondNotifee() ArgsElrondNotifee { - return ArgsElrondNotifee{ +func createMockArgsMultiversXNotifee() ArgsMultiversXNotifee { + return ArgsMultiversXNotifee{ Proxy: &testsCommon.ProxyStub{}, TxBuilder: &testsCommon.TxBuilderStub{}, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -39,7 +39,7 @@ func createMockArgsElrondNotifee() ArgsElrondNotifee { } } -func createMockArgsElrondNotifeeWithSomeRealComponents() ArgsElrondNotifee { +func createMockArgsMultiversXNotifeeWithSomeRealComponents() ArgsMultiversXNotifee { proxy := &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return &data.NetworkConfig{ @@ -54,7 +54,7 @@ func createMockArgsElrondNotifeeWithSomeRealComponents() ArgsElrondNotifee { holder, _ := cryptoProvider.NewCryptoComponentsHolder(keyGen, skBytes) txBuilder, _ := builders.NewTxBuilder(cryptoProvider.NewSigner()) - return ArgsElrondNotifee{ + return ArgsMultiversXNotifee{ Proxy: proxy, TxBuilder: txBuilder, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -84,15 +84,15 @@ func createMockPriceChanges() []*aggregator.ArgsPriceChanged { } } -func TestNewElrondNotifee(t *testing.T) { +func TestNewMultiversXNotifee(t *testing.T) { t.Parallel() t.Run("nil proxy should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.Proxy = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilProxy, err) @@ -100,9 +100,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil tx builder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.TxBuilder = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxBuilder, err) @@ -110,9 +110,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil tx nonce handler should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.TxNonceHandler = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxNonceHandler, err) @@ -120,9 +120,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.ContractAddress = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilContractAddressHandler, err) @@ -130,9 +130,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("invalid contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.ContractAddress = data.NewAddressFromBytes([]byte("invalid")) - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidContractAddress, err) @@ -140,9 +140,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("nil cryptoHlder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.CryptoHolder = nil - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, builders.ErrNilCryptoComponentsHolder, err) @@ -150,9 +150,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("invalid base gas limit should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.BaseGasLimit = minGasLimit - 1 - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidBaseGasLimit, err) @@ -160,9 +160,9 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("invalid gas limit for each should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() + args := createMockArgsMultiversXNotifee() args.GasLimitForEach = minGasLimit - 1 - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidGasLimitForEach, err) @@ -170,22 +170,22 @@ func TestNewElrondNotifee(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifee() - en, err := NewElrondNotifee(args) + args := createMockArgsMultiversXNotifee() + en, err := NewMultiversXNotifee(args) assert.False(t, check.IfNil(en)) assert.Nil(t, err) }) } -func TestElrondNotifee_PriceChanged(t *testing.T) { +func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() t.Run("get nonce errors", func(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { return expectedErr @@ -196,7 +196,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -206,7 +206,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Run("invalid price arguments", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -218,7 +218,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -230,7 +230,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.Proxy = &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return nil, expectedErr @@ -247,7 +247,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -258,7 +258,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -275,7 +275,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -286,7 +286,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -297,7 +297,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -309,7 +309,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { priceChanges := createMockPriceChanges() sentWasCalled := false - args := createMockArgsElrondNotifeeWithSomeRealComponents() + args := createMockArgsMultiversXNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -348,7 +348,7 @@ func TestElrondNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewElrondNotifee(args) + en, err := NewMultiversXNotifee(args) require.Nil(t, err) err = en.PriceChanged(context.Background(), priceChanges) diff --git a/aggregator/notifees/interface.go b/aggregator/notifees/interface.go index 6d71c500..81d45c2e 100644 --- a/aggregator/notifees/interface.go +++ b/aggregator/notifees/interface.go @@ -13,7 +13,7 @@ type TxBuilder interface { IsInterfaceNil() bool } -// Proxy holds the primitive functions that the elrond proxy engine supports & implements +// Proxy holds the primitive functions that the multiversx proxy engine supports & implements // dependency inversion: blockchain package is considered inner business logic, this package is considered "plugin" type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) diff --git a/aggregator/priceAggregator.go b/aggregator/priceAggregator.go index 3c4366c7..b05a610a 100644 --- a/aggregator/priceAggregator.go +++ b/aggregator/priceAggregator.go @@ -12,7 +12,7 @@ import ( const minResultsNum = 1 -var log = logger.GetOrCreate("elrond-sdk-erdgo/aggregator") +var log = logger.GetOrCreate("mx-sdk-go/aggregator") // ArgsPriceAggregator is the DTO used in the NewPriceAggregator function type ArgsPriceAggregator struct { diff --git a/authentication/native.go b/authentication/native.go index fe0bc57c..55879ad0 100644 --- a/authentication/native.go +++ b/authentication/native.go @@ -68,7 +68,7 @@ func NewNativeAuthClient(args ArgsNativeAuthClient) (*nativeAuthClient, error) { }, nil } -// GetAccessToken returns an access token used for authentication into different elrond services +// GetAccessToken returns an access token used for authentication into different MultiversX services func (nac *nativeAuthClient) GetAccessToken() (string, error) { now := nac.getTimeHandler() noToken := nac.tokenExpire.IsZero() diff --git a/blockchain/addressGenerator.go b/blockchain/addressGenerator.go index f8e07c42..f3206f4d 100644 --- a/blockchain/addressGenerator.go +++ b/blockchain/addressGenerator.go @@ -3,7 +3,7 @@ package blockchain import ( "bytes" - elrondCore "github.com/multiversx/mx-chain-core-go/core" + mxChainCore "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-core-go/core/check" "github.com/multiversx/mx-chain-core-go/data/typeConverters/uint64ByteSlice" "github.com/multiversx/mx-chain-core-go/hashing" @@ -22,7 +22,7 @@ const accountStartNonce = uint64(0) var initialDNSAddress = bytes.Repeat([]byte{1}, 32) -// addressGenerator is used to generate some addresses based on elrond-go logic +// addressGenerator is used to generate some addresses based on mx-chain-go logic type addressGenerator struct { coordinator *shardCoordinator blockChainHook process.BlockChainHookHandler @@ -42,7 +42,7 @@ func NewAddressGenerator(coordinator *shardCoordinator) (*addressGenerator, erro PubkeyConv: core.AddressPublicKeyConverter, StorageService: &disabled.StorageService{}, BlockChain: &disabled.Blockchain{}, - ShardCoordinator: &disabled.ElrondShardCoordinator{}, + ShardCoordinator: &disabled.MultiversXShardCoordinator{}, Marshalizer: &marshal.JsonMarshalizer{}, Uint64Converter: uint64ByteSlice.NewBigEndianConverter(), BuiltInFunctions: builtInFuncs, @@ -73,7 +73,7 @@ func (ag *addressGenerator) CompatibleDNSAddress(shardId byte) (core.AddressHand addressLen := len(initialDNSAddress) shardInBytes := []byte{0, shardId} - newDNSPk := string(initialDNSAddress[:(addressLen-elrondCore.ShardIdentiferLen)]) + string(shardInBytes) + newDNSPk := string(initialDNSAddress[:(addressLen-mxChainCore.ShardIdentiferLen)]) + string(shardInBytes) newDNSAddress, err := ag.blockChainHook.NewAddress([]byte(newDNSPk), accountStartNonce, factory.WasmVirtualMachine) if err != nil { return nil, err diff --git a/blockchain/cryptoProvider/signer.go b/blockchain/cryptoProvider/signer.go index a8610a14..02e93d40 100644 --- a/blockchain/cryptoProvider/signer.go +++ b/blockchain/cryptoProvider/signer.go @@ -12,7 +12,7 @@ import ( ) var ( - signerLog = logger.GetOrCreate("elrond-sdk-erdgo/signer") + signerLog = logger.GetOrCreate("mx-sdk-go/signer") hasher = keccak.NewKeccak() singleSigner = &singlesig.Ed25519Signer{} messagePrefix = []byte("\x17Elrond Signed Message:\n") diff --git a/blockchain/elrondBaseProxy.go b/blockchain/elrondBaseProxy.go index a759925a..b6413753 100644 --- a/blockchain/elrondBaseProxy.go +++ b/blockchain/elrondBaseProxy.go @@ -15,19 +15,19 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/blockchain") +var log = logger.GetOrCreate("mx-sdk-go/blockchain") const ( minimumCachingInterval = time.Second ) -type argsElrondBaseProxy struct { +type argsMultiversXBaseProxy struct { expirationTime time.Duration httpClientWrapper httpClientWrapper endpointProvider EndpointProvider } -type elrondBaseProxy struct { +type multiversXBaseProxy struct { httpClientWrapper mut sync.RWMutex fetchedConfigs *data.NetworkConfig @@ -37,14 +37,14 @@ type elrondBaseProxy struct { endpointProvider EndpointProvider } -// newElrondBaseProxy will create a base elrond proxy with cache instance -func newElrondBaseProxy(args argsElrondBaseProxy) (*elrondBaseProxy, error) { +// newMultiversXBaseProxy will create a base multiversx proxy with cache instance +func newMultiversXBaseProxy(args argsMultiversXBaseProxy) (*multiversXBaseProxy, error) { err := checkArgsBaseProxy(args) if err != nil { return nil, err } - return &elrondBaseProxy{ + return &multiversXBaseProxy{ httpClientWrapper: args.httpClientWrapper, cacheExpiryDuration: args.expirationTime, endpointProvider: args.endpointProvider, @@ -52,7 +52,7 @@ func newElrondBaseProxy(args argsElrondBaseProxy) (*elrondBaseProxy, error) { }, nil } -func checkArgsBaseProxy(args argsElrondBaseProxy) error { +func checkArgsBaseProxy(args argsMultiversXBaseProxy) error { if args.expirationTime < minimumCachingInterval { return fmt.Errorf("%w, provided: %v, minimum: %v", ErrInvalidCacherDuration, args.expirationTime, minimumCachingInterval) } @@ -71,7 +71,7 @@ func since(t time.Time) time.Duration { } // GetNetworkConfig will return the cached network configs fetching new values and saving them if necessary -func (proxy *elrondBaseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *multiversXBaseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.RLock() cachedConfigs := proxy.getCachedConfigs() proxy.mut.RUnlock() @@ -83,7 +83,7 @@ func (proxy *elrondBaseProxy) GetNetworkConfig(ctx context.Context) (*data.Netwo return proxy.cacheConfigs(ctx) } -func (proxy *elrondBaseProxy) getCachedConfigs() *data.NetworkConfig { +func (proxy *multiversXBaseProxy) getCachedConfigs() *data.NetworkConfig { if proxy.sinceTimeHandler(proxy.lastFetchedTime) > proxy.cacheExpiryDuration { return nil } @@ -91,7 +91,7 @@ func (proxy *elrondBaseProxy) getCachedConfigs() *data.NetworkConfig { return proxy.fetchedConfigs } -func (proxy *elrondBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *multiversXBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.Lock() defer proxy.mut.Unlock() @@ -114,7 +114,7 @@ func (proxy *elrondBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkCo } // getNetworkConfigFromSource retrieves the network configuration from the proxy -func (proxy *elrondBaseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *multiversXBaseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { buff, code, err := proxy.GetHTTP(ctx, proxy.endpointProvider.GetNetworkConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -134,7 +134,7 @@ func (proxy *elrondBaseProxy) getNetworkConfigFromSource(ctx context.Context) (* // GetShardOfAddress returns the shard ID of a provided address by using a shardCoordinator object and querying the // network config route -func (proxy *elrondBaseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { +func (proxy *multiversXBaseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { addr, err := data.NewAddressFromBech32String(bech32Address) if err != nil { return 0, err @@ -154,7 +154,7 @@ func (proxy *elrondBaseProxy) GetShardOfAddress(ctx context.Context, bech32Addre } // GetNetworkStatus will return the network status of a provided shard -func (proxy *elrondBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *multiversXBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { endpoint := proxy.endpointProvider.GetNodeStatus(shardID) buff, code, err := proxy.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -172,7 +172,7 @@ func (proxy *elrondBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint return &data.NetworkStatus{}, ErrInvalidEndpointProvider } -func (proxy *elrondBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *multiversXBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NetworkStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -190,7 +190,7 @@ func (proxy *elrondBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*da return response.Data.Status, nil } -func (proxy *elrondBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *multiversXBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NodeStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -208,7 +208,7 @@ func (proxy *elrondBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data. return response.Data.Status, nil } -func (proxy *elrondBaseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { +func (proxy *multiversXBaseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { if networkStatus == nil { return fmt.Errorf("%w, requested from %d", ErrNilNetworkStatus, shardID) } @@ -223,11 +223,11 @@ func (proxy *elrondBaseProxy) checkReceivedNodeStatus(networkStatus *data.Networ } // GetRestAPIEntityType returns the REST API entity type that this implementation works with -func (proxy *elrondBaseProxy) GetRestAPIEntityType() core.RestAPIEntityType { +func (proxy *multiversXBaseProxy) GetRestAPIEntityType() core.RestAPIEntityType { return proxy.endpointProvider.GetRestAPIEntityType() } // IsInterfaceNil returns true if there is no value under the interface -func (proxy *elrondBaseProxy) IsInterfaceNil() bool { +func (proxy *multiversXBaseProxy) IsInterfaceNil() bool { return proxy == nil } diff --git a/blockchain/elrondBaseProxy_test.go b/blockchain/elrondBaseProxy_test.go index 66a6417a..8f4a9916 100644 --- a/blockchain/elrondBaseProxy_test.go +++ b/blockchain/elrondBaseProxy_test.go @@ -18,23 +18,23 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsElrondBaseProxy() argsElrondBaseProxy { - return argsElrondBaseProxy{ +func createMockArgsMultiversXBaseProxy() argsMultiversXBaseProxy { + return argsMultiversXBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, endpointProvider: endpointProviders.NewNodeEndpointProvider(), } } -func TestNewElrondBaseProxy(t *testing.T) { +func TestNewMultiversXBaseProxy(t *testing.T) { t.Parallel() t.Run("nil http client wrapper", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = nil - baseProxy, err := newElrondBaseProxy(args) + baseProxy, err := newMultiversXBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilHTTPClientWrapper)) @@ -42,9 +42,9 @@ func TestNewElrondBaseProxy(t *testing.T) { t.Run("invalid caching duration", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.expirationTime = time.Second - time.Nanosecond - baseProxy, err := newElrondBaseProxy(args) + baseProxy, err := newMultiversXBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -52,9 +52,9 @@ func TestNewElrondBaseProxy(t *testing.T) { t.Run("nil endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = nil - baseProxy, err := newElrondBaseProxy(args) + baseProxy, err := newMultiversXBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilEndpointProvider)) @@ -62,15 +62,15 @@ func TestNewElrondBaseProxy(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() - baseProxy, err := newElrondBaseProxy(args) + args := createMockArgsMultiversXBaseProxy() + baseProxy, err := newMultiversXBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) assert.Nil(t, err) }) } -func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { +func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { t.Parallel() expectedReturnedNetworkConfig := &data.NetworkConfig{ @@ -110,10 +110,10 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval } @@ -134,10 +134,10 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval*2 + time.Millisecond } @@ -159,9 +159,9 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusBadRequest, expectedErr } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -180,9 +180,9 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return []byte("malformed data"), http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -211,9 +211,9 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return erroredNetworkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -232,10 +232,10 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) baseProxy.fetchedConfigs = expectedReturnedNetworkConfig baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval @@ -249,20 +249,20 @@ func TestElrondBaseProxy_GetNetworkConfig(t *testing.T) { }) } -func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { +func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") t.Run("get errors", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return nil, http.StatusBadRequest, expectedErr }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -272,13 +272,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -288,14 +288,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -314,13 +314,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -339,14 +339,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -356,13 +356,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -372,14 +372,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -402,13 +402,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -430,13 +430,13 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { CrossCheckBlockHeight: "aaa", } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -458,14 +458,14 @@ func TestElrondBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, // this won't be tested in this test } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -495,7 +495,7 @@ func getNodeStatusBytes(status *data.NetworkStatus) []byte { return respBytes } -func TestElrondBaseProxy_GetShardOfAddress(t *testing.T) { +func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { t.Parallel() t.Run("invalid address", func(t *testing.T) { @@ -554,7 +554,7 @@ func TestElrondBaseProxy_GetShardOfAddress(t *testing.T) { }) } -func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *elrondBaseProxy { +func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *multiversXBaseProxy { expectedReturnedNetworkConfig := &data.NetworkConfig{ NumShardsWithoutMeta: numShards, } @@ -576,18 +576,18 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *elrond return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsElrondBaseProxy() + args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newElrondBaseProxy(args) + baseProxy, _ := newMultiversXBaseProxy(args) return baseProxy } -func TestElrondBaseProxy_GetRestAPIEntityType(t *testing.T) { +func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() - args := createMockArgsElrondBaseProxy() - baseProxy, _ := newElrondBaseProxy(args) + args := createMockArgsMultiversXBaseProxy() + baseProxy, _ := newMultiversXBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) } diff --git a/blockchain/endpointProviders/nodeEndpointProvider.go b/blockchain/endpointProviders/nodeEndpointProvider.go index 3fad9fa1..071d2da9 100644 --- a/blockchain/endpointProviders/nodeEndpointProvider.go +++ b/blockchain/endpointProviders/nodeEndpointProvider.go @@ -13,7 +13,7 @@ const ( nodeRawMiniBlockByHashEndpoint = "internal/raw/miniblock/by-hash/%s/epoch/%d" ) -// nodeEndpointProvider is suitable to work with an Elrond node (observer) +// nodeEndpointProvider is suitable to work with an multiversx node (observer) type nodeEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/endpointProviders/proxyEndpointProvider.go b/blockchain/endpointProviders/proxyEndpointProvider.go index 5021b33e..eecf5079 100644 --- a/blockchain/endpointProviders/proxyEndpointProvider.go +++ b/blockchain/endpointProviders/proxyEndpointProvider.go @@ -13,7 +13,7 @@ const ( proxyRawMiniBlockByHash = "internal/%d/raw/miniblock/by-hash/%s/epoch/%d" ) -// proxyEndpointProvider is suitable to work with an Elrond Proxy +// proxyEndpointProvider is suitable to work with an MultiversX Proxy type proxyEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/finalityProvider/proxyFinalityProvider.go b/blockchain/finalityProvider/proxyFinalityProvider.go index fa5ada83..4cd04d59 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider.go +++ b/blockchain/finalityProvider/proxyFinalityProvider.go @@ -6,13 +6,13 @@ import ( "math/big" "strings" - elrondCore "github.com/multiversx/mx-chain-core-go/core" + mxChainCore "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-core-go/core/check" logger "github.com/multiversx/mx-chain-logger-go" "github.com/multiversx/mx-sdk-go/core" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/blockchain/finalityprovider") +var log = logger.GetOrCreate("mx-sdk-go/blockchain/finalityprovider") type proxyFinalityProvider struct { proxy proxy @@ -36,7 +36,7 @@ func (provider *proxyFinalityProvider) CheckShardFinalization(ctx context.Contex if maxNoncesDelta < core.MinAllowedDeltaToFinal { return fmt.Errorf("%w, provided: %d, minimum: %d", ErrInvalidAllowedDeltaToFinal, maxNoncesDelta, core.MinAllowedDeltaToFinal) } - if targetShardID == elrondCore.MetachainShardId { + if targetShardID == mxChainCore.MetachainShardId { // we consider this final since the minAllowedDeltaToFinal is 1 return nil } @@ -62,7 +62,7 @@ func (provider *proxyFinalityProvider) CheckShardFinalization(ctx context.Contex } func (provider *proxyFinalityProvider) getNoncesFromMetaAndShard(ctx context.Context, targetShardID uint32) (uint64, uint64, error) { - networkStatusMeta, err := provider.proxy.GetNetworkStatus(ctx, elrondCore.MetachainShardId) + networkStatusMeta, err := provider.proxy.GetNetworkStatus(ctx, mxChainCore.MetachainShardId) if err != nil { return 0, 0, err } diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 51b0c237..5c008673 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -85,7 +85,7 @@ func TestExtractNonceOfShardID(t *testing.T) { }) } -func TestElrondBaseProxy_CheckShardFinalization(t *testing.T) { +func TestMultiversXBaseProxy_CheckShardFinalization(t *testing.T) { t.Parallel() t.Run("invalid maxNoncesDelta", func(t *testing.T) { diff --git a/blockchain/interface.go b/blockchain/interface.go index 91d21ed8..ee8ac971 100644 --- a/blockchain/interface.go +++ b/blockchain/interface.go @@ -7,7 +7,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -// Proxy holds the primitive functions that the elrond proxy engine supports & implements +// Proxy holds the primitive functions that the multiversx proxy engine supports & implements type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) GetAccount(ctx context.Context, address core.AddressHandler) (*data.Account, error) diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 0901e308..d49d9c06 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -22,8 +22,8 @@ const ( withResultsQueryParam = "?withResults=true" ) -// ArgsElrondProxy is the DTO used in the elrond proxy constructor -type ArgsElrondProxy struct { +// ArgsMultiversXProxy is the DTO used in the multiversx proxy constructor +type ArgsMultiversXProxy struct { ProxyURL string Client erdgoHttp.Client SameScState bool @@ -34,9 +34,9 @@ type ArgsElrondProxy struct { EntityType erdgoCore.RestAPIEntityType } -// elrondProxy implements basic functions for interacting with an Elrond Proxy -type elrondProxy struct { - *elrondBaseProxy +// multiversXProxy implements basic functions for interacting with a multiversx Proxy +type multiversXProxy struct { + *multiversXBaseProxy sameScState bool shouldBeSynced bool finalityCheck bool @@ -44,8 +44,8 @@ type elrondProxy struct { finalityProvider FinalityProvider } -// NewElrondProxy initializes and returns an ElrondProxy object -func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { +// NewMultiversXProxy initializes and returns an multiversXProxy object +func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { err := checkArgsProxy(args) if err != nil { return nil, err @@ -57,12 +57,12 @@ func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { } clientWrapper := erdgoHttp.NewHttpClientWrapper(args.Client, args.ProxyURL) - baseArgs := argsElrondBaseProxy{ + baseArgs := argsMultiversXBaseProxy{ httpClientWrapper: clientWrapper, expirationTime: args.CacheExpirationTime, endpointProvider: endpointProvider, } - baseProxy, err := newElrondBaseProxy(baseArgs) + baseProxy, err := newMultiversXBaseProxy(baseArgs) if err != nil { return nil, err } @@ -72,8 +72,8 @@ func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { return nil, err } - ep := &elrondProxy{ - elrondBaseProxy: baseProxy, + ep := &multiversXProxy{ + multiversXBaseProxy: baseProxy, sameScState: args.SameScState, shouldBeSynced: args.ShouldBeSynced, finalityCheck: args.FinalityCheck, @@ -84,7 +84,7 @@ func NewElrondProxy(args ArgsElrondProxy) (*elrondProxy, error) { return ep, nil } -func checkArgsProxy(args ArgsElrondProxy) error { +func checkArgsProxy(args ArgsMultiversXProxy) error { if args.FinalityCheck { if args.AllowedDeltaToFinal < erdgoCore.MinAllowedDeltaToFinal { return fmt.Errorf("%w, provided: %d, minimum: %d", @@ -96,7 +96,7 @@ func checkArgsProxy(args ArgsElrondProxy) error { } // ExecuteVMQuery retrieves data from existing SC trie through the use of a VM -func (ep *elrondProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { +func (ep *multiversXProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { err := ep.checkFinalState(ctx, vmRequest.Address) if err != nil { return nil, err @@ -129,7 +129,7 @@ func (ep *elrondProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmVal return &response.Data, nil } -func (ep *elrondProxy) checkFinalState(ctx context.Context, address string) error { +func (ep *multiversXProxy) checkFinalState(ctx context.Context, address string) error { if !ep.finalityCheck { return nil } @@ -143,7 +143,7 @@ func (ep *elrondProxy) checkFinalState(ctx context.Context, address string) erro } // GetNetworkEconomics retrieves the network economics from the proxy -func (ep *elrondProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { +func (ep *multiversXProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetNetworkEconomics()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -162,7 +162,7 @@ func (ep *elrondProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEc } // GetDefaultTransactionArguments will prepare the transaction creation argument by querying the account's info -func (ep *elrondProxy) GetDefaultTransactionArguments( +func (ep *multiversXProxy) GetDefaultTransactionArguments( ctx context.Context, address erdgoCore.AddressHandler, networkConfigs *data.NetworkConfig, @@ -196,7 +196,7 @@ func (ep *elrondProxy) GetDefaultTransactionArguments( } // GetAccount retrieves an account info from the network (nonce, balance) -func (ep *elrondProxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { +func (ep *multiversXProxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { err := ep.checkFinalState(ctx, address.AddressAsBech32String()) if err != nil { return nil, err @@ -228,7 +228,7 @@ func (ep *elrondProxy) GetAccount(ctx context.Context, address erdgoCore.Address } // SendTransaction broadcasts a transaction to the network and returns the txhash if successful -func (ep *elrondProxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { +func (ep *multiversXProxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { jsonTx, err := json.Marshal(tx) if err != nil { return "", err @@ -251,7 +251,7 @@ func (ep *elrondProxy) SendTransaction(ctx context.Context, tx *data.Transaction } // SendTransactions broadcasts the provided transactions to the network and returns the txhashes if successful -func (ep *elrondProxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { +func (ep *multiversXProxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { jsonTx, err := json.Marshal(txs) if err != nil { return nil, err @@ -273,7 +273,7 @@ func (ep *elrondProxy) SendTransactions(ctx context.Context, txs []*data.Transac return ep.postProcessSendMultipleTxsResult(response) } -func (ep *elrondProxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { +func (ep *multiversXProxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { txHashes := make([]string, 0, len(response.Data.TxsHashes)) indexes := make([]int, 0, len(response.Data.TxsHashes)) for index := range response.Data.TxsHashes { @@ -292,7 +292,7 @@ func (ep *elrondProxy) postProcessSendMultipleTxsResult(response *data.SendTrans } // GetTransactionStatus retrieves a transaction's status from the network -func (ep *elrondProxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { +func (ep *multiversXProxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { endpoint := ep.endpointProvider.GetTransactionStatus(hash) buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -312,16 +312,16 @@ func (ep *elrondProxy) GetTransactionStatus(ctx context.Context, hash string) (s } // GetTransactionInfo retrieves a transaction's details from the network -func (ep *elrondProxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *multiversXProxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, false) } // GetTransactionInfoWithResults retrieves a transaction's details from the network with events -func (ep *elrondProxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *multiversXProxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, true) } -func (ep *elrondProxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { +func (ep *multiversXProxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { endpoint := ep.endpointProvider.GetTransactionInfo(hash) if withResults { endpoint += withResultsQueryParam @@ -345,7 +345,7 @@ func (ep *elrondProxy) getTransactionInfo(ctx context.Context, hash string, with } // RequestTransactionCost retrieves how many gas a transaction will consume -func (ep *elrondProxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { +func (ep *multiversXProxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { jsonTx, err := json.Marshal(tx) if err != nil { return nil, err @@ -368,7 +368,7 @@ func (ep *elrondProxy) RequestTransactionCost(ctx context.Context, tx *data.Tran } // GetLatestHyperBlockNonce retrieves the latest hyper block (metachain) nonce from the network -func (ep *elrondProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { +func (ep *multiversXProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, core.MetachainShardId) if err != nil { return 0, err @@ -378,20 +378,20 @@ func (ep *elrondProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, er } // GetHyperBlockByNonce retrieves a hyper block's info by nonce from the network -func (ep *elrondProxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { +func (ep *multiversXProxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByNonce(nonce) return ep.getHyperBlock(ctx, endpoint) } // GetHyperBlockByHash retrieves a hyper block's info by hash from the network -func (ep *elrondProxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { +func (ep *multiversXProxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByHash(hash) return ep.getHyperBlock(ctx, endpoint) } -func (ep *elrondProxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { +func (ep *multiversXProxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -410,27 +410,27 @@ func (ep *elrondProxy) getHyperBlock(ctx context.Context, endpoint string) (*dat } // GetRawBlockByHash retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { +func (ep *multiversXProxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByHash(shardId, hash) return ep.getRawBlock(ctx, endpoint) } // GetRawBlockByNonce retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { +func (ep *multiversXProxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByNonce(shardId, nonce) return ep.getRawBlock(ctx, endpoint) } // GetRawStartOfEpochMetaBlock retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { +func (ep *multiversXProxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawStartOfEpochMetaBlock(epoch) return ep.getRawBlock(ctx, endpoint) } -func (ep *elrondProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *multiversXProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -449,13 +449,13 @@ func (ep *elrondProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte } // GetRawMiniBlockByHash retrieves a raw block by hash from the network -func (ep *elrondProxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { +func (ep *multiversXProxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawMiniBlockByHash(shardId, hash, epoch) return ep.getRawMiniBlock(ctx, endpoint) } -func (ep *elrondProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *multiversXProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -474,7 +474,7 @@ func (ep *elrondProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([] } // GetNonceAtEpochStart retrieves the start of epoch nonce from hyper block (metachain) -func (ep *elrondProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { +func (ep *multiversXProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, shardId) if err != nil { return 0, err @@ -484,7 +484,7 @@ func (ep *elrondProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) } // GetRatingsConfig retrieves the ratings configuration from the proxy -func (ep *elrondProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { +func (ep *multiversXProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetRatingsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -503,7 +503,7 @@ func (ep *elrondProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfi } // GetEnableEpochsConfig retrieves the ratings configuration from the proxy -func (ep *elrondProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { +func (ep *multiversXProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetEnableEpochsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -522,7 +522,7 @@ func (ep *elrondProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableE } // GetGenesisNodesPubKeys retrieves genesis nodes configuration from proxy -func (ep *elrondProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { +func (ep *multiversXProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetGenesisNodesConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -541,7 +541,7 @@ func (ep *elrondProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.Genesi } // GetValidatorsInfoByEpoch retrieves the validators info by epoch -func (ep *elrondProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { +func (ep *multiversXProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetValidatorsInfo(epoch)) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -560,6 +560,6 @@ func (ep *elrondProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint3 } // IsInterfaceNil returns true if there is no value under the interface -func (ep *elrondProxy) IsInterfaceNil() bool { +func (ep *multiversXProxy) IsInterfaceNil() bool { return ep == nil } diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index 1c0669c9..90be805c 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -58,8 +58,8 @@ func createMockClientRespondingBytes(responseBytes []byte) *mockHTTPClient { } } -func createMockArgsElrondProxy(httpClient erdgoHttp.Client) ArgsElrondProxy { - return ArgsElrondProxy{ +func createMockArgsMultiversXProxy(httpClient erdgoHttp.Client) ArgsMultiversXProxy { + return ArgsMultiversXProxy{ ProxyURL: testHttpURL, Client: httpClient, SameScState: false, @@ -139,15 +139,15 @@ func handleRequestNetworkConfigAndStatus( }, handled, nil } -func TestNewElrondProxy(t *testing.T) { +func TestNewMultiversXProxy(t *testing.T) { t.Parallel() t.Run("invalid time cache should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) + args := createMockArgsMultiversXProxy(nil) args.CacheExpirationTime = time.Second - time.Nanosecond - proxy, err := NewElrondProxy(args) + proxy, err := NewMultiversXProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -155,10 +155,10 @@ func TestNewElrondProxy(t *testing.T) { t.Run("invalid nonce delta should error", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) + args := createMockArgsMultiversXProxy(nil) args.FinalityCheck = true args.AllowedDeltaToFinal = 0 - proxy, err := NewElrondProxy(args) + proxy, err := NewMultiversXProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidAllowedDeltaToFinal)) @@ -166,9 +166,9 @@ func TestNewElrondProxy(t *testing.T) { t.Run("should work with finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) + args := createMockArgsMultiversXProxy(nil) args.FinalityCheck = true - proxy, err := NewElrondProxy(args) + proxy, err := NewMultiversXProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -176,8 +176,8 @@ func TestNewElrondProxy(t *testing.T) { t.Run("should work without finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsElrondProxy(nil) - proxy, err := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(nil) + proxy, err := NewMultiversXProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -213,9 +213,9 @@ func TestGetAccount(t *testing.T) { }, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - proxy, _ := NewElrondProxy(args) + proxy, _ := NewMultiversXProxy(args) address, err := data.NewAddressFromBech32String("erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts") if err != nil { @@ -253,13 +253,13 @@ func TestGetAccount(t *testing.T) { }) } -func TestElrondProxy_GetNetworkEconomics(t *testing.T) { +func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) networkEconomics, err := ep.GetNetworkEconomics(context.Background()) require.Nil(t, err) @@ -274,13 +274,13 @@ func TestElrondProxy_GetNetworkEconomics(t *testing.T) { }, networkEconomics) } -func TestElrondProxy_RequestTransactionCost(t *testing.T) { +func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) tx := &data.Transaction{ Nonce: 1, @@ -300,13 +300,13 @@ func TestElrondProxy_RequestTransactionCost(t *testing.T) { }, txCost) } -func TestElrondProxy_GetTransactionInfoWithResults(t *testing.T) { +func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) tx, err := ep.GetTransactionInfoWithResults(context.Background(), "a40e5a6af4efe221608297a73459211756ab88b96896e6e331842807a138f343") require.Nil(t, err) @@ -315,14 +315,14 @@ func TestElrondProxy_GetTransactionInfoWithResults(t *testing.T) { fmt.Println(string(txBytes)) } -func TestElrondProxy_ExecuteVmQuery(t *testing.T) { +func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"data":{"returnData":["MC41LjU="],"returnCode":"ok","returnMessage":"","gasRemaining":18446744073685949187,"gasRefund":0,"outputAccounts":{"0000000000000000050033bb65a91ee17ab84c6f8a01846ef8644e15fb76696a":{"address":"erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt","nonce":0,"balance":null,"balanceDelta":0,"storageUpdates":{},"code":null,"codeMetaData":null,"outputTransfers":[],"callType":0}},"deletedAccounts":[],"touchedAccounts":[],"logs":[]}},"error":"","code":"successful"}`) t.Run("no finality check", func(t *testing.T) { httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -344,9 +344,9 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - ep, _ := NewElrondProxy(args) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -370,9 +370,9 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - ep, _ := NewElrondProxy(args) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "invalid", @@ -400,9 +400,9 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { }, nil }, } - args := createMockArgsElrondProxy(httpClient) + args := createMockArgsMultiversXProxy(httpClient) args.FinalityCheck = true - ep, _ := NewElrondProxy(args) + ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -416,7 +416,7 @@ func TestElrondProxy_ExecuteVmQuery(t *testing.T) { }) } -func TestElrondProxy_GetRawBlockByHash(t *testing.T) { +func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -436,8 +436,8 @@ func TestElrondProxy_GetRawBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByHash(context.Background(), 0, "aaaa") require.Nil(t, err) @@ -448,7 +448,7 @@ func TestElrondProxy_GetRawBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestElrondProxy_GetRawBlockByNonce(t *testing.T) { +func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -466,8 +466,8 @@ func TestElrondProxy_GetRawBlockByNonce(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByNonce(context.Background(), 0, 10) require.Nil(t, err) @@ -478,7 +478,7 @@ func TestElrondProxy_GetRawBlockByNonce(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestElrondProxy_GetRawMiniBlockByHash(t *testing.T) { +func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -496,8 +496,8 @@ func TestElrondProxy_GetRawMiniBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawMiniBlockByHash(context.Background(), 0, "aaaa", 1) require.Nil(t, err) @@ -508,7 +508,7 @@ func TestElrondProxy_GetRawMiniBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestElrondProxy_GetNonceAtEpochStart(t *testing.T) { +func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { t.Parallel() expectedNonce := uint64(2) @@ -526,8 +526,8 @@ func TestElrondProxy_GetNonceAtEpochStart(t *testing.T) { statusResponseBytes, _ := json.Marshal(statusResponse) httpClient := createMockClientRespondingBytes(statusResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetNonceAtEpochStart(context.Background(), core.MetachainShardId) require.Nil(t, err) @@ -535,7 +535,7 @@ func TestElrondProxy_GetNonceAtEpochStart(t *testing.T) { require.Equal(t, expectedNonce, response) } -func TestElrondProxy_GetRatingsConfig(t *testing.T) { +func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { t.Parallel() expectedRatingsConfig := &data.RatingsConfig{ @@ -552,8 +552,8 @@ func TestElrondProxy_GetRatingsConfig(t *testing.T) { ratingsResponseBytes, _ := json.Marshal(ratingsResponse) httpClient := createMockClientRespondingBytes(ratingsResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetRatingsConfig(context.Background()) require.Nil(t, err) @@ -561,7 +561,7 @@ func TestElrondProxy_GetRatingsConfig(t *testing.T) { require.Equal(t, expectedRatingsConfig, response) } -func TestElrondProxy_GetEnableEpochsConfig(t *testing.T) { +func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { t.Parallel() enableEpochs := config.EnableEpochs{ @@ -581,8 +581,8 @@ func TestElrondProxy_GetEnableEpochsConfig(t *testing.T) { enableEpochsResponseBytes, _ := json.Marshal(enableEpochsResponse) httpClient := createMockClientRespondingBytes(enableEpochsResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetEnableEpochsConfig(context.Background()) require.Nil(t, err) @@ -590,7 +590,7 @@ func TestElrondProxy_GetEnableEpochsConfig(t *testing.T) { require.Equal(t, expectedEnableEpochsConfig, response) } -func TestElrondProxy_GetGenesisNodesPubKeys(t *testing.T) { +func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { t.Parallel() expectedGenesisNodes := &data.GenesisNodes{ @@ -607,8 +607,8 @@ func TestElrondProxy_GetGenesisNodesPubKeys(t *testing.T) { genesisNodesResponseBytes, _ := json.Marshal(genesisNodesResponse) httpClient := createMockClientRespondingBytes(genesisNodesResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetGenesisNodesPubKeys(context.Background()) require.Nil(t, err) @@ -616,7 +616,7 @@ func TestElrondProxy_GetGenesisNodesPubKeys(t *testing.T) { require.Equal(t, expectedGenesisNodes, response) } -func TestElrondProxy_GetValidatorsInfoByEpoch(t *testing.T) { +func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { t.Parallel() expectedValidatorsInfo := []*state.ShardValidatorInfo{ @@ -635,8 +635,8 @@ func TestElrondProxy_GetValidatorsInfoByEpoch(t *testing.T) { validatorsInfoResponseBytes, _ := json.Marshal(validatorsInfoResponse) httpClient := createMockClientRespondingBytes(validatorsInfoResponseBytes) - args := createMockArgsElrondProxy(httpClient) - ep, _ := NewElrondProxy(args) + args := createMockArgsMultiversXProxy(httpClient) + ep, _ := NewMultiversXProxy(args) response, err := ep.GetValidatorsInfoByEpoch(context.Background(), 1) require.Nil(t, err) diff --git a/core/http/clientWrapper.go b/core/http/clientWrapper.go index 4d048996..8a8f24a3 100644 --- a/core/http/clientWrapper.go +++ b/core/http/clientWrapper.go @@ -12,7 +12,7 @@ import ( const ( httpUserAgentKey = "User-Agent" - httpUserAgent = "Elrond go SDK / 1.0.0 " + httpUserAgent = "MultiversX go SDK / 1.0.0 " httpAcceptTypeKey = "Accept" httpAcceptType = "application/json" diff --git a/core/variables.go b/core/variables.go index f317a61e..6758ddaf 100644 --- a/core/variables.go +++ b/core/variables.go @@ -5,7 +5,7 @@ import ( logger "github.com/multiversx/mx-chain-logger-go" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/core") +var log = logger.GetOrCreate("mx-sdk-go/core") // AddressPublicKeyConverter represents the default address public key converter var AddressPublicKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(AddressBytesLen, log) diff --git a/disabled/elrondShardCoordinator.go b/disabled/elrondShardCoordinator.go index 1e6a6939..c05e5538 100644 --- a/disabled/elrondShardCoordinator.go +++ b/disabled/elrondShardCoordinator.go @@ -1,35 +1,35 @@ package disabled -// ElrondShardCoordinator is the disabled shard coordinator instance that satisfies the elrond.sharding.Coordinator interface -type ElrondShardCoordinator struct { +// MultiversXShardCoordinator is the disabled shard coordinator instance that satisfies the mx-chain-go.sharding.Coordinator interface +type MultiversXShardCoordinator struct { } // NumberOfShards returns 0 -func (esc *ElrondShardCoordinator) NumberOfShards() uint32 { +func (msc *MultiversXShardCoordinator) NumberOfShards() uint32 { return 0 } // ComputeId returns 0 -func (esc *ElrondShardCoordinator) ComputeId(_ []byte) uint32 { +func (msc *MultiversXShardCoordinator) ComputeId(_ []byte) uint32 { return 0 } // SelfId returns 0 -func (esc *ElrondShardCoordinator) SelfId() uint32 { +func (msc *MultiversXShardCoordinator) SelfId() uint32 { return 0 } // SameShard returns false -func (esc *ElrondShardCoordinator) SameShard(_, _ []byte) bool { +func (msc *MultiversXShardCoordinator) SameShard(_, _ []byte) bool { return false } // CommunicationIdentifier returns empty string -func (esc *ElrondShardCoordinator) CommunicationIdentifier(_ uint32) string { +func (msc *MultiversXShardCoordinator) CommunicationIdentifier(_ uint32) string { return "" } // IsInterfaceNil returns true if there is no value under the interface -func (esc *ElrondShardCoordinator) IsInterfaceNil() bool { - return esc == nil +func (msc *MultiversXShardCoordinator) IsInterfaceNil() bool { + return msc == nil } diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index f55c0691..f5fedf4a 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -12,10 +12,10 @@ import ( "github.com/multiversx/mx-sdk-go/examples" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesAccount") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesAccount") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index b32e37f6..7ce33f9f 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -11,10 +11,10 @@ import ( "github.com/multiversx/mx-sdk-go/examples" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesBlock") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesBlock") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index be059b5a..81f413f8 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -22,7 +22,7 @@ import ( const timeToExecuteRequest = time.Second -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesFlowWalletTracker") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesFlowWalletTracker") type moveBalanceHandler interface { GenerateMoveBalanceTransactions(ctx context.Context, addresses []string) @@ -51,7 +51,7 @@ func main() { } func runApp() error { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -60,7 +60,7 @@ func runApp() error { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { return err } @@ -91,7 +91,7 @@ func runApp() error { return err } - receiverAddress := "erd1zptg3eu7uw0qvzhnu009lwxupcn6ntjxptj5gaxt8curhxjqr9tsqpsnht" // /elrond-sdk-erdgo/interactors/testdata/test.pem + receiverAddress := "erd1zptg3eu7uw0qvzhnu009lwxupcn6ntjxptj5gaxt8curhxjqr9tsqpsnht" // /mx-sdk-go/interactors/testdata/test.pem txInteractor, err := interactors.NewTransactionInteractor(ep, txBuilder) if err != nil { return err diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index b7a83115..97b84966 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -12,10 +12,10 @@ import ( "github.com/multiversx/mx-sdk-go/headerCheck" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesHeaderCheck") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesHeaderCheck") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index d723e1f9..3d49391d 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -22,7 +22,7 @@ import ( "github.com/multiversx/mx-sdk-go/interactors" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesPriceAggregator") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesPriceAggregator") const base = "ETH" const quote = "USD" @@ -33,7 +33,7 @@ const minResultsNum = 3 const pollInterval = time.Second * 2 const autoSendInterval = time.Second * 10 -const networkAddress = "https://testnet-gateway.elrond.com" +const networkAddress = "https://testnet-gateway.multiversx.com" var ( suite = ed25519.NewEd25519() @@ -211,7 +211,7 @@ func createAuthClient() (authentication.AuthClient, error) { return nil, err } - argsProxy := blockchain.ArgsElrondProxy{ + argsProxy := blockchain.ArgsMultiversXProxy{ ProxyURL: networkAddress, SameScState: false, ShouldBeSynced: false, @@ -221,7 +221,7 @@ func createAuthClient() (authentication.AuthClient, error) { EntityType: core.RestAPIEntityType("Proxy"), } - proxy, err := blockchain.NewElrondProxy(argsProxy) + proxy, err := blockchain.NewMultiversXProxy(argsProxy) if err != nil { return nil, err } diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 05f5421f..8323ff64 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -18,13 +18,13 @@ import ( var ( suite = ed25519.NewEd25519() keyGen = signing.NewKeyGenerator(suite) - log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesTransaction") + log = logger.GetOrCreate("mx-sdk-go/examples/examplesTransaction") ) func main() { _ = logger.SetLogLevel("*:DEBUG") - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -33,7 +33,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index dfa57909..bffe0643 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -11,10 +11,10 @@ import ( "github.com/multiversx/mx-sdk-go/examples" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesVMQuery") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesVMQuery") func main() { - args := blockchain.ArgsElrondProxy{ + args := blockchain.ArgsMultiversXProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewElrondProxy(args) + ep, err := blockchain.NewMultiversXProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesWallet/main.go b/examples/examplesWallet/main.go index 31aee691..d6d87a9b 100644 --- a/examples/examplesWallet/main.go +++ b/examples/examplesWallet/main.go @@ -5,7 +5,7 @@ import ( "github.com/multiversx/mx-sdk-go/interactors" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/examples/examplesWallet") +var log = logger.GetOrCreate("mx-sdk-go/examples/examplesWallet") func main() { w := interactors.NewWallet() diff --git a/examples/networks.go b/examples/networks.go index 4d955221..05cc5d97 100644 --- a/examples/networks.go +++ b/examples/networks.go @@ -1,7 +1,7 @@ package examples // MainnetGateway represents the mainnet gateway address -const MainnetGateway = "https://gateway.elrond.com" +const MainnetGateway = "https://gateway.multiversx.com" // TestnetGateway represents the testnet gateway address -const TestnetGateway = "https://testnet-gateway.elrond.com" +const TestnetGateway = "https://testnet-gateway.multiversx.com" diff --git a/headerCheck/headerCheck.go b/headerCheck/headerCheck.go index 31f1f018..9ec57b6a 100644 --- a/headerCheck/headerCheck.go +++ b/headerCheck/headerCheck.go @@ -10,7 +10,7 @@ import ( logger "github.com/multiversx/mx-chain-logger-go" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/headerCheck") +var log = logger.GetOrCreate("mx-sdk-go/headerCheck") // ArgsHeaderVerifier holds all dependencies required by headerVerifier in // order to create a new instance diff --git a/interactors/interface.go b/interactors/interface.go index 94a8026a..6c7e4507 100644 --- a/interactors/interface.go +++ b/interactors/interface.go @@ -7,7 +7,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -// Proxy holds the primitive functions that the elrond proxy engine supports & implements +// Proxy holds the primitive functions that the multiversx proxy engine supports & implements // dependency inversion: blockchain package is considered inner business logic, this package is considered "plugin" type Proxy interface { GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) diff --git a/interactors/nonceHandlerV1/nonceTransactionsHandler.go b/interactors/nonceHandlerV1/nonceTransactionsHandler.go index 9f2059f4..84d5c9c8 100644 --- a/interactors/nonceHandlerV1/nonceTransactionsHandler.go +++ b/interactors/nonceHandlerV1/nonceTransactionsHandler.go @@ -15,7 +15,7 @@ import ( const minimumIntervalToResend = time.Second -var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors/nonceHandlerV1") +var log = logger.GetOrCreate("mx-sdk-go/interactors/nonceHandlerV1") // nonceTransactionsHandlerV1 is the handler used for an unlimited number of addresses. // It basically contains a map of addressNonceHandler, creating new entries on the first diff --git a/interactors/nonceHandlerV2/nonceTransactionsHandler.go b/interactors/nonceHandlerV2/nonceTransactionsHandler.go index e4d68597..a725864a 100644 --- a/interactors/nonceHandlerV2/nonceTransactionsHandler.go +++ b/interactors/nonceHandlerV2/nonceTransactionsHandler.go @@ -15,7 +15,7 @@ import ( const minimumIntervalToResend = time.Second -var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors/nonceHandlerV2") +var log = logger.GetOrCreate("mx-sdk-go/interactors/nonceHandlerV2") // ArgsNonceTransactionsHandlerV2 is the argument DTO for a nonce transactions handler component type ArgsNonceTransactionsHandlerV2 struct { diff --git a/interactors/transaction.go b/interactors/transaction.go index 88f0f1a7..2357227c 100644 --- a/interactors/transaction.go +++ b/interactors/transaction.go @@ -10,7 +10,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/interactors") +var log = logger.GetOrCreate("mx-sdk-go/interactors") const defaultTimeBetweenBunches = time.Second diff --git a/storage/mapCacher.go b/storage/mapCacher.go index cfa9b8cb..d915b0ff 100644 --- a/storage/mapCacher.go +++ b/storage/mapCacher.go @@ -8,7 +8,7 @@ import ( logger "github.com/multiversx/mx-chain-logger-go" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/storage") +var log = logger.GetOrCreate("mx-sdk-go/storage") // mapCacher is the cacher implementation based on a map type mapCacher struct { diff --git a/workflows/walletsTracker.go b/workflows/walletsTracker.go index 855ef8d9..7595d5ff 100644 --- a/workflows/walletsTracker.go +++ b/workflows/walletsTracker.go @@ -12,7 +12,7 @@ import ( "github.com/multiversx/mx-sdk-go/data" ) -var log = logger.GetOrCreate("elrond-sdk-erdgo/workflows") +var log = logger.GetOrCreate("mx-sdk-go/workflows") // WalletTrackerArgs is the argument DTO for the NewWalletTracker constructor function type WalletTrackerArgs struct { From cdee899bbcd67ac87913b00f800a6740c31d2c9e Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 13:08:27 +0200 Subject: [PATCH 06/15] fixed an -> a --- blockchain/endpointProviders/nodeEndpointProvider.go | 2 +- blockchain/endpointProviders/proxyEndpointProvider.go | 2 +- blockchain/proxy.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blockchain/endpointProviders/nodeEndpointProvider.go b/blockchain/endpointProviders/nodeEndpointProvider.go index 071d2da9..c4e7fd1b 100644 --- a/blockchain/endpointProviders/nodeEndpointProvider.go +++ b/blockchain/endpointProviders/nodeEndpointProvider.go @@ -13,7 +13,7 @@ const ( nodeRawMiniBlockByHashEndpoint = "internal/raw/miniblock/by-hash/%s/epoch/%d" ) -// nodeEndpointProvider is suitable to work with an multiversx node (observer) +// nodeEndpointProvider is suitable to work with a MultiversX node (observer) type nodeEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/endpointProviders/proxyEndpointProvider.go b/blockchain/endpointProviders/proxyEndpointProvider.go index eecf5079..0a3df4f6 100644 --- a/blockchain/endpointProviders/proxyEndpointProvider.go +++ b/blockchain/endpointProviders/proxyEndpointProvider.go @@ -13,7 +13,7 @@ const ( proxyRawMiniBlockByHash = "internal/%d/raw/miniblock/by-hash/%s/epoch/%d" ) -// proxyEndpointProvider is suitable to work with an MultiversX Proxy +// proxyEndpointProvider is suitable to work with a MultiversX Proxy type proxyEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/proxy.go b/blockchain/proxy.go index d49d9c06..42603fd5 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -44,7 +44,7 @@ type multiversXProxy struct { finalityProvider FinalityProvider } -// NewMultiversXProxy initializes and returns an multiversXProxy object +// NewMultiversXProxy initializes and returns a multiversXProxy object func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { err := checkArgsProxy(args) if err != nil { From c5a28070f9a762912d767edf39e55bf8d6894036 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 13:08:27 +0200 Subject: [PATCH 07/15] fixed an -> a --- blockchain/endpointProviders/nodeEndpointProvider.go | 2 +- blockchain/endpointProviders/proxyEndpointProvider.go | 2 +- blockchain/proxy.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blockchain/endpointProviders/nodeEndpointProvider.go b/blockchain/endpointProviders/nodeEndpointProvider.go index 071d2da9..c4e7fd1b 100644 --- a/blockchain/endpointProviders/nodeEndpointProvider.go +++ b/blockchain/endpointProviders/nodeEndpointProvider.go @@ -13,7 +13,7 @@ const ( nodeRawMiniBlockByHashEndpoint = "internal/raw/miniblock/by-hash/%s/epoch/%d" ) -// nodeEndpointProvider is suitable to work with an multiversx node (observer) +// nodeEndpointProvider is suitable to work with a MultiversX node (observer) type nodeEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/endpointProviders/proxyEndpointProvider.go b/blockchain/endpointProviders/proxyEndpointProvider.go index eecf5079..0a3df4f6 100644 --- a/blockchain/endpointProviders/proxyEndpointProvider.go +++ b/blockchain/endpointProviders/proxyEndpointProvider.go @@ -13,7 +13,7 @@ const ( proxyRawMiniBlockByHash = "internal/%d/raw/miniblock/by-hash/%s/epoch/%d" ) -// proxyEndpointProvider is suitable to work with an MultiversX Proxy +// proxyEndpointProvider is suitable to work with a MultiversX Proxy type proxyEndpointProvider struct { *baseEndpointProvider } diff --git a/blockchain/proxy.go b/blockchain/proxy.go index d49d9c06..42603fd5 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -44,7 +44,7 @@ type multiversXProxy struct { finalityProvider FinalityProvider } -// NewMultiversXProxy initializes and returns an multiversXProxy object +// NewMultiversXProxy initializes and returns a multiversXProxy object func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { err := checkArgsProxy(args) if err != nil { From b97e76219287a4599d6fadc1484903b1542b113c Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 13:55:53 +0200 Subject: [PATCH 08/15] removed MultiversX from Proxy, Notifee, ShardCoordinator --- .../{elrondNotifee.go => mxNotifee.go} | 22 +++--- ...lrondNotifee_test.go => mxNotifee_test.go} | 72 +++++++++---------- blockchain/addressGenerator.go | 2 +- .../{elrondBaseProxy.go => baseProxy.go} | 34 ++++----- ...ondBaseProxy_test.go => baseProxy_test.go} | 50 ++++++------- blockchain/proxy.go | 16 ++--- blockchain/proxy_test.go | 44 ++++++------ disabled/elrondShardCoordinator.go | 35 --------- disabled/shardCoordinator.go | 35 +++++++++ examples/examplesAccount/main.go | 2 +- examples/examplesBlock/main.go | 2 +- examples/examplesFlowWalletTracker/main.go | 2 +- examples/examplesHeaderCheck/main.go | 2 +- examples/examplesPriceAggregator/main.go | 2 +- examples/examplesTransaction/main.go | 2 +- examples/examplesVMQuery/main.go | 2 +- 16 files changed, 162 insertions(+), 162 deletions(-) rename aggregator/notifees/{elrondNotifee.go => mxNotifee.go} (82%) rename aggregator/notifees/{elrondNotifee_test.go => mxNotifee_test.go} (85%) rename blockchain/{elrondBaseProxy.go => baseProxy.go} (78%) rename blockchain/{elrondBaseProxy_test.go => baseProxy_test.go} (93%) delete mode 100644 disabled/elrondShardCoordinator.go create mode 100644 disabled/shardCoordinator.go diff --git a/aggregator/notifees/elrondNotifee.go b/aggregator/notifees/mxNotifee.go similarity index 82% rename from aggregator/notifees/elrondNotifee.go rename to aggregator/notifees/mxNotifee.go index 79468645..339c492c 100644 --- a/aggregator/notifees/elrondNotifee.go +++ b/aggregator/notifees/mxNotifee.go @@ -18,8 +18,8 @@ const minGasLimit = uint64(1) var log = logger.GetOrCreate("mx-sdk-go/aggregator/notifees") -// ArgsMultiversXNotifee is the argument DTO for the NewMultiversXNotifee function -type ArgsMultiversXNotifee struct { +// ArgsMxNotifee is the argument DTO for the NewMxNotifee function +type ArgsMxNotifee struct { Proxy Proxy TxBuilder TxBuilder TxNonceHandler TransactionNonceHandler @@ -29,7 +29,7 @@ type ArgsMultiversXNotifee struct { GasLimitForEach uint64 } -type multiversXNotifee struct { +type mxNotifee struct { proxy Proxy txBuilder TxBuilder txNonceHandler TransactionNonceHandler @@ -39,14 +39,14 @@ type multiversXNotifee struct { cryptoHolder core.CryptoComponentsHolder } -// NewMultiversXNotifee will create a new instance of multiversXNotifee -func NewMultiversXNotifee(args ArgsMultiversXNotifee) (*multiversXNotifee, error) { - err := checkArgsMultiversXNotifee(args) +// NewMxNotifee will create a new instance of mxNotifee +func NewMxNotifee(args ArgsMxNotifee) (*mxNotifee, error) { + err := checkArgsMxNotifee(args) if err != nil { return nil, err } - notifee := &multiversXNotifee{ + notifee := &mxNotifee{ proxy: args.Proxy, txBuilder: args.TxBuilder, txNonceHandler: args.TxNonceHandler, @@ -59,7 +59,7 @@ func NewMultiversXNotifee(args ArgsMultiversXNotifee) (*multiversXNotifee, error return notifee, nil } -func checkArgsMultiversXNotifee(args ArgsMultiversXNotifee) error { +func checkArgsMxNotifee(args ArgsMxNotifee) error { if check.IfNil(args.Proxy) { return errNilProxy } @@ -90,7 +90,7 @@ func checkArgsMultiversXNotifee(args ArgsMultiversXNotifee) error { // PriceChanged is the function that gets called by a price notifier. This function will assemble a MultiversX // transaction, having the transaction's data field containing all the price changes information -func (en *multiversXNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { +func (en *mxNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { txData, err := en.prepareTxData(priceChanges) if err != nil { return err @@ -132,7 +132,7 @@ func (en *multiversXNotifee) PriceChanged(ctx context.Context, priceChanges []*a return nil } -func (en *multiversXNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { +func (en *mxNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { txDataBuilder := builders.NewTxDataBuilder() txDataBuilder.Function(function) @@ -148,6 +148,6 @@ func (en *multiversXNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceC } // IsInterfaceNil returns true if there is no value under the interface -func (en *multiversXNotifee) IsInterfaceNil() bool { +func (en *mxNotifee) IsInterfaceNil() bool { return en == nil } diff --git a/aggregator/notifees/elrondNotifee_test.go b/aggregator/notifees/mxNotifee_test.go similarity index 85% rename from aggregator/notifees/elrondNotifee_test.go rename to aggregator/notifees/mxNotifee_test.go index 6de19854..eebb452d 100644 --- a/aggregator/notifees/elrondNotifee_test.go +++ b/aggregator/notifees/mxNotifee_test.go @@ -27,8 +27,8 @@ var ( keyGen = signing.NewKeyGenerator(suite) ) -func createMockArgsMultiversXNotifee() ArgsMultiversXNotifee { - return ArgsMultiversXNotifee{ +func createMockArgsMxNotifee() ArgsMxNotifee { + return ArgsMxNotifee{ Proxy: &testsCommon.ProxyStub{}, TxBuilder: &testsCommon.TxBuilderStub{}, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -39,7 +39,7 @@ func createMockArgsMultiversXNotifee() ArgsMultiversXNotifee { } } -func createMockArgsMultiversXNotifeeWithSomeRealComponents() ArgsMultiversXNotifee { +func createMockArgsMxNotifeeWithSomeRealComponents() ArgsMxNotifee { proxy := &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return &data.NetworkConfig{ @@ -54,7 +54,7 @@ func createMockArgsMultiversXNotifeeWithSomeRealComponents() ArgsMultiversXNotif holder, _ := cryptoProvider.NewCryptoComponentsHolder(keyGen, skBytes) txBuilder, _ := builders.NewTxBuilder(cryptoProvider.NewSigner()) - return ArgsMultiversXNotifee{ + return ArgsMxNotifee{ Proxy: proxy, TxBuilder: txBuilder, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -84,15 +84,15 @@ func createMockPriceChanges() []*aggregator.ArgsPriceChanged { } } -func TestNewMultiversXNotifee(t *testing.T) { +func TestNewMxNotifee(t *testing.T) { t.Parallel() t.Run("nil proxy should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.Proxy = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilProxy, err) @@ -100,9 +100,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil tx builder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.TxBuilder = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxBuilder, err) @@ -110,9 +110,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil tx nonce handler should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.TxNonceHandler = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxNonceHandler, err) @@ -120,9 +120,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.ContractAddress = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilContractAddressHandler, err) @@ -130,9 +130,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("invalid contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.ContractAddress = data.NewAddressFromBytes([]byte("invalid")) - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidContractAddress, err) @@ -140,9 +140,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil cryptoHlder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.CryptoHolder = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, builders.ErrNilCryptoComponentsHolder, err) @@ -150,9 +150,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("invalid base gas limit should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.BaseGasLimit = minGasLimit - 1 - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidBaseGasLimit, err) @@ -160,9 +160,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("invalid gas limit for each should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.GasLimitForEach = minGasLimit - 1 - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidGasLimitForEach, err) @@ -170,22 +170,22 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() - en, err := NewMultiversXNotifee(args) + args := createMockArgsMxNotifee() + en, err := NewMxNotifee(args) assert.False(t, check.IfNil(en)) assert.Nil(t, err) }) } -func TestMultiversXNotifee_PriceChanged(t *testing.T) { +func TestMxNotifee_PriceChanged(t *testing.T) { t.Parallel() t.Run("get nonce errors", func(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { return expectedErr @@ -196,7 +196,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -206,7 +206,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Run("invalid price arguments", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -218,7 +218,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -230,7 +230,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.Proxy = &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return nil, expectedErr @@ -247,7 +247,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -258,7 +258,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -275,7 +275,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -286,7 +286,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -297,7 +297,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -309,7 +309,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { priceChanges := createMockPriceChanges() sentWasCalled := false - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -348,7 +348,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) err = en.PriceChanged(context.Background(), priceChanges) diff --git a/blockchain/addressGenerator.go b/blockchain/addressGenerator.go index f3206f4d..9f0ecb63 100644 --- a/blockchain/addressGenerator.go +++ b/blockchain/addressGenerator.go @@ -42,7 +42,7 @@ func NewAddressGenerator(coordinator *shardCoordinator) (*addressGenerator, erro PubkeyConv: core.AddressPublicKeyConverter, StorageService: &disabled.StorageService{}, BlockChain: &disabled.Blockchain{}, - ShardCoordinator: &disabled.MultiversXShardCoordinator{}, + ShardCoordinator: &disabled.ShardCoordinator{}, Marshalizer: &marshal.JsonMarshalizer{}, Uint64Converter: uint64ByteSlice.NewBigEndianConverter(), BuiltInFunctions: builtInFuncs, diff --git a/blockchain/elrondBaseProxy.go b/blockchain/baseProxy.go similarity index 78% rename from blockchain/elrondBaseProxy.go rename to blockchain/baseProxy.go index b6413753..bffc2d73 100644 --- a/blockchain/elrondBaseProxy.go +++ b/blockchain/baseProxy.go @@ -21,13 +21,13 @@ const ( minimumCachingInterval = time.Second ) -type argsMultiversXBaseProxy struct { +type argsBaseProxy struct { expirationTime time.Duration httpClientWrapper httpClientWrapper endpointProvider EndpointProvider } -type multiversXBaseProxy struct { +type baseProxy struct { httpClientWrapper mut sync.RWMutex fetchedConfigs *data.NetworkConfig @@ -37,14 +37,14 @@ type multiversXBaseProxy struct { endpointProvider EndpointProvider } -// newMultiversXBaseProxy will create a base multiversx proxy with cache instance -func newMultiversXBaseProxy(args argsMultiversXBaseProxy) (*multiversXBaseProxy, error) { +// newBaseProxy will create a base multiversx proxy with cache instance +func newBaseProxy(args argsBaseProxy) (*baseProxy, error) { err := checkArgsBaseProxy(args) if err != nil { return nil, err } - return &multiversXBaseProxy{ + return &baseProxy{ httpClientWrapper: args.httpClientWrapper, cacheExpiryDuration: args.expirationTime, endpointProvider: args.endpointProvider, @@ -52,7 +52,7 @@ func newMultiversXBaseProxy(args argsMultiversXBaseProxy) (*multiversXBaseProxy, }, nil } -func checkArgsBaseProxy(args argsMultiversXBaseProxy) error { +func checkArgsBaseProxy(args argsBaseProxy) error { if args.expirationTime < minimumCachingInterval { return fmt.Errorf("%w, provided: %v, minimum: %v", ErrInvalidCacherDuration, args.expirationTime, minimumCachingInterval) } @@ -71,7 +71,7 @@ func since(t time.Time) time.Duration { } // GetNetworkConfig will return the cached network configs fetching new values and saving them if necessary -func (proxy *multiversXBaseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *baseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.RLock() cachedConfigs := proxy.getCachedConfigs() proxy.mut.RUnlock() @@ -83,7 +83,7 @@ func (proxy *multiversXBaseProxy) GetNetworkConfig(ctx context.Context) (*data.N return proxy.cacheConfigs(ctx) } -func (proxy *multiversXBaseProxy) getCachedConfigs() *data.NetworkConfig { +func (proxy *baseProxy) getCachedConfigs() *data.NetworkConfig { if proxy.sinceTimeHandler(proxy.lastFetchedTime) > proxy.cacheExpiryDuration { return nil } @@ -91,7 +91,7 @@ func (proxy *multiversXBaseProxy) getCachedConfigs() *data.NetworkConfig { return proxy.fetchedConfigs } -func (proxy *multiversXBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *baseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.Lock() defer proxy.mut.Unlock() @@ -114,7 +114,7 @@ func (proxy *multiversXBaseProxy) cacheConfigs(ctx context.Context) (*data.Netwo } // getNetworkConfigFromSource retrieves the network configuration from the proxy -func (proxy *multiversXBaseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *baseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { buff, code, err := proxy.GetHTTP(ctx, proxy.endpointProvider.GetNetworkConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -134,7 +134,7 @@ func (proxy *multiversXBaseProxy) getNetworkConfigFromSource(ctx context.Context // GetShardOfAddress returns the shard ID of a provided address by using a shardCoordinator object and querying the // network config route -func (proxy *multiversXBaseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { +func (proxy *baseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { addr, err := data.NewAddressFromBech32String(bech32Address) if err != nil { return 0, err @@ -154,7 +154,7 @@ func (proxy *multiversXBaseProxy) GetShardOfAddress(ctx context.Context, bech32A } // GetNetworkStatus will return the network status of a provided shard -func (proxy *multiversXBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *baseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { endpoint := proxy.endpointProvider.GetNodeStatus(shardID) buff, code, err := proxy.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -172,7 +172,7 @@ func (proxy *multiversXBaseProxy) GetNetworkStatus(ctx context.Context, shardID return &data.NetworkStatus{}, ErrInvalidEndpointProvider } -func (proxy *multiversXBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *baseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NetworkStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -190,7 +190,7 @@ func (proxy *multiversXBaseProxy) getNetworkStatus(buff []byte, shardID uint32) return response.Data.Status, nil } -func (proxy *multiversXBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *baseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NodeStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -208,7 +208,7 @@ func (proxy *multiversXBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*d return response.Data.Status, nil } -func (proxy *multiversXBaseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { +func (proxy *baseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { if networkStatus == nil { return fmt.Errorf("%w, requested from %d", ErrNilNetworkStatus, shardID) } @@ -223,11 +223,11 @@ func (proxy *multiversXBaseProxy) checkReceivedNodeStatus(networkStatus *data.Ne } // GetRestAPIEntityType returns the REST API entity type that this implementation works with -func (proxy *multiversXBaseProxy) GetRestAPIEntityType() core.RestAPIEntityType { +func (proxy *baseProxy) GetRestAPIEntityType() core.RestAPIEntityType { return proxy.endpointProvider.GetRestAPIEntityType() } // IsInterfaceNil returns true if there is no value under the interface -func (proxy *multiversXBaseProxy) IsInterfaceNil() bool { +func (proxy *baseProxy) IsInterfaceNil() bool { return proxy == nil } diff --git a/blockchain/elrondBaseProxy_test.go b/blockchain/baseProxy_test.go similarity index 93% rename from blockchain/elrondBaseProxy_test.go rename to blockchain/baseProxy_test.go index 8f4a9916..3426ac64 100644 --- a/blockchain/elrondBaseProxy_test.go +++ b/blockchain/baseProxy_test.go @@ -18,8 +18,8 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsMultiversXBaseProxy() argsMultiversXBaseProxy { - return argsMultiversXBaseProxy{ +func createMockArgsMultiversXBaseProxy() argsBaseProxy { + return argsBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, endpointProvider: endpointProviders.NewNodeEndpointProvider(), @@ -34,7 +34,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = nil - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilHTTPClientWrapper)) @@ -44,7 +44,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.expirationTime = time.Second - time.Nanosecond - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -54,7 +54,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.endpointProvider = nil - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilEndpointProvider)) @@ -63,7 +63,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Parallel() args := createMockArgsMultiversXBaseProxy() - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) assert.Nil(t, err) @@ -113,7 +113,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval } @@ -137,7 +137,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval*2 + time.Millisecond } @@ -161,7 +161,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -182,7 +182,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -213,7 +213,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -235,7 +235,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) baseProxy.fetchedConfigs = expectedReturnedNetworkConfig baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval @@ -262,7 +262,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return nil, http.StatusBadRequest, expectedErr }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -278,7 +278,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -295,7 +295,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -320,7 +320,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -346,7 +346,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -362,7 +362,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -379,7 +379,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -408,7 +408,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -436,7 +436,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -465,7 +465,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNetworkStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -554,7 +554,7 @@ func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { }) } -func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *multiversXBaseProxy { +func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *baseProxy { expectedReturnedNetworkConfig := &data.NetworkConfig{ NumShardsWithoutMeta: numShards, } @@ -578,7 +578,7 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *multiv args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) return baseProxy } @@ -587,7 +587,7 @@ func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() args := createMockArgsMultiversXBaseProxy() - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) } diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 42603fd5..2f66679f 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -22,8 +22,8 @@ const ( withResultsQueryParam = "?withResults=true" ) -// ArgsMultiversXProxy is the DTO used in the multiversx proxy constructor -type ArgsMultiversXProxy struct { +// ArgsProxy is the DTO used in the multiversx proxy constructor +type ArgsProxy struct { ProxyURL string Client erdgoHttp.Client SameScState bool @@ -36,7 +36,7 @@ type ArgsMultiversXProxy struct { // multiversXProxy implements basic functions for interacting with a multiversx Proxy type multiversXProxy struct { - *multiversXBaseProxy + *baseProxy sameScState bool shouldBeSynced bool finalityCheck bool @@ -45,7 +45,7 @@ type multiversXProxy struct { } // NewMultiversXProxy initializes and returns a multiversXProxy object -func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { +func NewMultiversXProxy(args ArgsProxy) (*multiversXProxy, error) { err := checkArgsProxy(args) if err != nil { return nil, err @@ -57,12 +57,12 @@ func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { } clientWrapper := erdgoHttp.NewHttpClientWrapper(args.Client, args.ProxyURL) - baseArgs := argsMultiversXBaseProxy{ + baseArgs := argsBaseProxy{ httpClientWrapper: clientWrapper, expirationTime: args.CacheExpirationTime, endpointProvider: endpointProvider, } - baseProxy, err := newMultiversXBaseProxy(baseArgs) + baseProxy, err := newBaseProxy(baseArgs) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { } ep := &multiversXProxy{ - multiversXBaseProxy: baseProxy, + baseProxy: baseProxy, sameScState: args.SameScState, shouldBeSynced: args.ShouldBeSynced, finalityCheck: args.FinalityCheck, @@ -84,7 +84,7 @@ func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { return ep, nil } -func checkArgsProxy(args ArgsMultiversXProxy) error { +func checkArgsProxy(args ArgsProxy) error { if args.FinalityCheck { if args.AllowedDeltaToFinal < erdgoCore.MinAllowedDeltaToFinal { return fmt.Errorf("%w, provided: %d, minimum: %d", diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index 90be805c..dd9a0987 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -58,8 +58,8 @@ func createMockClientRespondingBytes(responseBytes []byte) *mockHTTPClient { } } -func createMockArgsMultiversXProxy(httpClient erdgoHttp.Client) ArgsMultiversXProxy { - return ArgsMultiversXProxy{ +func createMockArgsProxy(httpClient erdgoHttp.Client) ArgsProxy { + return ArgsProxy{ ProxyURL: testHttpURL, Client: httpClient, SameScState: false, @@ -145,7 +145,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("invalid time cache should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) args.CacheExpirationTime = time.Second - time.Nanosecond proxy, err := NewMultiversXProxy(args) @@ -155,7 +155,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("invalid nonce delta should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) args.FinalityCheck = true args.AllowedDeltaToFinal = 0 proxy, err := NewMultiversXProxy(args) @@ -166,7 +166,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("should work with finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) args.FinalityCheck = true proxy, err := NewMultiversXProxy(args) @@ -176,7 +176,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("should work without finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) proxy, err := NewMultiversXProxy(args) assert.False(t, check.IfNil(proxy)) @@ -213,7 +213,7 @@ func TestGetAccount(t *testing.T) { }, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true proxy, _ := NewMultiversXProxy(args) @@ -258,7 +258,7 @@ func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) networkEconomics, err := ep.GetNetworkEconomics(context.Background()) @@ -279,7 +279,7 @@ func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) tx := &data.Transaction{ @@ -305,7 +305,7 @@ func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) tx, err := ep.GetTransactionInfoWithResults(context.Background(), "a40e5a6af4efe221608297a73459211756ab88b96896e6e331842807a138f343") @@ -321,7 +321,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { responseBytes := []byte(`{"data":{"data":{"returnData":["MC41LjU="],"returnCode":"ok","returnMessage":"","gasRemaining":18446744073685949187,"gasRefund":0,"outputAccounts":{"0000000000000000050033bb65a91ee17ab84c6f8a01846ef8644e15fb76696a":{"address":"erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt","nonce":0,"balance":null,"balanceDelta":0,"storageUpdates":{},"code":null,"codeMetaData":null,"outputTransfers":[],"callType":0}},"deletedAccounts":[],"touchedAccounts":[],"logs":[]}},"error":"","code":"successful"}`) t.Run("no finality check", func(t *testing.T) { httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ @@ -344,7 +344,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true ep, _ := NewMultiversXProxy(args) @@ -370,7 +370,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true ep, _ := NewMultiversXProxy(args) @@ -400,7 +400,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { }, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true ep, _ := NewMultiversXProxy(args) @@ -436,7 +436,7 @@ func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByHash(context.Background(), 0, "aaaa") @@ -466,7 +466,7 @@ func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByNonce(context.Background(), 0, 10) @@ -496,7 +496,7 @@ func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawMiniBlockByHash(context.Background(), 0, "aaaa", 1) @@ -526,7 +526,7 @@ func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { statusResponseBytes, _ := json.Marshal(statusResponse) httpClient := createMockClientRespondingBytes(statusResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetNonceAtEpochStart(context.Background(), core.MetachainShardId) @@ -552,7 +552,7 @@ func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { ratingsResponseBytes, _ := json.Marshal(ratingsResponse) httpClient := createMockClientRespondingBytes(ratingsResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRatingsConfig(context.Background()) @@ -581,7 +581,7 @@ func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { enableEpochsResponseBytes, _ := json.Marshal(enableEpochsResponse) httpClient := createMockClientRespondingBytes(enableEpochsResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetEnableEpochsConfig(context.Background()) @@ -607,7 +607,7 @@ func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { genesisNodesResponseBytes, _ := json.Marshal(genesisNodesResponse) httpClient := createMockClientRespondingBytes(genesisNodesResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetGenesisNodesPubKeys(context.Background()) @@ -635,7 +635,7 @@ func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { validatorsInfoResponseBytes, _ := json.Marshal(validatorsInfoResponse) httpClient := createMockClientRespondingBytes(validatorsInfoResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetValidatorsInfoByEpoch(context.Background(), 1) diff --git a/disabled/elrondShardCoordinator.go b/disabled/elrondShardCoordinator.go deleted file mode 100644 index c05e5538..00000000 --- a/disabled/elrondShardCoordinator.go +++ /dev/null @@ -1,35 +0,0 @@ -package disabled - -// MultiversXShardCoordinator is the disabled shard coordinator instance that satisfies the mx-chain-go.sharding.Coordinator interface -type MultiversXShardCoordinator struct { -} - -// NumberOfShards returns 0 -func (msc *MultiversXShardCoordinator) NumberOfShards() uint32 { - return 0 -} - -// ComputeId returns 0 -func (msc *MultiversXShardCoordinator) ComputeId(_ []byte) uint32 { - return 0 -} - -// SelfId returns 0 -func (msc *MultiversXShardCoordinator) SelfId() uint32 { - return 0 -} - -// SameShard returns false -func (msc *MultiversXShardCoordinator) SameShard(_, _ []byte) bool { - return false -} - -// CommunicationIdentifier returns empty string -func (msc *MultiversXShardCoordinator) CommunicationIdentifier(_ uint32) string { - return "" -} - -// IsInterfaceNil returns true if there is no value under the interface -func (msc *MultiversXShardCoordinator) IsInterfaceNil() bool { - return msc == nil -} diff --git a/disabled/shardCoordinator.go b/disabled/shardCoordinator.go new file mode 100644 index 00000000..8d850af2 --- /dev/null +++ b/disabled/shardCoordinator.go @@ -0,0 +1,35 @@ +package disabled + +// ShardCoordinator is the disabled shard coordinator instance that satisfies the mx-chain-go.sharding.Coordinator interface +type ShardCoordinator struct { +} + +// NumberOfShards returns 0 +func (sc *ShardCoordinator) NumberOfShards() uint32 { + return 0 +} + +// ComputeId returns 0 +func (sc *ShardCoordinator) ComputeId(_ []byte) uint32 { + return 0 +} + +// SelfId returns 0 +func (sc *ShardCoordinator) SelfId() uint32 { + return 0 +} + +// SameShard returns false +func (sc *ShardCoordinator) SameShard(_, _ []byte) bool { + return false +} + +// CommunicationIdentifier returns empty string +func (sc *ShardCoordinator) CommunicationIdentifier(_ uint32) string { + return "" +} + +// IsInterfaceNil returns true if there is no value under the interface +func (sc *ShardCoordinator) IsInterfaceNil() bool { + return sc == nil +} diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index f5fedf4a..21ef4396 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -15,7 +15,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesAccount") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index 7ce33f9f..e2526bd2 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -14,7 +14,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesBlock") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index 81f413f8..baa2da1e 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -51,7 +51,7 @@ func main() { } func runApp() error { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index 97b84966..be09370f 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -15,7 +15,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesHeaderCheck") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index 3d49391d..7d236847 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -211,7 +211,7 @@ func createAuthClient() (authentication.AuthClient, error) { return nil, err } - argsProxy := blockchain.ArgsMultiversXProxy{ + argsProxy := blockchain.ArgsProxy{ ProxyURL: networkAddress, SameScState: false, ShouldBeSynced: false, diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 8323ff64..84268102 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -24,7 +24,7 @@ var ( func main() { _ = logger.SetLogLevel("*:DEBUG") - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index bffe0643..e5dcbde9 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -14,7 +14,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesVMQuery") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, From 0811617dd060d7b6160776c8765eee38734fb31b Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 13:55:53 +0200 Subject: [PATCH 09/15] removed MultiversX from Proxy, Notifee, ShardCoordinator --- .../{elrondNotifee.go => mxNotifee.go} | 22 +++--- ...lrondNotifee_test.go => mxNotifee_test.go} | 72 +++++++++---------- blockchain/addressGenerator.go | 2 +- .../{elrondBaseProxy.go => baseProxy.go} | 34 ++++----- ...ondBaseProxy_test.go => baseProxy_test.go} | 50 ++++++------- blockchain/proxy.go | 16 ++--- blockchain/proxy_test.go | 44 ++++++------ disabled/elrondShardCoordinator.go | 35 --------- disabled/shardCoordinator.go | 35 +++++++++ examples/examplesAccount/main.go | 2 +- examples/examplesBlock/main.go | 2 +- examples/examplesFlowWalletTracker/main.go | 2 +- examples/examplesHeaderCheck/main.go | 2 +- examples/examplesPriceAggregator/main.go | 2 +- examples/examplesTransaction/main.go | 2 +- examples/examplesVMQuery/main.go | 2 +- 16 files changed, 162 insertions(+), 162 deletions(-) rename aggregator/notifees/{elrondNotifee.go => mxNotifee.go} (82%) rename aggregator/notifees/{elrondNotifee_test.go => mxNotifee_test.go} (85%) rename blockchain/{elrondBaseProxy.go => baseProxy.go} (78%) rename blockchain/{elrondBaseProxy_test.go => baseProxy_test.go} (93%) delete mode 100644 disabled/elrondShardCoordinator.go create mode 100644 disabled/shardCoordinator.go diff --git a/aggregator/notifees/elrondNotifee.go b/aggregator/notifees/mxNotifee.go similarity index 82% rename from aggregator/notifees/elrondNotifee.go rename to aggregator/notifees/mxNotifee.go index 79468645..339c492c 100644 --- a/aggregator/notifees/elrondNotifee.go +++ b/aggregator/notifees/mxNotifee.go @@ -18,8 +18,8 @@ const minGasLimit = uint64(1) var log = logger.GetOrCreate("mx-sdk-go/aggregator/notifees") -// ArgsMultiversXNotifee is the argument DTO for the NewMultiversXNotifee function -type ArgsMultiversXNotifee struct { +// ArgsMxNotifee is the argument DTO for the NewMxNotifee function +type ArgsMxNotifee struct { Proxy Proxy TxBuilder TxBuilder TxNonceHandler TransactionNonceHandler @@ -29,7 +29,7 @@ type ArgsMultiversXNotifee struct { GasLimitForEach uint64 } -type multiversXNotifee struct { +type mxNotifee struct { proxy Proxy txBuilder TxBuilder txNonceHandler TransactionNonceHandler @@ -39,14 +39,14 @@ type multiversXNotifee struct { cryptoHolder core.CryptoComponentsHolder } -// NewMultiversXNotifee will create a new instance of multiversXNotifee -func NewMultiversXNotifee(args ArgsMultiversXNotifee) (*multiversXNotifee, error) { - err := checkArgsMultiversXNotifee(args) +// NewMxNotifee will create a new instance of mxNotifee +func NewMxNotifee(args ArgsMxNotifee) (*mxNotifee, error) { + err := checkArgsMxNotifee(args) if err != nil { return nil, err } - notifee := &multiversXNotifee{ + notifee := &mxNotifee{ proxy: args.Proxy, txBuilder: args.TxBuilder, txNonceHandler: args.TxNonceHandler, @@ -59,7 +59,7 @@ func NewMultiversXNotifee(args ArgsMultiversXNotifee) (*multiversXNotifee, error return notifee, nil } -func checkArgsMultiversXNotifee(args ArgsMultiversXNotifee) error { +func checkArgsMxNotifee(args ArgsMxNotifee) error { if check.IfNil(args.Proxy) { return errNilProxy } @@ -90,7 +90,7 @@ func checkArgsMultiversXNotifee(args ArgsMultiversXNotifee) error { // PriceChanged is the function that gets called by a price notifier. This function will assemble a MultiversX // transaction, having the transaction's data field containing all the price changes information -func (en *multiversXNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { +func (en *mxNotifee) PriceChanged(ctx context.Context, priceChanges []*aggregator.ArgsPriceChanged) error { txData, err := en.prepareTxData(priceChanges) if err != nil { return err @@ -132,7 +132,7 @@ func (en *multiversXNotifee) PriceChanged(ctx context.Context, priceChanges []*a return nil } -func (en *multiversXNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { +func (en *mxNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceChanged) ([]byte, error) { txDataBuilder := builders.NewTxDataBuilder() txDataBuilder.Function(function) @@ -148,6 +148,6 @@ func (en *multiversXNotifee) prepareTxData(priceChanges []*aggregator.ArgsPriceC } // IsInterfaceNil returns true if there is no value under the interface -func (en *multiversXNotifee) IsInterfaceNil() bool { +func (en *mxNotifee) IsInterfaceNil() bool { return en == nil } diff --git a/aggregator/notifees/elrondNotifee_test.go b/aggregator/notifees/mxNotifee_test.go similarity index 85% rename from aggregator/notifees/elrondNotifee_test.go rename to aggregator/notifees/mxNotifee_test.go index 6de19854..eebb452d 100644 --- a/aggregator/notifees/elrondNotifee_test.go +++ b/aggregator/notifees/mxNotifee_test.go @@ -27,8 +27,8 @@ var ( keyGen = signing.NewKeyGenerator(suite) ) -func createMockArgsMultiversXNotifee() ArgsMultiversXNotifee { - return ArgsMultiversXNotifee{ +func createMockArgsMxNotifee() ArgsMxNotifee { + return ArgsMxNotifee{ Proxy: &testsCommon.ProxyStub{}, TxBuilder: &testsCommon.TxBuilderStub{}, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -39,7 +39,7 @@ func createMockArgsMultiversXNotifee() ArgsMultiversXNotifee { } } -func createMockArgsMultiversXNotifeeWithSomeRealComponents() ArgsMultiversXNotifee { +func createMockArgsMxNotifeeWithSomeRealComponents() ArgsMxNotifee { proxy := &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return &data.NetworkConfig{ @@ -54,7 +54,7 @@ func createMockArgsMultiversXNotifeeWithSomeRealComponents() ArgsMultiversXNotif holder, _ := cryptoProvider.NewCryptoComponentsHolder(keyGen, skBytes) txBuilder, _ := builders.NewTxBuilder(cryptoProvider.NewSigner()) - return ArgsMultiversXNotifee{ + return ArgsMxNotifee{ Proxy: proxy, TxBuilder: txBuilder, TxNonceHandler: &testsCommon.TxNonceHandlerV2Stub{}, @@ -84,15 +84,15 @@ func createMockPriceChanges() []*aggregator.ArgsPriceChanged { } } -func TestNewMultiversXNotifee(t *testing.T) { +func TestNewMxNotifee(t *testing.T) { t.Parallel() t.Run("nil proxy should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.Proxy = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilProxy, err) @@ -100,9 +100,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil tx builder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.TxBuilder = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxBuilder, err) @@ -110,9 +110,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil tx nonce handler should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.TxNonceHandler = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilTxNonceHandler, err) @@ -120,9 +120,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.ContractAddress = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errNilContractAddressHandler, err) @@ -130,9 +130,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("invalid contract address should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.ContractAddress = data.NewAddressFromBytes([]byte("invalid")) - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidContractAddress, err) @@ -140,9 +140,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("nil cryptoHlder should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.CryptoHolder = nil - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, builders.ErrNilCryptoComponentsHolder, err) @@ -150,9 +150,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("invalid base gas limit should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.BaseGasLimit = minGasLimit - 1 - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidBaseGasLimit, err) @@ -160,9 +160,9 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("invalid gas limit for each should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() + args := createMockArgsMxNotifee() args.GasLimitForEach = minGasLimit - 1 - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) assert.True(t, check.IfNil(en)) assert.Equal(t, errInvalidGasLimitForEach, err) @@ -170,22 +170,22 @@ func TestNewMultiversXNotifee(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifee() - en, err := NewMultiversXNotifee(args) + args := createMockArgsMxNotifee() + en, err := NewMxNotifee(args) assert.False(t, check.IfNil(en)) assert.Nil(t, err) }) } -func TestMultiversXNotifee_PriceChanged(t *testing.T) { +func TestMxNotifee_PriceChanged(t *testing.T) { t.Parallel() t.Run("get nonce errors", func(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { return expectedErr @@ -196,7 +196,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -206,7 +206,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Run("invalid price arguments", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -218,7 +218,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -230,7 +230,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.Proxy = &testsCommon.ProxyStub{ GetNetworkConfigCalled: func() (*data.NetworkConfig, error) { return nil, expectedErr @@ -247,7 +247,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -258,7 +258,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -275,7 +275,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -286,7 +286,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -297,7 +297,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) priceChanges := createMockPriceChanges() @@ -309,7 +309,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { priceChanges := createMockPriceChanges() sentWasCalled := false - args := createMockArgsMultiversXNotifeeWithSomeRealComponents() + args := createMockArgsMxNotifeeWithSomeRealComponents() args.TxNonceHandler = &testsCommon.TxNonceHandlerV2Stub{ ApplyNonceAndGasPriceCalled: func(ctx context.Context, address core.AddressHandler, txArgs *data.ArgCreateTransaction) error { txArgs.Nonce = 43 @@ -348,7 +348,7 @@ func TestMultiversXNotifee_PriceChanged(t *testing.T) { }, } - en, err := NewMultiversXNotifee(args) + en, err := NewMxNotifee(args) require.Nil(t, err) err = en.PriceChanged(context.Background(), priceChanges) diff --git a/blockchain/addressGenerator.go b/blockchain/addressGenerator.go index f3206f4d..9f0ecb63 100644 --- a/blockchain/addressGenerator.go +++ b/blockchain/addressGenerator.go @@ -42,7 +42,7 @@ func NewAddressGenerator(coordinator *shardCoordinator) (*addressGenerator, erro PubkeyConv: core.AddressPublicKeyConverter, StorageService: &disabled.StorageService{}, BlockChain: &disabled.Blockchain{}, - ShardCoordinator: &disabled.MultiversXShardCoordinator{}, + ShardCoordinator: &disabled.ShardCoordinator{}, Marshalizer: &marshal.JsonMarshalizer{}, Uint64Converter: uint64ByteSlice.NewBigEndianConverter(), BuiltInFunctions: builtInFuncs, diff --git a/blockchain/elrondBaseProxy.go b/blockchain/baseProxy.go similarity index 78% rename from blockchain/elrondBaseProxy.go rename to blockchain/baseProxy.go index b6413753..bffc2d73 100644 --- a/blockchain/elrondBaseProxy.go +++ b/blockchain/baseProxy.go @@ -21,13 +21,13 @@ const ( minimumCachingInterval = time.Second ) -type argsMultiversXBaseProxy struct { +type argsBaseProxy struct { expirationTime time.Duration httpClientWrapper httpClientWrapper endpointProvider EndpointProvider } -type multiversXBaseProxy struct { +type baseProxy struct { httpClientWrapper mut sync.RWMutex fetchedConfigs *data.NetworkConfig @@ -37,14 +37,14 @@ type multiversXBaseProxy struct { endpointProvider EndpointProvider } -// newMultiversXBaseProxy will create a base multiversx proxy with cache instance -func newMultiversXBaseProxy(args argsMultiversXBaseProxy) (*multiversXBaseProxy, error) { +// newBaseProxy will create a base multiversx proxy with cache instance +func newBaseProxy(args argsBaseProxy) (*baseProxy, error) { err := checkArgsBaseProxy(args) if err != nil { return nil, err } - return &multiversXBaseProxy{ + return &baseProxy{ httpClientWrapper: args.httpClientWrapper, cacheExpiryDuration: args.expirationTime, endpointProvider: args.endpointProvider, @@ -52,7 +52,7 @@ func newMultiversXBaseProxy(args argsMultiversXBaseProxy) (*multiversXBaseProxy, }, nil } -func checkArgsBaseProxy(args argsMultiversXBaseProxy) error { +func checkArgsBaseProxy(args argsBaseProxy) error { if args.expirationTime < minimumCachingInterval { return fmt.Errorf("%w, provided: %v, minimum: %v", ErrInvalidCacherDuration, args.expirationTime, minimumCachingInterval) } @@ -71,7 +71,7 @@ func since(t time.Time) time.Duration { } // GetNetworkConfig will return the cached network configs fetching new values and saving them if necessary -func (proxy *multiversXBaseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *baseProxy) GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.RLock() cachedConfigs := proxy.getCachedConfigs() proxy.mut.RUnlock() @@ -83,7 +83,7 @@ func (proxy *multiversXBaseProxy) GetNetworkConfig(ctx context.Context) (*data.N return proxy.cacheConfigs(ctx) } -func (proxy *multiversXBaseProxy) getCachedConfigs() *data.NetworkConfig { +func (proxy *baseProxy) getCachedConfigs() *data.NetworkConfig { if proxy.sinceTimeHandler(proxy.lastFetchedTime) > proxy.cacheExpiryDuration { return nil } @@ -91,7 +91,7 @@ func (proxy *multiversXBaseProxy) getCachedConfigs() *data.NetworkConfig { return proxy.fetchedConfigs } -func (proxy *multiversXBaseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *baseProxy) cacheConfigs(ctx context.Context) (*data.NetworkConfig, error) { proxy.mut.Lock() defer proxy.mut.Unlock() @@ -114,7 +114,7 @@ func (proxy *multiversXBaseProxy) cacheConfigs(ctx context.Context) (*data.Netwo } // getNetworkConfigFromSource retrieves the network configuration from the proxy -func (proxy *multiversXBaseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { +func (proxy *baseProxy) getNetworkConfigFromSource(ctx context.Context) (*data.NetworkConfig, error) { buff, code, err := proxy.GetHTTP(ctx, proxy.endpointProvider.GetNetworkConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -134,7 +134,7 @@ func (proxy *multiversXBaseProxy) getNetworkConfigFromSource(ctx context.Context // GetShardOfAddress returns the shard ID of a provided address by using a shardCoordinator object and querying the // network config route -func (proxy *multiversXBaseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { +func (proxy *baseProxy) GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error) { addr, err := data.NewAddressFromBech32String(bech32Address) if err != nil { return 0, err @@ -154,7 +154,7 @@ func (proxy *multiversXBaseProxy) GetShardOfAddress(ctx context.Context, bech32A } // GetNetworkStatus will return the network status of a provided shard -func (proxy *multiversXBaseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *baseProxy) GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error) { endpoint := proxy.endpointProvider.GetNodeStatus(shardID) buff, code, err := proxy.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -172,7 +172,7 @@ func (proxy *multiversXBaseProxy) GetNetworkStatus(ctx context.Context, shardID return &data.NetworkStatus{}, ErrInvalidEndpointProvider } -func (proxy *multiversXBaseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *baseProxy) getNetworkStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NetworkStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -190,7 +190,7 @@ func (proxy *multiversXBaseProxy) getNetworkStatus(buff []byte, shardID uint32) return response.Data.Status, nil } -func (proxy *multiversXBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { +func (proxy *baseProxy) getNodeStatus(buff []byte, shardID uint32) (*data.NetworkStatus, error) { response := &data.NodeStatusResponse{} err := json.Unmarshal(buff, response) if err != nil { @@ -208,7 +208,7 @@ func (proxy *multiversXBaseProxy) getNodeStatus(buff []byte, shardID uint32) (*d return response.Data.Status, nil } -func (proxy *multiversXBaseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { +func (proxy *baseProxy) checkReceivedNodeStatus(networkStatus *data.NetworkStatus, shardID uint32) error { if networkStatus == nil { return fmt.Errorf("%w, requested from %d", ErrNilNetworkStatus, shardID) } @@ -223,11 +223,11 @@ func (proxy *multiversXBaseProxy) checkReceivedNodeStatus(networkStatus *data.Ne } // GetRestAPIEntityType returns the REST API entity type that this implementation works with -func (proxy *multiversXBaseProxy) GetRestAPIEntityType() core.RestAPIEntityType { +func (proxy *baseProxy) GetRestAPIEntityType() core.RestAPIEntityType { return proxy.endpointProvider.GetRestAPIEntityType() } // IsInterfaceNil returns true if there is no value under the interface -func (proxy *multiversXBaseProxy) IsInterfaceNil() bool { +func (proxy *baseProxy) IsInterfaceNil() bool { return proxy == nil } diff --git a/blockchain/elrondBaseProxy_test.go b/blockchain/baseProxy_test.go similarity index 93% rename from blockchain/elrondBaseProxy_test.go rename to blockchain/baseProxy_test.go index 8f4a9916..3426ac64 100644 --- a/blockchain/elrondBaseProxy_test.go +++ b/blockchain/baseProxy_test.go @@ -18,8 +18,8 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsMultiversXBaseProxy() argsMultiversXBaseProxy { - return argsMultiversXBaseProxy{ +func createMockArgsMultiversXBaseProxy() argsBaseProxy { + return argsBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, endpointProvider: endpointProviders.NewNodeEndpointProvider(), @@ -34,7 +34,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = nil - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilHTTPClientWrapper)) @@ -44,7 +44,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.expirationTime = time.Second - time.Nanosecond - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -54,7 +54,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.endpointProvider = nil - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.True(t, check.IfNil(baseProxy)) assert.True(t, errors.Is(err, ErrNilEndpointProvider)) @@ -63,7 +63,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Parallel() args := createMockArgsMultiversXBaseProxy() - baseProxy, err := newMultiversXBaseProxy(args) + baseProxy, err := newBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) assert.Nil(t, err) @@ -113,7 +113,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval } @@ -137,7 +137,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval*2 + time.Millisecond } @@ -161,7 +161,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -182,7 +182,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -213,7 +213,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) configs, err := baseProxy.GetNetworkConfig(context.Background()) @@ -235,7 +235,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) baseProxy.fetchedConfigs = expectedReturnedNetworkConfig baseProxy.sinceTimeHandler = func(t time.Time) time.Duration { return minimumCachingInterval @@ -262,7 +262,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return nil, http.StatusBadRequest, expectedErr }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -278,7 +278,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -295,7 +295,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return []byte("malformed response"), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -320,7 +320,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -346,7 +346,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return respBytes, http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -362,7 +362,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -379,7 +379,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNetworkStatusBytes(nil), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -408,7 +408,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, result) @@ -436,7 +436,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -465,7 +465,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { return getNetworkStatusBytes(providedNetworkStatus), http.StatusOK, nil }, } - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) result, err := baseProxy.GetNetworkStatus(context.Background(), 0) assert.Nil(t, err) @@ -554,7 +554,7 @@ func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { }) } -func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *multiversXBaseProxy { +func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *baseProxy { expectedReturnedNetworkConfig := &data.NetworkConfig{ NumShardsWithoutMeta: numShards, } @@ -578,7 +578,7 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *multiv args := createMockArgsMultiversXBaseProxy() args.httpClientWrapper = mockWrapper - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) return baseProxy } @@ -587,7 +587,7 @@ func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() args := createMockArgsMultiversXBaseProxy() - baseProxy, _ := newMultiversXBaseProxy(args) + baseProxy, _ := newBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) } diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 42603fd5..2f66679f 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -22,8 +22,8 @@ const ( withResultsQueryParam = "?withResults=true" ) -// ArgsMultiversXProxy is the DTO used in the multiversx proxy constructor -type ArgsMultiversXProxy struct { +// ArgsProxy is the DTO used in the multiversx proxy constructor +type ArgsProxy struct { ProxyURL string Client erdgoHttp.Client SameScState bool @@ -36,7 +36,7 @@ type ArgsMultiversXProxy struct { // multiversXProxy implements basic functions for interacting with a multiversx Proxy type multiversXProxy struct { - *multiversXBaseProxy + *baseProxy sameScState bool shouldBeSynced bool finalityCheck bool @@ -45,7 +45,7 @@ type multiversXProxy struct { } // NewMultiversXProxy initializes and returns a multiversXProxy object -func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { +func NewMultiversXProxy(args ArgsProxy) (*multiversXProxy, error) { err := checkArgsProxy(args) if err != nil { return nil, err @@ -57,12 +57,12 @@ func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { } clientWrapper := erdgoHttp.NewHttpClientWrapper(args.Client, args.ProxyURL) - baseArgs := argsMultiversXBaseProxy{ + baseArgs := argsBaseProxy{ httpClientWrapper: clientWrapper, expirationTime: args.CacheExpirationTime, endpointProvider: endpointProvider, } - baseProxy, err := newMultiversXBaseProxy(baseArgs) + baseProxy, err := newBaseProxy(baseArgs) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { } ep := &multiversXProxy{ - multiversXBaseProxy: baseProxy, + baseProxy: baseProxy, sameScState: args.SameScState, shouldBeSynced: args.ShouldBeSynced, finalityCheck: args.FinalityCheck, @@ -84,7 +84,7 @@ func NewMultiversXProxy(args ArgsMultiversXProxy) (*multiversXProxy, error) { return ep, nil } -func checkArgsProxy(args ArgsMultiversXProxy) error { +func checkArgsProxy(args ArgsProxy) error { if args.FinalityCheck { if args.AllowedDeltaToFinal < erdgoCore.MinAllowedDeltaToFinal { return fmt.Errorf("%w, provided: %d, minimum: %d", diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index 90be805c..dd9a0987 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -58,8 +58,8 @@ func createMockClientRespondingBytes(responseBytes []byte) *mockHTTPClient { } } -func createMockArgsMultiversXProxy(httpClient erdgoHttp.Client) ArgsMultiversXProxy { - return ArgsMultiversXProxy{ +func createMockArgsProxy(httpClient erdgoHttp.Client) ArgsProxy { + return ArgsProxy{ ProxyURL: testHttpURL, Client: httpClient, SameScState: false, @@ -145,7 +145,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("invalid time cache should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) args.CacheExpirationTime = time.Second - time.Nanosecond proxy, err := NewMultiversXProxy(args) @@ -155,7 +155,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("invalid nonce delta should error", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) args.FinalityCheck = true args.AllowedDeltaToFinal = 0 proxy, err := NewMultiversXProxy(args) @@ -166,7 +166,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("should work with finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) args.FinalityCheck = true proxy, err := NewMultiversXProxy(args) @@ -176,7 +176,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Run("should work without finality check", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXProxy(nil) + args := createMockArgsProxy(nil) proxy, err := NewMultiversXProxy(args) assert.False(t, check.IfNil(proxy)) @@ -213,7 +213,7 @@ func TestGetAccount(t *testing.T) { }, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true proxy, _ := NewMultiversXProxy(args) @@ -258,7 +258,7 @@ func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) networkEconomics, err := ep.GetNetworkEconomics(context.Background()) @@ -279,7 +279,7 @@ func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) tx := &data.Transaction{ @@ -305,7 +305,7 @@ func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) tx, err := ep.GetTransactionInfoWithResults(context.Background(), "a40e5a6af4efe221608297a73459211756ab88b96896e6e331842807a138f343") @@ -321,7 +321,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { responseBytes := []byte(`{"data":{"data":{"returnData":["MC41LjU="],"returnCode":"ok","returnMessage":"","gasRemaining":18446744073685949187,"gasRefund":0,"outputAccounts":{"0000000000000000050033bb65a91ee17ab84c6f8a01846ef8644e15fb76696a":{"address":"erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt","nonce":0,"balance":null,"balanceDelta":0,"storageUpdates":{},"code":null,"codeMetaData":null,"outputTransfers":[],"callType":0}},"deletedAccounts":[],"touchedAccounts":[],"logs":[]}},"error":"","code":"successful"}`) t.Run("no finality check", func(t *testing.T) { httpClient := createMockClientRespondingBytes(responseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ @@ -344,7 +344,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true ep, _ := NewMultiversXProxy(args) @@ -370,7 +370,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { return nil, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true ep, _ := NewMultiversXProxy(args) @@ -400,7 +400,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { }, nil }, } - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) args.FinalityCheck = true ep, _ := NewMultiversXProxy(args) @@ -436,7 +436,7 @@ func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByHash(context.Background(), 0, "aaaa") @@ -466,7 +466,7 @@ func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawBlockByNonce(context.Background(), 0, 10) @@ -496,7 +496,7 @@ func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { rawBlockDataBytes, _ := json.Marshal(rawBlockData) httpClient := createMockClientRespondingBytes(rawBlockDataBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRawMiniBlockByHash(context.Background(), 0, "aaaa", 1) @@ -526,7 +526,7 @@ func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { statusResponseBytes, _ := json.Marshal(statusResponse) httpClient := createMockClientRespondingBytes(statusResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetNonceAtEpochStart(context.Background(), core.MetachainShardId) @@ -552,7 +552,7 @@ func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { ratingsResponseBytes, _ := json.Marshal(ratingsResponse) httpClient := createMockClientRespondingBytes(ratingsResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetRatingsConfig(context.Background()) @@ -581,7 +581,7 @@ func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { enableEpochsResponseBytes, _ := json.Marshal(enableEpochsResponse) httpClient := createMockClientRespondingBytes(enableEpochsResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetEnableEpochsConfig(context.Background()) @@ -607,7 +607,7 @@ func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { genesisNodesResponseBytes, _ := json.Marshal(genesisNodesResponse) httpClient := createMockClientRespondingBytes(genesisNodesResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetGenesisNodesPubKeys(context.Background()) @@ -635,7 +635,7 @@ func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { validatorsInfoResponseBytes, _ := json.Marshal(validatorsInfoResponse) httpClient := createMockClientRespondingBytes(validatorsInfoResponseBytes) - args := createMockArgsMultiversXProxy(httpClient) + args := createMockArgsProxy(httpClient) ep, _ := NewMultiversXProxy(args) response, err := ep.GetValidatorsInfoByEpoch(context.Background(), 1) diff --git a/disabled/elrondShardCoordinator.go b/disabled/elrondShardCoordinator.go deleted file mode 100644 index c05e5538..00000000 --- a/disabled/elrondShardCoordinator.go +++ /dev/null @@ -1,35 +0,0 @@ -package disabled - -// MultiversXShardCoordinator is the disabled shard coordinator instance that satisfies the mx-chain-go.sharding.Coordinator interface -type MultiversXShardCoordinator struct { -} - -// NumberOfShards returns 0 -func (msc *MultiversXShardCoordinator) NumberOfShards() uint32 { - return 0 -} - -// ComputeId returns 0 -func (msc *MultiversXShardCoordinator) ComputeId(_ []byte) uint32 { - return 0 -} - -// SelfId returns 0 -func (msc *MultiversXShardCoordinator) SelfId() uint32 { - return 0 -} - -// SameShard returns false -func (msc *MultiversXShardCoordinator) SameShard(_, _ []byte) bool { - return false -} - -// CommunicationIdentifier returns empty string -func (msc *MultiversXShardCoordinator) CommunicationIdentifier(_ uint32) string { - return "" -} - -// IsInterfaceNil returns true if there is no value under the interface -func (msc *MultiversXShardCoordinator) IsInterfaceNil() bool { - return msc == nil -} diff --git a/disabled/shardCoordinator.go b/disabled/shardCoordinator.go new file mode 100644 index 00000000..8d850af2 --- /dev/null +++ b/disabled/shardCoordinator.go @@ -0,0 +1,35 @@ +package disabled + +// ShardCoordinator is the disabled shard coordinator instance that satisfies the mx-chain-go.sharding.Coordinator interface +type ShardCoordinator struct { +} + +// NumberOfShards returns 0 +func (sc *ShardCoordinator) NumberOfShards() uint32 { + return 0 +} + +// ComputeId returns 0 +func (sc *ShardCoordinator) ComputeId(_ []byte) uint32 { + return 0 +} + +// SelfId returns 0 +func (sc *ShardCoordinator) SelfId() uint32 { + return 0 +} + +// SameShard returns false +func (sc *ShardCoordinator) SameShard(_, _ []byte) bool { + return false +} + +// CommunicationIdentifier returns empty string +func (sc *ShardCoordinator) CommunicationIdentifier(_ uint32) string { + return "" +} + +// IsInterfaceNil returns true if there is no value under the interface +func (sc *ShardCoordinator) IsInterfaceNil() bool { + return sc == nil +} diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index f5fedf4a..21ef4396 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -15,7 +15,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesAccount") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index 7ce33f9f..e2526bd2 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -14,7 +14,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesBlock") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index 81f413f8..baa2da1e 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -51,7 +51,7 @@ func main() { } func runApp() error { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index 97b84966..be09370f 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -15,7 +15,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesHeaderCheck") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index 3d49391d..7d236847 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -211,7 +211,7 @@ func createAuthClient() (authentication.AuthClient, error) { return nil, err } - argsProxy := blockchain.ArgsMultiversXProxy{ + argsProxy := blockchain.ArgsProxy{ ProxyURL: networkAddress, SameScState: false, ShouldBeSynced: false, diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 8323ff64..84268102 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -24,7 +24,7 @@ var ( func main() { _ = logger.SetLogLevel("*:DEBUG") - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index bffe0643..e5dcbde9 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -14,7 +14,7 @@ import ( var log = logger.GetOrCreate("mx-sdk-go/examples/examplesVMQuery") func main() { - args := blockchain.ArgsMultiversXProxy{ + args := blockchain.ArgsProxy{ ProxyURL: examples.TestnetGateway, Client: nil, SameScState: false, From bdaed611ac239496de5adccb4104c36b50f72213 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 14:03:03 +0200 Subject: [PATCH 10/15] removed MultiversX from Proxy, Notifee, ShardCoordinator 2 --- blockchain/baseProxy_test.go | 56 +++++++++---------- .../proxyFinalityProvider_test.go | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/blockchain/baseProxy_test.go b/blockchain/baseProxy_test.go index 3426ac64..5351fe0e 100644 --- a/blockchain/baseProxy_test.go +++ b/blockchain/baseProxy_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsMultiversXBaseProxy() argsBaseProxy { +func createMockArgsBaseProxy() argsBaseProxy { return argsBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, @@ -26,13 +26,13 @@ func createMockArgsMultiversXBaseProxy() argsBaseProxy { } } -func TestNewMultiversXBaseProxy(t *testing.T) { +func TestNewBaseProxy(t *testing.T) { t.Parallel() t.Run("nil http client wrapper", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = nil baseProxy, err := newBaseProxy(args) @@ -42,7 +42,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("invalid caching duration", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.expirationTime = time.Second - time.Nanosecond baseProxy, err := newBaseProxy(args) @@ -52,7 +52,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("nil endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = nil baseProxy, err := newBaseProxy(args) @@ -62,7 +62,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, err := newBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) @@ -70,7 +70,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { +func TestBaseProxy_GetNetworkConfig(t *testing.T) { t.Parallel() expectedReturnedNetworkConfig := &data.NetworkConfig{ @@ -110,7 +110,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -134,7 +134,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -159,7 +159,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusBadRequest, expectedErr } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -180,7 +180,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return []byte("malformed data"), http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -211,7 +211,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return erroredNetworkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -232,7 +232,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -249,14 +249,14 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { +func TestBaseProxy_GetNetworkStatus(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") t.Run("get errors", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return nil, http.StatusBadRequest, expectedErr @@ -272,7 +272,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil @@ -288,7 +288,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -314,7 +314,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil @@ -339,7 +339,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -356,7 +356,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil @@ -372,7 +372,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -402,7 +402,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -430,7 +430,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { CrossCheckBlockHeight: "aaa", } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -458,7 +458,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, // this won't be tested in this test } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -495,7 +495,7 @@ func getNodeStatusBytes(status *data.NetworkStatus) []byte { return respBytes } -func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { +func TestBaseProxy_GetShardOfAddress(t *testing.T) { t.Parallel() t.Run("invalid address", func(t *testing.T) { @@ -576,17 +576,17 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *basePr return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) return baseProxy } -func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { +func TestBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, _ := newBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 5c008673..9ca4d01c 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -85,7 +85,7 @@ func TestExtractNonceOfShardID(t *testing.T) { }) } -func TestMultiversXBaseProxy_CheckShardFinalization(t *testing.T) { +func TestBaseProxy_CheckShardFinalization(t *testing.T) { t.Parallel() t.Run("invalid maxNoncesDelta", func(t *testing.T) { From ed8be3bf6453087b83075ac036d9cf5f906dc845 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 14:03:03 +0200 Subject: [PATCH 11/15] removed MultiversX from Proxy, Notifee, ShardCoordinator 2 --- blockchain/baseProxy_test.go | 56 +++++++++---------- .../proxyFinalityProvider_test.go | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/blockchain/baseProxy_test.go b/blockchain/baseProxy_test.go index 3426ac64..5351fe0e 100644 --- a/blockchain/baseProxy_test.go +++ b/blockchain/baseProxy_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsMultiversXBaseProxy() argsBaseProxy { +func createMockArgsBaseProxy() argsBaseProxy { return argsBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, @@ -26,13 +26,13 @@ func createMockArgsMultiversXBaseProxy() argsBaseProxy { } } -func TestNewMultiversXBaseProxy(t *testing.T) { +func TestNewBaseProxy(t *testing.T) { t.Parallel() t.Run("nil http client wrapper", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = nil baseProxy, err := newBaseProxy(args) @@ -42,7 +42,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("invalid caching duration", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.expirationTime = time.Second - time.Nanosecond baseProxy, err := newBaseProxy(args) @@ -52,7 +52,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("nil endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = nil baseProxy, err := newBaseProxy(args) @@ -62,7 +62,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, err := newBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) @@ -70,7 +70,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { +func TestBaseProxy_GetNetworkConfig(t *testing.T) { t.Parallel() expectedReturnedNetworkConfig := &data.NetworkConfig{ @@ -110,7 +110,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -134,7 +134,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -159,7 +159,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusBadRequest, expectedErr } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -180,7 +180,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return []byte("malformed data"), http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -211,7 +211,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return erroredNetworkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -232,7 +232,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -249,14 +249,14 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { +func TestBaseProxy_GetNetworkStatus(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") t.Run("get errors", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return nil, http.StatusBadRequest, expectedErr @@ -272,7 +272,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil @@ -288,7 +288,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -314,7 +314,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil @@ -339,7 +339,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -356,7 +356,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil @@ -372,7 +372,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -402,7 +402,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -430,7 +430,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { CrossCheckBlockHeight: "aaa", } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -458,7 +458,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, // this won't be tested in this test } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -495,7 +495,7 @@ func getNodeStatusBytes(status *data.NetworkStatus) []byte { return respBytes } -func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { +func TestBaseProxy_GetShardOfAddress(t *testing.T) { t.Parallel() t.Run("invalid address", func(t *testing.T) { @@ -576,17 +576,17 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *basePr return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) return baseProxy } -func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { +func TestBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, _ := newBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 5c008673..9ca4d01c 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -85,7 +85,7 @@ func TestExtractNonceOfShardID(t *testing.T) { }) } -func TestMultiversXBaseProxy_CheckShardFinalization(t *testing.T) { +func TestBaseProxy_CheckShardFinalization(t *testing.T) { t.Parallel() t.Run("invalid maxNoncesDelta", func(t *testing.T) { From d570806f2a3725b97ee45b4b70022b2b4c99264a Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 14:03:03 +0200 Subject: [PATCH 12/15] removed MultiversX from Proxy, Notifee, ShardCoordinator 2 --- blockchain/baseProxy_test.go | 56 +++++++-------- .../proxyFinalityProvider_test.go | 2 +- blockchain/proxy.go | 68 +++++++++---------- blockchain/proxy_test.go | 42 ++++++------ examples/examplesAccount/main.go | 2 +- examples/examplesBlock/main.go | 2 +- examples/examplesFlowWalletTracker/main.go | 2 +- examples/examplesHeaderCheck/main.go | 2 +- examples/examplesPriceAggregator/main.go | 2 +- examples/examplesTransaction/main.go | 2 +- examples/examplesVMQuery/main.go | 2 +- 11 files changed, 91 insertions(+), 91 deletions(-) diff --git a/blockchain/baseProxy_test.go b/blockchain/baseProxy_test.go index 3426ac64..5351fe0e 100644 --- a/blockchain/baseProxy_test.go +++ b/blockchain/baseProxy_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsMultiversXBaseProxy() argsBaseProxy { +func createMockArgsBaseProxy() argsBaseProxy { return argsBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, @@ -26,13 +26,13 @@ func createMockArgsMultiversXBaseProxy() argsBaseProxy { } } -func TestNewMultiversXBaseProxy(t *testing.T) { +func TestNewBaseProxy(t *testing.T) { t.Parallel() t.Run("nil http client wrapper", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = nil baseProxy, err := newBaseProxy(args) @@ -42,7 +42,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("invalid caching duration", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.expirationTime = time.Second - time.Nanosecond baseProxy, err := newBaseProxy(args) @@ -52,7 +52,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("nil endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = nil baseProxy, err := newBaseProxy(args) @@ -62,7 +62,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, err := newBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) @@ -70,7 +70,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { +func TestBaseProxy_GetNetworkConfig(t *testing.T) { t.Parallel() expectedReturnedNetworkConfig := &data.NetworkConfig{ @@ -110,7 +110,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -134,7 +134,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -159,7 +159,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusBadRequest, expectedErr } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -180,7 +180,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return []byte("malformed data"), http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -211,7 +211,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return erroredNetworkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -232,7 +232,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -249,14 +249,14 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { +func TestBaseProxy_GetNetworkStatus(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") t.Run("get errors", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return nil, http.StatusBadRequest, expectedErr @@ -272,7 +272,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil @@ -288,7 +288,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -314,7 +314,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil @@ -339,7 +339,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -356,7 +356,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil @@ -372,7 +372,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -402,7 +402,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -430,7 +430,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { CrossCheckBlockHeight: "aaa", } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -458,7 +458,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, // this won't be tested in this test } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -495,7 +495,7 @@ func getNodeStatusBytes(status *data.NetworkStatus) []byte { return respBytes } -func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { +func TestBaseProxy_GetShardOfAddress(t *testing.T) { t.Parallel() t.Run("invalid address", func(t *testing.T) { @@ -576,17 +576,17 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *basePr return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) return baseProxy } -func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { +func TestBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, _ := newBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 5c008673..9ca4d01c 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -85,7 +85,7 @@ func TestExtractNonceOfShardID(t *testing.T) { }) } -func TestMultiversXBaseProxy_CheckShardFinalization(t *testing.T) { +func TestBaseProxy_CheckShardFinalization(t *testing.T) { t.Parallel() t.Run("invalid maxNoncesDelta", func(t *testing.T) { diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 2f66679f..3ba2fd85 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -34,8 +34,8 @@ type ArgsProxy struct { EntityType erdgoCore.RestAPIEntityType } -// multiversXProxy implements basic functions for interacting with a multiversx Proxy -type multiversXProxy struct { +// proxy implements basic functions for interacting with a multiversx Proxy +type proxy struct { *baseProxy sameScState bool shouldBeSynced bool @@ -44,8 +44,8 @@ type multiversXProxy struct { finalityProvider FinalityProvider } -// NewMultiversXProxy initializes and returns a multiversXProxy object -func NewMultiversXProxy(args ArgsProxy) (*multiversXProxy, error) { +// NewProxy initializes and returns a proxy object +func NewProxy(args ArgsProxy) (*proxy, error) { err := checkArgsProxy(args) if err != nil { return nil, err @@ -72,7 +72,7 @@ func NewMultiversXProxy(args ArgsProxy) (*multiversXProxy, error) { return nil, err } - ep := &multiversXProxy{ + ep := &proxy{ baseProxy: baseProxy, sameScState: args.SameScState, shouldBeSynced: args.ShouldBeSynced, @@ -96,7 +96,7 @@ func checkArgsProxy(args ArgsProxy) error { } // ExecuteVMQuery retrieves data from existing SC trie through the use of a VM -func (ep *multiversXProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { +func (ep *proxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { err := ep.checkFinalState(ctx, vmRequest.Address) if err != nil { return nil, err @@ -129,7 +129,7 @@ func (ep *multiversXProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.V return &response.Data, nil } -func (ep *multiversXProxy) checkFinalState(ctx context.Context, address string) error { +func (ep *proxy) checkFinalState(ctx context.Context, address string) error { if !ep.finalityCheck { return nil } @@ -143,7 +143,7 @@ func (ep *multiversXProxy) checkFinalState(ctx context.Context, address string) } // GetNetworkEconomics retrieves the network economics from the proxy -func (ep *multiversXProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { +func (ep *proxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetNetworkEconomics()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -162,7 +162,7 @@ func (ep *multiversXProxy) GetNetworkEconomics(ctx context.Context) (*data.Netwo } // GetDefaultTransactionArguments will prepare the transaction creation argument by querying the account's info -func (ep *multiversXProxy) GetDefaultTransactionArguments( +func (ep *proxy) GetDefaultTransactionArguments( ctx context.Context, address erdgoCore.AddressHandler, networkConfigs *data.NetworkConfig, @@ -196,7 +196,7 @@ func (ep *multiversXProxy) GetDefaultTransactionArguments( } // GetAccount retrieves an account info from the network (nonce, balance) -func (ep *multiversXProxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { +func (ep *proxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { err := ep.checkFinalState(ctx, address.AddressAsBech32String()) if err != nil { return nil, err @@ -228,7 +228,7 @@ func (ep *multiversXProxy) GetAccount(ctx context.Context, address erdgoCore.Add } // SendTransaction broadcasts a transaction to the network and returns the txhash if successful -func (ep *multiversXProxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { +func (ep *proxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { jsonTx, err := json.Marshal(tx) if err != nil { return "", err @@ -251,7 +251,7 @@ func (ep *multiversXProxy) SendTransaction(ctx context.Context, tx *data.Transac } // SendTransactions broadcasts the provided transactions to the network and returns the txhashes if successful -func (ep *multiversXProxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { +func (ep *proxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { jsonTx, err := json.Marshal(txs) if err != nil { return nil, err @@ -273,7 +273,7 @@ func (ep *multiversXProxy) SendTransactions(ctx context.Context, txs []*data.Tra return ep.postProcessSendMultipleTxsResult(response) } -func (ep *multiversXProxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { +func (ep *proxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { txHashes := make([]string, 0, len(response.Data.TxsHashes)) indexes := make([]int, 0, len(response.Data.TxsHashes)) for index := range response.Data.TxsHashes { @@ -292,7 +292,7 @@ func (ep *multiversXProxy) postProcessSendMultipleTxsResult(response *data.SendT } // GetTransactionStatus retrieves a transaction's status from the network -func (ep *multiversXProxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { +func (ep *proxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { endpoint := ep.endpointProvider.GetTransactionStatus(hash) buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -312,16 +312,16 @@ func (ep *multiversXProxy) GetTransactionStatus(ctx context.Context, hash string } // GetTransactionInfo retrieves a transaction's details from the network -func (ep *multiversXProxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *proxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, false) } // GetTransactionInfoWithResults retrieves a transaction's details from the network with events -func (ep *multiversXProxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *proxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, true) } -func (ep *multiversXProxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { +func (ep *proxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { endpoint := ep.endpointProvider.GetTransactionInfo(hash) if withResults { endpoint += withResultsQueryParam @@ -345,7 +345,7 @@ func (ep *multiversXProxy) getTransactionInfo(ctx context.Context, hash string, } // RequestTransactionCost retrieves how many gas a transaction will consume -func (ep *multiversXProxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { +func (ep *proxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { jsonTx, err := json.Marshal(tx) if err != nil { return nil, err @@ -368,7 +368,7 @@ func (ep *multiversXProxy) RequestTransactionCost(ctx context.Context, tx *data. } // GetLatestHyperBlockNonce retrieves the latest hyper block (metachain) nonce from the network -func (ep *multiversXProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { +func (ep *proxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, core.MetachainShardId) if err != nil { return 0, err @@ -378,20 +378,20 @@ func (ep *multiversXProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64 } // GetHyperBlockByNonce retrieves a hyper block's info by nonce from the network -func (ep *multiversXProxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { +func (ep *proxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByNonce(nonce) return ep.getHyperBlock(ctx, endpoint) } // GetHyperBlockByHash retrieves a hyper block's info by hash from the network -func (ep *multiversXProxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { +func (ep *proxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByHash(hash) return ep.getHyperBlock(ctx, endpoint) } -func (ep *multiversXProxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { +func (ep *proxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -410,27 +410,27 @@ func (ep *multiversXProxy) getHyperBlock(ctx context.Context, endpoint string) ( } // GetRawBlockByHash retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { +func (ep *proxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByHash(shardId, hash) return ep.getRawBlock(ctx, endpoint) } // GetRawBlockByNonce retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { +func (ep *proxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByNonce(shardId, nonce) return ep.getRawBlock(ctx, endpoint) } // GetRawStartOfEpochMetaBlock retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { +func (ep *proxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawStartOfEpochMetaBlock(epoch) return ep.getRawBlock(ctx, endpoint) } -func (ep *multiversXProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *proxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -449,13 +449,13 @@ func (ep *multiversXProxy) getRawBlock(ctx context.Context, endpoint string) ([] } // GetRawMiniBlockByHash retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { +func (ep *proxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawMiniBlockByHash(shardId, hash, epoch) return ep.getRawMiniBlock(ctx, endpoint) } -func (ep *multiversXProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *proxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -474,7 +474,7 @@ func (ep *multiversXProxy) getRawMiniBlock(ctx context.Context, endpoint string) } // GetNonceAtEpochStart retrieves the start of epoch nonce from hyper block (metachain) -func (ep *multiversXProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { +func (ep *proxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, shardId) if err != nil { return 0, err @@ -484,7 +484,7 @@ func (ep *multiversXProxy) GetNonceAtEpochStart(ctx context.Context, shardId uin } // GetRatingsConfig retrieves the ratings configuration from the proxy -func (ep *multiversXProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { +func (ep *proxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetRatingsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -503,7 +503,7 @@ func (ep *multiversXProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsC } // GetEnableEpochsConfig retrieves the ratings configuration from the proxy -func (ep *multiversXProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { +func (ep *proxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetEnableEpochsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -522,7 +522,7 @@ func (ep *multiversXProxy) GetEnableEpochsConfig(ctx context.Context) (*data.Ena } // GetGenesisNodesPubKeys retrieves genesis nodes configuration from proxy -func (ep *multiversXProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { +func (ep *proxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetGenesisNodesConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -541,7 +541,7 @@ func (ep *multiversXProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.Ge } // GetValidatorsInfoByEpoch retrieves the validators info by epoch -func (ep *multiversXProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { +func (ep *proxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetValidatorsInfo(epoch)) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -560,6 +560,6 @@ func (ep *multiversXProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch u } // IsInterfaceNil returns true if there is no value under the interface -func (ep *multiversXProxy) IsInterfaceNil() bool { +func (ep *proxy) IsInterfaceNil() bool { return ep == nil } diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index dd9a0987..ecc3de07 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -139,7 +139,7 @@ func handleRequestNetworkConfigAndStatus( }, handled, nil } -func TestNewMultiversXProxy(t *testing.T) { +func TestNewProxy(t *testing.T) { t.Parallel() t.Run("invalid time cache should error", func(t *testing.T) { @@ -147,7 +147,7 @@ func TestNewMultiversXProxy(t *testing.T) { args := createMockArgsProxy(nil) args.CacheExpirationTime = time.Second - time.Nanosecond - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -158,7 +158,7 @@ func TestNewMultiversXProxy(t *testing.T) { args := createMockArgsProxy(nil) args.FinalityCheck = true args.AllowedDeltaToFinal = 0 - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidAllowedDeltaToFinal)) @@ -168,7 +168,7 @@ func TestNewMultiversXProxy(t *testing.T) { args := createMockArgsProxy(nil) args.FinalityCheck = true - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -177,7 +177,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Parallel() args := createMockArgsProxy(nil) - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -215,7 +215,7 @@ func TestGetAccount(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - proxy, _ := NewMultiversXProxy(args) + proxy, _ := NewProxy(args) address, err := data.NewAddressFromBech32String("erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts") if err != nil { @@ -259,7 +259,7 @@ func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) networkEconomics, err := ep.GetNetworkEconomics(context.Background()) require.Nil(t, err) @@ -280,7 +280,7 @@ func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) tx := &data.Transaction{ Nonce: 1, @@ -306,7 +306,7 @@ func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) tx, err := ep.GetTransactionInfoWithResults(context.Background(), "a40e5a6af4efe221608297a73459211756ab88b96896e6e331842807a138f343") require.Nil(t, err) @@ -322,7 +322,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { t.Run("no finality check", func(t *testing.T) { httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -346,7 +346,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -372,7 +372,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "invalid", @@ -402,7 +402,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -437,7 +437,7 @@ func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { httpClient := createMockClientRespondingBytes(rawBlockDataBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRawBlockByHash(context.Background(), 0, "aaaa") require.Nil(t, err) @@ -467,7 +467,7 @@ func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { httpClient := createMockClientRespondingBytes(rawBlockDataBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRawBlockByNonce(context.Background(), 0, 10) require.Nil(t, err) @@ -497,7 +497,7 @@ func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { httpClient := createMockClientRespondingBytes(rawBlockDataBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRawMiniBlockByHash(context.Background(), 0, "aaaa", 1) require.Nil(t, err) @@ -527,7 +527,7 @@ func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { httpClient := createMockClientRespondingBytes(statusResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetNonceAtEpochStart(context.Background(), core.MetachainShardId) require.Nil(t, err) @@ -553,7 +553,7 @@ func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { httpClient := createMockClientRespondingBytes(ratingsResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRatingsConfig(context.Background()) require.Nil(t, err) @@ -582,7 +582,7 @@ func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { httpClient := createMockClientRespondingBytes(enableEpochsResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetEnableEpochsConfig(context.Background()) require.Nil(t, err) @@ -608,7 +608,7 @@ func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { httpClient := createMockClientRespondingBytes(genesisNodesResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetGenesisNodesPubKeys(context.Background()) require.Nil(t, err) @@ -636,7 +636,7 @@ func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { httpClient := createMockClientRespondingBytes(validatorsInfoResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetValidatorsInfoByEpoch(context.Background(), 1) require.Nil(t, err) diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index 21ef4396..f96620e8 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index e2526bd2..62894aa9 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index baa2da1e..209aa2d8 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -60,7 +60,7 @@ func runApp() error { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { return err } diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index be09370f..502ba105 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index 7d236847..dec18cff 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -221,7 +221,7 @@ func createAuthClient() (authentication.AuthClient, error) { EntityType: core.RestAPIEntityType("Proxy"), } - proxy, err := blockchain.NewMultiversXProxy(argsProxy) + proxy, err := blockchain.NewProxy(argsProxy) if err != nil { return nil, err } diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 84268102..1d09ad98 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -33,7 +33,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index e5dcbde9..741dfbc4 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return From d6e5cc51df6198eaa67775ce04c0124c16941960 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 14:03:03 +0200 Subject: [PATCH 13/15] removed MultiversX from Proxy, Notifee, ShardCoordinator 2 --- blockchain/baseProxy_test.go | 56 +++++++-------- .../proxyFinalityProvider_test.go | 2 +- blockchain/proxy.go | 68 +++++++++---------- blockchain/proxy_test.go | 42 ++++++------ examples/examplesAccount/main.go | 2 +- examples/examplesBlock/main.go | 2 +- examples/examplesFlowWalletTracker/main.go | 2 +- examples/examplesHeaderCheck/main.go | 2 +- examples/examplesPriceAggregator/main.go | 2 +- examples/examplesTransaction/main.go | 2 +- examples/examplesVMQuery/main.go | 2 +- 11 files changed, 91 insertions(+), 91 deletions(-) diff --git a/blockchain/baseProxy_test.go b/blockchain/baseProxy_test.go index 3426ac64..5351fe0e 100644 --- a/blockchain/baseProxy_test.go +++ b/blockchain/baseProxy_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func createMockArgsMultiversXBaseProxy() argsBaseProxy { +func createMockArgsBaseProxy() argsBaseProxy { return argsBaseProxy{ httpClientWrapper: &testsCommon.HTTPClientWrapperStub{}, expirationTime: time.Second, @@ -26,13 +26,13 @@ func createMockArgsMultiversXBaseProxy() argsBaseProxy { } } -func TestNewMultiversXBaseProxy(t *testing.T) { +func TestNewBaseProxy(t *testing.T) { t.Parallel() t.Run("nil http client wrapper", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = nil baseProxy, err := newBaseProxy(args) @@ -42,7 +42,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("invalid caching duration", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.expirationTime = time.Second - time.Nanosecond baseProxy, err := newBaseProxy(args) @@ -52,7 +52,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("nil endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = nil baseProxy, err := newBaseProxy(args) @@ -62,7 +62,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { t.Run("should work", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, err := newBaseProxy(args) assert.False(t, check.IfNil(baseProxy)) @@ -70,7 +70,7 @@ func TestNewMultiversXBaseProxy(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { +func TestBaseProxy_GetNetworkConfig(t *testing.T) { t.Parallel() expectedReturnedNetworkConfig := &data.NetworkConfig{ @@ -110,7 +110,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -134,7 +134,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -159,7 +159,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusBadRequest, expectedErr } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -180,7 +180,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return []byte("malformed data"), http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -211,7 +211,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return erroredNetworkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) @@ -232,7 +232,7 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { return nil, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper args.expirationTime = minimumCachingInterval * 2 baseProxy, _ := newBaseProxy(args) @@ -249,14 +249,14 @@ func TestMultiversXBaseProxy_GetNetworkConfig(t *testing.T) { }) } -func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { +func TestBaseProxy_GetNetworkStatus(t *testing.T) { t.Parallel() expectedErr := errors.New("expected error") t.Run("get errors", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return nil, http.StatusBadRequest, expectedErr @@ -272,7 +272,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return []byte("malformed response"), http.StatusOK, nil @@ -288,7 +288,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("malformed response - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -314,7 +314,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return respBytes, http.StatusOK, nil @@ -339,7 +339,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { } respBytes, _ := json.Marshal(resp) - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -356,7 +356,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - node endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNetworkStatusBytes(nil), http.StatusOK, nil @@ -372,7 +372,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { t.Run("GetNodeStatus returns nil network status - proxy endpoint provider", func(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -402,7 +402,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -430,7 +430,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { CrossCheckBlockHeight: "aaa", } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { return getNodeStatusBytes(providedNetworkStatus), http.StatusOK, nil @@ -458,7 +458,7 @@ func TestMultiversXBaseProxy_GetNetworkStatus(t *testing.T) { ShardID: core.MetachainShardId, // this won't be tested in this test } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.endpointProvider = endpointProviders.NewProxyEndpointProvider() args.httpClientWrapper = &testsCommon.HTTPClientWrapperStub{ GetHTTPCalled: func(ctx context.Context, endpoint string) ([]byte, int, error) { @@ -495,7 +495,7 @@ func getNodeStatusBytes(status *data.NetworkStatus) []byte { return respBytes } -func TestMultiversXBaseProxy_GetShardOfAddress(t *testing.T) { +func TestBaseProxy_GetShardOfAddress(t *testing.T) { t.Parallel() t.Run("invalid address", func(t *testing.T) { @@ -576,17 +576,17 @@ func createBaseProxyForGetShardOfAddress(numShards uint32, errGet error) *basePr return networkConfigBytes, http.StatusOK, nil } - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() args.httpClientWrapper = mockWrapper baseProxy, _ := newBaseProxy(args) return baseProxy } -func TestMultiversXBaseProxy_GetRestAPIEntityType(t *testing.T) { +func TestBaseProxy_GetRestAPIEntityType(t *testing.T) { t.Parallel() - args := createMockArgsMultiversXBaseProxy() + args := createMockArgsBaseProxy() baseProxy, _ := newBaseProxy(args) assert.Equal(t, args.endpointProvider.GetRestAPIEntityType(), baseProxy.GetRestAPIEntityType()) diff --git a/blockchain/finalityProvider/proxyFinalityProvider_test.go b/blockchain/finalityProvider/proxyFinalityProvider_test.go index 5c008673..9ca4d01c 100644 --- a/blockchain/finalityProvider/proxyFinalityProvider_test.go +++ b/blockchain/finalityProvider/proxyFinalityProvider_test.go @@ -85,7 +85,7 @@ func TestExtractNonceOfShardID(t *testing.T) { }) } -func TestMultiversXBaseProxy_CheckShardFinalization(t *testing.T) { +func TestBaseProxy_CheckShardFinalization(t *testing.T) { t.Parallel() t.Run("invalid maxNoncesDelta", func(t *testing.T) { diff --git a/blockchain/proxy.go b/blockchain/proxy.go index 2f66679f..3ba2fd85 100644 --- a/blockchain/proxy.go +++ b/blockchain/proxy.go @@ -34,8 +34,8 @@ type ArgsProxy struct { EntityType erdgoCore.RestAPIEntityType } -// multiversXProxy implements basic functions for interacting with a multiversx Proxy -type multiversXProxy struct { +// proxy implements basic functions for interacting with a multiversx Proxy +type proxy struct { *baseProxy sameScState bool shouldBeSynced bool @@ -44,8 +44,8 @@ type multiversXProxy struct { finalityProvider FinalityProvider } -// NewMultiversXProxy initializes and returns a multiversXProxy object -func NewMultiversXProxy(args ArgsProxy) (*multiversXProxy, error) { +// NewProxy initializes and returns a proxy object +func NewProxy(args ArgsProxy) (*proxy, error) { err := checkArgsProxy(args) if err != nil { return nil, err @@ -72,7 +72,7 @@ func NewMultiversXProxy(args ArgsProxy) (*multiversXProxy, error) { return nil, err } - ep := &multiversXProxy{ + ep := &proxy{ baseProxy: baseProxy, sameScState: args.SameScState, shouldBeSynced: args.ShouldBeSynced, @@ -96,7 +96,7 @@ func checkArgsProxy(args ArgsProxy) error { } // ExecuteVMQuery retrieves data from existing SC trie through the use of a VM -func (ep *multiversXProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { +func (ep *proxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error) { err := ep.checkFinalState(ctx, vmRequest.Address) if err != nil { return nil, err @@ -129,7 +129,7 @@ func (ep *multiversXProxy) ExecuteVMQuery(ctx context.Context, vmRequest *data.V return &response.Data, nil } -func (ep *multiversXProxy) checkFinalState(ctx context.Context, address string) error { +func (ep *proxy) checkFinalState(ctx context.Context, address string) error { if !ep.finalityCheck { return nil } @@ -143,7 +143,7 @@ func (ep *multiversXProxy) checkFinalState(ctx context.Context, address string) } // GetNetworkEconomics retrieves the network economics from the proxy -func (ep *multiversXProxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { +func (ep *proxy) GetNetworkEconomics(ctx context.Context) (*data.NetworkEconomics, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetNetworkEconomics()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -162,7 +162,7 @@ func (ep *multiversXProxy) GetNetworkEconomics(ctx context.Context) (*data.Netwo } // GetDefaultTransactionArguments will prepare the transaction creation argument by querying the account's info -func (ep *multiversXProxy) GetDefaultTransactionArguments( +func (ep *proxy) GetDefaultTransactionArguments( ctx context.Context, address erdgoCore.AddressHandler, networkConfigs *data.NetworkConfig, @@ -196,7 +196,7 @@ func (ep *multiversXProxy) GetDefaultTransactionArguments( } // GetAccount retrieves an account info from the network (nonce, balance) -func (ep *multiversXProxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { +func (ep *proxy) GetAccount(ctx context.Context, address erdgoCore.AddressHandler) (*data.Account, error) { err := ep.checkFinalState(ctx, address.AddressAsBech32String()) if err != nil { return nil, err @@ -228,7 +228,7 @@ func (ep *multiversXProxy) GetAccount(ctx context.Context, address erdgoCore.Add } // SendTransaction broadcasts a transaction to the network and returns the txhash if successful -func (ep *multiversXProxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { +func (ep *proxy) SendTransaction(ctx context.Context, tx *data.Transaction) (string, error) { jsonTx, err := json.Marshal(tx) if err != nil { return "", err @@ -251,7 +251,7 @@ func (ep *multiversXProxy) SendTransaction(ctx context.Context, tx *data.Transac } // SendTransactions broadcasts the provided transactions to the network and returns the txhashes if successful -func (ep *multiversXProxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { +func (ep *proxy) SendTransactions(ctx context.Context, txs []*data.Transaction) ([]string, error) { jsonTx, err := json.Marshal(txs) if err != nil { return nil, err @@ -273,7 +273,7 @@ func (ep *multiversXProxy) SendTransactions(ctx context.Context, txs []*data.Tra return ep.postProcessSendMultipleTxsResult(response) } -func (ep *multiversXProxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { +func (ep *proxy) postProcessSendMultipleTxsResult(response *data.SendTransactionsResponse) ([]string, error) { txHashes := make([]string, 0, len(response.Data.TxsHashes)) indexes := make([]int, 0, len(response.Data.TxsHashes)) for index := range response.Data.TxsHashes { @@ -292,7 +292,7 @@ func (ep *multiversXProxy) postProcessSendMultipleTxsResult(response *data.SendT } // GetTransactionStatus retrieves a transaction's status from the network -func (ep *multiversXProxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { +func (ep *proxy) GetTransactionStatus(ctx context.Context, hash string) (string, error) { endpoint := ep.endpointProvider.GetTransactionStatus(hash) buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { @@ -312,16 +312,16 @@ func (ep *multiversXProxy) GetTransactionStatus(ctx context.Context, hash string } // GetTransactionInfo retrieves a transaction's details from the network -func (ep *multiversXProxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *proxy) GetTransactionInfo(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, false) } // GetTransactionInfoWithResults retrieves a transaction's details from the network with events -func (ep *multiversXProxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { +func (ep *proxy) GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error) { return ep.getTransactionInfo(ctx, hash, true) } -func (ep *multiversXProxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { +func (ep *proxy) getTransactionInfo(ctx context.Context, hash string, withResults bool) (*data.TransactionInfo, error) { endpoint := ep.endpointProvider.GetTransactionInfo(hash) if withResults { endpoint += withResultsQueryParam @@ -345,7 +345,7 @@ func (ep *multiversXProxy) getTransactionInfo(ctx context.Context, hash string, } // RequestTransactionCost retrieves how many gas a transaction will consume -func (ep *multiversXProxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { +func (ep *proxy) RequestTransactionCost(ctx context.Context, tx *data.Transaction) (*data.TxCostResponseData, error) { jsonTx, err := json.Marshal(tx) if err != nil { return nil, err @@ -368,7 +368,7 @@ func (ep *multiversXProxy) RequestTransactionCost(ctx context.Context, tx *data. } // GetLatestHyperBlockNonce retrieves the latest hyper block (metachain) nonce from the network -func (ep *multiversXProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { +func (ep *proxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, core.MetachainShardId) if err != nil { return 0, err @@ -378,20 +378,20 @@ func (ep *multiversXProxy) GetLatestHyperBlockNonce(ctx context.Context) (uint64 } // GetHyperBlockByNonce retrieves a hyper block's info by nonce from the network -func (ep *multiversXProxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { +func (ep *proxy) GetHyperBlockByNonce(ctx context.Context, nonce uint64) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByNonce(nonce) return ep.getHyperBlock(ctx, endpoint) } // GetHyperBlockByHash retrieves a hyper block's info by hash from the network -func (ep *multiversXProxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { +func (ep *proxy) GetHyperBlockByHash(ctx context.Context, hash string) (*data.HyperBlock, error) { endpoint := ep.endpointProvider.GetHyperBlockByHash(hash) return ep.getHyperBlock(ctx, endpoint) } -func (ep *multiversXProxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { +func (ep *proxy) getHyperBlock(ctx context.Context, endpoint string) (*data.HyperBlock, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -410,27 +410,27 @@ func (ep *multiversXProxy) getHyperBlock(ctx context.Context, endpoint string) ( } // GetRawBlockByHash retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { +func (ep *proxy) GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByHash(shardId, hash) return ep.getRawBlock(ctx, endpoint) } // GetRawBlockByNonce retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { +func (ep *proxy) GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error) { endpoint := ep.endpointProvider.GetRawBlockByNonce(shardId, nonce) return ep.getRawBlock(ctx, endpoint) } // GetRawStartOfEpochMetaBlock retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { +func (ep *proxy) GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawStartOfEpochMetaBlock(epoch) return ep.getRawBlock(ctx, endpoint) } -func (ep *multiversXProxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *proxy) getRawBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -449,13 +449,13 @@ func (ep *multiversXProxy) getRawBlock(ctx context.Context, endpoint string) ([] } // GetRawMiniBlockByHash retrieves a raw block by hash from the network -func (ep *multiversXProxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { +func (ep *proxy) GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error) { endpoint := ep.endpointProvider.GetRawMiniBlockByHash(shardId, hash, epoch) return ep.getRawMiniBlock(ctx, endpoint) } -func (ep *multiversXProxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { +func (ep *proxy) getRawMiniBlock(ctx context.Context, endpoint string) ([]byte, error) { buff, code, err := ep.GetHTTP(ctx, endpoint) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -474,7 +474,7 @@ func (ep *multiversXProxy) getRawMiniBlock(ctx context.Context, endpoint string) } // GetNonceAtEpochStart retrieves the start of epoch nonce from hyper block (metachain) -func (ep *multiversXProxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { +func (ep *proxy) GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error) { response, err := ep.GetNetworkStatus(ctx, shardId) if err != nil { return 0, err @@ -484,7 +484,7 @@ func (ep *multiversXProxy) GetNonceAtEpochStart(ctx context.Context, shardId uin } // GetRatingsConfig retrieves the ratings configuration from the proxy -func (ep *multiversXProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { +func (ep *proxy) GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetRatingsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -503,7 +503,7 @@ func (ep *multiversXProxy) GetRatingsConfig(ctx context.Context) (*data.RatingsC } // GetEnableEpochsConfig retrieves the ratings configuration from the proxy -func (ep *multiversXProxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { +func (ep *proxy) GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetEnableEpochsConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -522,7 +522,7 @@ func (ep *multiversXProxy) GetEnableEpochsConfig(ctx context.Context) (*data.Ena } // GetGenesisNodesPubKeys retrieves genesis nodes configuration from proxy -func (ep *multiversXProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { +func (ep *proxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetGenesisNodesConfig()) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -541,7 +541,7 @@ func (ep *multiversXProxy) GetGenesisNodesPubKeys(ctx context.Context) (*data.Ge } // GetValidatorsInfoByEpoch retrieves the validators info by epoch -func (ep *multiversXProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { +func (ep *proxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error) { buff, code, err := ep.GetHTTP(ctx, ep.endpointProvider.GetValidatorsInfo(epoch)) if err != nil || code != http.StatusOK { return nil, createHTTPStatusError(code, err) @@ -560,6 +560,6 @@ func (ep *multiversXProxy) GetValidatorsInfoByEpoch(ctx context.Context, epoch u } // IsInterfaceNil returns true if there is no value under the interface -func (ep *multiversXProxy) IsInterfaceNil() bool { +func (ep *proxy) IsInterfaceNil() bool { return ep == nil } diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index dd9a0987..ecc3de07 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -139,7 +139,7 @@ func handleRequestNetworkConfigAndStatus( }, handled, nil } -func TestNewMultiversXProxy(t *testing.T) { +func TestNewProxy(t *testing.T) { t.Parallel() t.Run("invalid time cache should error", func(t *testing.T) { @@ -147,7 +147,7 @@ func TestNewMultiversXProxy(t *testing.T) { args := createMockArgsProxy(nil) args.CacheExpirationTime = time.Second - time.Nanosecond - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidCacherDuration)) @@ -158,7 +158,7 @@ func TestNewMultiversXProxy(t *testing.T) { args := createMockArgsProxy(nil) args.FinalityCheck = true args.AllowedDeltaToFinal = 0 - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.True(t, check.IfNil(proxy)) assert.True(t, errors.Is(err, ErrInvalidAllowedDeltaToFinal)) @@ -168,7 +168,7 @@ func TestNewMultiversXProxy(t *testing.T) { args := createMockArgsProxy(nil) args.FinalityCheck = true - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -177,7 +177,7 @@ func TestNewMultiversXProxy(t *testing.T) { t.Parallel() args := createMockArgsProxy(nil) - proxy, err := NewMultiversXProxy(args) + proxy, err := NewProxy(args) assert.False(t, check.IfNil(proxy)) assert.Nil(t, err) @@ -215,7 +215,7 @@ func TestGetAccount(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - proxy, _ := NewMultiversXProxy(args) + proxy, _ := NewProxy(args) address, err := data.NewAddressFromBech32String("erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts") if err != nil { @@ -259,7 +259,7 @@ func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) networkEconomics, err := ep.GetNetworkEconomics(context.Background()) require.Nil(t, err) @@ -280,7 +280,7 @@ func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) tx := &data.Transaction{ Nonce: 1, @@ -306,7 +306,7 @@ func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) tx, err := ep.GetTransactionInfoWithResults(context.Background(), "a40e5a6af4efe221608297a73459211756ab88b96896e6e331842807a138f343") require.Nil(t, err) @@ -322,7 +322,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { t.Run("no finality check", func(t *testing.T) { httpClient := createMockClientRespondingBytes(responseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -346,7 +346,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -372,7 +372,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "invalid", @@ -402,7 +402,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { } args := createMockArgsProxy(httpClient) args.FinalityCheck = true - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.ExecuteVMQuery(context.Background(), &data.VmValueRequest{ Address: "erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt", @@ -437,7 +437,7 @@ func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { httpClient := createMockClientRespondingBytes(rawBlockDataBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRawBlockByHash(context.Background(), 0, "aaaa") require.Nil(t, err) @@ -467,7 +467,7 @@ func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { httpClient := createMockClientRespondingBytes(rawBlockDataBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRawBlockByNonce(context.Background(), 0, 10) require.Nil(t, err) @@ -497,7 +497,7 @@ func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { httpClient := createMockClientRespondingBytes(rawBlockDataBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRawMiniBlockByHash(context.Background(), 0, "aaaa", 1) require.Nil(t, err) @@ -527,7 +527,7 @@ func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { httpClient := createMockClientRespondingBytes(statusResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetNonceAtEpochStart(context.Background(), core.MetachainShardId) require.Nil(t, err) @@ -553,7 +553,7 @@ func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { httpClient := createMockClientRespondingBytes(ratingsResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetRatingsConfig(context.Background()) require.Nil(t, err) @@ -582,7 +582,7 @@ func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { httpClient := createMockClientRespondingBytes(enableEpochsResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetEnableEpochsConfig(context.Background()) require.Nil(t, err) @@ -608,7 +608,7 @@ func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { httpClient := createMockClientRespondingBytes(genesisNodesResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetGenesisNodesPubKeys(context.Background()) require.Nil(t, err) @@ -636,7 +636,7 @@ func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { httpClient := createMockClientRespondingBytes(validatorsInfoResponseBytes) args := createMockArgsProxy(httpClient) - ep, _ := NewMultiversXProxy(args) + ep, _ := NewProxy(args) response, err := ep.GetValidatorsInfoByEpoch(context.Background(), 1) require.Nil(t, err) diff --git a/examples/examplesAccount/main.go b/examples/examplesAccount/main.go index 21ef4396..f96620e8 100644 --- a/examples/examplesAccount/main.go +++ b/examples/examplesAccount/main.go @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesBlock/main.go b/examples/examplesBlock/main.go index e2526bd2..62894aa9 100644 --- a/examples/examplesBlock/main.go +++ b/examples/examplesBlock/main.go @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesFlowWalletTracker/main.go b/examples/examplesFlowWalletTracker/main.go index baa2da1e..209aa2d8 100644 --- a/examples/examplesFlowWalletTracker/main.go +++ b/examples/examplesFlowWalletTracker/main.go @@ -60,7 +60,7 @@ func runApp() error { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { return err } diff --git a/examples/examplesHeaderCheck/main.go b/examples/examplesHeaderCheck/main.go index be09370f..502ba105 100644 --- a/examples/examplesHeaderCheck/main.go +++ b/examples/examplesHeaderCheck/main.go @@ -24,7 +24,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesPriceAggregator/main.go b/examples/examplesPriceAggregator/main.go index 7d236847..dec18cff 100644 --- a/examples/examplesPriceAggregator/main.go +++ b/examples/examplesPriceAggregator/main.go @@ -221,7 +221,7 @@ func createAuthClient() (authentication.AuthClient, error) { EntityType: core.RestAPIEntityType("Proxy"), } - proxy, err := blockchain.NewMultiversXProxy(argsProxy) + proxy, err := blockchain.NewProxy(argsProxy) if err != nil { return nil, err } diff --git a/examples/examplesTransaction/main.go b/examples/examplesTransaction/main.go index 84268102..1d09ad98 100644 --- a/examples/examplesTransaction/main.go +++ b/examples/examplesTransaction/main.go @@ -33,7 +33,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return diff --git a/examples/examplesVMQuery/main.go b/examples/examplesVMQuery/main.go index e5dcbde9..741dfbc4 100644 --- a/examples/examplesVMQuery/main.go +++ b/examples/examplesVMQuery/main.go @@ -23,7 +23,7 @@ func main() { CacheExpirationTime: time.Minute, EntityType: core.Proxy, } - ep, err := blockchain.NewMultiversXProxy(args) + ep, err := blockchain.NewProxy(args) if err != nil { log.Error("error creating proxy", "error", err) return From 231d1a1b5e23e7385fe0b5edac7ca7bfe8c96032 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 14:12:43 +0200 Subject: [PATCH 14/15] proxy test renamed --- blockchain/proxy_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index ecc3de07..40b65ca7 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -253,7 +253,7 @@ func TestGetAccount(t *testing.T) { }) } -func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { +func TestProxy_GetNetworkEconomics(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) @@ -274,7 +274,7 @@ func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { }, networkEconomics) } -func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { +func TestProxy_RequestTransactionCost(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) @@ -300,7 +300,7 @@ func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { }, txCost) } -func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { +func TestProxy_GetTransactionInfoWithResults(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) @@ -315,7 +315,7 @@ func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { fmt.Println(string(txBytes)) } -func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { +func TestProxy_ExecuteVmQuery(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"data":{"returnData":["MC41LjU="],"returnCode":"ok","returnMessage":"","gasRemaining":18446744073685949187,"gasRefund":0,"outputAccounts":{"0000000000000000050033bb65a91ee17ab84c6f8a01846ef8644e15fb76696a":{"address":"erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt","nonce":0,"balance":null,"balanceDelta":0,"storageUpdates":{},"code":null,"codeMetaData":null,"outputTransfers":[],"callType":0}},"deletedAccounts":[],"touchedAccounts":[],"logs":[]}},"error":"","code":"successful"}`) @@ -416,7 +416,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { }) } -func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { +func TestProxy_GetRawBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -448,7 +448,7 @@ func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { +func TestProxy_GetRawBlockByNonce(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -478,7 +478,7 @@ func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { +func TestProxy_GetRawMiniBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -508,7 +508,7 @@ func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { +func TestProxy_GetNonceAtEpochStart(t *testing.T) { t.Parallel() expectedNonce := uint64(2) @@ -535,7 +535,7 @@ func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { require.Equal(t, expectedNonce, response) } -func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { +func TestProxy_GetRatingsConfig(t *testing.T) { t.Parallel() expectedRatingsConfig := &data.RatingsConfig{ @@ -561,7 +561,7 @@ func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { require.Equal(t, expectedRatingsConfig, response) } -func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { +func TestProxy_GetEnableEpochsConfig(t *testing.T) { t.Parallel() enableEpochs := config.EnableEpochs{ @@ -590,7 +590,7 @@ func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { require.Equal(t, expectedEnableEpochsConfig, response) } -func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { +func TestProxy_GetGenesisNodesPubKeys(t *testing.T) { t.Parallel() expectedGenesisNodes := &data.GenesisNodes{ @@ -616,7 +616,7 @@ func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { require.Equal(t, expectedGenesisNodes, response) } -func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { +func TestProxy_GetValidatorsInfoByEpoch(t *testing.T) { t.Parallel() expectedValidatorsInfo := []*state.ShardValidatorInfo{ From adc4068e9dedf1b143baa57cfb705e1101722f39 Mon Sep 17 00:00:00 2001 From: radu chis Date: Thu, 26 Jan 2023 14:12:43 +0200 Subject: [PATCH 15/15] proxy test renamed --- blockchain/proxy_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/blockchain/proxy_test.go b/blockchain/proxy_test.go index ecc3de07..40b65ca7 100644 --- a/blockchain/proxy_test.go +++ b/blockchain/proxy_test.go @@ -253,7 +253,7 @@ func TestGetAccount(t *testing.T) { }) } -func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { +func TestProxy_GetNetworkEconomics(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"metrics":{"erd_dev_rewards":"0","erd_epoch_for_economics_data":263,"erd_inflation":"5869888769785838708144","erd_total_fees":"51189055176110000000","erd_total_staked_value":"9963775651405816710680128","erd_total_supply":"21556417261819025351089574","erd_total_top_up_value":"1146275808171377418645274"}},"code":"successful"}`) @@ -274,7 +274,7 @@ func TestMultiversXProxy_GetNetworkEconomics(t *testing.T) { }, networkEconomics) } -func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { +func TestProxy_RequestTransactionCost(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"txGasUnits":24273810,"returnMessage":""},"error":"","code":"successful"}`) @@ -300,7 +300,7 @@ func TestMultiversXProxy_RequestTransactionCost(t *testing.T) { }, txCost) } -func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { +func TestProxy_GetTransactionInfoWithResults(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"transaction":{"type":"normal","nonce":22100,"round":53057,"epoch":263,"value":"0","receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","gasPrice":1000000001,"gasLimit":19210000,"data":"RVNEVE5GVFRyYW5zZmVyQDU5NTk1OTQ1MzY0MzM5MkQzMDM5MzQzOTMwMzBAMDFAMDFAMDAwMDAwMDAwMDAwMDAwMDA1MDA1QzgzRTBDNDJFRENFMzk0RjQwQjI0RDI5RDI5OEIwMjQ5QzQxRjAyODk3NEA2Njc1NkU2NEA1N0M1MDZBMTlEOEVBRTE4Mjk0MDNBOEYzRjU0RTFGMDM3OUYzODE1N0ZDRjUzRDVCQ0E2RjIzN0U0QTRDRjYxQDFjMjA=","signature":"37922ccb13d46857d819cd618f1fd8e76777e14f1c16a54eeedd55c67d5883db0e3a91cd0ff0f541e2c3d7347488b4020c0ba4765c9bc02ea0ae1c3f6db1ec05","sourceShard":1,"destinationShard":1,"blockNonce":53052,"blockHash":"4a63312d1bfe48aa516185d12abff5daf6343fce1f298db51291168cf97a790c","notarizedAtSourceInMetaNonce":53053,"NotarizedAtSourceInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","notarizedAtDestinationInMetaNonce":53053,"notarizedAtDestinationInMetaHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","miniblockType":"TxBlock","miniblockHash":"0c659cce5e2653522cc0e3cf35571264522035a7aef4ffa5244d1ed3d8bc01a8","status":"success","hyperblockNonce":53053,"hyperblockHash":"342d189e36ef5cbf9f8b3f2cb5bf2cb8e2260062c6acdf89ce5faacd99f4dbcc","smartContractResults":[{"hash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","nonce":0,"value":0,"receiver":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","sender":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","data":"ESDTNFTTransfer@595959453643392d303934393030@01@01@080112020001226f08011204746573741a20ceb056611da7c977378598cbf276bc90943a3959441320bff0f8d0ca3618c05b20e8072a206161616161616161616161616161616161616161616161616161616161616161320461626261321268747470733a2f2f656c726f6e642e636f6d3a0474657374@66756e64@57c506a19d8eae1829403a8f3f54e1f0379f38157fcf53d5bca6f237e4a4cf61@1c20","prevTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":18250000,"gasPrice":1000000001,"callType":0},{"hash":"f337d2705d2b644f9d8f75cf270e879b6ada51c4c54009e94305adf368d1adbc","nonce":1,"value":102793170000000,"receiver":"erd1e6c9vcga5lyhwdu9nr9lya4ujz2r5w2egsfjp0lslrgv5dsccpdsmre6va","sender":"erd1qqqqqqqqqqqqqpgqtjp7p3pwmn3efaqtynff62vtqfyug8cz396qs5vnsy","data":"@6f6b","prevTxHash":"5ab14959aaeb3a20d95ec6bbefc03f251732d9368711c55c63d3811e70903f4e","originalTxHash":"c7fadeaccce0673bd6ce3a1f472f7cc1beef20c0b3131cfa9866cd5075816639","gasLimit":0,"gasPrice":1000000001,"callType":0}]}},"error":"","code":"successful"}`) @@ -315,7 +315,7 @@ func TestMultiversXProxy_GetTransactionInfoWithResults(t *testing.T) { fmt.Println(string(txBytes)) } -func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { +func TestProxy_ExecuteVmQuery(t *testing.T) { t.Parallel() responseBytes := []byte(`{"data":{"data":{"returnData":["MC41LjU="],"returnCode":"ok","returnMessage":"","gasRemaining":18446744073685949187,"gasRefund":0,"outputAccounts":{"0000000000000000050033bb65a91ee17ab84c6f8a01846ef8644e15fb76696a":{"address":"erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt","nonce":0,"balance":null,"balanceDelta":0,"storageUpdates":{},"code":null,"codeMetaData":null,"outputTransfers":[],"callType":0}},"deletedAccounts":[],"touchedAccounts":[],"logs":[]}},"error":"","code":"successful"}`) @@ -416,7 +416,7 @@ func TestMultiversXProxy_ExecuteVmQuery(t *testing.T) { }) } -func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { +func TestProxy_GetRawBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -448,7 +448,7 @@ func TestMultiversXProxy_GetRawBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { +func TestProxy_GetRawBlockByNonce(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -478,7 +478,7 @@ func TestMultiversXProxy_GetRawBlockByNonce(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { +func TestProxy_GetRawMiniBlockByHash(t *testing.T) { t.Parallel() expectedTs := &testStruct{ @@ -508,7 +508,7 @@ func TestMultiversXProxy_GetRawMiniBlockByHash(t *testing.T) { require.Equal(t, expectedTs, ts) } -func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { +func TestProxy_GetNonceAtEpochStart(t *testing.T) { t.Parallel() expectedNonce := uint64(2) @@ -535,7 +535,7 @@ func TestMultiversXProxy_GetNonceAtEpochStart(t *testing.T) { require.Equal(t, expectedNonce, response) } -func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { +func TestProxy_GetRatingsConfig(t *testing.T) { t.Parallel() expectedRatingsConfig := &data.RatingsConfig{ @@ -561,7 +561,7 @@ func TestMultiversXProxy_GetRatingsConfig(t *testing.T) { require.Equal(t, expectedRatingsConfig, response) } -func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { +func TestProxy_GetEnableEpochsConfig(t *testing.T) { t.Parallel() enableEpochs := config.EnableEpochs{ @@ -590,7 +590,7 @@ func TestMultiversXProxy_GetEnableEpochsConfig(t *testing.T) { require.Equal(t, expectedEnableEpochsConfig, response) } -func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { +func TestProxy_GetGenesisNodesPubKeys(t *testing.T) { t.Parallel() expectedGenesisNodes := &data.GenesisNodes{ @@ -616,7 +616,7 @@ func TestMultiversXProxy_GetGenesisNodesPubKeys(t *testing.T) { require.Equal(t, expectedGenesisNodes, response) } -func TestMultiversXProxy_GetValidatorsInfoByEpoch(t *testing.T) { +func TestProxy_GetValidatorsInfoByEpoch(t *testing.T) { t.Parallel() expectedValidatorsInfo := []*state.ShardValidatorInfo{