EIP-1186 eth_getProof (#17737)

* first impl of eth_getProof

* fixed docu

* added comments and refactored based on comments from holiman

* created structs

* handle errors correctly

* change Value to *hexutil.Big in order to have the same output as parity

* use ProofList as return type
This commit is contained in:
Simon Jentzsch
2018-10-18 21:41:22 +02:00
committed by Martin Holst Swende
parent cdf5982cfc
commit 97fb08342d
4 changed files with 105 additions and 0 deletions

View File

@ -35,6 +35,8 @@ type StateDB interface {
SetNonce(common.Address, uint64)
GetCodeHash(common.Address) common.Hash
GetProof(common.Address) (ProofList, error)
GetStorageProof(common.Address, common.Hash) (ProofList, error)
GetCode(common.Address) []byte
SetCode(common.Address, []byte)
GetCodeSize(common.Address) int
@ -78,3 +80,11 @@ type CallContext interface {
// Create a new contract
Create(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, common.Address, error)
}
// MerkleProof
type ProofList [][]byte
func (n *ProofList) Put(key []byte, value []byte) error {
*n = append(*n, value)
return nil
}