Skip to content

Commit

Permalink
core/eth: use maps.Clone (#11079)
Browse files Browse the repository at this point in the history
  • Loading branch information
estensen authored Jul 9, 2024
1 parent c30399d commit 7647861
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 2 additions & 6 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"bytes"
"fmt"
"io"
"maps"
"math/big"

"github.com/holiman/uint256"
Expand Down Expand Up @@ -56,12 +57,7 @@ func (s Storage) String() (str string) {
}

func (s Storage) Copy() Storage {
cpy := make(Storage)
for key, value := range s {
cpy[key] = value
}

return cpy
return maps.Clone(s)
}

// stateObject represents an Ethereum account which is being modified.
Expand Down
7 changes: 2 additions & 5 deletions eth/tracers/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"io"
"maps"
"math/big"
"os"
"strings"
Expand All @@ -44,11 +45,7 @@ type Storage map[libcommon.Hash]libcommon.Hash

// Copy duplicates the current storage.
func (s Storage) Copy() Storage {
cpy := make(Storage)
for key, value := range s {
cpy[key] = value
}
return cpy
return maps.Clone(s)
}

// LogConfig are the configuration options for structured logger the EVM
Expand Down

0 comments on commit 7647861

Please sign in to comment.