Skip to content

Commit c7e740f

Browse files
core/state: remove pointless wrapper functions (#30891)
1 parent 330190e commit c7e740f

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

core/state/access_list.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ func (al *accessList) Equal(other *accessList) bool {
139139
if !maps.Equal(al.addresses, other.addresses) {
140140
return false
141141
}
142-
return slices.EqualFunc(al.slots, other.slots,
143-
func(m map[common.Hash]struct{}, m2 map[common.Hash]struct{}) bool {
144-
return maps.Equal(m, m2)
145-
})
142+
return slices.EqualFunc(al.slots, other.slots, maps.Equal)
146143
}
147144

148145
// PrettyPrint prints the contents of the access list in a human-readable form

core/state/statedb_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,7 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error {
650650
{
651651
have := state.transientStorage
652652
want := checkstate.transientStorage
653-
eq := maps.EqualFunc(have, want,
654-
func(a Storage, b Storage) bool {
655-
return maps.Equal(a, b)
656-
})
657-
if !eq {
653+
if !maps.EqualFunc(have, want, maps.Equal) {
658654
return fmt.Errorf("transient storage differs ,have\n%v\nwant\n%v",
659655
have.PrettyPrint(),
660656
want.PrettyPrint())
@@ -1034,12 +1030,8 @@ func testMissingTrieNodes(t *testing.T, scheme string) {
10341030

10351031
func TestStateDBAccessList(t *testing.T) {
10361032
// Some helpers
1037-
addr := func(a string) common.Address {
1038-
return common.HexToAddress(a)
1039-
}
1040-
slot := func(a string) common.Hash {
1041-
return common.HexToHash(a)
1042-
}
1033+
addr := common.HexToAddress
1034+
slot := common.HexToHash
10431035

10441036
db := NewDatabaseForTesting()
10451037
state, _ := New(types.EmptyRootHash, db)

0 commit comments

Comments
 (0)