Skip to content
Merged
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
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,5 @@ ot = "ot"
ba = "ba"
BA = "BA"
unparseable = "unparseable"
# ExternalInitiators common var name
eis = "eis"
6 changes: 3 additions & 3 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.35.1
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chain-selectors v1.0.109
github.com/smartcontractkit/chain-selectors v1.0.111
github.com/smartcontractkit/chainlink-ccip/chains/evm v0.0.0-20260908164107-3de1349d970b
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260917115705-1d3a14a9b049
github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260903141829-ef07b52a737d
Expand Down Expand Up @@ -513,7 +513,7 @@ require (
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260908155618-50f521d70e62 // indirect
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260908155618-50f521d70e62 // indirect
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260908155618-50f521d70e62 // indirect
github.com/smartcontractkit/chainlink-ccv v0.12.0 // indirect
github.com/smartcontractkit/chainlink-ccv v0.13.1-0.20260918171034-c93b0d2ef3c0 // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20260915184316-2730f1867c92 // indirect
github.com/smartcontractkit/chainlink-confidential-compute v1.3.0 // indirect
github.com/smartcontractkit/chainlink-data-streams v1.1.1 // indirect
Expand All @@ -528,7 +528,7 @@ require (
github.com/smartcontractkit/chainlink-protos/chainlink-ccv/message-discovery v0.0.0-20251211142334-5c3421fe2c8d // indirect
github.com/smartcontractkit/chainlink-protos/chainlink-ccv/message-rules v0.0.0-20260505131349-78e491b80735 // indirect
github.com/smartcontractkit/chainlink-protos/chainlink-ccv/verifier v0.0.0-20251211142334-5c3421fe2c8d // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804200254-c1accce563a8 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260916140808-f5d22b3cb3ee // indirect
github.com/smartcontractkit/chainlink-protos/data-feeds v0.1.1-0.20260501174546-2e8846986b36 // indirect
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305 // indirect
github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260729184203-90b4cdd48536 // indirect
Expand Down
12 changes: 6 additions & 6 deletions core/scripts/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions core/utils/abihelpers/abi_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestProofFlagToBits(t *testing.T) {
Expand Down Expand Up @@ -79,14 +80,14 @@ func TestABIEncodeDecode(t *testing.T) {
}{big.NewInt(10), big.NewInt(12)}}

encoded, err := ABIEncode(abiStr, values...)
assert.NoError(t, err)
require.NoError(t, err)
assert.NotNil(t, encoded)

encodedAgain, err := ABIEncode(abiStr, values...)
assert.NoError(t, err)
require.NoError(t, err)
assert.True(t, bytes.Equal(encoded, encodedAgain))

decoded, err := ABIDecode(abiStr, encoded)
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, decoded, values)
}
10 changes: 5 additions & 5 deletions core/utils/backoff_ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (

type timerFactory func(d time.Duration) *time.Timer

func newBackoffTicker(tf timerFactory, min, max time.Duration) BackoffTicker {
func newBackoffTicker(tf timerFactory, minDuration, maxDuration time.Duration) BackoffTicker {
c := make(chan time.Time, 1)
return BackoffTicker{
createTimer: tf,
b: backoff.Backoff{
Min: min,
Max: max,
Min: minDuration,
Max: maxDuration,
},
C: c,
chStop: make(chan struct{}),
Expand All @@ -34,8 +34,8 @@ type BackoffTicker struct {
}

// NewBackoffTicker returns a new BackoffTicker for the given range.
func NewBackoffTicker(min, max time.Duration) BackoffTicker {
return newBackoffTicker(time.NewTimer, min, max)
func NewBackoffTicker(minDuration, maxDuration time.Duration) BackoffTicker {
return newBackoffTicker(time.NewTimer, minDuration, maxDuration)
}

// Start - Starts the ticker
Expand Down
42 changes: 21 additions & 21 deletions core/utils/backoff_ticker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ func TestBackoffTicker_Bounds(t *testing.T) {
t.Parallel()

bt := NewBackoffTicker(1*time.Millisecond, 2*time.Second)
min, max := bt.Bounds()
assert.Equal(t, 1*time.Millisecond, min)
assert.Equal(t, 2*time.Second, max)
minVal, maxVal := bt.Bounds()
assert.Equal(t, 1*time.Millisecond, minVal)
assert.Equal(t, 2*time.Second, maxVal)
}

func TestBackoffTicker_StartTwice(t *testing.T) {
Expand Down Expand Up @@ -51,20 +51,20 @@ func TestBackoffTicker_NoTicksAfterStop(t *testing.T) {

t.Parallel()

min := 100 * time.Millisecond
max := 5 * time.Second
minVal := 100 * time.Millisecond
maxVal := 5 * time.Second

chTime := make(chan time.Time, 1)
defer close(chTime)

newFakeTimer := func(d time.Duration) *time.Timer {
assert.Equal(t, min, d)
realTimer := time.NewTimer(max)
assert.Equal(t, minVal, d)
realTimer := time.NewTimer(maxVal)
realTimer.C = chTime
return realTimer
}

bt := newBackoffTicker(newFakeTimer, min, max)
bt := newBackoffTicker(newFakeTimer, minVal, maxVal)

ok := bt.Start()
assert.True(t, ok)
Expand All @@ -75,7 +75,7 @@ func TestBackoffTicker_NoTicksAfterStop(t *testing.T) {
chTime <- time.Now()

select {
case <-time.After(2 * min):
case <-time.After(2 * minVal):
case <-bt.Ticks():
assert.FailNow(t, "received a tick after Stop()")
}
Expand All @@ -88,20 +88,20 @@ func TestBackoffTicker_Ticks(t *testing.T) {

t.Parallel()

min := 100 * time.Millisecond
max := 5 * time.Second
minVal := 100 * time.Millisecond
maxVal := 5 * time.Second

chTime := make(chan time.Time)
defer close(chTime)

newFakeTimer := func(d time.Duration) *time.Timer {
assert.Equal(t, min, d)
realTimer := time.NewTimer(max)
assert.Equal(t, minVal, d)
realTimer := time.NewTimer(maxVal)
realTimer.C = chTime
return realTimer
}

bt := newBackoffTicker(newFakeTimer, min, max)
bt := newBackoffTicker(newFakeTimer, minVal, maxVal)

ok := bt.Start()
assert.True(t, ok)
Expand All @@ -124,7 +124,7 @@ func TestBackoffTicker_Ticks(t *testing.T) {
}

select {
case <-time.After(2 * min):
case <-time.After(2 * minVal):
case <-bt.Ticks():
assert.FailNow(t, "received an unexpected tick")
}
Expand All @@ -133,18 +133,18 @@ func TestBackoffTicker_Ticks(t *testing.T) {
func TestBackoffTicker_Restart(t *testing.T) {
t.Parallel()

min := 1 * time.Second
max := 10 * time.Second
minVal := 1 * time.Second
maxVal := 10 * time.Second

var newTimerCount atomic.Int32

newFakeTimer := func(d time.Duration) *time.Timer {
newTimerCount.Add(1)
assert.Equal(t, min, d)
return time.NewTimer(max)
assert.Equal(t, minVal, d)
return time.NewTimer(maxVal)
}

bt := newBackoffTicker(newFakeTimer, min, max)
bt := newBackoffTicker(newFakeTimer, minVal, maxVal)

ok := bt.Start()
assert.True(t, ok)
Expand All @@ -158,5 +158,5 @@ func TestBackoffTicker_Restart(t *testing.T) {

assert.Eventually(t, func() bool {
return newTimerCount.Load() == 2
}, min, min/100, "expected timer factory to be triggered twice")
}, minVal, minVal/100, "expected timer factory to be triggered twice")
}
8 changes: 4 additions & 4 deletions core/utils/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package utils
import "errors"

// BatchSplit splits an slices into an slices of slicess with a maximum length
func BatchSplit[T any](list []T, max int) (out [][]T, err error) {
if max == 0 {
func BatchSplit[T any](list []T, maxLen int) (out [][]T, err error) {
if maxLen == 0 {
return out, errors.New("max batch length cannot be 0")
}

// batch list into no more than max each
for len(list) > max {
for len(list) > maxLen {
// assign to list: remaining after taking slice from beginning
// append to out: max length slice from beginning of list
list, out = list[max:], append(out, list[:max])
list, out = list[maxLen:], append(out, list[:maxLen])
}
out = append(out, list) // append remaining to list (slice len < max)
return out, nil
Expand Down
5 changes: 3 additions & 2 deletions core/utils/collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestBatchSplit(t *testing.T) {
list := []int{}
list := make([]int, 0, 100)
for i := range 100 {
list = append(list, i)
}
Expand Down Expand Up @@ -38,7 +39,7 @@ func TestBatchSplit(t *testing.T) {
return
}

assert.NoError(t, err)
require.NoError(t, err)
assert.Len(t, batch, r.num) // check number of batches

temp := []int{}
Expand Down
33 changes: 24 additions & 9 deletions core/utils/config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,52 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/config"
)

type ErrInvalid = config.ErrInvalid
type InvalidError = config.ErrInvalid

// NewErrDuplicate returns an ErrInvalid with a standard duplicate message.
func NewErrDuplicate(name string, value any) ErrInvalid {
// NewErrDuplicate returns an InvalidError with a standard duplicate message.
func NewErrDuplicate(name string, value any) InvalidError {
return config.NewErrDuplicate(name, value)
}

type ErrMissing = config.ErrMissing
type MissingError = config.ErrMissing

type ErrEmpty = config.ErrEmpty
type EmptyError = config.ErrEmpty

// UniqueStrings is a helper for tracking unique values in string form.
type UniqueStrings = config.UniqueStrings

type ErrOverride struct {
type OverrideError struct {
Name string
}

func (e ErrOverride) Error() string {
func (e OverrideError) Error() string {
return e.Name + ": overrides (duplicate keys or list elements) are not allowed for multiple secrets files"
}

type ErrDeprecated struct {
type DeprecatedError struct {
Name string
Version semver.Version
}

func (e ErrDeprecated) Error() string {
func (e DeprecatedError) Error() string {
when := "a future version"
if e.Version != (semver.Version{}) {
when = fmt.Sprintf("version %s", e.Version)
}
return fmt.Sprintf("%s: is deprecated and will be removed in %s", e.Name, when)
}

// Deprecated: use InvalidError instead.
type ErrInvalid = InvalidError //nolint:errname // backward compatibility

// Deprecated: use MissingError instead.
type ErrMissing = MissingError //nolint:errname // backward compatibility

// Deprecated: use EmptyError instead.
type ErrEmpty = EmptyError //nolint:errname // backward compatibility

// Deprecated: use OverrideError instead.
type ErrOverride = OverrideError //nolint:errname // backward compatibility

// Deprecated: use DeprecatedError instead.
type ErrDeprecated = DeprecatedError //nolint:errname // backward compatibility
2 changes: 1 addition & 1 deletion core/utils/crypto/private_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Test_EncryptedPrivateKey_Scan(t *testing.T) {

// Error if not bytes
err = actual.Scan("not bytes")
assert.Error(t, err)
require.Error(t, err)

// Bytes
err = actual.Scan(b)
Expand Down
2 changes: 1 addition & 1 deletion core/utils/crypto/public_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Test_PublicKey_Scan(t *testing.T) {

// Error if not bytes
err = actual.Scan("not bytes")
assert.Error(t, err)
require.Error(t, err)

// Nil
err = actual.Scan(nil)
Expand Down
12 changes: 6 additions & 6 deletions core/utils/deferable_write_closer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ func TestDeferableWriteCloser_Close(t *testing.T) {
wc := NewDeferableWriteCloser(f)
wantStr := "wanted"
_, err = io.WriteString(wc, wantStr)
assert.NoError(t, err)
require.NoError(t, err)
defer func() {
assert.NoError(t, wc.Close())
}()

assert.NoError(t, wc.Close())
require.NoError(t, wc.Close())
assert.True(t, wc.closed)
// safe to close multiple times
assert.NoError(t, wc.Close())
require.NoError(t, wc.Close())

_, err = io.WriteString(f, "after close")
assert.ErrorIs(t, err, os.ErrClosed)
require.ErrorIs(t, err, os.ErrClosed)

_, err = io.WriteString(f, "write to wc after close")
assert.ErrorIs(t, err, os.ErrClosed)
require.ErrorIs(t, err, os.ErrClosed)

r, err := os.ReadFile(f.Name())
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, wantStr, string(r))
}
Loading
Loading