Closed stoqnkpL closed 7 months ago
Just flagging that implementing this would be incredibly helpful :)
@kantorcodes thanks. Could you assist by giving a bit more information on where it's useful to you. A few questions
Thanks
All sub tasks completed and v0.97 should have full historical support.
Definition
We need to add support of historical blocks related to the work defined in HIP-584, so that we enrich user experience. Additionally we would want to support historical state in the context of system precompiles.
Abstract
This work package would enhance the user experience by extending
eth_call
to work with different block values in the context of system precompiles.Motivation
Ongoing support of
eth_call
executions require full support of all possible block values for all type of read calls, including system precompiles.Rationale
As defined in HIP-415, in Hedera the block number is the consecutive number of a record file that was streamed from the consensus nodes.
The JSON-RPC endpoint
eth_call
accepts a block number as an input argument. This block number specifies that the execution ofeth_call
has to be based on the state that is produced after the execution of all transactions into the specified block. In this way, the state would reliably reflect the changes included in the given block.The block number can be specified in a hexadecimal format or with string values -
“latest”
or“earliest”
. The other strings defined in Ethereum won’t be supported, since they don’t have an alternative in Hedera. These are -“pending”
,“safe”
and“finalized”
. In order to be possible to query historical blocks, we should meet some requirements:With the current package, we would enhance this support also for system precompiles.
User stories
eth_call
Ethereum JSON-RPC queries using historical blocks, calling a view function of a smart contract that in turn make calls to Hedera read only system contracts. This will allow me to see what a particular smart contract state was in the past which I can use to develop block explorers, analytical tools, etc.Specification
normal
and ahistorical
table, that we would to query viaUNION_ALL
statement,sort
by timestamp andlimit
to 1. In this way we would find the correct historical information. For thetoken allowances
historical value - currently only the granted allowance is kept in thetoken_allowance_history
table. More details are provided in the links below.HTSPrecompiledContract
,ExchangeRatePrecompiledContract
,PrngSystemPrecompiledContract
. For the scope ofHTSPrecompiledContract
we need to support only read-related precompile calls.Backwards compatibility
We extend the functionality of the existing code base in
hedera-mirror-web3
, so no implications here.Security Implications
This work package shares the same security consideration like
HIP-584
itself. We may receive a bunch of requests that put high load on the network, but we have a global rate limit mechanism over theweb3
module, so we don’t have security implications specific for this work package.References/Dependencies
eth_call
-design doc- [shared]