@@ -692,7 +692,6 @@ func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Addre
692
692
storageHash = types .EmptyRootHash
693
693
}
694
694
keccakCodeHash := state .GetKeccakCodeHash (address )
695
- poseidonCodeHash := state .GetPoseidonCodeHash (address )
696
695
storageProof := make ([]StorageResult , len (storageKeys ))
697
696
698
697
// if we have a storageTrie, (which means the account exists), we can update the storagehash
@@ -701,7 +700,6 @@ func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Addre
701
700
} else {
702
701
// no storageTrie means the account does not exist, so the codeHash is the hash of an empty bytearray.
703
702
keccakCodeHash = codehash .EmptyKeccakCodeHash
704
- poseidonCodeHash = codehash .EmptyPoseidonCodeHash
705
703
}
706
704
707
705
// create the proof for the storageKeys
@@ -723,17 +721,26 @@ func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Addre
723
721
return nil , proofErr
724
722
}
725
723
726
- return & AccountResult {
727
- Address : address ,
728
- AccountProof : toHexSlice (accountProof ),
729
- Balance : (* hexutil .Big )(state .GetBalance (address )),
730
- KeccakCodeHash : keccakCodeHash ,
731
- PoseidonCodeHash : poseidonCodeHash ,
732
- CodeSize : hexutil .Uint64 (state .GetCodeSize (address )),
733
- Nonce : hexutil .Uint64 (state .GetNonce (address )),
734
- StorageHash : storageHash ,
735
- StorageProof : storageProof ,
736
- }, state .Error ()
724
+ result := & AccountResult {
725
+ Address : address ,
726
+ AccountProof : toHexSlice (accountProof ),
727
+ Balance : (* hexutil .Big )(state .GetBalance (address )),
728
+ KeccakCodeHash : keccakCodeHash ,
729
+ CodeSize : hexutil .Uint64 (state .GetCodeSize (address )),
730
+ Nonce : hexutil .Uint64 (state .GetNonce (address )),
731
+ StorageHash : storageHash ,
732
+ StorageProof : storageProof ,
733
+ }
734
+
735
+ if state .IsZktrie () {
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 ()
737
744
}
738
745
739
746
// GetHeaderByNumber returns the requested canonical block header.
0 commit comments