From 81f84b79ce12eab8ae6b2755086b1375645e051d Mon Sep 17 00:00:00 2001 From: wit765 <765765346@qq.com> Date: Mon, 8 Sep 2025 14:39:41 +0800 Subject: [PATCH] ethclient/gethclient: remove unused function GetProof (#1448) Co-authored-by: Wit Liu --- ethclient/gethclient/gethclient.go | 58 ------------------------------ 1 file changed, 58 deletions(-) diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index 917f7fa15d..ac2255bd3d 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -61,17 +61,6 @@ func (ec *Client) CreateAccessList(ctx context.Context, msg ethereum.CallMsg) (* return result.Accesslist, uint64(result.GasUsed), result.Error, nil } -// AccountResult is the result of a GetProof operation. -type AccountResult struct { - Address common.Address `json:"address"` - AccountProof []string `json:"accountProof"` - Balance *big.Int `json:"balance"` - CodeHash common.Hash `json:"codeHash"` - Nonce uint64 `json:"nonce"` - StorageHash common.Hash `json:"storageHash"` - StorageProof []StorageResult `json:"storageProof"` -} - // StorageResult provides a proof for a key-value pair. type StorageResult struct { Key string `json:"key"` @@ -79,53 +68,6 @@ type StorageResult struct { Proof []string `json:"proof"` } -// GetProof returns the account and storage values of the specified account including the Merkle-proof. -// The block number can be nil, in which case the value is taken from the latest known block. -func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []string, blockNumber *big.Int) (*AccountResult, error) { - type storageResult struct { - Key string `json:"key"` - Value *hexutil.Big `json:"value"` - Proof []string `json:"proof"` - } - - type accountResult struct { - Address common.Address `json:"address"` - AccountProof []string `json:"accountProof"` - Balance *hexutil.Big `json:"balance"` - CodeHash common.Hash `json:"codeHash"` - Nonce hexutil.Uint64 `json:"nonce"` - StorageHash common.Hash `json:"storageHash"` - StorageProof []storageResult `json:"storageProof"` - } - - // Avoid keys being 'null'. - if keys == nil { - keys = []string{} - } - - var res accountResult - err := ec.c.CallContext(ctx, &res, "eth_getProof", account, keys, toBlockNumArg(blockNumber)) - // Turn hexutils back to normal datatypes - storageResults := make([]StorageResult, 0, len(res.StorageProof)) - for _, st := range res.StorageProof { - storageResults = append(storageResults, StorageResult{ - Key: st.Key, - Value: st.Value.ToInt(), - Proof: st.Proof, - }) - } - result := AccountResult{ - Address: res.Address, - AccountProof: res.AccountProof, - Balance: res.Balance.ToInt(), - Nonce: uint64(res.Nonce), - CodeHash: res.CodeHash, - StorageHash: res.StorageHash, - StorageProof: storageResults, - } - return &result, err -} - // CallContract executes a message call transaction, which is directly executed in the VM // of the node, but never mined into the blockchain. //