Skip to content

Commit 57c00ba

Browse files
author
colinlyguo
committed
return PoseidonCodeHash for zktrie
1 parent e80917d commit 57c00ba

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

internal/ethapi/api.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ type StorageResult struct {
679679

680680
// GetProof returns the Merkle-proof for a given account and optionally some storage keys.
681681
func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) {
682-
state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
682+
state, header, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
683683
if state == nil || err != nil {
684684
return nil, err
685685
}
@@ -721,7 +721,7 @@ func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Addre
721721
return nil, proofErr
722722
}
723723

724-
return &AccountResult{
724+
result := &AccountResult{
725725
Address: address,
726726
AccountProof: toHexSlice(accountProof),
727727
Balance: (*hexutil.Big)(state.GetBalance(address)),
@@ -730,7 +730,17 @@ func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Addre
730730
Nonce: hexutil.Uint64(state.GetNonce(address)),
731731
StorageHash: storageHash,
732732
StorageProof: storageProof,
733-
}, state.Error()
733+
}
734+
735+
if !s.b.ChainConfig().IsEuclid(header.Time) {
736+
if storageTrie != nil {
737+
result.PoseidonCodeHash = state.GetPoseidonCodeHash(address)
738+
} else {
739+
result.PoseidonCodeHash = codehash.EmptyPoseidonCodeHash
740+
}
741+
}
742+
743+
return result, state.Error()
734744
}
735745

736746
// GetHeaderByNumber returns the requested canonical block header.

0 commit comments

Comments
 (0)