fix rpc hex unmarshaling (#529)

This commit is contained in:
noot 2020-09-23 11:36:07 -04:00 committed by GitHub
parent a54c2dc726
commit c1df065d3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,7 +226,7 @@ func TestEth_GetLogs_Topics_AB(t *testing.T) {
func TestEth_GetTransactionCount(t *testing.T) { func TestEth_GetTransactionCount(t *testing.T) {
// TODO: this test passes on when run on its own, but fails when run with the other tests // TODO: this test passes on when run on its own, but fails when run with the other tests
if testing.Short() { if testing.Short() {
t.Skip("skipping TestEth_GetLogs_Topics_AB") t.Skip("skipping TestEth_GetTransactionCount")
} }
prev := getNonce(t) prev := getNonce(t)
@ -238,7 +238,7 @@ func TestEth_GetTransactionCount(t *testing.T) {
func TestEth_GetTransactionLogs(t *testing.T) { func TestEth_GetTransactionLogs(t *testing.T) {
// TODO: this test passes on when run on its own, but fails when run with the other tests // TODO: this test passes on when run on its own, but fails when run with the other tests
if testing.Short() { if testing.Short() {
t.Skip("skipping TestEth_GetLogs_Topics_AB") t.Skip("skipping TestEth_GetTransactionLogs")
} }
hash, _ := deployTestContract(t) hash, _ := deployTestContract(t)
@ -569,7 +569,7 @@ func TestEth_GetFilterChanges_NoTopics(t *testing.T) {
// instantiate new filter // instantiate new filter
rpcRes = call(t, "eth_newFilter", param) rpcRes = call(t, "eth_newFilter", param)
require.Nil(t, rpcRes.Error) require.Nil(t, rpcRes.Error)
var ID hexutil.Bytes var ID string
err = json.Unmarshal(rpcRes.Result, &ID) err = json.Unmarshal(rpcRes.Result, &ID)
require.NoError(t, err) require.NoError(t, err)
@ -577,7 +577,7 @@ func TestEth_GetFilterChanges_NoTopics(t *testing.T) {
deployTestContract(t) deployTestContract(t)
// get filter changes // get filter changes
changesRes := call(t, "eth_getFilterChanges", []string{ID.String()}) changesRes := call(t, "eth_getFilterChanges", []string{ID})
var logs []*ethtypes.Log var logs []*ethtypes.Log
err = json.Unmarshal(changesRes.Result, &logs) err = json.Unmarshal(changesRes.Result, &logs)
@ -688,14 +688,14 @@ func TestEth_GetFilterChanges_Topics_XB(t *testing.T) {
// instantiate new filter // instantiate new filter
rpcRes = call(t, "eth_newFilter", param) rpcRes = call(t, "eth_newFilter", param)
var ID hexutil.Bytes var ID string
err = json.Unmarshal(rpcRes.Result, &ID) err = json.Unmarshal(rpcRes.Result, &ID)
require.NoError(t, err) require.NoError(t, err)
deployTestContractWithFunction(t) deployTestContractWithFunction(t)
// get filter changes // get filter changes
changesRes := call(t, "eth_getFilterChanges", []string{ID.String()}) changesRes := call(t, "eth_getFilterChanges", []string{ID})
var logs []*ethtypes.Log var logs []*ethtypes.Log
err = json.Unmarshal(changesRes.Result, &logs) err = json.Unmarshal(changesRes.Result, &logs)
@ -712,10 +712,9 @@ func TestEth_GetFilterChanges_Topics_XXC(t *testing.T) {
func TestEth_PendingTransactionFilter(t *testing.T) { func TestEth_PendingTransactionFilter(t *testing.T) {
rpcRes := call(t, "eth_newPendingTransactionFilter", []string{}) rpcRes := call(t, "eth_newPendingTransactionFilter", []string{})
var code hexutil.Bytes var ID string
err := code.UnmarshalJSON(rpcRes.Result) err := json.Unmarshal(rpcRes.Result, &ID)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, code)
for i := 0; i < 5; i++ { for i := 0; i < 5; i++ {
deployTestContractWithFunction(t) deployTestContractWithFunction(t)
@ -724,7 +723,7 @@ func TestEth_PendingTransactionFilter(t *testing.T) {
time.Sleep(10 * time.Second) time.Sleep(10 * time.Second)
// get filter changes // get filter changes
changesRes := call(t, "eth_getFilterChanges", []string{code.String()}) changesRes := call(t, "eth_getFilterChanges", []string{ID})
require.NotNil(t, changesRes) require.NotNil(t, changesRes)
var txs []*hexutil.Bytes var txs []*hexutil.Bytes