Skip to content

Commit

Permalink
core/state: remove pointless wrapper functions (#30891)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitglorythegreat authored and ucwong committed Dec 11, 2024
1 parent dfd45cc commit 8e567f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
5 changes: 1 addition & 4 deletions core/state/access_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ func (al *accessList) Equal(other *accessList) bool {
if !maps.Equal(al.addresses, other.addresses) {
return false
}
return slices.EqualFunc(al.slots, other.slots,
func(m map[common.Hash]struct{}, m2 map[common.Hash]struct{}) bool {
return maps.Equal(m, m2)
})
return slices.EqualFunc(al.slots, other.slots, maps.Equal)
}

// PrettyPrint prints the contents of the access list in a human-readable form
Expand Down
14 changes: 3 additions & 11 deletions core/state/statedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,7 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error {
{
have := state.transientStorage
want := checkstate.transientStorage
eq := maps.EqualFunc(have, want,
func(a Storage, b Storage) bool {
return maps.Equal(a, b)
})
if !eq {
if !maps.EqualFunc(have, want, maps.Equal) {
return fmt.Errorf("transient storage differs ,have\n%v\nwant\n%v",
have.PrettyPrint(),
want.PrettyPrint())
Expand Down Expand Up @@ -770,12 +766,8 @@ func TestMissingTrieNodes(t *testing.T) {

func TestStateDBAccessList(t *testing.T) {
// Some helpers
addr := func(a string) common.Address {
return common.HexToAddress(a)
}
slot := func(a string) common.Hash {
return common.HexToHash(a)
}
addr := common.HexToAddress
slot := common.HexToHash

memDb := rawdb.NewMemoryDatabase()
db := NewDatabase(memDb, nil)
Expand Down

0 comments on commit 8e567f5

Please sign in to comment.