Skip to content

Commit

Permalink
fixes after merge + fixed linter + core update to the proper one
Browse files Browse the repository at this point in the history
  • Loading branch information
sstanculeanu committed Jan 28, 2025
1 parent 6b1b0ba commit b7f36bd
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 43 deletions.
2 changes: 1 addition & 1 deletion common/converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func ProcessDestinationShardAsObserver(destinationShardIdAsObserver string) (uin

val, err := strconv.ParseUint(destShard, 10, 32)
if err != nil {
return 0, fmt.Errorf("error parsing DestinationShardAsObserver option: " + err.Error())
return 0, fmt.Errorf("error parsing DestinationShardAsObserver option: %s", err.Error())
}

return uint32(val), err
Expand Down
2 changes: 1 addition & 1 deletion consensus/spos/bls/v2/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (sr *subroundEndRound) DoEndRoundJobByNode() bool {

// CreateAndBroadcastProof calls the unexported createAndBroadcastHeaderFinalInfo function
func (sr *subroundEndRound) CreateAndBroadcastProof(signature []byte, bitmap []byte) {
sr.createAndBroadcastProof(signature, bitmap)
_, _ = sr.createAndBroadcastProof(signature, bitmap)
}

// ReceivedProof calls the unexported receivedProof function
Expand Down
1 change: 1 addition & 0 deletions dataRetriever/dataPool/proofsCache/proofsPool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func TestProofsPool_ShouldWork(t *testing.T) {

proof, err = pp.GetProof(shardID, []byte("hash3"))
require.Nil(t, err)
require.Equal(t, proof3, proof)

proof, err = pp.GetProof(shardID, []byte("hash4"))
require.Nil(t, err)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/klauspost/cpuid/v2 v2.2.5
github.com/mitchellh/mapstructure v1.5.0
github.com/multiversx/mx-chain-communication-go v1.1.1
github.com/multiversx/mx-chain-core-go v1.2.24
github.com/multiversx/mx-chain-core-go v1.2.25-0.20250128130418-5550d48d5e66
github.com/multiversx/mx-chain-crypto-go v1.2.12
github.com/multiversx/mx-chain-es-indexer-go v1.7.14
github.com/multiversx/mx-chain-logger-go v1.0.15
Expand All @@ -33,6 +33,7 @@ require (
github.com/stretchr/testify v1.8.4
github.com/urfave/cli v1.22.10
golang.org/x/crypto v0.10.0
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
gopkg.in/go-playground/validator.v8 v8.18.2
)

Expand Down Expand Up @@ -173,7 +174,6 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/sync v0.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUY
github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o=
github.com/multiversx/mx-chain-communication-go v1.1.1 h1:y4DoQeQOJTaSUsRzczQFazf8JYQmInddypApqA3AkwM=
github.com/multiversx/mx-chain-communication-go v1.1.1/go.mod h1:WK6bP4pGEHGDDna/AYRIMtl6G9OA0NByI1Lw8PmOnRM=
github.com/multiversx/mx-chain-core-go v1.2.24 h1:O0X7N9GfNVUCE9fukXA+dvfCRRjViYn88zOaE7feUog=
github.com/multiversx/mx-chain-core-go v1.2.24/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-core-go v1.2.25-0.20250128130418-5550d48d5e66 h1:V44pZBVEu3rqTM8CFZljCyYu36yOV4S+4AkRi19FxWE=
github.com/multiversx/mx-chain-core-go v1.2.25-0.20250128130418-5550d48d5e66/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-crypto-go v1.2.12 h1:zWip7rpUS4CGthJxfKn5MZfMfYPjVjIiCID6uX5BSOk=
github.com/multiversx/mx-chain-crypto-go v1.2.12/go.mod h1:HzcPpCm1zanNct/6h2rIh+MFrlXbjA5C8+uMyXj3LI4=
github.com/multiversx/mx-chain-es-indexer-go v1.7.14 h1:V4fuubEUYskWCLQIkbuoB0WHoKyldLQRq/fllIzW1CU=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ func updateNumberTransactionsProposed(
transactionsForLeader[addressProposer] += nbTransactions
}

func updateRewardsForMetachain(_ map[string]uint32, _ *integrationTests.TestProcessorNode) {
}

func verifyRewardsForMetachain(
t *testing.T,
mapRewardsForMeta map[string]uint32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestRelayedTransactionInMultiShardEnvironmentWithNormalTxButWithTooMuchGas(

roundToPropagateMultiShard := int64(20)
for i := int64(0); i <= roundToPropagateMultiShard; i++ {
round, nonce = integrationTests.ProposeAndSyncOneBlock(t, nodes, idxProposers, round, nonce)
round, nonce = integrationTests.ProposeAndSyncOneBlock(t, nodes, leaders, round, nonce)
integrationTests.AddSelfNotarizedHeaderByMetachain(nodes)
}

Expand Down
10 changes: 0 additions & 10 deletions integrationTests/multiShard/smartContract/scCallingSC_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,16 +960,6 @@ func TestSCNonPayableIntraShardErrorShouldProcessBlock(t *testing.T) {
}
}

func getNodeIndex(nodeList []*integrationTests.TestProcessorNode, node *integrationTests.TestProcessorNode) (int, error) {
for i := range nodeList {
if node == nodeList[i] {
return i, nil
}
}

return 0, errors.New("no such node in list")
}

func putDeploySCToDataPool(
fileName string,
pubkey []byte,
Expand Down
3 changes: 0 additions & 3 deletions integrationTests/testProcessorNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ import (
"github.com/multiversx/mx-chain-go/vm"
vmProcess "github.com/multiversx/mx-chain-go/vm/process"
"github.com/multiversx/mx-chain-go/vm/systemSmartContracts/defaults"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
"github.com/multiversx/mx-chain-vm-common-go/parsers"
wasmConfig "github.com/multiversx/mx-chain-vm-go/config"
)

var zero = big.NewInt(0)
Expand Down
5 changes: 3 additions & 2 deletions integrationTests/vm/wasm/wasmvm/testRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package wasmvm
import (
"crypto/rand"
"encoding/hex"
"errors"
"fmt"
"math/big"
"time"
Expand Down Expand Up @@ -171,7 +172,7 @@ func DeployAndExecuteERC20WithBigInt(
return nil, err
}
if returnCode != vmcommon.Ok {
return nil, fmt.Errorf(returnCode.String())
return nil, errors.New(returnCode.String())
}
ownerNonce++

Expand Down Expand Up @@ -263,7 +264,7 @@ func SetupERC20Test(
return err
}
if returnCode != vmcommon.Ok {
return fmt.Errorf(returnCode.String())
return errors.New(returnCode.String())
}

testContext.ContractOwner.Nonce++
Expand Down
2 changes: 1 addition & 1 deletion process/block/displayBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (txc *transactionCounter) displayTxBlockBody(
miniBlock.SenderShardID,
miniBlock.ReceiverShardID)

if miniBlock.TxHashes == nil || len(miniBlock.TxHashes) == 0 {
if len(miniBlock.TxHashes) == 0 {
lines = append(lines, display.NewLineData(false, []string{
part, "", "<EMPTY>"}))
}
Expand Down
4 changes: 2 additions & 2 deletions process/block/displayMetaBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (hc *headersCounter) displayShardInfo(lines []*display.LineData, header *bl
"Header hash",
logger.DisplayByteSlice(shardData.HeaderHash)}))

if shardData.ShardMiniBlockHeaders == nil || len(shardData.ShardMiniBlockHeaders) == 0 {
if len(shardData.ShardMiniBlockHeaders) == 0 {
lines = append(lines, display.NewLineData(false, []string{
"", "ShardMiniBlockHeaders", "<EMPTY>"}))
}
Expand Down Expand Up @@ -197,7 +197,7 @@ func (hc *headersCounter) displayTxBlockBody(
miniBlock.SenderShardID,
miniBlock.ReceiverShardID)

if miniBlock.TxHashes == nil || len(miniBlock.TxHashes) == 0 {
if len(miniBlock.TxHashes) == 0 {
lines = append(lines, display.NewLineData(false, []string{
part, "", "<EMPTY>"}))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ func getArgumentsMeta(
WhiteListHandler: &testscommon.WhiteListHandlerStub{},
WhiteListerVerifiedTxs: &testscommon.WhiteListHandlerStub{},
AntifloodHandler: &mock.P2PAntifloodHandlerStub{},
ArgumentsParser: &mock.ArgumentParserMock{},
ArgumentsParser: &testscommon.ArgumentParserMock{},
PreferredPeersHolder: &p2pmocks.PeersHolderStub{},
RequestHandler: &testscommon.RequestHandlerStub{},
PeerSignatureHandler: &mock.PeerSignatureHandlerStub{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ func getArgumentsShard(
AntifloodHandler: &mock.P2PAntifloodHandlerStub{},
WhiteListHandler: &testscommon.WhiteListHandlerStub{},
WhiteListerVerifiedTxs: &testscommon.WhiteListHandlerStub{},
ArgumentsParser: &mock.ArgumentParserMock{},
ArgumentsParser: &testscommon.ArgumentParserMock{},
PreferredPeersHolder: &p2pmocks.PeersHolderStub{},
RequestHandler: &testscommon.RequestHandlerStub{},
PeerSignatureHandler: &mock.PeerSignatureHandlerStub{},
Expand Down
3 changes: 2 additions & 1 deletion process/smartContract/processorV2/testScProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package processorV2

import (
"encoding/hex"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -79,7 +80,7 @@ func (tsp *TestScProcessor) GetCompositeTestError() error {

func wrapErrorIfNotContains(originalError error, msg string) error {
if originalError == nil {
return fmt.Errorf(msg)
return errors.New(msg)
}

alreadyContainsMessage := strings.Contains(originalError.Error(), msg)
Expand Down
3 changes: 2 additions & 1 deletion process/smartContract/testScProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package smartContract

import (
"encoding/hex"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -83,7 +84,7 @@ func (tsp *TestScProcessor) GetCompositeTestError() error {

func wrapErrorIfNotContains(originalError error, msg string) error {
if originalError == nil {
return fmt.Errorf(msg)
return errors.New(msg)
}

alreadyContainsMessage := strings.Contains(originalError.Error(), msg)
Expand Down
4 changes: 2 additions & 2 deletions process/transaction/interceptedTransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func createInterceptedTxWithTxFeeHandlerAndVersionChecker(tx *dataTransaction.Tr
shardCoordinator,
txFeeHandler,
&testscommon.WhiteListHandlerStub{},
&mock.ArgumentParserMock{},
&testscommon.ArgumentParserMock{},
[]byte("T"),
false,
&hashingMocks.HasherMock{},
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestNewInterceptedTransaction_NilBufferShouldErr(t *testing.T) {
mock.NewOneShardCoordinatorMock(),
&economicsmocks.EconomicsHandlerStub{},
&testscommon.WhiteListHandlerStub{},
&mock.ArgumentParserMock{},
&testscommon.ArgumentParserMock{},
[]byte("chainID"),
false,
&hashingMocks.HasherMock{},
Expand Down
18 changes: 9 additions & 9 deletions process/transactionEvaluator/simulationAccountsDB_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,36 @@ func TestReadOnlyAccountsDB_WriteOperationsShouldNotCalled(t *testing.T) {
failErrMsg := "this function should have not be called"
accDb := &stateMock.AccountsStub{
SaveAccountCalled: func(account vmcommon.AccountHandler) error {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
return nil
},
RemoveAccountCalled: func(_ []byte) error {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
return nil
},
CommitCalled: func() ([]byte, error) {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
return nil, nil
},
RevertToSnapshotCalled: func(_ int) error {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
return nil
},
RecreateTrieCalled: func(_ common.RootHashHolder) error {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
return nil
},
PruneTrieCalled: func(_ []byte, _ state.TriePruningIdentifier, _ state.PruningHandler) {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
},
CancelPruneCalled: func(_ []byte, _ state.TriePruningIdentifier) {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
},
SnapshotStateCalled: func(_ []byte, _ uint32) {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
},
RecreateAllTriesCalled: func(_ []byte) (map[string]common.Trie, error) {
t.Errorf(failErrMsg)
t.Errorf("%s", failErrMsg)
return nil, nil
},
}
Expand Down

0 comments on commit b7f36bd

Please sign in to comment.