From 804d3f2f83767bc11afe6bced0d725b00df46953 Mon Sep 17 00:00:00 2001 From: Bogdan Rosianu Date: Tue, 26 Sep 2023 15:56:39 +0300 Subject: [PATCH] removed inconsistency check for repopulated tokens supply --- process/errors.go | 3 -- process/esdtSupplyProcessor.go | 8 ---- process/esdtSupplyProcessor_test.go | 57 ----------------------------- 3 files changed, 68 deletions(-) diff --git a/process/errors.go b/process/errors.go index 3fd82766..e5f1ddbc 100644 --- a/process/errors.go +++ b/process/errors.go @@ -109,6 +109,3 @@ var ErrEmptyAppVersionString = errors.New("empty app version string") // ErrEmptyCommitString signals than an empty commit id string has been provided var ErrEmptyCommitString = errors.New("empty commit id string") - -// ErrInconsistentTokensSuppliesResponses signals an inconsistent response from the nodes -var ErrInconsistentTokensSuppliesResponses = errors.New("inconsistent tokens supplies shard responses") diff --git a/process/esdtSupplyProcessor.go b/process/esdtSupplyProcessor.go index 957bfb6d..37998d80 100644 --- a/process/esdtSupplyProcessor.go +++ b/process/esdtSupplyProcessor.go @@ -103,14 +103,6 @@ func (esp *esdtSupplyProcessor) getSupplyFromShards(tokenIdentifier string) (*da } if numNodesWithRecomputedSupply > 0 { - if numNodesWithRecomputedSupply != numNodesQueried { - // this means that some nodes have recomputed supply and some don't - log.Error("inconsistent observers setup: some nodes have recomputed supply and some don't", - "numNodesWithRecomputedSupply", numNodesWithRecomputedSupply, - "numNodesQueried", numNodesQueried) - return nil, ErrInconsistentTokensSuppliesResponses - } - totalSupply.RecomputedSupply = true } diff --git a/process/esdtSupplyProcessor_test.go b/process/esdtSupplyProcessor_test.go index d73dda9b..a12e0c16 100644 --- a/process/esdtSupplyProcessor_test.go +++ b/process/esdtSupplyProcessor_test.go @@ -120,63 +120,6 @@ func TestEsdtSupplyProcessor_GetESDTSupplyNonFungible(t *testing.T) { require.Equal(t, "0", supplyRes.Data.InitialMinted) } -func TestEsdtSupplyProcessor_GetESDTSupplyShouldReturnErrorIfInconsistentResponses(t *testing.T) { - t.Parallel() - - called := false - baseProc := &mock.ProcessorStub{ - GetShardIDsCalled: func() []uint32 { - return []uint32{0, 1, core.MetachainShardId} - }, - GetObserversCalled: func(shardID uint32) ([]*data.NodeData, error) { - return []*data.NodeData{ - { - ShardId: shardID, - Address: fmt.Sprintf("shard-%d", shardID), - }, - { - ShardId: shardID, - Address: fmt.Sprintf("shard-%d", shardID), - }, - }, nil - }, - CallGetRestEndPointCalled: func(address string, path string, value interface{}) (int, error) { - switch address { - case "shard-0": - if !called { - called = true - return 400, errors.New("local err") - } - valResp := value.(*data.ESDTSupplyResponse) - valResp.Data.Supply = "300" - valResp.Data.RecomputedSupply = true - return 200, nil - case "shard-1": - valResp := value.(*data.ESDTSupplyResponse) - valResp.Data.Supply = "600" - valResp.Data.Minted = "50" - valResp.Data.Burned = "100" - valResp.Data.RecomputedSupply = false - return 200, nil - } - return 0, nil - }, - } - scQueryProc := &mock.SCQueryServiceStub{ - ExecuteQueryCalled: func(query *data.SCQuery) (*vm.VMOutputApi, data.BlockInfo, error) { - return &vm.VMOutputApi{ - ReturnData: [][]byte{nil, nil, nil, []byte("500")}, - }, data.BlockInfo{}, nil - }, - } - esdtProc, err := NewESDTSupplyProcessor(baseProc, scQueryProc) - require.Nil(t, err) - - supplyRes, err := esdtProc.GetESDTSupply("SEMI-ABCDEF") - require.Empty(t, supplyRes) - require.Equal(t, ErrInconsistentTokensSuppliesResponses, err) -} - func TestEsdtSupplyProcessor_GetESDTSupplyShouldReturnRecomputed(t *testing.T) { t.Parallel()