Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Light client gas estimation does not work #8976

Closed
danuker opened this issue Jun 25, 2018 · 8 comments
Closed

Light client gas estimation does not work #8976

danuker opened this issue Jun 25, 2018 · 8 comments
Assignees
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Milestone

Comments

@danuker
Copy link

danuker commented Jun 25, 2018

I'm running:

  • Which Parity version?: 1.11.4-beta-cc44ae9cb-20180619/x86_64-linux-gnu/rustc1.26.1
  • Which operating system?: Linux Debian
  • How installed?: via binaries (Deb packages)
  • Are you fully synchronized?: yes (in light mode)
  • Which network are you connected to?: ethereum
  • Did you try to restart the node?: yes

I am running the light client (--light CLI option).

Steps to reproduce
When I try to get a gas estimation for a plain transaction, I get a weird "Unknown block number" error.

> curl --data '{"method":"eth_estimateGas","params":[{"from":"0x_my_address_here"}],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Unknown block number"},"id":1}

Actual behavior
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Unknown block number"},"id":1}

Expected behavior
I should either get a real gas estimate, or a useful error message.

@danuker
Copy link
Author

danuker commented Jun 25, 2018

Note: While waiting for a "real" sync, I can get a proper response to eth_estimateGas.

@Tbaut
Copy link
Contributor

Tbaut commented Jun 26, 2018

Thanks for reporting the issue.
Can you try with "latest":

curl --data '{"method":"eth_estimateGas","params":[{"from":"0x_my_address_here"}, "latest"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

(I could not reproduce on Kovan)

@Tbaut Tbaut added F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. M6-rpcapi 📣 RPC API. labels Jun 26, 2018
@Tbaut Tbaut added this to the 1.12 milestone Jun 26, 2018
@danuker
Copy link
Author

danuker commented Jun 28, 2018

I tried it. Same response:

> curl --data '{"method":"eth_estimateGas","params":[{"from":"0x_my_address_here"}, "latest"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8544
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Unknown block number"},"id":1}

Edit: had to start on different ports; my default node was using the default ones.

@niklasad1 niklasad1 self-assigned this Jun 28, 2018
@danuker
Copy link
Author

danuker commented Jul 2, 2018

Seems to work on Kovan for me as well.

@Tbaut
Copy link
Contributor

Tbaut commented Jul 3, 2018

I can reproduce a slightly different problem on mainnet, the call is simply not resolving. This is a known issue though: #8996

I could not reproduce your problem though.

@niklasad1
Copy link
Collaborator

@danuker @Tbaut

I can reproduce this on the main net what I have discovered is that the merkle proof fails because your account is not in the state db and then it will just return an empty account!

This gets then propagated via the network to the rpc helper which in turn pattern match on the account to get the nonce. Thus, if the nonce is missing it will be regarded as an invalid block number that's the reason why you see the following error message :

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Unknown block number"},"id":1}

@niklasad1
Copy link
Collaborator

niklasad1 commented Jul 3, 2018

@rphmeier
Is it safe to provide a default value for the nonce in this context, i.e. on either of the following places:

I'm not sure of what implications this would have on the other RPCs!

@niklasad1 niklasad1 added P7-nicetohave 🐕 Issue is worth doing eventually. and removed Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. labels Jul 3, 2018
@rphmeier
Copy link
Contributor

rphmeier commented Jul 3, 2018

The right place to change it would be in light_fetch, where we should use the default account nonce when we get the None variant of the returned Option<BasicAccount>.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Projects
None yet
Development

No branches or pull requests

5 participants