mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/devp2p/internal/ethtest: rebase updates
This commit is contained in:
parent
54e523d6a0
commit
e8ffcdaaec
2 changed files with 16 additions and 7 deletions
|
|
@ -103,13 +103,13 @@ func (c *Chain) AccountsInHashOrder() []state.DumpAccount {
|
|||
addr := addr
|
||||
list[i] = acc
|
||||
list[i].Address = &addr
|
||||
if len(acc.SecureKey) != 32 {
|
||||
if len(acc.AddressHash) != 32 {
|
||||
panic(fmt.Errorf("missing/invalid SecureKey in dump account %v", addr))
|
||||
}
|
||||
i++
|
||||
}
|
||||
slices.SortFunc(list, func(x, y state.DumpAccount) int {
|
||||
return bytes.Compare(x.SecureKey, y.SecureKey)
|
||||
return bytes.Compare(x.AddressHash, y.AddressHash)
|
||||
})
|
||||
return list
|
||||
}
|
||||
|
|
@ -317,7 +317,16 @@ func readState(file string) (map[common.Address]state.DumpAccount, error) {
|
|||
if err := json.Unmarshal(f, &dump); err != nil {
|
||||
return nil, fmt.Errorf("unable to unmarshal state: %v", err)
|
||||
}
|
||||
return dump.Accounts, nil
|
||||
|
||||
state := make(map[common.Address]state.DumpAccount)
|
||||
for key, acct := range dump.Accounts {
|
||||
var addr common.Address
|
||||
if err := addr.UnmarshalText([]byte(key)); err != nil {
|
||||
return nil, fmt.Errorf("invalid address %q", key)
|
||||
}
|
||||
state[addr] = acct
|
||||
}
|
||||
return state, nil
|
||||
}
|
||||
|
||||
func readAccounts(file string) (map[common.Address]*senderInfo, error) {
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ func (s *Suite) TestSnapGetAccountRange(t *utesting.T) {
|
|||
// test values derived from chain/ account dump
|
||||
root = s.chain.Head().Root()
|
||||
headstate = s.chain.AccountsInHashOrder()
|
||||
firstKey = common.BytesToHash(headstate[0].SecureKey)
|
||||
secondKey = common.BytesToHash(headstate[1].SecureKey)
|
||||
firstKey = common.BytesToHash(headstate[0].AddressHash)
|
||||
secondKey = common.BytesToHash(headstate[1].AddressHash)
|
||||
storageRoot = findNonEmptyStorageRoot(headstate)
|
||||
)
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ type stRangesTest struct {
|
|||
func (s *Suite) TestSnapGetStorageRanges(t *utesting.T) {
|
||||
var (
|
||||
acct = common.HexToAddress("0x8bebc8ba651aee624937e7d897853ac30c95a067")
|
||||
acctHash = common.BytesToHash(s.chain.state[acct].SecureKey)
|
||||
acctHash = common.BytesToHash(s.chain.state[acct].AddressHash)
|
||||
ffHash = common.MaxHash
|
||||
zero = common.Hash{}
|
||||
blockroot = s.chain.Head().Root()
|
||||
|
|
@ -597,7 +597,7 @@ func (s *Suite) TestSnapTrieNodes(t *utesting.T) {
|
|||
var (
|
||||
// This is the known address of the snap storage testing contract.
|
||||
storageAcct = common.HexToAddress("0x8bebc8ba651aee624937e7d897853ac30c95a067")
|
||||
storageAcctHash = common.BytesToHash(s.chain.state[storageAcct].SecureKey)
|
||||
storageAcctHash = common.BytesToHash(s.chain.state[storageAcct].AddressHash)
|
||||
// This is the known address of an existing account.
|
||||
key = common.FromHex("0xa87387b50b481431c6ccdb9ae99a54d4dcdd4a3eff75d7b17b4818f7bbfc21e9")
|
||||
empty = types.EmptyCodeHash
|
||||
|
|
|
|||
Loading…
Reference in a new issue