diff --git a/app/rpc/namespaces/eth/simulation/evm_test.go b/app/rpc/namespaces/eth/simulation/evm_test.go deleted file mode 100644 index 01ca1aa8c3..0000000000 --- a/app/rpc/namespaces/eth/simulation/evm_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package simulation - -import ( - "testing" - - sdk "github.com/okex/exchain/libs/cosmos-sdk/types" - "github.com/okex/exchain/x/evm/types" -) - -func TestEvmFactory(t *testing.T) { - ef := EvmFactory{ChainId: "ok-1"} - - sr := ef.BuildSimulator() - if sr != nil { - sr.DoCall(types.MsgEthermint{ - AccountNonce: 0, - Price: sdk.NewInt(100000), - GasLimit: 30000000, - Recipient: nil, - Amount: sdk.NewInt(100), - Payload: nil, - From: nil, - }) - } -} diff --git a/libs/tendermint/rpc/client/rpc_test.go b/libs/tendermint/rpc/client/rpc_test.go index 8fff3c36b2..b27d35d0b8 100644 --- a/libs/tendermint/rpc/client/rpc_test.go +++ b/libs/tendermint/rpc/client/rpc_test.go @@ -384,7 +384,7 @@ func TestTx(t *testing.T) { txHeight := bres.Height txHash := bres.Hash - anotherTxHash := types.Tx("a different tx").Hash() + anotherTxHash := types.Tx("a different tx").Hash(txHeight) cases := []struct { valid bool @@ -458,7 +458,7 @@ func TestTxSearch(t *testing.T) { // pick out the last tx to have something to search for in tests find := result.Txs[len(result.Txs)-1] - anotherTxHash := types.Tx("a different tx").Hash() + anotherTxHash := types.Tx("a different tx").Hash(0) for i, c := range GetClients() { t.Logf("client %d", i) diff --git a/libs/tendermint/state/txindex/indexer_service_test.go b/libs/tendermint/state/txindex/indexer_service_test.go index c880c7d624..3f1ae9907d 100644 --- a/libs/tendermint/state/txindex/indexer_service_test.go +++ b/libs/tendermint/state/txindex/indexer_service_test.go @@ -57,10 +57,10 @@ func TestIndexerServiceIndexesBlocks(t *testing.T) { time.Sleep(100 * time.Millisecond) // check the result - res, err := txIndexer.Get(types.Tx("foo").Hash()) + res, err := txIndexer.Get(types.Tx("foo").Hash(txResult1.Height)) assert.NoError(t, err) assert.Equal(t, txResult1, res) - res, err = txIndexer.Get(types.Tx("bar").Hash()) + res, err = txIndexer.Get(types.Tx("bar").Hash(txResult2.Height)) assert.NoError(t, err) assert.Equal(t, txResult2, res) } diff --git a/libs/tendermint/state/txindex/kv/kv_test.go b/libs/tendermint/state/txindex/kv/kv_test.go index 3da58b6f9c..0cceb45e91 100644 --- a/libs/tendermint/state/txindex/kv/kv_test.go +++ b/libs/tendermint/state/txindex/kv/kv_test.go @@ -33,7 +33,7 @@ func TestTxIndex(t *testing.T) { Code: abci.CodeTypeOK, Log: "", Events: nil, }, } - hash := tx.Hash() + hash := tx.Hash(txResult.Height) batch := txindex.NewBatch(1) if err := batch.Add(txResult); err != nil { @@ -56,7 +56,7 @@ func TestTxIndex(t *testing.T) { Code: abci.CodeTypeOK, Log: "", Events: nil, }, } - hash2 := tx2.Hash() + hash2 := tx2.Hash(txResult2.Height) err = indexer.Index(txResult2) require.NoError(t, err) @@ -75,7 +75,7 @@ func TestTxSearch(t *testing.T) { {Type: "account", Attributes: []kv.Pair{{Key: []byte("owner"), Value: []byte("Ivan")}}}, {Type: "", Attributes: []kv.Pair{{Key: []byte("not_allowed"), Value: []byte("Vlad")}}}, }) - hash := txResult.Tx.Hash() + hash := txResult.Tx.Hash(txResult.Height) err := indexer.Index(txResult) require.NoError(t, err) @@ -162,7 +162,7 @@ func TestTxSearchDeprecatedIndexing(t *testing.T) { txResult1 := txResultWithEvents([]abci.Event{ {Type: "account", Attributes: []kv.Pair{{Key: []byte("number"), Value: []byte("1")}}}, }) - hash1 := txResult1.Tx.Hash() + hash1 := txResult1.Tx.Hash(txResult1.Height) err := indexer.Index(txResult1) require.NoError(t, err) @@ -171,7 +171,7 @@ func TestTxSearchDeprecatedIndexing(t *testing.T) { txResult2 := txResultWithEvents(nil) txResult2.Tx = types.Tx("HELLO WORLD 2") - hash2 := txResult2.Tx.Hash() + hash2 := txResult2.Tx.Hash(txResult2.Height) b := indexer.store.NewBatch() rawBytes, err := cdc.MarshalBinaryBare(txResult2) diff --git a/libs/tendermint/types/event_bus_test.go b/libs/tendermint/types/event_bus_test.go index 49570ae07a..d8947d9992 100644 --- a/libs/tendermint/types/event_bus_test.go +++ b/libs/tendermint/types/event_bus_test.go @@ -32,7 +32,7 @@ func TestEventBusPublishEventTx(t *testing.T) { } // PublishEventTx adds 3 composite keys, so the query below should work - query := fmt.Sprintf("tm.event='Tx' AND tx.height=1 AND tx.hash='%X' AND testType.baz=1", tx.Hash()) + query := fmt.Sprintf("tm.event='Tx' AND tx.height=1 AND tx.hash='%X' AND testType.baz=1", tx.Hash(0)) txsSub, err := eventBus.Subscribe(context.Background(), "test", tmquery.MustParse(query)) require.NoError(t, err) diff --git a/libs/tendermint/types/events_test.go b/libs/tendermint/types/events_test.go index a4b71d9223..cde3348cfa 100644 --- a/libs/tendermint/types/events_test.go +++ b/libs/tendermint/types/events_test.go @@ -9,9 +9,10 @@ import ( func TestQueryTxFor(t *testing.T) { tx := Tx("foo") + height := int64(0) assert.Equal(t, - fmt.Sprintf("tm.event='Tx' AND tx.hash='%X'", tx.Hash()), - EventQueryTxFor(tx).String(), + fmt.Sprintf("tm.event='Tx' AND tx.hash='%X'", tx.Hash(height)), + EventQueryTxFor(tx, height).String(), ) }