forked from cerc-io/laconicd-deprecated
evm: update msgs to accept zero gas price (#299)
* update keeper to accept gas price=0; default pending to latest * cleanup * more cleanup * more cleanup * more cleanup * more cleanup * ante: copy IncrementSequenceDecorator from SDK's AnteHandler * improve bloom test * lint * update msg error Co-authored-by: Federico Kunze <federico.kunze94@gmail.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze
Federico Kunze
parent
51b68d7512
commit
1f63ddfe96
@@ -11,6 +11,7 @@ package tests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
@@ -107,6 +108,14 @@ func call(t *testing.T, method string, params interface{}) *Response {
|
||||
return rpcRes
|
||||
}
|
||||
|
||||
// turns a 0x prefixed hex string to a big.Int
|
||||
func hexToBigInt(t *testing.T, in string) *big.Int {
|
||||
s := in[2:]
|
||||
b, err := hex.DecodeString(s)
|
||||
require.NoError(t, err)
|
||||
return big.NewInt(0).SetBytes(b)
|
||||
}
|
||||
|
||||
func TestEth_protocolVersion(t *testing.T) {
|
||||
expectedRes := hexutil.Uint(version.ProtocolVersion)
|
||||
|
||||
@@ -590,3 +599,41 @@ func TestEth_PendingTransactionFilter(t *testing.T) {
|
||||
require.True(t, len(txs) >= 2, "could not get any txs", "changesRes.Result", string(changesRes.Result))
|
||||
|
||||
}
|
||||
|
||||
func TestBlockBloom(t *testing.T) {
|
||||
hash := deployTestContractWithFunction(t)
|
||||
receipt := waitForReceipt(t, hash)
|
||||
|
||||
number := receipt["blockNumber"].(string)
|
||||
t.Log(number)
|
||||
|
||||
param := []interface{}{number, false}
|
||||
rpcRes := call(t, "eth_getBlockByNumber", param)
|
||||
|
||||
block := make(map[string]interface{})
|
||||
err := json.Unmarshal(rpcRes.Result, &block)
|
||||
require.NoError(t, err)
|
||||
|
||||
lb := hexToBigInt(t, block["logsBloom"].(string))
|
||||
require.NotEqual(t, big.NewInt(0), lb)
|
||||
require.Equal(t, hash.String(), block["transactions"].([]interface{})[0])
|
||||
}
|
||||
|
||||
func TestBlockBloom_Hash(t *testing.T) {
|
||||
t.Skip()
|
||||
// TODO: get this to work
|
||||
hash := deployTestContractWithFunction(t)
|
||||
receipt := waitForReceipt(t, hash)
|
||||
|
||||
blockHash := receipt["blockHash"].(string)
|
||||
|
||||
param := []interface{}{blockHash, false}
|
||||
rpcRes := call(t, "eth_getBlockByHash", param)
|
||||
|
||||
block := make(map[string]interface{})
|
||||
err := json.Unmarshal(rpcRes.Result, &block)
|
||||
require.NoError(t, err)
|
||||
|
||||
lb := hexToBigInt(t, block["logsBloom"].(string))
|
||||
require.NotEqual(t, big.NewInt(0), lb)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user