fix ZkTrie's GetStorage (#800)

This commit is contained in:
HAOYUatHZ 2024-06-05 15:26:30 +08:00 committed by GitHub
parent b0b4608450
commit 20a7093f4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,7 +27,6 @@ import (
"github.com/ethereum/go-ethereum/crypto/poseidon" "github.com/ethereum/go-ethereum/crypto/poseidon"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie/trienode" "github.com/ethereum/go-ethereum/trie/trienode"
) )
@ -83,12 +82,7 @@ func (t *ZkTrie) GetAccount(address common.Address) (*types.StateAccount, error)
func (t *ZkTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) { func (t *ZkTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) {
sanityCheckByte32Key(key) sanityCheckByte32Key(key)
enc, err := t.TryGet(key) return t.TryGet(key)
if err != nil || len(enc) == 0 {
return nil, err
}
_, content, _, err := rlp.Split(enc)
return content, err
} }
func (t *ZkTrie) UpdateAccount(address common.Address, acc *types.StateAccount) error { func (t *ZkTrie) UpdateAccount(address common.Address, acc *types.StateAccount) error {