fix getProof API when zktrie is enabled (#132)

fix getProof under zktrie
This commit is contained in:
Ho 2022-07-27 13:01:38 +08:00 committed by GitHub
parent eb11a84c56
commit fefa8b99c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -657,8 +657,13 @@ func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Addre
return nil, err return nil, err
} }
zktrie := s.b.ChainConfig().Zktrie
storageTrie := state.StorageTrie(address) storageTrie := state.StorageTrie(address)
storageHash := types.EmptyRootHash var storageHash common.Hash
if !zktrie {
storageHash = types.EmptyRootHash
}
codeHash := state.GetCodeHash(address) codeHash := state.GetCodeHash(address)
storageProof := make([]StorageResult, len(storageKeys)) storageProof := make([]StorageResult, len(storageKeys))

View file

@ -18,6 +18,7 @@ package les
import ( import (
"crypto/ecdsa" "crypto/ecdsa"
"errors"
"time" "time"
"github.com/scroll-tech/go-ethereum/common/mclock" "github.com/scroll-tech/go-ethereum/common/mclock"
@ -81,6 +82,11 @@ func NewLesServer(node *node.Node, e ethBackend, config *ethconfig.Config) (*Les
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Now disable for zktrie
if e.BlockChain().Config().Zktrie {
return nil, errors.New("light server not work with zktrie storage")
}
// Calculate the number of threads used to service the light client // Calculate the number of threads used to service the light client
// requests based on the user-specified value. // requests based on the user-specified value.
threads := config.LightServ * 4 / 100 threads := config.LightServ * 4 / 100