Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support the currently unsupported historical state queries #280

Closed
Yawning opened this issue May 25, 2022 · 1 comment
Closed

feat: Support the currently unsupported historical state queries #280

Yawning opened this issue May 25, 2022 · 1 comment

Comments

@Yawning
Copy link
Contributor

Yawning commented May 25, 2022

There are a number of historical state queries that are currently unsupported, due to requiring the ability to query an old version of oasis-node with historical state (ie: an archive node). While the naive approach (#268) would be something like "write a composite client that queries the correct node based on block height", this approach is non-workable due to backward/forward incompatible changes to the oasis-node gRPC protocol, and the extreme difficulty in getting multiple versions of the oasis-core code to co-exist in a single binary.

Web3 methods that DO require an archive node:

  • eth_getStorageAt
  • eth_getBalance
  • eth_getTransactionCount
  • eth_getCode
  • eth_call
  • eth_estimateGas (Could/should reject historical queries instead)

While it may seem like certain calls are mis-categorized as not requiring an archive note, this list is written under the assumption that the non-archive node has access to the SQL database containing historical state (so any node can service calls that do not require access to the paratime storage).

Instead of doing this the correct way (single web3 gateway instance that can query multiple oasis-node instances), which doesn't actually work, the wrong way will work like thus:

                             (via web3)
[ mainnet web3-gw ] ----------------------------> [ archive web3-gw ]    
     |                                                 |
     +--> [ mainnet oasis-node ]                       +--> [ archive oasis-node ]

This will re-dispatch the 6 calls that require historical state access via web3's JSON-RPC to an archival web3-gw instance (built against the appropriately ancient versions of oasis-sdk and oasis-core) that will service the requests. The downsides are:

  • This requires 1 extra instance of the web3-gw (wastes CPU cycles)
  • This requires 1 extra copy of the SQL db state (the mainnet web3-gw requires all of it, the archive web3-gw requries the historical portion). Add an option to disable the indexer #84 would mostly solve this.
@Yawning
Copy link
Contributor Author

Yawning commented Jun 3, 2022

Done in #281

@Yawning Yawning closed this as completed Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant