forked from cerc-io/laconicd-deprecated
rpc, evm: use binary search to estimate gas (#272)
* do binary search to estimate gas Closes #268 - Also refactor ApplyMessage to be more reuseable move binary search to rpc api side to have a clean context each try remove EstimateGas grpc api * extract BinSearch function and add unit test * do estimateGas in grpc query Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
parent
072f0534db
commit
14b38af8bc
@@ -803,9 +803,10 @@ func TestEth_EstimateGas(t *testing.T) {
|
||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
||||
param[0]["to"] = "0x1122334455667788990011223344556677889900"
|
||||
param[0]["value"] = "0x1"
|
||||
param[0]["gas"] = "0x5209"
|
||||
rpcRes := call(t, "eth_estimateGas", param)
|
||||
require.NotNil(t, rpcRes)
|
||||
require.NotEmpty(t, rpcRes.Result)
|
||||
require.Equal(t, rpcRes.Result, "0x5208")
|
||||
|
||||
var gas string
|
||||
err := json.Unmarshal(rpcRes.Result, &gas)
|
||||
|
||||
Reference in New Issue
Block a user