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

[light client] RPC eth_estimateGas don't behave as in full client #9535

Closed
niklasad1 opened this issue Sep 12, 2018 · 0 comments · Fixed by #9591
Closed

[light client] RPC eth_estimateGas don't behave as in full client #9535

niklasad1 opened this issue Sep 12, 2018 · 0 comments · Fixed by #9591
Labels
M4-core ⛓ Core client code / Rust. P5-sometimesoon 🌲 Issue is worth doing soon.
Milestone

Comments

@niklasad1
Copy link
Collaborator

niklasad1 commented Sep 12, 2018

What is the problem

In the context of a light-client, for example, we want to use the eth_estimateGas RPC for an unknown account and this doesn't work currently because the ExecutionProof always falls and this don't happen in full client implementation.

2018-09-12 10:54:02   TRACE rpc  Request: {"method":"eth_estimateGas","params":[{"from":"acc", "gas":"0xffff", "gasPrice":"0xffff", "nonce":"0x0"}, "latest"],"id":1,"jsonrpc":"2.0"}.           
2018-09-12 10:54:02   DEBUG on_demand  Execution request, Incomplete { block_hash: Scalar(0x97db89353cc3abb9d51a6690338cb66a2f10dd58f350394e9f1f980201320b2c), from: acc, action: Create, gas: 65535, gas_price: 65535, value: 0, data: [] }
execute_tx finished wait on the future
2018-09-12 10:54:04  IO Worker #1 DEBUG on_demand  #1 requests have not been dispatched
2018-09-12 10:54:04  IO Worker #1 DEBUG on_demand  ReqID: Request #11
2018-09-12 10:54:04  IO Worker #1 DEBUG on_demand  Request Batch { outputs: {}, requests: [Execution(Incomplete { block_hash: Scalar(0x97db89353cc3abb9d51a6690338cb66a2f10dd58f350394e9f1f980201320b2c), from: x, action: Create, gas: 65535, gas_price: 65535, value: 0, data: [] })], answered: 0 }
2018-09-12 10:54:07  IO Worker #2 DEBUG on_demand  Execution request completed Incomplete { block_hash: Scalar(0x97db89353cc3abb9d51a6690338cb66a2f10dd58f350394e9f1f980201320b2c), from: account, action: Create, gas: 65535, gas_price: 65535, value: 0, data: [] }
2018-09-12 10:54:07  IO Worker #2 DEBUG on_demand  BadExecution Proof
2018-09-12 10:54:07  IO Worker #2 DEBUG on_demand  Peer 43 gave bad response: Validity(BadProof)
2018-09-12 10:54:07  IO Worker #2 DEBUG on_demand  BadExecution Proof
2018-09-12 10:54:07  IO Worker #2 DEBUG on_demand  Peer 36 gave bad response: Validity(BadProof)
...
and so on!

1 The request batch log is not part of parity, I manually added it which prints out the number of requests and indiviudal request which have not been anwered yet!

Educated Guess

I'm not exactly sure the reason why but I think it is because the actual execution in full client seems to boost the actual account balance to execute the transaction successfully (transact_virtual will provide enough funds), https://github.com/paritytech/parity-ethereum/blob/master/ethcore/src/client/client.rs#L1473-#L1545.

In the light client validation (executed by one or more full nodes) we use are using the actual account balance for validation and should be changed to do same as the full client (boost the account balance)!

However, in context as a validator, I'm not sure how to distinguish between different executions and it might be better to leave it as it is!

Related files:

@niklasad1 niklasad1 added P5-sometimesoon 🌲 Issue is worth doing soon. Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. M4-core ⛓ Core client code / Rust. labels Sep 12, 2018
@5chdn 5chdn added this to the 2.2 milestone Sep 27, 2018
@ordian ordian removed the Z0-unconfirmed 🤔 Issue might be valid, but it’s not yet known. label Sep 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
M4-core ⛓ Core client code / Rust. P5-sometimesoon 🌲 Issue is worth doing soon.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants