diff --git a/.changeset/tricky-candles-matter.md b/.changeset/tricky-candles-matter.md new file mode 100644 index 0000000000..0dc7806703 --- /dev/null +++ b/.changeset/tricky-candles-matter.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#bugfix Memory leak fix on promwrapper diff --git a/core/chains/evm/config/toml/defaults/BOB_Mainnet.toml b/core/chains/evm/config/toml/defaults/BOB_Mainnet.toml index 806f7f8726..5197c88e76 100644 --- a/core/chains/evm/config/toml/defaults/BOB_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/BOB_Mainnet.toml @@ -3,8 +3,8 @@ ChainID = '60808' ChainType = 'optimismBedrock' # finality_depth was: ~850 FinalityDepth = 900 -# block_time was: 2s -LogPollInterval = '5s' +# block_time was: 2s, adding 1 second buffer +LogPollInterval = '3s' # finality_depth * block_time / 60 secs = ~30 min (finality time) NoNewFinalizedHeadsThreshold = '35m' @@ -16,8 +16,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 2s -CacheTimeout = '2s' +# block_time was: 2s, per recommendation skip 1-2 blocks +CacheTimeout = '4s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/BOB_Testnet.toml b/core/chains/evm/config/toml/defaults/BOB_Testnet.toml index 2b5313b5e5..85abf5f560 100644 --- a/core/chains/evm/config/toml/defaults/BOB_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/BOB_Testnet.toml @@ -3,8 +3,8 @@ ChainID = '808813' ChainType = 'optimismBedrock' # finality_depth was: ~850 FinalityDepth = 900 -# block_time was: 2s -LogPollInterval = '5s' +# block_time was: 2s, adding 1 second buffer +LogPollInterval = '3s' # finality_depth * block_time / 60 secs = ~30 min (finality time) NoNewFinalizedHeadsThreshold = '35m' @@ -16,8 +16,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 2s -CacheTimeout = '2s' +# block_time was: 2s, per recommendation skip 1-2 blocks +CacheTimeout = '4s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/Berachain_Testnet.toml b/core/chains/evm/config/toml/defaults/Berachain_Testnet.toml index 1014b7b8bf..7024d12a99 100644 --- a/core/chains/evm/config/toml/defaults/Berachain_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/Berachain_Testnet.toml @@ -1,8 +1,8 @@ ChainID = '80084' # finality_depth: instant FinalityDepth = 10 -# block_time: 5s -LogPollInterval = '10s' +# block_time: 5s, adding 1 second buffer +LogPollInterval = '6s' # finality_depth * block_time / 60 secs = ~0.8 min (finality time) NoNewFinalizedHeadsThreshold = '5m' @@ -12,8 +12,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 5s -CacheTimeout = '5s' +# block_time was: 5s, per recommendation skip 1-2 blocks +CacheTimeout = '10s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/Bsquared_Mainnet.toml b/core/chains/evm/config/toml/defaults/Bsquared_Mainnet.toml index 98c17e9220..61b0e5337c 100644 --- a/core/chains/evm/config/toml/defaults/Bsquared_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Bsquared_Mainnet.toml @@ -3,8 +3,8 @@ ChainID = '223' ChainType = 'optimismBedrock' # finality_depth was: ~1900 FinalityDepth = 2000 -# block_time: ~2s -LogPollInterval = '5s' +# block_time: ~2s, adding 1 second buffer +LogPollInterval = '3s' # finality_depth * block_time / 60 secs = ~66 min (finality time) NoNewFinalizedHeadsThreshold = '70m' @@ -16,8 +16,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 2s -CacheTimeout = '2s' +# block_time was: 2s, per recommendation skip 1-2 blocks +CacheTimeout = '4s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/Bsquared_Testnet.toml b/core/chains/evm/config/toml/defaults/Bsquared_Testnet.toml index 1a5c7c26eb..b7cfd35fc4 100644 --- a/core/chains/evm/config/toml/defaults/Bsquared_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/Bsquared_Testnet.toml @@ -3,8 +3,8 @@ ChainID = '1123' ChainType = 'optimismBedrock' # finality_depth was: ~1900 FinalityDepth = 2000 -# block_time: ~2s -LogPollInterval = '5s' +# block_time: ~2s, adding 1 second buffer +LogPollInterval = '3s' # finality_depth * block_time / 60 secs = ~66 min (finality time) NoNewFinalizedHeadsThreshold = '70m' @@ -16,8 +16,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 2s -CacheTimeout = '2s' +# block_time was: 2s, per recommendation skip 1-2 blocks +CacheTimeout = '4s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/Unichain_Testnet.toml b/core/chains/evm/config/toml/defaults/Unichain_Testnet.toml index 68d18a1888..5e18f0d471 100644 --- a/core/chains/evm/config/toml/defaults/Unichain_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/Unichain_Testnet.toml @@ -3,12 +3,13 @@ ChainID = '1301' ChainType = 'optimismBedrock' # finality_depth was: ~1900 FinalityDepth = 2000 -# block_time was: ~1s -LogPollInterval = '5s' +# block_time was: ~1s, adding 1 second buffer +LogPollInterval = '2s' # batching_size_finalization_percentage = 30% according to the explorer batching view -# ( batching_size_finalization_percentage * finality_depth) * block_time / 60 secs = ~33 min (finality time) -NoNewFinalizedHeadsThreshold = '10m' +# ( batching_size_finalization_percentage * finality_depth) * block_time / 60 secs = ~10 min (finality time) +# After running soak tests using 10m threw issues as there are batchs that take 35m, so we are bumping it to 45m to be sure +NoNewFinalizedHeadsThreshold = '45m' FinalityTagEnabled = true @@ -17,8 +18,9 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 1s -CacheTimeout = '1s' +# block_time was: 1s, per recommendation skip 1-2 blocks +CacheTimeout = '2s' [GasEstimator.BlockHistory] +# As we see blocks containing between ~[8-12]tx, to get about ~1000 tx to check we would need to rougly go 100 tx back BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/Worldchain_Mainnet.toml b/core/chains/evm/config/toml/defaults/Worldchain_Mainnet.toml index d33b75b22e..9b25d89d98 100644 --- a/core/chains/evm/config/toml/defaults/Worldchain_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Worldchain_Mainnet.toml @@ -3,8 +3,8 @@ ChainID = '480' ChainType = 'optimismBedrock' # finality_depth was: ~2400 FinalityDepth = 2500 -# block_time was: 2s -LogPollInterval = '5s' +# block_time was: 2s, adding 1 second buffer +LogPollInterval = '3s' # finality_depth * block_time / 60 secs = ~83 min (finality time) NoNewFinalizedHeadsThreshold = '90m' @@ -16,8 +16,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 2s -CacheTimeout = '2s' +# block_time was: 2s, per recommendation skip 1-2 blocks +CacheTimeout = '4s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/chains/evm/config/toml/defaults/Worldchain_Testnet.toml b/core/chains/evm/config/toml/defaults/Worldchain_Testnet.toml index 34bc35d72b..0161832228 100644 --- a/core/chains/evm/config/toml/defaults/Worldchain_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/Worldchain_Testnet.toml @@ -3,8 +3,8 @@ ChainID = '4801' ChainType = 'optimismBedrock' # finality_depth was: ~2400 FinalityDepth = 2500 -# block_time was: 2s -LogPollInterval = '5s' +# block_time was: 2s, adding 1 second buffer +LogPollInterval = '3s' # finality_depth * block_time / 60 secs = ~83 min (finality time) NoNewFinalizedHeadsThreshold = '90m' @@ -16,8 +16,8 @@ EIP1559DynamicFees = true Mode = 'FeeHistory' [GasEstimator.FeeHistory] -# block_time was: 2s -CacheTimeout = '2s' +# block_time was: 2s, per recommendation skip 1-2 blocks +CacheTimeout = '4s' [GasEstimator.BlockHistory] BlockHistorySize = 100 diff --git a/core/scripts/ccip/manual-execution/go.mod b/core/scripts/ccip/manual-execution/go.mod index 4737afb745..9e1c87289e 100644 --- a/core/scripts/ccip/manual-execution/go.mod +++ b/core/scripts/ccip/manual-execution/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/ethereum/go-ethereum v1.11.3 github.com/pkg/errors v0.9.1 - github.com/smartcontractkit/chain-selectors v1.0.28 + github.com/smartcontractkit/chain-selectors v1.0.30 go.uber.org/multierr v1.1.0 golang.org/x/crypto v0.1.0 ) diff --git a/core/scripts/ccip/manual-execution/go.sum b/core/scripts/ccip/manual-execution/go.sum index 62e99b76bf..afb6fee028 100644 --- a/core/scripts/ccip/manual-execution/go.sum +++ b/core/scripts/ccip/manual-execution/go.sum @@ -72,8 +72,8 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/smartcontractkit/chain-selectors v1.0.28 h1:oY4/X4MJTUptVo0mG21xYYfni/78iqnqyS7LddQGeVo= -github.com/smartcontractkit/chain-selectors v1.0.28/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.30 h1:jk+xVRocgQ/uvKLSd1JzeHJ/v+EKu1BjrreaSGqKzjo= +github.com/smartcontractkit/chain-selectors v1.0.30/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 7260e0541b..2d1f4eb22d 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 - github.com/smartcontractkit/chain-selectors v1.0.28 + github.com/smartcontractkit/chain-selectors v1.0.30 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index a396da63ae..2d931398a2 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1073,8 +1073,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartcontractkit/chain-selectors v1.0.28 h1:oY4/X4MJTUptVo0mG21xYYfni/78iqnqyS7LddQGeVo= -github.com/smartcontractkit/chain-selectors v1.0.28/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.30 h1:jk+xVRocgQ/uvKLSd1JzeHJ/v+EKu1BjrreaSGqKzjo= +github.com/smartcontractkit/chain-selectors v1.0.30/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= diff --git a/core/services/ocr2/plugins/promwrapper/plugin.go b/core/services/ocr2/plugins/promwrapper/plugin.go index cc6c9d135d..aa60ab8800 100644 --- a/core/services/ocr2/plugins/promwrapper/plugin.go +++ b/core/services/ocr2/plugins/promwrapper/plugin.go @@ -7,15 +7,23 @@ import ( "context" "fmt" "math/big" - "sync" "time" "github.com/ethereum/go-ethereum/common" + "github.com/patrickmn/go-cache" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) +const ( + // defaultExpiration is the default expiration time for cache items. + defaultExpiration = 30 * time.Minute + + // defaultCleanupInterval is the default interval for cache cleanup. + defaultCleanupInterval = 5 * time.Minute +) + // Type assertions, buckets and labels. var ( _ types.ReportingPlugin = &promPlugin{} @@ -160,10 +168,10 @@ type ( chainID *big.Int oracleID string configDigest string - queryEndTimes sync.Map - observationEndTimes sync.Map - reportEndTimes sync.Map - acceptFinalizedReportEndTimes sync.Map + queryEndTimes *cache.Cache + observationEndTimes *cache.Cache + reportEndTimes *cache.Cache + acceptFinalizedReportEndTimes *cache.Cache prometheusBackend PrometheusBackend } ) @@ -223,13 +231,17 @@ func New( } return &promPlugin{ - wrapped: plugin, - name: name, - chainType: chainType, - chainID: chainID, - oracleID: fmt.Sprintf("%d", config.OracleID), - configDigest: common.Bytes2Hex(config.ConfigDigest[:]), - prometheusBackend: prometheusBackend, + wrapped: plugin, + name: name, + chainType: chainType, + chainID: chainID, + oracleID: fmt.Sprintf("%d", config.OracleID), + configDigest: common.Bytes2Hex(config.ConfigDigest[:]), + prometheusBackend: prometheusBackend, + queryEndTimes: cache.New(defaultExpiration, defaultCleanupInterval), + observationEndTimes: cache.New(defaultExpiration, defaultCleanupInterval), + reportEndTimes: cache.New(defaultExpiration, defaultCleanupInterval), + acceptFinalizedReportEndTimes: cache.New(defaultExpiration, defaultCleanupInterval), } } @@ -238,7 +250,7 @@ func (p *promPlugin) Query(ctx context.Context, timestamp types.ReportTimestamp) defer func() { duration := float64(time.Now().UTC().Sub(start)) p.prometheusBackend.SetQueryDuration(getLabelsValues(p, timestamp), duration) - p.queryEndTimes.Store(timestamp, time.Now().UTC()) // note time at end of Query() + p.setEndTime(timestamp, p.queryEndTimes) // note time at end of Query() }() return p.wrapped.Query(ctx, timestamp) @@ -249,17 +261,16 @@ func (p *promPlugin) Observation(ctx context.Context, timestamp types.ReportTime // Report latency between Query() and Observation(). labelValues := getLabelsValues(p, timestamp) - if queryEndTime, ok := p.queryEndTimes.Load(timestamp); ok { + if queryEndTime, ok := p.queryEndTimes.Get(timestampToKey(timestamp)); ok { latency := float64(start.Sub(queryEndTime.(time.Time))) p.prometheusBackend.SetQueryToObservationLatency(labelValues, latency) - p.queryEndTimes.Delete(timestamp) } // Report latency for Observation() at end of call. defer func() { duration := float64(time.Now().UTC().Sub(start)) p.prometheusBackend.SetObservationDuration(labelValues, duration) - p.observationEndTimes.Store(timestamp, time.Now().UTC()) // note time at end of Observe() + p.setEndTime(timestamp, p.observationEndTimes) // note time at end of Observe() }() return p.wrapped.Observation(ctx, timestamp, query) @@ -270,17 +281,16 @@ func (p *promPlugin) Report(ctx context.Context, timestamp types.ReportTimestamp // Report latency between Observation() and Report(). labelValues := getLabelsValues(p, timestamp) - if observationEndTime, ok := p.observationEndTimes.Load(timestamp); ok { + if observationEndTime, ok := p.observationEndTimes.Get(timestampToKey(timestamp)); ok { latency := float64(start.Sub(observationEndTime.(time.Time))) p.prometheusBackend.SetObservationToReportLatency(labelValues, latency) - p.observationEndTimes.Delete(timestamp) } // Report latency for Report() at end of call. defer func() { duration := float64(time.Now().UTC().Sub(start)) p.prometheusBackend.SetReportDuration(labelValues, duration) - p.reportEndTimes.Store(timestamp, time.Now().UTC()) // note time at end of Report() + p.setEndTime(timestamp, p.reportEndTimes) // note time at end of Report() }() return p.wrapped.Report(ctx, timestamp, query, observations) @@ -291,17 +301,16 @@ func (p *promPlugin) ShouldAcceptFinalizedReport(ctx context.Context, timestamp // Report latency between Report() and ShouldAcceptFinalizedReport(). labelValues := getLabelsValues(p, timestamp) - if reportEndTime, ok := p.reportEndTimes.Load(timestamp); ok { + if reportEndTime, ok := p.reportEndTimes.Get(timestampToKey(timestamp)); ok { latency := float64(start.Sub(reportEndTime.(time.Time))) p.prometheusBackend.SetReportToAcceptFinalizedReportLatency(labelValues, latency) - p.reportEndTimes.Delete(timestamp) } // Report latency for ShouldAcceptFinalizedReport() at end of call. defer func() { duration := float64(time.Now().UTC().Sub(start)) p.prometheusBackend.SetShouldAcceptFinalizedReportDuration(labelValues, duration) - p.acceptFinalizedReportEndTimes.Store(timestamp, time.Now().UTC()) // note time at end of ShouldAcceptFinalizedReport() + p.setEndTime(timestamp, p.acceptFinalizedReportEndTimes) // note time at end of ShouldAcceptFinalizedReport() }() return p.wrapped.ShouldAcceptFinalizedReport(ctx, timestamp, report) @@ -312,10 +321,9 @@ func (p *promPlugin) ShouldTransmitAcceptedReport(ctx context.Context, timestamp // Report latency between ShouldAcceptFinalizedReport() and ShouldTransmitAcceptedReport(). labelValues := getLabelsValues(p, timestamp) - if acceptFinalizedReportEndTime, ok := p.acceptFinalizedReportEndTimes.Load(timestamp); ok { + if acceptFinalizedReportEndTime, ok := p.acceptFinalizedReportEndTimes.Get(timestampToKey(timestamp)); ok { latency := float64(start.Sub(acceptFinalizedReportEndTime.(time.Time))) p.prometheusBackend.SetAcceptFinalizedReportToTransmitAcceptedReportLatency(labelValues, latency) - p.acceptFinalizedReportEndTimes.Delete(timestamp) } defer func() { @@ -343,3 +351,11 @@ func (p *promPlugin) Close() error { return p.wrapped.Close() } + +func (p *promPlugin) setEndTime(timestamp types.ReportTimestamp, cache *cache.Cache) { + cache.SetDefault(timestampToKey(timestamp), time.Now().UTC()) +} + +func timestampToKey(timestamp types.ReportTimestamp) string { + return fmt.Sprintf("%x_%d_%d", timestamp.ConfigDigest[:], timestamp.Epoch, timestamp.Round) +} diff --git a/core/services/ocr2/plugins/promwrapper/plugin_test.go b/core/services/ocr2/plugins/promwrapper/plugin_test.go index b4de7f027f..5b8187405f 100644 --- a/core/services/ocr2/plugins/promwrapper/plugin_test.go +++ b/core/services/ocr2/plugins/promwrapper/plugin_test.go @@ -69,12 +69,12 @@ func TestPlugin_MustInstantiate(t *testing.T) { // Ensure instantiation without panic for no override backend. var reportingPlugin = &fakeReportingPlugin{} promPlugin := New(reportingPlugin, "test", "EVM", big.NewInt(1), types.ReportingPluginConfig{}, nil) - require.NotEqual(t, nil, promPlugin) + require.NotNil(t, promPlugin) // Ensure instantiation without panic for override provided. backend := mocks.NewPrometheusBackend(t) promPlugin = New(reportingPlugin, "test-2", "EVM", big.NewInt(1), types.ReportingPluginConfig{}, backend) - require.NotEqual(t, nil, promPlugin) + require.NotNil(t, promPlugin) } func TestPlugin_GetLatencies(t *testing.T) { @@ -194,45 +194,37 @@ func TestPlugin_GetLatencies(t *testing.T) { types.ReportingPluginConfig{ConfigDigest: reportTimestamp.ConfigDigest}, backend, ).(*promPlugin) - require.NotEqual(t, nil, promPlugin) + require.NotNil(t, promPlugin) ctx := testutils.Context(t) // Run OCR methods. _, err := promPlugin.Query(ctx, reportTimestamp) require.NoError(t, err) - _, ok := promPlugin.queryEndTimes.Load(reportTimestamp) - require.Equal(t, true, ok) + _, ok := promPlugin.queryEndTimes.Get(timestampToKey(reportTimestamp)) + require.True(t, ok) time.Sleep(qToOLatency) _, err = promPlugin.Observation(ctx, reportTimestamp, nil) require.NoError(t, err) - _, ok = promPlugin.queryEndTimes.Load(reportTimestamp) - require.Equal(t, false, ok) - _, ok = promPlugin.observationEndTimes.Load(reportTimestamp) - require.Equal(t, true, ok) + _, ok = promPlugin.observationEndTimes.Get(timestampToKey(reportTimestamp)) + require.True(t, ok) time.Sleep(oToRLatency) _, _, err = promPlugin.Report(ctx, reportTimestamp, nil, nil) require.NoError(t, err) - _, ok = promPlugin.observationEndTimes.Load(reportTimestamp) - require.Equal(t, false, ok) - _, ok = promPlugin.reportEndTimes.Load(reportTimestamp) - require.Equal(t, true, ok) + _, ok = promPlugin.reportEndTimes.Get(timestampToKey(reportTimestamp)) + require.True(t, ok) time.Sleep(rToALatency) _, err = promPlugin.ShouldAcceptFinalizedReport(ctx, reportTimestamp, nil) require.NoError(t, err) - _, ok = promPlugin.reportEndTimes.Load(reportTimestamp) - require.Equal(t, false, ok) - _, ok = promPlugin.acceptFinalizedReportEndTimes.Load(reportTimestamp) - require.Equal(t, true, ok) + _, ok = promPlugin.acceptFinalizedReportEndTimes.Get(timestampToKey(reportTimestamp)) + require.True(t, ok) time.Sleep(aToTLatency) _, err = promPlugin.ShouldTransmitAcceptedReport(ctx, reportTimestamp, nil) require.NoError(t, err) - _, ok = promPlugin.acceptFinalizedReportEndTimes.Load(reportTimestamp) - require.Equal(t, false, ok) // Close. err = promPlugin.Close() diff --git a/docs/CONFIG.md b/docs/CONFIG.md index c0bb07347c..e700d94a14 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -3823,7 +3823,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 2000 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '3s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -3877,7 +3877,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '2s' +CacheTimeout = '4s' [HeadTracker] HistoryDepth = 100 @@ -4648,7 +4648,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 2500 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '3s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -4702,7 +4702,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '2s' +CacheTimeout = '4s' [HeadTracker] HistoryDepth = 100 @@ -5472,7 +5472,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 2000 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '3s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -5526,7 +5526,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '2s' +CacheTimeout = '4s' [HeadTracker] HistoryDepth = 100 @@ -5575,7 +5575,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 2000 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '2s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -5587,7 +5587,7 @@ LogBroadcasterEnabled = true RPCDefaultBatchSize = 250 RPCBlockQueryDelay = 1 FinalizedBlockOffset = 0 -NoNewFinalizedHeadsThreshold = '10m0s' +NoNewFinalizedHeadsThreshold = '45m0s' [Transactions] ForwardersEnabled = false @@ -5629,7 +5629,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '1s' +CacheTimeout = '2s' [HeadTracker] HistoryDepth = 100 @@ -6399,7 +6399,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 2500 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '3s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -6453,7 +6453,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '2s' +CacheTimeout = '4s' [HeadTracker] HistoryDepth = 100 @@ -8363,7 +8363,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 900 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '3s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -8417,7 +8417,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '2s' +CacheTimeout = '4s' [HeadTracker] HistoryDepth = 100 @@ -8773,7 +8773,7 @@ BlockBackfillSkip = false FinalityDepth = 10 FinalityTagEnabled = false LogBackfillBatchSize = 1000 -LogPollInterval = '10s' +LogPollInterval = '6s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -8827,7 +8827,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '5s' +CacheTimeout = '10s' [HeadTracker] HistoryDepth = 100 @@ -9705,7 +9705,7 @@ ChainType = 'optimismBedrock' FinalityDepth = 900 FinalityTagEnabled = true LogBackfillBatchSize = 1000 -LogPollInterval = '5s' +LogPollInterval = '3s' LogKeepBlocksDepth = 100000 LogPrunePageSize = 10000 BackupLogPollerBlockDelay = 100 @@ -9759,7 +9759,7 @@ CheckInclusionPercentile = 90 TransactionPercentile = 60 [GasEstimator.FeeHistory] -CacheTimeout = '2s' +CacheTimeout = '4s' [HeadTracker] HistoryDepth = 100 diff --git a/go.mod b/go.mod index 69b064f3e8..e184e443e5 100644 --- a/go.mod +++ b/go.mod @@ -73,7 +73,7 @@ require ( github.com/scylladb/go-reflectx v1.0.1 github.com/shirou/gopsutil/v3 v3.24.3 github.com/shopspring/decimal v1.4.0 - github.com/smartcontractkit/chain-selectors v1.0.28 + github.com/smartcontractkit/chain-selectors v1.0.30 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 diff --git a/go.sum b/go.sum index 62364b470c..1f2c17d9ae 100644 --- a/go.sum +++ b/go.sum @@ -1034,8 +1034,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartcontractkit/chain-selectors v1.0.28 h1:oY4/X4MJTUptVo0mG21xYYfni/78iqnqyS7LddQGeVo= -github.com/smartcontractkit/chain-selectors v1.0.28/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.30 h1:jk+xVRocgQ/uvKLSd1JzeHJ/v+EKu1BjrreaSGqKzjo= +github.com/smartcontractkit/chain-selectors v1.0.30/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index daaf79a29e..a3a0f3abd2 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -32,7 +32,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/shopspring/decimal v1.4.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chain-selectors v1.0.28 + github.com/smartcontractkit/chain-selectors v1.0.30 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index d7e57df976..ff4de1e4b0 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1417,8 +1417,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/smartcontractkit/chain-selectors v1.0.28 h1:oY4/X4MJTUptVo0mG21xYYfni/78iqnqyS7LddQGeVo= -github.com/smartcontractkit/chain-selectors v1.0.28/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.30 h1:jk+xVRocgQ/uvKLSd1JzeHJ/v+EKu1BjrreaSGqKzjo= +github.com/smartcontractkit/chain-selectors v1.0.30/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index f1d775878b..df2c44f105 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -386,7 +386,7 @@ require ( github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/smartcontractkit/chain-selectors v1.0.28 // indirect + github.com/smartcontractkit/chain-selectors v1.0.30 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 30c4d3c4bc..3745234553 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1393,8 +1393,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/smartcontractkit/chain-selectors v1.0.28 h1:oY4/X4MJTUptVo0mG21xYYfni/78iqnqyS7LddQGeVo= -github.com/smartcontractkit/chain-selectors v1.0.28/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.30 h1:jk+xVRocgQ/uvKLSd1JzeHJ/v+EKu1BjrreaSGqKzjo= +github.com/smartcontractkit/chain-selectors v1.0.30/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925085218-aded1b263ecc h1:ALbyaoRzUSXQ2NhGFKVOyJqO22IB5yQjhjKWbIZGbrI=