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

eth_call to pending state of fully synced full history Parity node returns error #10096

Closed
vbaranov opened this issue Dec 21, 2018 · 2 comments · Fixed by #11127
Closed

eth_call to pending state of fully synced full history Parity node returns error #10096

vbaranov opened this issue Dec 21, 2018 · 2 comments · Fixed by #11127
Labels
F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API.
Milestone

Comments

@vbaranov
Copy link
Contributor

  • Parity Ethereum version: 2.2.1-beta
  • Operating system: MacOS
  • Installation: one-line installer
  • Fully synchronized: yes
  • Network: POA core
  • Restarted: yes

Description of the Issue

eth_call to pending state with fully synced Parity full history node returns This request is not supported because your node is running with state pruning. Run with --pruning=archive.

MacBook-Pro-Viktor:~ viktor$ curl -X POST -H 'Content-Type: application/json'  --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to": "0x4316f704989157162de90997ce1a05cff3118680", "data": "0x8da5cb5b"}, "pending"],"id":676681188149}' http://localhost:8545
{"jsonrpc":"2.0","error":{"code":-32000,"message":"This request is not supported because your node is running with state pruning. Run with --pruning=archive."},"id":676681188149}

screen shot 2018-12-21 at 13 16 03

Parameters of archive node:

2018-12-21 13:48:10  Starting Parity-Ethereum/v2.2.1-beta-5c56fc5-20181114/x86_64-macos/rustc1.30.1
2018-12-21 13:48:10  Keys path ./parity_data/keys/Core
2018-12-21 13:48:10  DB path ./parity_data/chains/Core/db/39bb23edadd3d2d8
2018-12-21 13:48:10  State DB configuration: archive +Fat +Trace
2018-12-21 13:48:10  Operating mode: active
2018-12-21 13:48:10  Warning: Warp Sync is disabled because Fat DB is turned on.
2018-12-21 13:48:10  Configured for Core using AuthorityRound engine
[parity]
chain = "./spec.json"
base_path = "./parity_data"

[network]
reserved_peers="./bootnodes.txt"
port = 30303

[rpc]
apis = ["web3","eth","net", "parity",  "traces" ]
port = 8545
interface = "0.0.0.0"
cors=["all"]

[websockets]
port = 8546
interface = "0.0.0.0"
max_connections = 1000
apis = ["web3","eth","net","parity", "pubsub", "traces"]

[footprint]
tracing = "on"
pruning = "archive"
fat_db = "on"
#scale_verifiers = true

What is wrong with the configuration to get a response from pending state?

@jam10o-new jam10o-new added F2-bug 🐞 The client fails to follow expected behavior. M4-core ⛓ Core client code / Rust. labels Dec 21, 2018
@jam10o-new jam10o-new added this to the 2.3 milestone Dec 21, 2018
@tomusdrw
Copy link
Collaborator

@vbaranov try with --force-sealing. By default pending state is not available (unless running with --force-sealing or mining), the error message here is very misleading though and definitely should be improved.

@tomusdrw tomusdrw added M6-rpcapi 📣 RPC API. and removed M4-core ⛓ Core client code / Rust. labels Dec 21, 2018
@vbaranov
Copy link
Contributor Author

@tomusdrw, I restarted archive node with --force-sealing flag from 0 block. The error for pending state is still there.

@5chdn 5chdn modified the milestones: 2.3, 2.4 Jan 10, 2019
@5chdn 5chdn modified the milestones: 2.4, 2.5 Feb 21, 2019
@soc1c soc1c modified the milestones: 2.5, 2.6 Apr 2, 2019
@ordian ordian modified the milestones: 2.6, 2.7 Jul 12, 2019
dvdplm added a commit that referenced this issue Oct 4, 2019
Before this PR we would return a rather confusing error when calling `eth_call` and `eth_estimateGas` with `"Pending"`, e.g.:

```
{"jsonrpc":"2.0","error":{"code":-32000,"message":"This request is not supported because your node is running with state pruning. Run with --pruning=archive."},"id":"e237678f6648ed12ff05a74933d06d17"}
```

In reality what is going on is that users often use `"Pending"` when they really mean `"Latest"` (e.g. MyCrypto…) and when the block in question is not actually pending. This changes our behaviour for these two RPC calls to fall back to `"Latest"` when the query with `"Pending"` fails.
Note that we already behave this way for many other RPCs:

	- eth_call (after this PR)
	- eth_estimateGas (after this PR)
	- eth_getBalance
	- eth_getCode
	- eth_getStorageAt

Closes #10096
dvdplm added a commit that referenced this issue Oct 11, 2019
* Change how RPCs eth_call and eth_estimateGas handle "Pending"

Before this PR we would return a rather confusing error when calling `eth_call` and `eth_estimateGas` with `"Pending"`, e.g.:

```
{"jsonrpc":"2.0","error":{"code":-32000,"message":"This request is not supported because your node is running with state pruning. Run with --pruning=archive."},"id":"e237678f6648ed12ff05a74933d06d17"}
```

In reality what is going on is that users often use `"Pending"` when they really mean `"Latest"` (e.g. MyCrypto…) and when the block in question is not actually pending. This changes our behaviour for these two RPC calls to fall back to `"Latest"` when the query with `"Pending"` fails.
Note that we already behave this way for many other RPCs:

	- eth_call (after this PR)
	- eth_estimateGas (after this PR)
	- eth_getBalance
	- eth_getCode
	- eth_getStorageAt

Closes #10096

* Fetch jsonrpc from git

* No real need to wait for new jsonrpc

* Add tests for calling eth_call/eth_estimateGas with "Pending"

* Fix a todo, add another

* Change client.latest_state to return the best header as well so we avoid potential data races and do less work

* Impl review suggestions

* Update rpc/src/v1/impls/eth.rs

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Review grumbles

* update docs
dvdplm added a commit that referenced this issue Nov 6, 2019
* Change how RPCs eth_call and eth_estimateGas handle "Pending"

Before this PR we would return a rather confusing error when calling `eth_call` and `eth_estimateGas` with `"Pending"`, e.g.:

```
{"jsonrpc":"2.0","error":{"code":-32000,"message":"This request is not supported because your node is running with state pruning. Run with --pruning=archive."},"id":"e237678f6648ed12ff05a74933d06d17"}
```

In reality what is going on is that users often use `"Pending"` when they really mean `"Latest"` (e.g. MyCrypto…) and when the block in question is not actually pending. This changes our behaviour for these two RPC calls to fall back to `"Latest"` when the query with `"Pending"` fails.
Note that we already behave this way for many other RPCs:

	- eth_call (after this PR)
	- eth_estimateGas (after this PR)
	- eth_getBalance
	- eth_getCode
	- eth_getStorageAt

Closes #10096

* Fetch jsonrpc from git

* No real need to wait for new jsonrpc

* Add tests for calling eth_call/eth_estimateGas with "Pending"

* Fix a todo, add another

* Change client.latest_state to return the best header as well so we avoid potential data races and do less work

* Impl review suggestions

* Update rpc/src/v1/impls/eth.rs

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Review grumbles

* update docs
niklasad1 pushed a commit that referenced this issue Nov 7, 2019
* Change how RPCs eth_call and eth_estimateGas handle "Pending"

Before this PR we would return a rather confusing error when calling `eth_call` and `eth_estimateGas` with `"Pending"`, e.g.:

```
{"jsonrpc":"2.0","error":{"code":-32000,"message":"This request is not supported because your node is running with state pruning. Run with --pruning=archive."},"id":"e237678f6648ed12ff05a74933d06d17"}
```

In reality what is going on is that users often use `"Pending"` when they really mean `"Latest"` (e.g. MyCrypto…) and when the block in question is not actually pending. This changes our behaviour for these two RPC calls to fall back to `"Latest"` when the query with `"Pending"` fails.
Note that we already behave this way for many other RPCs:

	- eth_call (after this PR)
	- eth_estimateGas (after this PR)
	- eth_getBalance
	- eth_getCode
	- eth_getStorageAt

Closes #10096

* Fetch jsonrpc from git

* No real need to wait for new jsonrpc

* Add tests for calling eth_call/eth_estimateGas with "Pending"

* Fix a todo, add another

* Change client.latest_state to return the best header as well so we avoid potential data races and do less work

* Impl review suggestions

* Update rpc/src/v1/impls/eth.rs

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Review grumbles

* update docs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@tomusdrw @ordian @vbaranov @5chdn @jam10o-new @soc1c and others