From 560a12b1829137b70319fb871053f413e316c643 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Thu, 28 Mar 2024 18:38:26 +0800 Subject: [PATCH] eth/tracers/logger: using maps.Equal --- eth/tracers/logger/access_list_tracer.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/eth/tracers/logger/access_list_tracer.go b/eth/tracers/logger/access_list_tracer.go index fda26a81af..d5f0d05b87 100644 --- a/eth/tracers/logger/access_list_tracer.go +++ b/eth/tracers/logger/access_list_tracer.go @@ -21,6 +21,7 @@ import ( "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" + "maps" ) // accessList is an accumulator for the set of accounts and storage slots an EVM @@ -71,17 +72,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 }