diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index e2c0ef3ed0..11e71989bd 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -125,6 +125,15 @@ func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []s return &result, err } +type RequiredBlockState struct { +} + +// GetRequiredBlockState returns all state required to execute a single historical block. +func (ec *Client) GetRequiredBlockState(ctx context.Context, blockNumber *big.Int) (*RequiredBlockState, error) { + result := RequiredBlockState{} + return &result, nil +} + // CallContract executes a message call transaction, which is directly executed in the VM // of the node, but never mined into the blockchain. // diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index cf1960fcf6..6a30fb60dc 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -933,6 +933,18 @@ func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc. return result, nil } +// GetRequiredBlockState returns all state required to execute a single historical block. +func (s *BlockChainAPI) GetRequiredBlockState(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error) { + block, err := s.b.BlockByNumberOrHash(ctx, blockNrOrHash) + if block == nil || err != nil { + // When the block doesn't exist, the RPC method should return JSON null + return nil, nil + } + + result := make([]map[string]interface{}, 1) + return result, nil +} + // OverrideAccount indicates the overriding fields of account during the execution // of a message call. // Note, state and stateDiff can't be specified at the same time. If state is diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 59882cd6bb..9caf0ecfc8 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -1619,6 +1619,10 @@ func TestRPCGetBlockReceipts(t *testing.T) { } } +func TestRPCGetRequiredBlockState(t *testing.T) { + // +} + func testRPCResponseWithFile(t *testing.T, testid int, result interface{}, rpc string, file string) { data, err := json.MarshalIndent(result, "", " ") if err != nil {