From b836ea7c2a6df603f5ee277bb2909259a4ff2aa1 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Thu, 20 Nov 2025 16:03:22 +0800 Subject: [PATCH] ethclient/gethclient: remove unused function GetProof #1448, fix XFN-115 --- ethclient/gethclient/gethclient.go | 53 ------------------------------ 1 file changed, 53 deletions(-) diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index 755705ab7f..fdd4afb303 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -58,17 +58,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"` @@ -76,48 +65,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"` - } - - 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, - } - return &result, err -} - // OverrideAccount specifies the state of an account to be overridden. type OverrideAccount struct { Nonce uint64 `json:"nonce"`