From a9717f05e9af0fa07746c6b95b7f1625089a860f Mon Sep 17 00:00:00 2001 From: ferglor Date: Fri, 10 May 2024 16:09:32 +0100 Subject: [PATCH 1/4] Revert "Add logs to identify when assumptions of log queuing behaviour are violated" (#13173) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Add logs to identify when assumptions of log queuing behaviour are vi…" This reverts commit 6a342ae0ba1cbd6ce1a11a31befa37f33ab38302. * Add changeset --- .changeset/heavy-mails-rule.md | 5 - .changeset/moody-candles-compare.md | 5 + .../evmregistry/v21/logprovider/buffer_v1.go | 58 ++---------- .../v21/logprovider/buffer_v1_test.go | 91 ------------------- .../evmregistry/v21/logprovider/log.go | 12 +-- 5 files changed, 17 insertions(+), 154 deletions(-) delete mode 100644 .changeset/heavy-mails-rule.md create mode 100644 .changeset/moody-candles-compare.md diff --git a/.changeset/heavy-mails-rule.md b/.changeset/heavy-mails-rule.md deleted file mode 100644 index fdb6b3929b3..00000000000 --- a/.changeset/heavy-mails-rule.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Add logs for when the assumptions of how the log buffer will be used are violated #internal diff --git a/.changeset/moody-candles-compare.md b/.changeset/moody-candles-compare.md new file mode 100644 index 00000000000..b235b284a1e --- /dev/null +++ b/.changeset/moody-candles-compare.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +Revert block number tracking #changed diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go index b556b142984..fbc1da075df 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go @@ -76,25 +76,20 @@ type logBuffer struct { lastBlockSeen *atomic.Int64 // map of upkeep id to its queue queues map[string]*upkeepLogQueue - // map for then number of times we have enqueued logs for a block number - enqueuedBlocks map[int64]map[string]int - lock sync.RWMutex + lock sync.RWMutex } func NewLogBuffer(lggr logger.Logger, lookback, blockRate, logLimit uint32) LogBuffer { return &logBuffer{ - lggr: lggr.Named("KeepersRegistry.LogEventBufferV1"), - opts: newLogBufferOptions(lookback, blockRate, logLimit), - lastBlockSeen: new(atomic.Int64), - enqueuedBlocks: map[int64]map[string]int{}, - queues: make(map[string]*upkeepLogQueue), + lggr: lggr.Named("KeepersRegistry.LogEventBufferV1"), + opts: newLogBufferOptions(lookback, blockRate, logLimit), + lastBlockSeen: new(atomic.Int64), + queues: make(map[string]*upkeepLogQueue), } } // Enqueue adds logs to the buffer and might also drop logs if the limit for the // given upkeep was exceeded. It will create a new buffer if it does not exist. -// Logs are expected to be enqueued in increasing order of block number. -// All logs for an upkeep on a particular block will be enqueued in a single Enqueue call. // Returns the number of logs that were added and number of logs that were dropped. func (b *logBuffer) Enqueue(uid *big.Int, logs ...logpoller.Log) (int, int) { buf, ok := b.getUpkeepQueue(uid) @@ -102,54 +97,17 @@ func (b *logBuffer) Enqueue(uid *big.Int, logs ...logpoller.Log) (int, int) { buf = newUpkeepLogQueue(b.lggr, uid, b.opts) b.setUpkeepQueue(uid, buf) } - - latestLogBlock, uniqueBlocks := blockStatistics(logs...) - if lastBlockSeen := b.lastBlockSeen.Load(); lastBlockSeen < latestLogBlock { - b.lastBlockSeen.Store(latestLogBlock) - } else if latestLogBlock < lastBlockSeen { - b.lggr.Debugw("enqueuing logs from a block older than latest seen block", "logBlock", latestLogBlock, "lastBlockSeen", lastBlockSeen) + latestBlock := latestBlockNumber(logs...) + if b.lastBlockSeen.Load() < latestBlock { + b.lastBlockSeen.Store(latestBlock) } - - b.trackBlockNumbersForUpkeep(uid, uniqueBlocks) - blockThreshold := b.lastBlockSeen.Load() - int64(b.opts.lookback.Load()) if blockThreshold <= 0 { blockThreshold = 1 } - - // clean up enqueued block counts - for block := range b.enqueuedBlocks { - if block < blockThreshold { - delete(b.enqueuedBlocks, block) - } - } - return buf.enqueue(blockThreshold, logs...) } -// trackBlockNumbersForUpkeep keeps track of the number of times we enqueue logs for an upkeep, -// for a specific block number. The expectation is that we will only enqueue logs for an upkeep for a -// specific block number once, i.e. all logs for an upkeep for a block, will be enqueued in a single -// enqueue call. In the event that we see upkeep logs enqueued for a particular block more than once, -// we log a message. -func (b *logBuffer) trackBlockNumbersForUpkeep(uid *big.Int, uniqueBlocks map[int64]bool) { - for blockNumber := range uniqueBlocks { - if blockNumbers, ok := b.enqueuedBlocks[blockNumber]; ok { - if upkeepBlockInstances, ok := blockNumbers[uid.String()]; ok { - blockNumbers[uid.String()] = upkeepBlockInstances + 1 - b.lggr.Debugw("enqueuing logs again for a previously seen block for this upkeep", "blockNumber", blockNumber, "numberOfEnqueues", b.enqueuedBlocks[blockNumber], "upkeepID", uid.String()) - } else { - blockNumbers[uid.String()] = 1 - } - b.enqueuedBlocks[blockNumber] = blockNumbers - } else { - b.enqueuedBlocks[blockNumber] = map[string]int{ - uid.String(): 1, - } - } - } -} - // Dequeue greedly pulls logs from the buffers. // Returns logs and the number of remaining logs in the buffer. func (b *logBuffer) Dequeue(block int64, blockRate, upkeepLimit, maxResults int, upkeepSelector func(id *big.Int) bool) ([]BufferedLog, int) { diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1_test.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1_test.go index d6b4f43ac6e..19f806d35b9 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" @@ -51,96 +50,6 @@ func TestLogEventBufferV1_SyncFilters(t *testing.T) { require.Equal(t, 1, buf.NumOfUpkeeps()) } -type readableLogger struct { - logger.Logger - DebugwFn func(msg string, keysAndValues ...interface{}) - NamedFn func(name string) logger.Logger - WithFn func(args ...interface{}) logger.Logger -} - -func (l *readableLogger) Debugw(msg string, keysAndValues ...interface{}) { - l.DebugwFn(msg, keysAndValues...) -} - -func (l *readableLogger) Named(name string) logger.Logger { - return l -} - -func (l *readableLogger) With(args ...interface{}) logger.Logger { - return l -} - -func TestLogEventBufferV1_EnqueueViolations(t *testing.T) { - t.Run("enqueuing logs for a block older than latest seen logs a message", func(t *testing.T) { - logReceived := false - readableLogger := &readableLogger{ - DebugwFn: func(msg string, keysAndValues ...interface{}) { - if msg == "enqueuing logs from a block older than latest seen block" { - logReceived = true - assert.Equal(t, "logBlock", keysAndValues[0]) - assert.Equal(t, int64(1), keysAndValues[1]) - assert.Equal(t, "lastBlockSeen", keysAndValues[2]) - assert.Equal(t, int64(2), keysAndValues[3]) - } - }, - } - - logBufferV1 := NewLogBuffer(readableLogger, 10, 20, 1) - - buf := logBufferV1.(*logBuffer) - - buf.Enqueue(big.NewInt(1), - logpoller.Log{BlockNumber: 2, TxHash: common.HexToHash("0x1"), LogIndex: 0}, - logpoller.Log{BlockNumber: 2, TxHash: common.HexToHash("0x1"), LogIndex: 1}, - ) - buf.Enqueue(big.NewInt(2), - logpoller.Log{BlockNumber: 1, TxHash: common.HexToHash("0x2"), LogIndex: 0}, - ) - - assert.Equal(t, 1, buf.enqueuedBlocks[2]["1"]) - assert.Equal(t, 1, buf.enqueuedBlocks[1]["2"]) - assert.True(t, true, logReceived) - }) - - t.Run("enqueuing logs for the same block over multiple calls logs a message", func(t *testing.T) { - logReceived := false - readableLogger := &readableLogger{ - DebugwFn: func(msg string, keysAndValues ...interface{}) { - if msg == "enqueuing logs again for a previously seen block" { - logReceived = true - assert.Equal(t, "blockNumber", keysAndValues[0]) - assert.Equal(t, int64(3), keysAndValues[1]) - assert.Equal(t, "numberOfEnqueues", keysAndValues[2]) - assert.Equal(t, 2, keysAndValues[3]) - } - }, - } - - logBufferV1 := NewLogBuffer(readableLogger, 10, 20, 1) - - buf := logBufferV1.(*logBuffer) - - buf.Enqueue(big.NewInt(1), - logpoller.Log{BlockNumber: 1, TxHash: common.HexToHash("0x1"), LogIndex: 0}, - logpoller.Log{BlockNumber: 1, TxHash: common.HexToHash("0x1"), LogIndex: 1}, - ) - buf.Enqueue(big.NewInt(2), - logpoller.Log{BlockNumber: 2, TxHash: common.HexToHash("0x2"), LogIndex: 0}, - ) - buf.Enqueue(big.NewInt(3), - logpoller.Log{BlockNumber: 3, TxHash: common.HexToHash("0x3a"), LogIndex: 0}, - ) - buf.Enqueue(big.NewInt(3), - logpoller.Log{BlockNumber: 3, TxHash: common.HexToHash("0x3b"), LogIndex: 0}, - ) - - assert.Equal(t, 1, buf.enqueuedBlocks[2]["2"]) - assert.Equal(t, 1, buf.enqueuedBlocks[1]["1"]) - assert.Equal(t, 2, buf.enqueuedBlocks[3]["3"]) - assert.True(t, true, logReceived) - }) -} - func TestLogEventBufferV1_Dequeue(t *testing.T) { tests := []struct { name string diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/log.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/log.go index 9603d6da5be..9156e341688 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/log.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/log.go @@ -8,7 +8,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" ) -// LogSorter sorts the logs primarily by block number, then by log index, and finally by tx hash. +// LogSorter sorts the logs based on block number, tx hash and log index. // returns true if b should come before a. func LogSorter(a, b logpoller.Log) bool { return LogComparator(a, b) > 0 @@ -57,17 +57,13 @@ func logID(l logpoller.Log) string { return hex.EncodeToString(ext.LogIdentifier()) } -// blockStatistics returns the latest block number from the given logs, and a map of unique block numbers -func blockStatistics(logs ...logpoller.Log) (int64, map[int64]bool) { +// latestBlockNumber returns the latest block number from the given logs +func latestBlockNumber(logs ...logpoller.Log) int64 { var latest int64 - uniqueBlocks := map[int64]bool{} - for _, l := range logs { if l.BlockNumber > latest { latest = l.BlockNumber } - uniqueBlocks[l.BlockNumber] = true } - - return latest, uniqueBlocks + return latest } From fbd94c43511dabd272d7fd990dfb76de66c30a16 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 10 May 2024 12:17:37 -0700 Subject: [PATCH 2/4] chore: update solana-build-contracts for node20 (#13175) * chore: update solana-build-contracts for node20 * chore: bump chainlink-solana version --- .changeset/many-kings-notice.md | 5 +++++ .github/workflows/integration-tests.yml | 13 ++++--------- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 .changeset/many-kings-notice.md diff --git a/.changeset/many-kings-notice.md b/.changeset/many-kings-notice.md new file mode 100644 index 00000000000..b6d1f593494 --- /dev/null +++ b/.changeset/many-kings-notice.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +bump chainlink-solana dependency #internal diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 10d3e53d619..1f121b635fb 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1031,11 +1031,6 @@ jobs: solana-test-image-exists, get_solana_sha, ] - container: - image: projectserum/build:${{ needs.get_projectserum_version.outputs.projectserum_version }} - env: - RUSTUP_HOME: "/root/.rustup" - FORCE_COLOR: 1 steps: - name: Collect Metrics if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' @@ -1049,17 +1044,17 @@ jobs: this-job-name: Solana Build Artifacts continue-on-error: true - name: Checkout the solana repo - # Use v3.6.0 because the custom runner (container configured above) - # doesn't have node20 installed which is required for versions >=4 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 with: repository: smartcontractkit/chainlink-solana ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Build contracts if: (needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch') && needs.solana-test-image-exists.outputs.exists == 'false' - uses: smartcontractkit/chainlink-solana/.github/actions/build_contract_artifacts@21675b3a7dcdff8e790391708d4763020cace21e # stable action on December 18 2023 + uses: smartcontractkit/chainlink-solana/.github/actions/build_contract_artifacts@46b1311a5a83f33d08ffa8e1e0ab04f9ad51665d # node20 update on may 10, 2024 with: ref: ${{ needs.get_solana_sha.outputs.sha }} + image: projectserum/build + image-version: ${{ needs.get_projectserum_version.outputs.projectserum_version }} solana-build-test-image: environment: integration diff --git a/core/scripts/go.mod b/core/scripts/go.mod index a69addbe272..2135c6833c9 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -259,7 +259,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 0cfaea93a7e..47254fb049d 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1193,8 +1193,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab h1:Ct1oUlyn03HDUVdFHJqtRGRUujMqdoMzvf/Cjhe30Ag= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab/go.mod h1:RPUY7r8GxgzXxS1ijtU1P/fpJomOXztXgUbEziNmbCA= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 h1:nU9yibgmCMr6Yz4Ge2IJqzQGMYYpOlISor0HYwUewwU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 h1:f3W82k9V/XA6ZP/VQVJcGMVR6CrL3pQrPJSwyQWVFys= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 h1:ssh/w3oXWu+C6bE88GuFRC1+0Bx/4ihsbc80XMLrl2k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69/go.mod h1:VsfjhvWgjxqWja4q+FlXEtX5lu8BSxn10xRo6gi948g= github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 h1:LQmRsrzzaYYN3wEU1l5tWiccznhvbyGnu2N+wHSXZAo= diff --git a/go.mod b/go.mod index 68d3b786345..1c44fac9da9 100644 --- a/go.mod +++ b/go.mod @@ -76,7 +76,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c diff --git a/go.sum b/go.sum index 47fd0ae3243..7cc88d7c0f4 100644 --- a/go.sum +++ b/go.sum @@ -1179,8 +1179,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab h1:Ct1oUlyn03HDUVdFHJqtRGRUujMqdoMzvf/Cjhe30Ag= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab/go.mod h1:RPUY7r8GxgzXxS1ijtU1P/fpJomOXztXgUbEziNmbCA= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 h1:nU9yibgmCMr6Yz4Ge2IJqzQGMYYpOlISor0HYwUewwU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 h1:f3W82k9V/XA6ZP/VQVJcGMVR6CrL3pQrPJSwyQWVFys= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 h1:ssh/w3oXWu+C6bE88GuFRC1+0Bx/4ihsbc80XMLrl2k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69/go.mod h1:VsfjhvWgjxqWja4q+FlXEtX5lu8BSxn10xRo6gi948g= github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index b376dcdb3a4..ebfae9cce35 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -380,7 +380,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 9fcb97899ce..40faaf8867a 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1526,8 +1526,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab h1:Ct1oUlyn03HDUVdFHJqtRGRUujMqdoMzvf/Cjhe30Ag= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab/go.mod h1:RPUY7r8GxgzXxS1ijtU1P/fpJomOXztXgUbEziNmbCA= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 h1:nU9yibgmCMr6Yz4Ge2IJqzQGMYYpOlISor0HYwUewwU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 h1:f3W82k9V/XA6ZP/VQVJcGMVR6CrL3pQrPJSwyQWVFys= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 h1:ssh/w3oXWu+C6bE88GuFRC1+0Bx/4ihsbc80XMLrl2k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69/go.mod h1:VsfjhvWgjxqWja4q+FlXEtX5lu8BSxn10xRo6gi948g= github.com/smartcontractkit/chainlink-testing-framework v1.28.8 h1:EaxNwB/16wpISzaUn2WJ4bE3TawD3joEekIlQuWNRGo= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index c79fcf9ff16..85638238a8e 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -368,7 +368,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 // indirect github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240227164431-18a7065e23ea // indirect github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 5cf90c3712c..40e8d977596 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1508,8 +1508,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab h1:Ct1oUlyn03HDUVdFHJqtRGRUujMqdoMzvf/Cjhe30Ag= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab/go.mod h1:RPUY7r8GxgzXxS1ijtU1P/fpJomOXztXgUbEziNmbCA= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3 h1:nU9yibgmCMr6Yz4Ge2IJqzQGMYYpOlISor0HYwUewwU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240508123714-3a7c0d9d22e3/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 h1:f3W82k9V/XA6ZP/VQVJcGMVR6CrL3pQrPJSwyQWVFys= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 h1:ssh/w3oXWu+C6bE88GuFRC1+0Bx/4ihsbc80XMLrl2k= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69/go.mod h1:VsfjhvWgjxqWja4q+FlXEtX5lu8BSxn10xRo6gi948g= github.com/smartcontractkit/chainlink-testing-framework v1.28.8 h1:EaxNwB/16wpISzaUn2WJ4bE3TawD3joEekIlQuWNRGo= From 2a8d1b150a07c5dfd036559a35c8f83bb3e4f757 Mon Sep 17 00:00:00 2001 From: Dimitris Grigoriou Date: Sat, 11 May 2024 01:50:28 +0300 Subject: [PATCH 3/4] Decouple utils tests from core (#12993) * Add first version of evm utils * Remove unused context util * Add WSServer tests * Add NewLegacyTransaction test * Update NewTestChainScopedConfig to apply correct defaults * Move testutils * Decouple utils tests from core * Add changeset --- .changeset/tender-pianos-hunt.md | 5 +++++ core/chains/evm/types/models_test.go | 17 +++++++++-------- core/chains/evm/utils/utils_test.go | 8 +++++--- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 .changeset/tender-pianos-hunt.md diff --git a/.changeset/tender-pianos-hunt.md b/.changeset/tender-pianos-hunt.md new file mode 100644 index 00000000000..a909d9901dc --- /dev/null +++ b/.changeset/tender-pianos-hunt.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +Decouple utils tests from core #internal diff --git a/core/chains/evm/types/models_test.go b/core/chains/evm/types/models_test.go index 4757ddab5e6..db7b876bb64 100644 --- a/core/chains/evm/types/models_test.go +++ b/core/chains/evm/types/models_test.go @@ -18,13 +18,14 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-common/pkg/utils/hex" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" ) @@ -55,11 +56,11 @@ func TestHead_GreaterThan(t *testing.T) { greater bool }{ {"nil nil", nil, nil, false}, - {"present nil", cltest.Head(1), nil, true}, - {"nil present", nil, cltest.Head(1), false}, - {"less", cltest.Head(1), cltest.Head(2), false}, - {"equal", cltest.Head(2), cltest.Head(2), false}, - {"greater", cltest.Head(2), cltest.Head(1), true}, + {"present nil", testutils.Head(1), nil, true}, + {"nil present", nil, testutils.Head(1), false}, + {"less", testutils.Head(1), testutils.Head(2), false}, + {"equal", testutils.Head(2), testutils.Head(2), false}, + {"greater", testutils.Head(2), testutils.Head(1), true}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -76,7 +77,7 @@ func TestHead_NextInt(t *testing.T) { want *big.Int }{ {"nil", nil, nil}, - {"one", cltest.Head(1), big.NewInt(2)}, + {"one", testutils.Head(1), big.NewInt(2)}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -98,7 +99,7 @@ func TestEthTxAttempt_GetSignedTx(t *testing.T) { chainID := big.NewInt(3) - signedTx, err := ethKeyStore.SignTx(testutils.Context(t), fromAddress, tx, chainID) + signedTx, err := ethKeyStore.SignTx(tests.Context(t), fromAddress, tx, chainID) require.NoError(t, err) rlp := new(bytes.Buffer) require.NoError(t, signedTx.EncodeRLP(rlp)) diff --git a/core/chains/evm/utils/utils_test.go b/core/chains/evm/utils/utils_test.go index 9e8b44864ad..829cd314a61 100644 --- a/core/chains/evm/utils/utils_test.go +++ b/core/chains/evm/utils/utils_test.go @@ -13,8 +13,10 @@ import ( "github.com/stretchr/testify/assert" "go.uber.org/multierr" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" ) func TestKeccak256(t *testing.T) { @@ -208,7 +210,7 @@ func TestRetryWithBackoff(t *testing.T) { t.Parallel() var counter atomic.Int32 - ctx, cancel := context.WithCancel(testutils.Context(t)) + ctx, cancel := context.WithCancel(tests.Context(t)) utils.RetryWithBackoff(ctx, func() bool { return false @@ -222,7 +224,7 @@ func TestRetryWithBackoff(t *testing.T) { assert.Eventually(t, func() bool { return counter.Load() == 3 - }, testutils.WaitTimeout(t), testutils.TestInterval) + }, tests.WaitTimeout(t), tests.TestInterval) cancel() From eed5668e3c83cb680d2915f89d097fcb1b74a4f9 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 11 May 2024 07:45:06 -0600 Subject: [PATCH 4/4] fix metric description on mercury_transmit_queue_load (#13132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix metric description on mercury_transmit_queue_load * Add changeset * Add changesets tag * Decouple gas tests (#12972) * Add first version of evm utils * Remove unused context util * Add WSServer tests * Add NewLegacyTransaction test * Update NewTestChainScopedConfig to apply correct defaults * Decouple gas package tests from core * Move testutils * Update paths * Fix import error * Add changeset * Add logs to identify when assumptions of log queuing behaviour are violated (#12846) * Add logs to identify when assumptions of log queuing behaviour are violated * Add tests * go import * Add changeset * Update enqueuing assumption * Update tests * Extract block tracking into a separate function * Clean up outdated enqueued blocks * Clean up imports * Ignore reord buffer in cleanup * Cleanup test name * tools/docker: bump postgres to v14 (#13156) * changed spammy error log to debug (#13153) * [KS-186] Add custom OCR3 Capability Provider (#13137) * [KS-193] Pass MercuryTriggerService to Mercury Transmitter (#13118) 1. Add EnableTriggerCapability flag to Relay config 2. Create MercuryTriggerService lazily, on the first call to NewMercuryProvider() 3. Make it available in the Transmitter (no-op for now) * update changeset to include db_update tag (#13170) * fix go-etheruem compatibility pipeline trigger (#13162) * Revert "Add logs to identify when assumptions of log queuing behaviour are violated" (#13173) * Revert "Add logs to identify when assumptions of log queuing behaviour are vi…" This reverts commit 6a342ae0ba1cbd6ce1a11a31befa37f33ab38302. * Add changeset * chore: update solana-build-contracts for node20 (#13175) * chore: update solana-build-contracts for node20 * chore: bump chainlink-solana version * Decouple utils tests from core (#12993) * Add first version of evm utils * Remove unused context util * Add WSServer tests * Add NewLegacyTransaction test * Update NewTestChainScopedConfig to apply correct defaults * Move testutils * Decouple utils tests from core * Add changeset --------- Co-authored-by: Dimitris Grigoriou Co-authored-by: ferglor Co-authored-by: Jordan Krage Co-authored-by: Patrick Co-authored-by: Cedric Co-authored-by: Bolek <1416262+bolekk@users.noreply.github.com> Co-authored-by: Chunkai Yang Co-authored-by: Bartek Tofel Co-authored-by: Erik Burton --- .changeset/ninety-months-roll.md | 5 +++++ core/services/relay/evm/mercury/queue.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/ninety-months-roll.md diff --git a/.changeset/ninety-months-roll.md b/.changeset/ninety-months-roll.md new file mode 100644 index 00000000000..69a03086a1f --- /dev/null +++ b/.changeset/ninety-months-roll.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#nops fix metric description on mercury_transmit_queue_load diff --git a/core/services/relay/evm/mercury/queue.go b/core/services/relay/evm/mercury/queue.go index 8a89f47302b..80d0c77f46b 100644 --- a/core/services/relay/evm/mercury/queue.go +++ b/core/services/relay/evm/mercury/queue.go @@ -29,7 +29,7 @@ var _ services.Service = (*TransmitQueue)(nil) var transmitQueueLoad = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "mercury_transmit_queue_load", - Help: "Percent of transmit queue capacity used", + Help: "Current count of items in the transmit queue", }, []string{"feedID", "serverURL", "capacity"}, )