Skip to content

Commit

Permalink
eth/tracers/logger: using maps.Equal (#29384)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
cuiweixie and fjl authored Mar 28, 2024
1 parent 7481398 commit 0183c7a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions eth/tracers/logger/access_list_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package logger

import (
"maps"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -71,17 +73,9 @@ func (al accessList) equal(other accessList) bool {
// Accounts match, cross reference the storage slots too
for addr, slots := range al {
otherslots := other[addr]

if len(slots) != len(otherslots) {
if !maps.Equal(slots, otherslots) {
return false
}
// Given that len(slots) == len(otherslots), we only need to check that
// all the items from slots are in otherslots.
for hash := range slots {
if _, ok := otherslots[hash]; !ok {
return false
}
}
}
return true
}
Expand Down

0 comments on commit 0183c7a

Please sign in to comment.