Use hexutil.Encode instead of deprecated common.ToHex
This commit is contained in:
parent
f4ca756812
commit
77e86a698a
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/trie"
|
"github.com/ethereum/go-ethereum/trie"
|
||||||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Builder interface {
|
type Builder interface {
|
||||||
@ -156,7 +157,7 @@ func (sdb *builder) buildDiffEventual(accounts map[common.Address]*state.Account
|
|||||||
|
|
||||||
codeBytes, err := sdb.chainDB.Get(val.CodeHash)
|
codeBytes, err := sdb.chainDB.Get(val.CodeHash)
|
||||||
|
|
||||||
codeHash := common.ToHex(val.CodeHash)
|
codeHash := hexutil.Encode(val.CodeHash)
|
||||||
hexRoot := val.Root.Hex()
|
hexRoot := val.Root.Hex()
|
||||||
|
|
||||||
if created {
|
if created {
|
||||||
@ -222,7 +223,7 @@ func (sdb *builder) buildDiffIncremental(creations map[common.Address]*state.Acc
|
|||||||
NewValue: createdAcc.Balance,
|
NewValue: createdAcc.Balance,
|
||||||
OldValue: deletedAcc.Balance,
|
OldValue: deletedAcc.Balance,
|
||||||
}
|
}
|
||||||
codeHash := common.ToHex(createdAcc.CodeHash)
|
codeHash := hexutil.Encode(createdAcc.CodeHash)
|
||||||
|
|
||||||
nHexRoot := createdAcc.Root.Hex()
|
nHexRoot := createdAcc.Root.Hex()
|
||||||
oHexRoot := deletedAcc.Root.Hex()
|
oHexRoot := deletedAcc.Root.Hex()
|
||||||
@ -258,7 +259,7 @@ func (sdb *builder) buildStorageDiffsEventual(sr common.Hash, creation bool) (ma
|
|||||||
if it.Leaf() {
|
if it.Leaf() {
|
||||||
log.Debug("Found leaf in storage", "path", pathToStr(it))
|
log.Debug("Found leaf in storage", "path", pathToStr(it))
|
||||||
path := pathToStr(it)
|
path := pathToStr(it)
|
||||||
value := common.ToHex(it.LeafBlob())
|
value := hexutil.Encode(it.LeafBlob())
|
||||||
if creation {
|
if creation {
|
||||||
storageDiffs[path] = DiffString{NewValue: &value}
|
storageDiffs[path] = DiffString{NewValue: &value}
|
||||||
} else {
|
} else {
|
||||||
@ -292,11 +293,11 @@ func (sdb *builder) buildStorageDiffsIncremental(oldSR common.Hash, newSR common
|
|||||||
if it.Leaf() {
|
if it.Leaf() {
|
||||||
log.Debug("Found leaf in storage", "path", pathToStr(it))
|
log.Debug("Found leaf in storage", "path", pathToStr(it))
|
||||||
path := pathToStr(it)
|
path := pathToStr(it)
|
||||||
value := common.ToHex(it.LeafBlob())
|
value := hexutil.Encode(it.LeafBlob())
|
||||||
if oldVal, err := oldTrie.TryGet(it.LeafKey()); err != nil {
|
if oldVal, err := oldTrie.TryGet(it.LeafKey()); err != nil {
|
||||||
log.Error("Failed to look up value in oldTrie", "path", path, "error", err)
|
log.Error("Failed to look up value in oldTrie", "path", path, "error", err)
|
||||||
} else {
|
} else {
|
||||||
hexOldVal := common.ToHex(oldVal)
|
hexOldVal := hexutil.Encode(oldVal)
|
||||||
storageDiffs[path] = DiffString{OldValue: &hexOldVal, NewValue: &value}
|
storageDiffs[path] = DiffString{OldValue: &hexOldVal, NewValue: &value}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,10 +312,10 @@ func (sdb *builder) buildStorageDiffsIncremental(oldSR common.Hash, newSR common
|
|||||||
|
|
||||||
func (sdb *builder) addressByPath(path []byte) (*common.Address, error) {
|
func (sdb *builder) addressByPath(path []byte) (*common.Address, error) {
|
||||||
// db := core.PreimageTable(sdb.chainDb)
|
// db := core.PreimageTable(sdb.chainDb)
|
||||||
log.Debug("Looking up address from path", "path", common.ToHex(append([]byte("secure-key-"), path...)))
|
log.Debug("Looking up address from path", "path", hexutil.Encode(append([]byte("secure-key-"), path...)))
|
||||||
// if addrBytes,err := db.Get(path); err != nil {
|
// if addrBytes,err := db.Get(path); err != nil {
|
||||||
if addrBytes, err := sdb.chainDB.Get(append([]byte("secure-key-"), hexToKeybytes(path)...)); err != nil {
|
if addrBytes, err := sdb.chainDB.Get(append([]byte("secure-key-"), hexToKeybytes(path)...)); err != nil {
|
||||||
log.Error("Error looking up address via path", "path", common.ToHex(append([]byte("secure-key-"), path...)), "error", err)
|
log.Error("Error looking up address via path", "path", hexutil.Encode(append([]byte("secure-key-"), path...)), "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
addr := common.BytesToAddress(addrBytes)
|
addr := common.BytesToAddress(addrBytes)
|
||||||
|
Loading…
Reference in New Issue
Block a user