diff --git a/pkg/consensus/consensus_test.go b/pkg/consensus/consensus_test.go index 4dd826e94..acf219fe1 100644 --- a/pkg/consensus/consensus_test.go +++ b/pkg/consensus/consensus_test.go @@ -226,7 +226,7 @@ func newTestService(t *testing.T) *service { } func getTestValidator(i int) (*privateKey, *publicKey) { - key := testchain.PrivateKeyByID(i) + key := testchain.PrivateKey(i) return &privateKey{PrivateKey: key}, &publicKey{PublicKey: key.PublicKey()} } diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index 66430b673..12b0dc1c6 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -416,6 +416,7 @@ func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (ke count = len(result) } result = result[:count] + sort.Sort(result) n.validators.Store(result) return result, nil } diff --git a/pkg/core/native_neo_test.go b/pkg/core/native_neo_test.go index 250c9195f..3fe7591b9 100644 --- a/pkg/core/native_neo_test.go +++ b/pkg/core/native_neo_test.go @@ -2,6 +2,7 @@ package core import ( "math/big" + "sort" "testing" "github.com/nspcc-dev/neo-go/pkg/config/netmode" @@ -31,9 +32,11 @@ func TestNEO_Vote(t *testing.T) { ic := bc.newInteropContext(trigger.System, bc.dao, nil, tx) ic.VM = vm.New() + standBySorted := bc.GetStandByValidators() + sort.Sort(standBySorted) pubs, err := neo.GetValidatorsInternal(bc, ic.DAO) require.NoError(t, err) - require.Equal(t, bc.GetStandByValidators(), pubs) + require.Equal(t, standBySorted, pubs) sz := testchain.Size() @@ -65,7 +68,7 @@ func TestNEO_Vote(t *testing.T) { // We still haven't voted enough validators in. pubs, err = neo.GetValidatorsInternal(bc, ic.DAO) require.NoError(t, err) - require.Equal(t, bc.GetStandByValidators(), pubs) + require.Equal(t, standBySorted, pubs) // Register and give some value to the last validator. require.NoError(t, neo.RegisterCandidateInternal(ic, candidates[0])) @@ -77,7 +80,9 @@ func TestNEO_Vote(t *testing.T) { pubs, err = neo.GetValidatorsInternal(bc, ic.DAO) require.NoError(t, err) - require.Equal(t, candidates, pubs) + sortedCandidates := candidates.Copy() + sort.Sort(sortedCandidates) + require.EqualValues(t, sortedCandidates, pubs) require.NoError(t, neo.UnregisterCandidateInternal(ic, candidates[0])) require.Error(t, neo.VoteInternal(ic, h, candidates[0])) diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 18ea335fe..8c6c3cba6 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -52,8 +52,8 @@ type rpcTestCase struct { check func(t *testing.T, e *executor, result interface{}) } -const testContractHash = "36c3b0c85d98607db00b711885ec3e411d9b1672" -const deploymentTxHash = "60a1fc8ceb7948d9933aec0cedd148441568575c40af7e0985cc366ed153d57e" +const testContractHash = "5b5f77b947194ba45ff5fa1ba6e066af5636d110" +const deploymentTxHash = "af0f94f6bdc5aada7abf1db19f1fcd2ea56cea596c41dc4abdfa6cd9664a7d72" var rpcTestCases = map[string][]rpcTestCase{ "getapplicationlog": { @@ -1027,7 +1027,7 @@ func checkNep5Balances(t *testing.T, e *executor, acc interface{}) { }, { Asset: e.chain.UtilityTokenHash(), - Amount: "915.78962700", + Amount: "915.61054740", LastUpdated: 6, }}, Address: testchain.PrivateKeyByID(0).GetScriptHash().StringLE(), @@ -1145,16 +1145,6 @@ func checkNep5TransfersAux(t *testing.T, e *executor, acc interface{}, start, en } netFee += b.Transactions[j].NetworkFee } - if i > 0 { - expected.Received = append(expected.Received, result.NEP5Transfer{ - Timestamp: b.Timestamp, - Asset: e.chain.UtilityTokenHash(), - Address: "", // minted from network fees. - Amount: amountToString(big.NewInt(netFee), 8), - Index: b.Index, - TxHash: b.Hash(), - }) - } } require.Equal(t, expected.Address, res.Address) diff --git a/pkg/rpc/server/testdata/testblocks.acc b/pkg/rpc/server/testdata/testblocks.acc index e34c40cd3..430f85dcd 100644 Binary files a/pkg/rpc/server/testdata/testblocks.acc and b/pkg/rpc/server/testdata/testblocks.acc differ