Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions commit/merkleroot/rmn/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/sha256"
"errors"
"fmt"
"maps"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -1053,9 +1054,7 @@ func (m *mockPeerClient) getReceivedRequests() map[rmntypes.NodeID][]*rmnpb.Requ
cp := make(map[rmntypes.NodeID][]*rmnpb.Request)
m.mu.RLock()
defer m.mu.RUnlock()
for k, v := range m.receivedRequests {
cp[k] = v
}
maps.Copy(cp, m.receivedRequests)
return cp
}

Expand Down
5 changes: 2 additions & 3 deletions commit/merkleroot/transmission_checks_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package merkleroot

import (
"maps"
"testing"

"github.com/stretchr/testify/mock"
Expand Down Expand Up @@ -28,9 +29,7 @@ func TestValidateRootBlessings(t *testing.T) {
copyConfigWithOverride := func(chain cciptypes.ChainSelector,
override reader2.StaticSourceChainConfig) map[cciptypes.ChainSelector]reader2.StaticSourceChainConfig {
config := make(map[cciptypes.ChainSelector]reader2.StaticSourceChainConfig)
for k, v := range sourceChainConfig {
config[k] = v
}
maps.Copy(config, sourceChainConfig)
config[chain] = override
return config
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/addressbook/book.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package addressbook

import (
"errors"
"maps"
"sync"

"github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
Expand Down Expand Up @@ -73,9 +74,7 @@ func (b *Book) InsertOrUpdate(addresses ContractAddresses) error {
}

// if contract exists, set or replace any existing address for each chain
for chain, addr := range chains {
b.mem[name][chain] = addr
}
maps.Copy(b.mem[name], chains)
}

return nil
Expand Down
9 changes: 3 additions & 6 deletions pkg/ocrtypecodec/v1/translate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v1

import (
"maps"
"math/big"

"google.golang.org/protobuf/types/known/timestamppb"
Expand Down Expand Up @@ -854,9 +855,7 @@ func (t *protoTranslator) nonceObservationsToProto(

for chainSel, nonceMap := range observations {
addrToNonce := make(map[string]uint64, len(nonceMap))
for addr, nonce := range nonceMap {
addrToNonce[addr] = nonce
}
maps.Copy(addrToNonce, nonceMap)
nonceObservations[uint64(chainSel)] = &ocrtypecodecpb.StringAddrToNonce{Nonces: addrToNonce}
}

Expand All @@ -873,9 +872,7 @@ func (t *protoTranslator) nonceObservationsFromProto(

for chainSel, nonceMap := range pbObservations {
innerMap := make(map[string]uint64, len(nonceMap.Nonces))
for addr, nonce := range nonceMap.Nonces {
innerMap[addr] = nonce
}
maps.Copy(innerMap, nonceMap.Nonces)
nonces[cciptypes.ChainSelector(chainSel)] = innerMap
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/reader/config_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package reader
import (
"context"
"fmt"
"maps"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -591,9 +592,7 @@ func (c *configPoller) GetOfframpSourceChainConfigs(
}

// Merge the new configs with existing cached results
for chain, config := range newCachedConfigs {
cachedSourceConfigs[chain] = config
}
maps.Copy(cachedSourceConfigs, newCachedConfigs)

return cachedSourceConfigs, nil
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/reader/config_poller_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package reader
import (
"context"
"errors"
"maps"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -314,9 +315,7 @@ func TestConfigPollerV2_BatchRefreshChainAndSourceConfigs_Error(t *testing.T) {
cache.sourceChainMu.RLock()
initialSourceRefreshTime := cache.sourceChainRefresh
initialSourceConfigData := make(map[cciptypes.ChainSelector]StaticSourceChainConfig)
for k, v := range cache.staticSourceChainConfigs {
initialSourceConfigData[k] = v
}
maps.Copy(initialSourceConfigData, cache.staticSourceChainConfigs)
cache.sourceChainMu.RUnlock()

// Verify cache was populated
Expand Down
5 changes: 2 additions & 3 deletions pkg/reader/usdc_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/binary"
"fmt"
"maps"

sel "github.com/smartcontractkit/chain-selectors"

Expand Down Expand Up @@ -231,9 +232,7 @@ func AllAvailableDomains() map[uint64]uint32 {
}

destDomains := make(map[uint64]uint32)
for k, v := range CCTPDestDomains {
destDomains[k] = v
}
maps.Copy(destDomains, CCTPDestDomains)

for i, chainID := range chainIDs {
chainSelector, _ := sel.SelectorFromChainId(chainID)
Expand Down