diff --git a/core/capabilities/ccip/ccip_integration_tests/helpers.go b/core/capabilities/ccip/ccip_integration_tests/helpers.go index 25baddfb48e..03b35744d81 100644 --- a/core/capabilities/ccip/ccip_integration_tests/helpers.go +++ b/core/capabilities/ccip/ccip_integration_tests/helpers.go @@ -8,14 +8,6 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink-ccip/chainconfig" - "github.com/smartcontractkit/chainlink-ccip/pluginconfig" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" - "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3" - "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccip_integration_tests/integrationhelpers" - cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" @@ -24,8 +16,16 @@ import ( confighelper2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper" + "github.com/smartcontractkit/chainlink-ccip/chainconfig" + "github.com/smartcontractkit/chainlink-ccip/pluginconfig" + commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3" + + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccip_integration_tests/integrationhelpers" + cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ccip_config" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/maybe_revert_message_receiver" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/mock_rmn_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/nonce_manager" @@ -503,6 +503,7 @@ func (h *homeChain) AddDON( schedule, oracles, encodedOffchainConfig, + nil, MaxDurationQuery, MaxDurationObservation, MaxDurationShouldAcceptAttestedReport, diff --git a/core/capabilities/ccip/delegate.go b/core/capabilities/ccip/delegate.go index 84f3e7c1b76..b3f5f47713d 100644 --- a/core/capabilities/ccip/delegate.go +++ b/core/capabilities/ccip/delegate.go @@ -278,7 +278,7 @@ func (d *Delegate) getHomeChainContractReader( } reader, err := evm.NewChainReaderService( - context.Background(), + ctx, d.lggr, homeChain.LogPoller(), homeChain.HeadTracker(), diff --git a/core/capabilities/ccip/ocrimpls/config_digester.go b/core/capabilities/ccip/ocrimpls/config_digester.go index ef0c5e7ca32..5bbaf590717 100644 --- a/core/capabilities/ccip/ocrimpls/config_digester.go +++ b/core/capabilities/ccip/ocrimpls/config_digester.go @@ -1,6 +1,10 @@ package ocrimpls -import "github.com/smartcontractkit/libocr/offchainreporting2plus/types" +import ( + "context" + + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" +) type configDigester struct { d types.ConfigDigest @@ -11,12 +15,12 @@ func NewConfigDigester(d types.ConfigDigest) *configDigester { } // ConfigDigest implements types.OffchainConfigDigester. -func (c *configDigester) ConfigDigest(types.ContractConfig) (types.ConfigDigest, error) { +func (c *configDigester) ConfigDigest(context.Context, types.ContractConfig) (types.ConfigDigest, error) { return c.d, nil } // ConfigDigestPrefix implements types.OffchainConfigDigester. -func (c *configDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error) { +func (c *configDigester) ConfigDigestPrefix(ctx context.Context) (types.ConfigDigestPrefix, error) { return types.ConfigDigestPrefixCCIPMultiRole, nil } diff --git a/core/capabilities/ccip/ocrimpls/contract_transmitter.go b/core/capabilities/ccip/ocrimpls/contract_transmitter.go index fd8e206d0e3..d3ca35bbe83 100644 --- a/core/capabilities/ccip/ocrimpls/contract_transmitter.go +++ b/core/capabilities/ccip/ocrimpls/contract_transmitter.go @@ -113,7 +113,7 @@ func NewExecContractTransmitter[RI any]( } // FromAccount implements ocr3types.ContractTransmitter. -func (c *commitTransmitter[RI]) FromAccount() (ocrtypes.Account, error) { +func (c *commitTransmitter[RI]) FromAccount(context.Context) (ocrtypes.Account, error) { return c.fromAccount, nil } diff --git a/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go b/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go index eae7abae9d5..6bf85192741 100644 --- a/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go +++ b/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go @@ -7,6 +7,7 @@ import ( "testing" "time" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls" cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" @@ -103,6 +104,7 @@ func testTransmitter( expectedSigsEnabled bool, report []byte, ) { + ctx := tests.Context(t) uni := newTestUniverse[[]byte](t, nil) c, err := uni.wrapper.LatestConfigDetails(nil, pluginType) @@ -125,7 +127,7 @@ func testTransmitter( seqNr := uint64(1) attributedSigs := uni.SignReport(t, configDigest, rwi, seqNr) - account, err := uni.transmitterWithSigs.FromAccount() + account, err := uni.transmitterWithSigs.FromAccount(ctx) require.NoError(t, err, "failed to get from account") require.Equal(t, ocrtypes.Account(uni.transmitters[0].Hex()), account, "from account mismatch") if withSigs { diff --git a/core/capabilities/ccip/oraclecreator/plugin.go b/core/capabilities/ccip/oraclecreator/plugin.go index 9374f8fe9fd..dd1e4482f58 100644 --- a/core/capabilities/ccip/oraclecreator/plugin.go +++ b/core/capabilities/ccip/oraclecreator/plugin.go @@ -469,7 +469,9 @@ func (ofc offChainConfig) isValid() bool { func defaultLocalConfig() ocrtypes.LocalConfig { return ocrtypes.LocalConfig{ - BlockchainTimeout: 10 * time.Second, + DefaultMaxDurationInitialization: 30 * time.Second, + BlockchainTimeout: 10 * time.Second, + ContractConfigLoadTimeout: 10 * time.Second, // Config tracking is handled by the launcher, since we're doing blue-green // deployments we're not going to be using OCR's built-in config switching, // which always shuts down the previous instance. diff --git a/core/capabilities/integration_tests/mock_libocr.go b/core/capabilities/integration_tests/mock_libocr.go index 14ccdce6000..7a046296283 100644 --- a/core/capabilities/integration_tests/mock_libocr.go +++ b/core/capabilities/integration_tests/mock_libocr.go @@ -121,7 +121,7 @@ func (m *mockLibOCR) simulateProtocolRound(ctx context.Context) error { var outcomes []ocr3types.Outcome for _, node := range m.nodes { - outcome, err2 := node.Outcome(m.outcomeCtx, query, observations) + outcome, err2 := node.Outcome(ctx, m.outcomeCtx, query, observations) if err2 != nil { return fmt.Errorf("failed to get outcome: %w", err) } @@ -140,7 +140,7 @@ func (m *mockLibOCR) simulateProtocolRound(ctx context.Context) error { } } - reports, err := leader.Reports(0, outcomes[0]) + reports, err := leader.Reports(ctx, 0, outcomes[0]) if err != nil { return fmt.Errorf("failed to get reports: %w", err) } @@ -148,7 +148,7 @@ func (m *mockLibOCR) simulateProtocolRound(ctx context.Context) error { // create signatures var signatures []types.AttributedOnchainSignature for i, node := range m.nodes { - sig, err := node.key.Sign(types.ReportContext{}, report.Report) + sig, err := node.key.Sign(types.ReportContext{}, report.ReportWithInfo.Report) if err != nil { return fmt.Errorf("failed to sign report: %w", err) } @@ -160,7 +160,7 @@ func (m *mockLibOCR) simulateProtocolRound(ctx context.Context) error { } for _, node := range m.nodes { - accept, err := node.ShouldAcceptAttestedReport(ctx, m.seqNr, report) + accept, err := node.ShouldAcceptAttestedReport(ctx, m.seqNr, report.ReportWithInfo) if err != nil { return fmt.Errorf("failed to check if report should be accepted: %w", err) } @@ -168,7 +168,7 @@ func (m *mockLibOCR) simulateProtocolRound(ctx context.Context) error { continue } - transmit, err := node.ShouldTransmitAcceptedReport(ctx, m.seqNr, report) + transmit, err := node.ShouldTransmitAcceptedReport(ctx, m.seqNr, report.ReportWithInfo) if err != nil { return fmt.Errorf("failed to check if report should be transmitted: %w", err) } @@ -186,7 +186,7 @@ func (m *mockLibOCR) simulateProtocolRound(ctx context.Context) error { selectedSignatures[i] = signatures[indices[i]] } - err = node.Transmit(ctx, types.ConfigDigest{}, 0, report, selectedSignatures) + err = node.Transmit(ctx, types.ConfigDigest{}, 0, report.ReportWithInfo, selectedSignatures) if err != nil { return fmt.Errorf("failed to transmit report: %w", err) } diff --git a/core/capabilities/integration_tests/setup.go b/core/capabilities/integration_tests/setup.go index f419c05e6c3..3521757c66b 100644 --- a/core/capabilities/integration_tests/setup.go +++ b/core/capabilities/integration_tests/setup.go @@ -20,19 +20,19 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" ocrTypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/feeds_consumer" - commoncap "github.com/smartcontractkit/chainlink-common/pkg/capabilities" "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3" "github.com/smartcontractkit/chainlink-common/pkg/capabilities/datastreams" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" coretypes "github.com/smartcontractkit/chainlink-common/pkg/types/core" v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/capabilities" remotetypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/feeds_consumer" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -169,7 +169,7 @@ func createDons(ctx context.Context, t *testing.T, lggr logger.Logger, reportsSi repConfig := ocr3types.ReportingPluginConfig{ F: int(workflowDon.F), } - plugin, _, err := pluginFactory.NewReportingPlugin(repConfig) + plugin, _, err := pluginFactory.NewReportingPlugin(ctx, repConfig) require.NoError(t, err) transmitter := ocr3.NewContractTransmitter(lggr, capabilityRegistry, "") @@ -331,8 +331,9 @@ func newFeedID(t *testing.T) string { } func newReport(t *testing.T, feedID [32]byte, price *big.Int, timestamp int64) []byte { + ctx := tests.Context(t) v3Codec := reportcodec.NewReportCodec(feedID, logger.TestLogger(t)) - raw, err := v3Codec.BuildReport(v3.ReportFields{ + raw, err := v3Codec.BuildReport(ctx, v3.ReportFields{ BenchmarkPrice: price, Timestamp: uint32(timestamp), Bid: big.NewInt(0), diff --git a/core/capabilities/streams/codec_test.go b/core/capabilities/streams/codec_test.go index 02ec474fec9..13f4f299f8c 100644 --- a/core/capabilities/streams/codec_test.go +++ b/core/capabilities/streams/codec_test.go @@ -14,6 +14,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/capabilities/datastreams" v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink-common/pkg/values" "github.com/smartcontractkit/chainlink/v2/core/capabilities/streams" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -109,8 +110,9 @@ func newFeedID(t *testing.T) ([32]byte, string) { } func newReport(t *testing.T, feedID [32]byte, price *big.Int, timestamp int64) []byte { + ctx := tests.Context(t) v3Codec := reportcodec.NewReportCodec(feedID, logger.TestLogger(t)) - raw, err := v3Codec.BuildReport(v3.ReportFields{ + raw, err := v3Codec.BuildReport(ctx, v3.ReportFields{ BenchmarkPrice: price, Timestamp: uint32(timestamp), ValidFromTimestamp: uint32(timestamp), diff --git a/core/chains/evm/log/helpers_test.go b/core/chains/evm/log/helpers_test.go index df0d54680cd..45248b83947 100644 --- a/core/chains/evm/log/helpers_test.go +++ b/core/chains/evm/log/helpers_test.go @@ -97,7 +97,7 @@ func newBroadcasterHelperWithEthClient(t *testing.T, ethClient evmclient.Client, lb := log.NewTestBroadcaster(orm, ethClient, config.EVM(), lggr, highestSeenHead, mailMon) kst := cltest.NewKeyStore(t, db) - cc := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{ + chainsAndConfig := evmtest.NewLegacyChainsAndConfig(t, evmtest.TestChainOpts{ Client: ethClient, GeneralConfig: globalConfig, DB: db, @@ -107,10 +107,11 @@ func newBroadcasterHelperWithEthClient(t *testing.T, ethClient evmclient.Client, }) m := make(map[string]legacyevm.Chain) - for _, r := range cc.Slice() { - m[r.Chain().ID().String()] = r.Chain() + for _, r := range chainsAndConfig.Slice() { + m[r.ID().String()] = r } - legacyChains := legacyevm.NewLegacyChains(m, cc.AppConfig().EVMConfigs()) + + legacyChains := chainsAndConfig.NewLegacyChains() pipelineHelper := cltest.NewJobPipelineV2(t, globalConfig.WebServer(), globalConfig.JobPipeline(), legacyChains, db, kst, nil, nil) return &broadcasterHelper{ diff --git a/core/chains/legacyevm/chain.go b/core/chains/legacyevm/chain.go index f826e9576c1..496994c29d7 100644 --- a/core/chains/legacyevm/chain.go +++ b/core/chains/legacyevm/chain.go @@ -131,27 +131,12 @@ type AppConfig interface { toml.HasEVMConfigs } -type ChainRelayExtenderConfig struct { +type ChainRelayOpts struct { Logger logger.Logger KeyStore keystore.Eth ChainOpts } -func (c ChainRelayExtenderConfig) Validate() error { - err := c.ChainOpts.Validate() - if c.Logger == nil { - err = errors.Join(err, errors.New("nil Logger")) - } - if c.KeyStore == nil { - err = errors.Join(err, errors.New("nil Keystore")) - } - - if err != nil { - err = fmt.Errorf("invalid ChainRelayerExtenderConfig: %w", err) - } - return err -} - type ChainOpts struct { AppConfig AppConfig @@ -188,7 +173,7 @@ func (o ChainOpts) Validate() error { return err } -func NewTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainRelayExtenderConfig) (Chain, error) { +func NewTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainRelayOpts) (Chain, error) { err := opts.Validate() if err != nil { return nil, err @@ -203,7 +188,7 @@ func NewTOMLChain(ctx context.Context, chain *toml.EVMConfig, opts ChainRelayExt return newChain(ctx, cfg, chain.Nodes, opts) } -func newChain(ctx context.Context, cfg *evmconfig.ChainScoped, nodes []*toml.Node, opts ChainRelayExtenderConfig) (*chain, error) { +func newChain(ctx context.Context, cfg *evmconfig.ChainScoped, nodes []*toml.Node, opts ChainRelayOpts) (*chain, error) { chainID := cfg.EVM().ChainID() l := opts.Logger var client evmclient.Client diff --git a/core/chains/legacyevm/evm_txm.go b/core/chains/legacyevm/evm_txm.go index ab116749665..dd062acb51c 100644 --- a/core/chains/legacyevm/evm_txm.go +++ b/core/chains/legacyevm/evm_txm.go @@ -22,7 +22,7 @@ func newEvmTxm( client evmclient.Client, lggr logger.Logger, logPoller logpoller.LogPoller, - opts ChainRelayExtenderConfig, + opts ChainRelayOpts, headTracker httypes.HeadTracker, ) (txm txmgr.TxManager, estimator gas.EvmFeeEstimator, diff --git a/core/cmd/shell_local_test.go b/core/cmd/shell_local_test.go index 6f4907a5a6f..79d2b9f07a6 100644 --- a/core/cmd/shell_local_test.go +++ b/core/cmd/shell_local_test.go @@ -43,7 +43,7 @@ import ( "github.com/urfave/cli" ) -func genTestEVMRelayers(t *testing.T, opts legacyevm.ChainRelayExtenderConfig, ks evmrelayer.CSAETHKeystore) *chainlink.CoreRelayerChainInteroperators { +func genTestEVMRelayers(t *testing.T, opts legacyevm.ChainRelayOpts, ks evmrelayer.CSAETHKeystore) *chainlink.CoreRelayerChainInteroperators { f := chainlink.RelayerFactory{ Logger: opts.Logger, LoopRegistry: plugins.NewLoopRegistry(opts.Logger, opts.AppConfig.Tracing(), opts.AppConfig.Telemetry()), @@ -87,7 +87,7 @@ func TestShell_RunNodeWithPasswords(t *testing.T) { lggr := logger.TestLogger(t) - opts := legacyevm.ChainRelayExtenderConfig{ + opts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: keyStore.Eth(), ChainOpts: legacyevm.ChainOpts{ @@ -191,7 +191,7 @@ func TestShell_RunNodeWithAPICredentialsFile(t *testing.T) { ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(10), nil).Maybe() lggr := logger.TestLogger(t) - opts := legacyevm.ChainRelayExtenderConfig{ + opts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: keyStore.Eth(), ChainOpts: legacyevm.ChainOpts{ diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index 159ea27e939..66d3ee50ffb 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -69,7 +69,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/static" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -1271,7 +1270,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { kst := cltest.NewKeyStore(t, db) require.NoError(t, kst.Unlock(ctx, cltest.Password)) - cc := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), Client: ethClient, GeneralConfig: cfg}) + chainsAndConfig := evmtest.NewLegacyChainsAndConfig(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), Client: ethClient, GeneralConfig: cfg}) b41 := evmtypes.Block{ Number: 41, @@ -1327,8 +1326,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { ethClient.On("HeadByHash", mock.Anything, h41.Hash).Return(&h41, nil).Maybe() ethClient.On("HeadByHash", mock.Anything, h42.Hash).Return(&h42, nil).Maybe() - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(cc) - for _, re := range cc.Slice() { + for _, re := range chainsAndConfig.Slice() { servicetest.Run(t, re) } var newHeads evmtestutils.RawSub[*evmtypes.Head] @@ -1338,6 +1336,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { t.Fatal("timed out waiting for app to subscribe") } + legacyChains := chainsAndConfig.NewLegacyChains() chain := evmtest.MustGetDefaultChain(t, legacyChains) estimator := chain.GasEstimator() gasPrice, gasLimit, err := estimator.GetFee(testutils.Context(t), nil, 500_000, maxGasPrice, nil, nil) diff --git a/core/internal/testutils/evmtest/evmtest.go b/core/internal/testutils/evmtest/evmtest.go index 40f5eee994f..5d8a110cdd3 100644 --- a/core/internal/testutils/evmtest/evmtest.go +++ b/core/internal/testutils/evmtest/evmtest.go @@ -64,19 +64,26 @@ type TestChainOpts struct { GasEstimator gas.EvmFeeEstimator } -// NewChainRelayExtenders returns a simple chain collection with one chain and +// NewLegacyChainsAndConfig returns a simple chain collection with one chain and // allows to mock client/config on that chain -func NewChainRelayExtenders(t testing.TB, testopts TestChainOpts) *evmrelay.ChainRelayerExtenders { - opts := NewChainRelayExtOpts(t, testopts) - cc, err := evmrelay.NewChainRelayerExtenders(testutils.Context(t), opts) +func NewLegacyChainsAndConfig(t testing.TB, testopts TestChainOpts) *evmrelay.LegacyChainsAndConfig { + opts := NewChainOpts(t, testopts) + cc, err := evmrelay.NewLegacyChainsAndConfig(testutils.Context(t), opts) require.NoError(t, err) return cc } -func NewChainRelayExtOpts(t testing.TB, testopts TestChainOpts) legacyevm.ChainRelayExtenderConfig { +func NewLegacyChains(t testing.TB, testopts TestChainOpts) *legacyevm.LegacyChains { + opts := NewChainOpts(t, testopts) + cc, err := evmrelay.NewLegacyChainsAndConfig(testutils.Context(t), opts) + require.NoError(t, err) + return cc.NewLegacyChains() +} + +func NewChainOpts(t testing.TB, testopts TestChainOpts) legacyevm.ChainRelayOpts { require.NotNil(t, testopts.KeyStore) lggr := logger.TestLogger(t) - opts := legacyevm.ChainRelayExtenderConfig{ + opts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: testopts.KeyStore, ChainOpts: legacyevm.ChainOpts{ diff --git a/core/scripts/chaincli/handler/keeper_deployer.go b/core/scripts/chaincli/handler/keeper_deployer.go index 9e5a791d6c4..f0689a176de 100644 --- a/core/scripts/chaincli/handler/keeper_deployer.go +++ b/core/scripts/chaincli/handler/keeper_deployer.go @@ -169,6 +169,7 @@ func (d *v20KeeperDeployer) SetKeepers(ctx context.Context, opts *bind.TransactO S, // s []int, oracleIdentities, // oracles []OracleIdentityExtra, offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 1600*time.Millisecond, // maxDurationObservation time.Duration, 800*time.Millisecond, // maxDurationReport time.Duration, sum of MaxDurationQuery/Observation/Report must be less than DeltaProgress @@ -312,6 +313,7 @@ func (d *v21KeeperDeployer) SetKeepers(ctx context.Context, opts *bind.TransactO S, // s []int, oracleIdentities, // oracles []OracleIdentityExtra, offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 1600*time.Millisecond, // maxDurationObservation time.Duration, 20*time.Millisecond, // maxDurationShouldAcceptFinalizedReport time.Duration, diff --git a/core/scripts/functions/src/generate_ocr2_config_cmd.go b/core/scripts/functions/src/generate_ocr2_config_cmd.go index 7ac3b68d11d..11fd2198a8e 100644 --- a/core/scripts/functions/src/generate_ocr2_config_cmd.go +++ b/core/scripts/functions/src/generate_ocr2_config_cmd.go @@ -251,6 +251,7 @@ func (g *generateOCR2Config) Run(args []string) { cfg.TransmissionSchedule, identities, reportingPluginConfigBytes, + nil, time.Duration(cfg.MaxDurationQueryMillis)*time.Millisecond, time.Duration(cfg.MaxDurationObservationMillis)*time.Millisecond, time.Duration(cfg.MaxDurationReportMillis)*time.Millisecond, diff --git a/core/scripts/go.mod b/core/scripts/go.mod index d79e372db4f..5385e450c26 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -21,10 +21,10 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 - github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf + github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 - github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 + github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 @@ -116,7 +116,7 @@ require ( github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/esote/minmaxheap v1.0.0 // indirect github.com/ethereum/c-kzg-4844 v0.4.0 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -271,15 +271,15 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shirou/gopsutil/v3 v3.24.3 // indirect github.com/smartcontractkit/chain-selectors v1.0.23 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6 // 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 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 // indirect + github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // 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 + github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 // indirect + github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 // indirect github.com/smartcontractkit/wsrpc v0.8.2 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect @@ -341,8 +341,8 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect - golang.org/x/mod v0.20.0 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -350,7 +350,7 @@ require ( golang.org/x/term v0.24.0 // indirect golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.25.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect @@ -374,7 +374,7 @@ require ( replace ( // until merged upstream: https://github.com/omissis/go-jsonschema/pull/264 - github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-rtinianov + github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-smallSizedInts // replicating the replace directive on cosmos SDK github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 9c85a9ea4db..d99394a39a9 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -357,8 +357,8 @@ github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+ne github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -581,8 +581,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -1079,30 +1079,30 @@ 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.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnjjIQAEBnutCtksPzVDY= github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= -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-ccip v0.0.0-20240916150615-85b8aa5fa7e6 h1:cbHlV2CSphQ+ghDye21M8ym0aAO/Y649H2Mg60M2AuE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf h1:1AlTUkT5D8HmvU9bwDoIN54/EFyOnRBl7gnXZVrYXEA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf/go.mod h1:l8NTByXUdGGJX+vyKYI6yX1/HIpM14F8Wm9BkU3Q4Qo= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2/go.mod h1:rNhNSrrRMvkgAm5SA6bNTdh2340bTQQZdUVNtZ2o2bk= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f h1:p4p3jBT91EQyLuAMvHD+zNJsuAYI/QjJbzuGUJ7wIgg= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f/go.mod h1:FLlWBt2hwiMVgt9AcSo6wBJYIRd/nsc8ENbV1Wir1bw= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 h1:JPs35oSO07PK3Qv7Kyv0GJHVLacIE1IkrvefaPyBjKs= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664/go.mod h1:iJ9DKYo0F64ue7IogAIELwU2DfrhEAh76eSmZOilT8A= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae h1:d+B8y2Nd/PrnPMNoaSPn3eDgUgxcVcIqAxGrvYu/gGw= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae/go.mod h1:ec/a20UZ7YRK4oxJcnTBFzp1+DBcJcwqEaerUMsktMs= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc h1:7HsLUzUQRIbfCukKvYU9XCNq2UEln1GwogHpUhy+a/k= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc/go.mod h1:4+dzRyvI4lVZe6OJxO9Z+wd6YhJKPiHYL1nTATkEIWg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f h1:pNhHmwBpb8YFiwd7d4D4U7sVgK1LSQHpoacxfQyDXpg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f/go.mod h1:q7AATJ7zSPB86ORu0pyu7ySAhCxJD04scKJnFztTUWU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 h1:gA5i53h0RvT3Nip2m5V6GFxXvmKc7b/f5un8ZAMD8Gw= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5/go.mod h1:llM0s/N/PAE3LOaZ6kiC7nzw9/0KPJoiziGgLraOoS0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 h1:/Isyny7N6lRayJwIn4cY9TYmT9UdxvsxqWiq12rzAeg= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7/go.mod h1:25aVOs3Z3Un/Iux8Ak9y3dIVqVTtk7eR85dhynmWxiM= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 h1:+f25XTEd4VQu/a7wV7ynVxepKK84Zvkia5BRVqBrlVk= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0/go.mod h1:hRZixlXa4dtA1J3iZPhleWenxHlEro49ZDK3j73MlnM= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 h1:MNuAkek6lUrq3r0f1ixdFHRjO6NcQqauT7oWn87v/EQ= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350/go.mod h1:kkGccKLSkEm+SAqIZdB2mC1/fYaqj/o/n5zt3kDIWMo= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb h1:dy265V6XxfVjgMGFq6VZfo7KsDbl/7Q05+lUOZyOPNA= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb/go.mod h1:CFiZ6DGbcMKjvxOmr75cwCi5LZgsIbgYgmISZ43mSKM= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a h1:grNwfsQUl5eY7fRxNbpPFPcHlq4bTNF7TgiZjoJjtBU= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a/go.mod h1:WnqjsdxI5x1V0Lpov0QEEHvW/f2H64eAQpE6B/3KjnI= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac h1:jo3kFDcpF4/hfBLNMhLL7bvjdnJkEaUhbxXIFiC9lVs= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 h1:yyzB+d9AaOqgtoKYW+Uiak7/HMX8aK16yEWtnhaEnOA= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:tEwKLdONxgNpde1JA7/XxmIAq3wqD6efSOX/UWtqkZQ= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 h1:0JAy7OlCERnznorGxooCN5rwzEYvHnR4Y6IqVBqfxxY= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:JjP0TZ026rjAlFuj3SMcC/WO93SBV5vbMr8wTbFpaIg= github.com/smartcontractkit/wsrpc v0.8.2 h1:XB/xcn/MMseHW+8JE8+a/rceA86ck7Ur6cEa9LiUC8M= github.com/smartcontractkit/wsrpc v0.8.2/go.mod h1:2u/wfnhl5R4RlSXseN4n6HHIWk8w1Am3AT6gWftQbNg= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1376,8 +1376,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1402,8 +1402,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1614,8 +1614,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go index d9280ffe243..b4867da0266 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config.go @@ -181,6 +181,7 @@ func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKe cfg.TransmissionSchedule, identities, nil, // empty plugin config + nil, time.Duration(cfg.MaxDurationQueryMillis)*time.Millisecond, time.Duration(cfg.MaxDurationObservationMillis)*time.Millisecond, time.Duration(cfg.MaxDurationAcceptMillis)*time.Millisecond, diff --git a/core/services/blockhashstore/bhs_test.go b/core/services/blockhashstore/bhs_test.go index b2e978293df..7e395da74c0 100644 --- a/core/services/blockhashstore/bhs_test.go +++ b/core/services/blockhashstore/bhs_test.go @@ -19,7 +19,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/blockhashstore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -30,8 +29,7 @@ func TestStoreRotatesFromAddresses(t *testing.T) { cfg := configtest.NewTestGeneralConfig(t) kst := cltest.NewKeyStore(t, db) require.NoError(t, kst.Unlock(ctx, cltest.Password)) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg, Client: ethClient}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg, Client: ethClient}) chain, err := legacyChains.Get(cltest.FixtureChainID.String()) require.NoError(t, err) lggr := logger.TestLogger(t) diff --git a/core/services/blockhashstore/delegate_test.go b/core/services/blockhashstore/delegate_test.go index 6bc93546605..0beaff9249d 100644 --- a/core/services/blockhashstore/delegate_test.go +++ b/core/services/blockhashstore/delegate_test.go @@ -26,7 +26,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestDelegate_JobType(t *testing.T) { @@ -61,7 +60,7 @@ func createTestDelegate(t *testing.T) (*blockhashstore.Delegate, *testData) { lp.On("RegisterFilter", mock.Anything, mock.Anything).Return(nil) lp.On("LatestBlock", mock.Anything).Return(logpoller.LogPollerBlock{}, nil) - relayExtenders := evmtest.NewChainRelayExtenders( + legacyChains := evmtest.NewLegacyChains( t, evmtest.TestChainOpts{ DB: db, @@ -71,7 +70,6 @@ func createTestDelegate(t *testing.T) (*blockhashstore.Delegate, *testData) { LogPoller: lp, }, ) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) return blockhashstore.NewDelegate(cfg, lggr, legacyChains, kst), &testData{ ethClient: ethClient, ethKeyStore: kst, diff --git a/core/services/chainlink/relayer_chain_interoperators.go b/core/services/chainlink/relayer_chain_interoperators.go index 582dd61677c..8197b12ec7b 100644 --- a/core/services/chainlink/relayer_chain_interoperators.go +++ b/core/services/chainlink/relayer_chain_interoperators.go @@ -8,10 +8,10 @@ import ( "sync" "github.com/smartcontractkit/chainlink-common/pkg/loop" - "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/relay" "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos" "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/adapters" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/chains" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" @@ -140,7 +140,6 @@ func InitCosmos(ctx context.Context, factory RelayerFactory, config CosmosFactor return fmt.Errorf("failed to setup Cosmos relayer: %w", err2) } legacyMap := make(map[string]cosmos.Chain) - for id, a := range adapters { op.srvs = append(op.srvs, a) op.loopRelayers[id] = a @@ -420,25 +419,24 @@ func NewLegacyCosmos(m map[string]adapters.Chain) *LegacyCosmos { return chains.NewChainsKV[adapters.Chain](m) } -type CosmosLoopRelayerChainer interface { +type LOOPRelayAdapter interface { loop.Relayer Chain() adapters.Chain } -type CosmosLoopRelayerChain struct { +type loopRelayAdapter struct { loop.Relayer chain adapters.Chain } -func NewCosmosLoopRelayerChain(r *cosmos.Relayer, s adapters.Chain) *CosmosLoopRelayerChain { - ra := relay.NewServerAdapter(r, s) - return &CosmosLoopRelayerChain{ - Relayer: ra, - chain: s, +func NewCosmosLOOPRelayerChain(r *cosmos.Relayer) *loopRelayAdapter { + return &loopRelayAdapter{ + Relayer: relay.NewServerAdapter(r), + chain: r.Chain(), } } -func (r *CosmosLoopRelayerChain) Chain() adapters.Chain { +func (r *loopRelayAdapter) Chain() adapters.Chain { return r.chain } -var _ CosmosLoopRelayerChainer = &CosmosLoopRelayerChain{} +var _ LOOPRelayAdapter = &loopRelayAdapter{} diff --git a/core/services/chainlink/relayer_factory.go b/core/services/chainlink/relayer_factory.go index 11e477a54f6..bbd9f283add 100644 --- a/core/services/chainlink/relayer_factory.go +++ b/core/services/chainlink/relayer_factory.go @@ -9,7 +9,6 @@ import ( "github.com/pelletier/go-toml/v2" "github.com/smartcontractkit/chainlink-common/pkg/loop" - "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/relay" "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" "github.com/smartcontractkit/chainlink-common/pkg/types" coretypes "github.com/smartcontractkit/chainlink-common/pkg/types/core" @@ -20,12 +19,13 @@ import ( pkgstarknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink" starkchain "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/chain" starkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - corerelay "github.com/smartcontractkit/chainlink/v2/core/services/relay" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/services/relay/dummy" evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc" @@ -55,31 +55,27 @@ type EVMFactoryConfig struct { coreconfig.MercuryTransmitter } -func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (map[types.RelayID]evmrelay.LoopRelayAdapter, error) { +func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (map[types.RelayID]evmrelay.LOOPRelayAdapter, error) { // TODO impl EVM loop. For now always 'fallback' to an adapter and embedded chain - relayers := make(map[types.RelayID]evmrelay.LoopRelayAdapter) + relayers := make(map[types.RelayID]evmrelay.LOOPRelayAdapter) lggr := r.Logger.Named("EVM") // override some common opts with the factory values. this seems weird... maybe other signatures should change, or this should take a different type... - ccOpts := legacyevm.ChainRelayExtenderConfig{ + ccOpts := legacyevm.ChainRelayOpts{ Logger: lggr, KeyStore: config.CSAETHKeystore.Eth(), ChainOpts: config.ChainOpts, } - evmRelayExtenders, err := evmrelay.NewChainRelayerExtenders(ctx, ccOpts) + legacyChains, err := evmrelay.NewLegacyChains(ctx, ccOpts) if err != nil { return nil, err } - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(evmRelayExtenders) - for _, ext := range evmRelayExtenders.Slice() { - relayID := types.RelayID{Network: corerelay.NetworkEVM, ChainID: ext.Chain().ID().String()} - chain, err2 := legacyChains.Get(relayID.ChainID) - if err2 != nil { - return nil, err2 - } + for _, chain := range legacyChains { + relayID := types.RelayID{Network: relay.NetworkEVM, ChainID: chain.ID().String()} + chain := chain relayerOpts := evmrelay.RelayerOpts{ DS: ccOpts.DS, @@ -89,13 +85,13 @@ func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (m CapabilitiesRegistry: r.CapabilitiesRegistry, HTTPClient: r.HTTPClient, } - relayer, err2 := evmrelay.NewRelayer(lggr.Named(relayID.ChainID), chain, relayerOpts) + relayer, err2 := evmrelay.NewRelayer(ctx, lggr.Named(relayID.ChainID), chain, relayerOpts) if err2 != nil { err = errors.Join(err, err2) continue } - relayers[relayID] = evmrelay.NewLoopRelayServerAdapter(relayer, ext) + relayers[relayID] = evmrelay.NewLOOPRelayAdapter(relayer) } // always return err because it is accumulating individual errors @@ -117,7 +113,7 @@ func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solcfg.TOMLConf unique := make(map[string]struct{}) // create one relayer per chain id for _, chainCfg := range chainCfgs { - relayID := types.RelayID{Network: corerelay.NetworkSolana, ChainID: *chainCfg.ChainID} + relayID := types.RelayID{Network: relay.NetworkSolana, ChainID: *chainCfg.ChainID} _, alreadyExists := unique[relayID.Name()] if alreadyExists { return nil, fmt.Errorf("duplicate chain definitions for %s", relayID.Name()) @@ -166,7 +162,7 @@ func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solcfg.TOMLConf if err != nil { return nil, err } - solanaRelayers[relayID] = relay.NewServerAdapter(solana.NewRelayer(lggr, chain, r.CapabilitiesRegistry), chain) + solanaRelayers[relayID] = relay.NewServerAdapter(solana.NewRelayer(lggr, chain, r.CapabilitiesRegistry)) } } return solanaRelayers, nil @@ -190,7 +186,7 @@ func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs starkcfg.TO unique := make(map[string]struct{}) // create one relayer per chain id for _, chainCfg := range chainCfgs { - relayID := types.RelayID{Network: corerelay.NetworkStarkNet, ChainID: *chainCfg.ChainID} + relayID := types.RelayID{Network: relay.NetworkStarkNet, ChainID: *chainCfg.ChainID} _, alreadyExists := unique[relayID.Name()] if alreadyExists { return nil, fmt.Errorf("duplicate chain definitions for %s", relayID.Name()) @@ -241,7 +237,7 @@ func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs starkcfg.TO return nil, err } - starknetRelayers[relayID] = relay.NewServerAdapter(pkgstarknet.NewRelayer(lggr, chain, r.CapabilitiesRegistry), chain) + starknetRelayers[relayID] = relay.NewServerAdapter(pkgstarknet.NewRelayer(lggr, chain, r.CapabilitiesRegistry)) } } return starknetRelayers, nil @@ -271,12 +267,12 @@ func (c CosmosFactoryConfig) Validate() error { return err } -func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[types.RelayID]CosmosLoopRelayerChainer, error) { +func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[types.RelayID]LOOPRelayAdapter, error) { err := config.Validate() if err != nil { return nil, fmt.Errorf("cannot create Cosmos relayer: %w", err) } - relayers := make(map[types.RelayID]CosmosLoopRelayerChainer) + relayers := make(map[types.RelayID]LOOPRelayAdapter) var ( cosmosLggr = r.Logger.Named("Cosmos") @@ -285,7 +281,7 @@ func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[types.RelayI // create one relayer per chain id for _, chainCfg := range config.TOMLConfigs { - relayID := types.RelayID{Network: corerelay.NetworkCosmos, ChainID: *chainCfg.ChainID} + relayID := types.RelayID{Network: relay.NetworkCosmos, ChainID: *chainCfg.ChainID} lggr := cosmosLggr.Named(relayID.ChainID) @@ -300,7 +296,7 @@ func (r *RelayerFactory) NewCosmos(config CosmosFactoryConfig) (map[types.RelayI return nil, fmt.Errorf("failed to load Cosmos chain %q: %w", relayID, err) } - relayers[relayID] = NewCosmosLoopRelayerChain(cosmos.NewRelayer(lggr, chain), chain) + relayers[relayID] = NewCosmosLOOPRelayerChain(cosmos.NewRelayer(lggr, chain)) } return relayers, nil } @@ -313,7 +309,7 @@ type AptosFactoryConfig struct { func (r *RelayerFactory) NewAptos(ks keystore.Aptos, chainCfgs RawConfigs) (map[types.RelayID]loop.Relayer, error) { plugin := env.NewPlugin("aptos") loopKs := &keystore.AptosLooppSigner{Aptos: ks} - return r.NewLOOPRelayer("Aptos", corerelay.NetworkAptos, plugin, loopKs, chainCfgs) + return r.NewLOOPRelayer("Aptos", relay.NetworkAptos, plugin, loopKs, chainCfgs) } func (r *RelayerFactory) NewLOOPRelayer(name string, network string, plugin env.Plugin, ks coretypes.Keystore, chainCfgs RawConfigs) (map[types.RelayID]loop.Relayer, error) { diff --git a/core/services/directrequest/delegate_test.go b/core/services/directrequest/delegate_test.go index 0876031fb9a..cb66dcdb349 100644 --- a/core/services/directrequest/delegate_test.go +++ b/core/services/directrequest/delegate_test.go @@ -34,7 +34,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" pipeline_mocks "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestDelegate_ServicesForSpec(t *testing.T) { @@ -46,10 +45,9 @@ func TestDelegate_ServicesForSpec(t *testing.T) { }) keyStore := cltest.NewKeyStore(t, db) mailMon := servicetest.Run(t, mailboxtest.NewMonitor(t)) - relayerExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, MailMon: mailMon, KeyStore: keyStore.Eth()}) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, MailMon: mailMon, KeyStore: keyStore.Eth()}) lggr := logger.TestLogger(t) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayerExtenders) delegate := directrequest.NewDelegate(lggr, runner, nil, legacyChains, mailMon) t.Run("Spec without DirectRequestSpec", func(t *testing.T) { @@ -86,12 +84,11 @@ func NewDirectRequestUniverseWithConfig(t *testing.T, cfg chainlink.GeneralConfi db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, LogBroadcaster: broadcaster, MailMon: mailMon, KeyStore: keyStore.Eth()}) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, LogBroadcaster: broadcaster, MailMon: mailMon, KeyStore: keyStore.Eth()}) lggr := logger.TestLogger(t) orm := pipeline.NewORM(db, lggr, cfg.JobPipeline().MaxSuccessfulRuns()) btORM := bridges.NewORM(db) jobORM := job.NewORM(db, orm, btORM, keyStore, lggr) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) delegate := directrequest.NewDelegate(lggr, runner, orm, legacyChains, mailMon) jb := cltest.MakeDirectRequestJobSpec(t) diff --git a/core/services/feeds/orm_test.go b/core/services/feeds/orm_test.go index 976465f37f0..cfe6cef37b9 100644 --- a/core/services/feeds/orm_test.go +++ b/core/services/feeds/orm_test.go @@ -23,7 +23,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" "github.com/smartcontractkit/chainlink/v2/core/utils/crypto" ) @@ -1700,12 +1699,12 @@ func createJob(t *testing.T, db *sqlx.DB, externalJobID uuid.UUID) *job.Job { ctx := testutils.Context(t) var ( - config = configtest.NewGeneralConfig(t, nil) - keyStore = cltest.NewKeyStore(t, db) - lggr = logger.TestLogger(t) - pipelineORM = pipeline.NewORM(db, lggr, config.JobPipeline().MaxSuccessfulRuns()) - bridgeORM = bridges.NewORM(db) - relayExtenders = evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) + config = configtest.NewGeneralConfig(t, nil) + keyStore = cltest.NewKeyStore(t, db) + lggr = logger.TestLogger(t) + pipelineORM = pipeline.NewORM(db, lggr, config.JobPipeline().MaxSuccessfulRuns()) + bridgeORM = bridges.NewORM(db) + legacyChains = evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) ) orm := job.NewORM(db, pipelineORM, bridgeORM, keyStore, lggr) require.NoError(t, keyStore.OCR().Add(ctx, cltest.DefaultOCRKey)) @@ -1717,7 +1716,6 @@ func createJob(t *testing.T, db *sqlx.DB, externalJobID uuid.UUID) *job.Job { _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ JobID: externalJobID.String(), diff --git a/core/services/feeds/service_test.go b/core/services/feeds/service_test.go index 9098d439eb2..faa89884049 100644 --- a/core/services/feeds/service_test.go +++ b/core/services/feeds/service_test.go @@ -40,7 +40,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/versioning" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" "github.com/smartcontractkit/chainlink/v2/core/utils/crypto" @@ -186,9 +185,8 @@ func setupTestServiceCfg(t *testing.T, overrideCfg func(c *chainlink.Config, s * gcfg := configtest.NewGeneralConfig(t, overrideCfg) keyStore := new(ksmocks.Master) ethKeyStore := cltest.NewKeyStore(t, db).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: gcfg, + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: gcfg, HeadTracker: headtracker.NullTracker, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) keyStore.On("Eth").Return(ethKeyStore) keyStore.On("CSA").Return(csaKeystore) keyStore.On("P2P").Return(p2pKeystore) diff --git a/core/services/functions/listener_test.go b/core/services/functions/listener_test.go index a1a29bf2500..b04c5c130e7 100644 --- a/core/services/functions/listener_test.go +++ b/core/services/functions/listener_test.go @@ -37,7 +37,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/functions/config" threshold_mocks "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/threshold/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" evmrelay_mocks "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types/mocks" s4_mocks "github.com/smartcontractkit/chainlink/v2/core/services/s4/mocks" @@ -86,8 +85,7 @@ func NewFunctionsListenerUniverse(t *testing.T, timeoutSec int, pruneFrequencySe db := pgtest.NewSqlxDB(t) kst := cltest.NewKeyStore(t, db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, KeyStore: kst.Eth(), LogBroadcaster: broadcaster, MailMon: mailMon}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, Client: ethClient, KeyStore: kst.Eth(), LogBroadcaster: broadcaster, MailMon: mailMon}) chain := legacyChains.Slice()[0] lggr := logger.TestLogger(t) diff --git a/core/services/job/helpers_test.go b/core/services/job/helpers_test.go index 6f9bee66a0c..f801a684643 100644 --- a/core/services/job/helpers_test.go +++ b/core/services/job/helpers_test.go @@ -24,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) @@ -211,8 +210,7 @@ func makeMinimalHTTPOracleSpec(t *testing.T, db *sqlx.DB, cfg chainlink.GeneralC } s := fmt.Sprintf(minimalNonBootstrapTemplate, contractAddress, transmitterAddress, keyBundle, fetchUrl, timeout) keyStore := cltest.NewKeyStore(t, db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: evmtest.NewEthClientMockWithDefaultChain(t), GeneralConfig: cfg, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: evmtest.NewEthClientMockWithDefaultChain(t), GeneralConfig: cfg, KeyStore: keyStore.Eth()}) _, err := ocr.ValidatedOracleSpecToml(cfg, legacyChains, s) require.NoError(t, err) err = toml.Unmarshal([]byte(s), &os) diff --git a/core/services/job/job_orm_test.go b/core/services/job/job_orm_test.go index e65e7fa5e12..14aab17721d 100644 --- a/core/services/job/job_orm_test.go +++ b/core/services/job/job_orm_test.go @@ -43,7 +43,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocrbootstrap" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/relay" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrfcommon" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" @@ -374,8 +373,7 @@ func TestORM_DeleteJob_DeletesAssociatedRecords(t *testing.T) { _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ TransmitterAddress: address.Hex(), DS1BridgeName: bridge.Name.String(), @@ -782,8 +780,7 @@ func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { TransmitterAddress: address.Hex(), JobID: externalJobID.UUID.String(), }) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, spec.Toml()) require.NoError(t, err) @@ -1041,8 +1038,7 @@ func Test_FindJobs(t *testing.T) { _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) jb1, err := ocr.ValidatedOracleSpecToml(config, legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ JobID: uuid.New().String(), @@ -1126,8 +1122,7 @@ func Test_FindJob(t *testing.T) { // Must uniquely name the OCR Specs to properly insert a new job in the job table. externalJobID := uuid.New() _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) job, err := ocr.ValidatedOracleSpecToml(config, legacyChains, testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ JobID: externalJobID.String(), @@ -1358,8 +1353,7 @@ func Test_FindPipelineRuns(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) @@ -1422,8 +1416,7 @@ func Test_PipelineRunsByJobID(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) @@ -1485,8 +1478,7 @@ func Test_FindPipelineRunIDsByJobID(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore) _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) @@ -1600,8 +1592,7 @@ func Test_FindPipelineRunsByIDs(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) @@ -1725,7 +1716,7 @@ func Test_FindJobWithoutSpecErrors(t *testing.T) { jb, err = orm.FindJobWithoutSpecErrors(ctx, jobSpec.ID) require.NoError(t, err) - jbWithErrors, err := orm.FindJobTx(testutils.Context(t), jobSpec.ID) + jbWithErrors, err := orm.FindJob(testutils.Context(t), jobSpec.ID) require.NoError(t, err) assert.Equal(t, len(jb.JobSpecErrors), 0) @@ -1780,8 +1771,7 @@ func Test_CountPipelineRunsByJobID(t *testing.T) { pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.JobPipeline().MaxSuccessfulRuns()) bridgesORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) orm := NewTestORM(t, db, pipelineORM, bridgesORM, keyStore) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}) diff --git a/core/services/job/job_pipeline_orm_integration_test.go b/core/services/job/job_pipeline_orm_integration_test.go index ca6cc6f832e..f26c9431ff5 100644 --- a/core/services/job/job_pipeline_orm_integration_test.go +++ b/core/services/job/job_pipeline_orm_integration_test.go @@ -20,7 +20,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) @@ -156,8 +155,7 @@ func TestPipelineORM_Integration(t *testing.T) { clearJobsDb(t, db) orm := pipeline.NewORM(db, logger.TestLogger(t), cfg.JobPipeline().MaxSuccessfulRuns()) btORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{Client: evmtest.NewEthClientMockWithDefaultChain(t), DB: db, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{Client: evmtest.NewEthClientMockWithDefaultChain(t), DB: db, GeneralConfig: config, KeyStore: ethKeyStore}) runner := pipeline.NewRunner(orm, btORM, config.JobPipeline(), cfg.WebServer(), legacyChains, nil, nil, lggr, nil, nil) jobORM := NewTestORM(t, db, orm, btORM, keyStore) diff --git a/core/services/job/mocks/orm.go b/core/services/job/mocks/orm.go index 7d3e3de7711..15a78abdaf3 100644 --- a/core/services/job/mocks/orm.go +++ b/core/services/job/mocks/orm.go @@ -716,63 +716,6 @@ func (_c *ORM_FindJobIDsWithBridge_Call) RunAndReturn(run func(context.Context, return _c } -// FindJobTx provides a mock function with given fields: ctx, id -func (_m *ORM) FindJobTx(ctx context.Context, id int32) (job.Job, error) { - ret := _m.Called(ctx, id) - - if len(ret) == 0 { - panic("no return value specified for FindJobTx") - } - - var r0 job.Job - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, int32) (job.Job, error)); ok { - return rf(ctx, id) - } - if rf, ok := ret.Get(0).(func(context.Context, int32) job.Job); ok { - r0 = rf(ctx, id) - } else { - r0 = ret.Get(0).(job.Job) - } - - if rf, ok := ret.Get(1).(func(context.Context, int32) error); ok { - r1 = rf(ctx, id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ORM_FindJobTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindJobTx' -type ORM_FindJobTx_Call struct { - *mock.Call -} - -// FindJobTx is a helper method to define mock.On call -// - ctx context.Context -// - id int32 -func (_e *ORM_Expecter) FindJobTx(ctx interface{}, id interface{}) *ORM_FindJobTx_Call { - return &ORM_FindJobTx_Call{Call: _e.mock.On("FindJobTx", ctx, id)} -} - -func (_c *ORM_FindJobTx_Call) Run(run func(ctx context.Context, id int32)) *ORM_FindJobTx_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(int32)) - }) - return _c -} - -func (_c *ORM_FindJobTx_Call) Return(_a0 job.Job, _a1 error) *ORM_FindJobTx_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ORM_FindJobTx_Call) RunAndReturn(run func(context.Context, int32) (job.Job, error)) *ORM_FindJobTx_Call { - _c.Call.Return(run) - return _c -} - // FindJobWithoutSpecErrors provides a mock function with given fields: ctx, id func (_m *ORM) FindJobWithoutSpecErrors(ctx context.Context, id int32) (job.Job, error) { ret := _m.Called(ctx, id) diff --git a/core/services/job/orm.go b/core/services/job/orm.go index d02e0b29200..c73857d55fe 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -47,7 +47,6 @@ type ORM interface { InsertJob(ctx context.Context, job *Job) error CreateJob(ctx context.Context, jb *Job) error FindJobs(ctx context.Context, offset, limit int) ([]Job, int, error) - FindJobTx(ctx context.Context, id int32) (Job, error) FindJob(ctx context.Context, id int32) (Job, error) FindJobByExternalJobID(ctx context.Context, uuid uuid.UUID) (Job, error) FindJobIDByAddress(ctx context.Context, address evmtypes.EIP55Address, evmChainID *big.Big) (int32, error) @@ -951,10 +950,6 @@ func LoadConfigVarsOCR(evmOcrCfg evmconfig.OCR, ocrCfg OCRConfig, os OCROracleSp return LoadConfigVarsLocalOCR(evmOcrCfg, os, ocrCfg), nil } -func (o *orm) FindJobTx(ctx context.Context, id int32) (Job, error) { - return o.FindJob(ctx, id) -} - // FindJob returns job by ID, with all relations preloaded func (o *orm) FindJob(ctx context.Context, id int32) (jb Job, err error) { err = o.findJob(ctx, &jb, "id", id) diff --git a/core/services/job/runner_integration_test.go b/core/services/job/runner_integration_test.go index 0b55b14250e..af3a1f5698d 100644 --- a/core/services/job/runner_integration_test.go +++ b/core/services/job/runner_integration_test.go @@ -44,7 +44,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -84,8 +83,7 @@ func TestRunner(t *testing.T) { require.NoError(t, pipelineORM.Start(ctx)) t.Cleanup(func() { assert.NoError(t, pipelineORM.Close()) }) btORM := bridges.NewORM(db) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) c := clhttptest.NewTestLocalOnlyHTTPClient() runner := pipeline.NewRunner(pipelineORM, btORM, config.JobPipeline(), config.WebServer(), legacyChains, nil, nil, logger.TestLogger(t), c, c) @@ -561,14 +559,13 @@ answer1 [type=median index=0]; c.OCR.CaptureEATelemetry = ptr(tc.specCaptureEATelemetry) }) - relayExtenders = evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains = evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains2 := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) kb, err := keyStore.OCR().Create(ctx) require.NoError(t, err) s := fmt.Sprintf(minimalNonBootstrapTemplate, cltest.NewEIP55Address(), transmitterAddress.Hex(), kb.ID(), "http://blah.com", "") - jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, s) + jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains2, s) require.NoError(t, err) err = toml.Unmarshal([]byte(s), &jb) require.NoError(t, err) @@ -588,7 +585,7 @@ answer1 [type=median index=0]; nil, pw, monitoringEndpoint, - legacyChains, + legacyChains2, lggr, config, servicetest.Run(t, mailboxtest.NewMonitor(t)), diff --git a/core/services/job/spawner_test.go b/core/services/job/spawner_test.go index 86f0324e6a0..9dccd87d006 100644 --- a/core/services/job/spawner_test.go +++ b/core/services/job/spawner_test.go @@ -37,7 +37,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" evmrelayer "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) @@ -66,12 +65,11 @@ func clearDB(t *testing.T, db *sqlx.DB) { } type relayGetter struct { - e evmrelay.EVMChainRelayerExtender r *evmrelayer.Relayer } func (g *relayGetter) Get(id types.RelayID) (loop.Relayer, error) { - return evmrelayer.NewLoopRelayServerAdapter(g.r, g.e), nil + return evmrelayer.NewLOOPRelayAdapter(g.r), nil } func (g *relayGetter) GetIDToRelayerMap() (map[types.RelayID]loop.Relayer, error) { @@ -102,8 +100,7 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { }). Return(nil).Maybe() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, GeneralConfig: config, KeyStore: ethKeyStore}) t.Run("should respect its dependents", func(t *testing.T) { lggr := logger.TestLogger(t) orm := NewTestORM(t, db, pipeline.NewORM(db, lggr, config.JobPipeline().MaxSuccessfulRuns()), bridges.NewORM(db), keyStore) @@ -289,13 +286,11 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { } lggr := logger.TestLogger(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, testopts) - assert.Equal(t, relayExtenders.Len(), 1) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) - chain, err := legacyChains.Get("0") - require.NoError(t, err) + legacyChains := evmtest.NewLegacyChains(t, testopts) + assert.Equal(t, legacyChains.Len(), 1) + chain := evmtest.MustGetDefaultChain(t, legacyChains) - evmRelayer, err := evmrelayer.NewRelayer(lggr, chain, evmrelayer.RelayerOpts{ + evmRelayer, err := evmrelayer.NewRelayer(ctx, lggr, chain, evmrelayer.RelayerOpts{ DS: db, CSAETHKeystore: keyStore, CapabilitiesRegistry: capabilities.NewRegistry(lggr), @@ -303,7 +298,6 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) { assert.NoError(t, err) testRelayGetter := &relayGetter{ - e: relayExtenders.Slice()[0], r: evmRelayer, } diff --git a/core/services/keeper/registry_interface.go b/core/services/keeper/registry_interface.go index c80be29154a..04bcb8e257d 100644 --- a/core/services/keeper/registry_interface.go +++ b/core/services/keeper/registry_interface.go @@ -161,11 +161,11 @@ func (rw *RegistryWrapper) getUpkeepCount(opts *bind.CallOpts) (*big.Int, error) } } -func (rw *RegistryWrapper) GetActiveUpkeepIDs(opts *bind.CallOpts) ([]*big.Int, error) { +func (rw *RegistryWrapper) GetActiveUpkeepIDs(ctx context.Context, opts *bind.CallOpts) ([]*big.Int, error) { if opts == nil || opts.BlockNumber.Int64() == 0 { var head *evmtypes.Head // fetch the current block number so batched GetActiveUpkeepIDs calls can be performed on the same block - head, err := rw.evmClient.HeadByNumber(context.Background(), nil) + head, err := rw.evmClient.HeadByNumber(ctx, nil) if err != nil { return nil, errors.Wrap(err, "failed to fetch EVM block header") } diff --git a/core/services/keeper/registry_synchronizer_helper_test.go b/core/services/keeper/registry_synchronizer_helper_test.go index 73a3cb88166..e095615cb26 100644 --- a/core/services/keeper/registry_synchronizer_helper_test.go +++ b/core/services/keeper/registry_synchronizer_helper_test.go @@ -23,7 +23,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keeper" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) const syncInterval = 1000 * time.Hour // prevents sync timer from triggering during test @@ -44,8 +43,7 @@ func setupRegistrySync(t *testing.T, version keeper.RegistryVersion) ( lbMock := logmocks.NewBroadcaster(t) lbMock.On("AddDependents", 1).Maybe() j := cltest.MustInsertKeeperJob(t, db, korm, cltest.NewEIP55Address(), cltest.NewEIP55Address()) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, Client: ethClient, LogBroadcaster: lbMock, GeneralConfig: cfg, KeyStore: keyStore.Eth()}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, Client: ethClient, LogBroadcaster: lbMock, GeneralConfig: cfg, KeyStore: keyStore.Eth()}) jpv2 := cltest.NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), legacyChains, db, keyStore, nil, nil) contractAddress := j.KeeperSpec.ContractAddress.Address() diff --git a/core/services/keeper/registry_synchronizer_sync.go b/core/services/keeper/registry_synchronizer_sync.go index 6615d376e2b..f8352a7483a 100644 --- a/core/services/keeper/registry_synchronizer_sync.go +++ b/core/services/keeper/registry_synchronizer_sync.go @@ -44,7 +44,7 @@ func (rs *RegistrySynchronizer) syncRegistry(ctx context.Context) (Registry, err } func (rs *RegistrySynchronizer) fullSyncUpkeeps(ctx context.Context, reg Registry) error { - activeUpkeepIDs, err := rs.registryWrapper.GetActiveUpkeepIDs(nil) + activeUpkeepIDs, err := rs.registryWrapper.GetActiveUpkeepIDs(ctx, nil) if err != nil { return errors.Wrap(err, "unable to get active upkeep IDs") } diff --git a/core/services/keeper/upkeep_executer.go b/core/services/keeper/upkeep_executer.go index 170546287e5..d18a7d809b1 100644 --- a/core/services/keeper/upkeep_executer.go +++ b/core/services/keeper/upkeep_executer.go @@ -162,7 +162,7 @@ func (ex *UpkeepExecuter) processActiveUpkeeps(ctx context.Context) { } var activeUpkeeps []UpkeepRegistration - turnBinary, err2 := ex.turnBlockHashBinary(registry, head, ex.config.TurnLookBack()) + turnBinary, err2 := ex.turnBlockHashBinary(ctx, registry, head, ex.config.TurnLookBack()) if err2 != nil { ex.logger.Error(errors.Wrap(err2, "unable to get turn block number hash")) return @@ -247,9 +247,9 @@ func (ex *UpkeepExecuter) execute(upkeep UpkeepRegistration, head *evmtypes.Head } } -func (ex *UpkeepExecuter) turnBlockHashBinary(registry Registry, head *evmtypes.Head, lookback int64) (string, error) { +func (ex *UpkeepExecuter) turnBlockHashBinary(ctx context.Context, registry Registry, head *evmtypes.Head, lookback int64) (string, error) { turnBlock := head.Number - (head.Number % int64(registry.BlockCountPerTurn)) - lookback - block, err := ex.ethClient.HeadByNumber(context.Background(), big.NewInt(turnBlock)) + block, err := ex.ethClient.HeadByNumber(ctx, big.NewInt(turnBlock)) if err != nil { return "", err } diff --git a/core/services/keeper/upkeep_executer_test.go b/core/services/keeper/upkeep_executer_test.go index 55926242a2a..e32a1be9b37 100644 --- a/core/services/keeper/upkeep_executer_test.go +++ b/core/services/keeper/upkeep_executer_test.go @@ -37,7 +37,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keeper" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func newHead() evmtypes.Head { @@ -81,8 +80,7 @@ func setup(t *testing.T, estimator gas.EvmFeeEstimator, overrideFn func(c *chain ethClient.On("IsL2").Return(false).Maybe() ethClient.On("HeadByNumber", mock.Anything, mock.Anything).Maybe().Return(&evmtypes.Head{Number: 1, Hash: utils.NewHash()}, nil) txm := txmmocks.NewMockEvmTxManager(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{TxManager: txm, DB: db, Client: ethClient, KeyStore: keyStore.Eth(), GeneralConfig: cfg, GasEstimator: estimator}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{TxManager: txm, DB: db, Client: ethClient, KeyStore: keyStore.Eth(), GeneralConfig: cfg, GasEstimator: estimator}) jpv2 := cltest.NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), legacyChains, db, keyStore, nil, nil) ch := evmtest.MustGetDefaultChain(t, legacyChains) orm := keeper.NewORM(db, logger.TestLogger(t)) diff --git a/core/services/llo/bm/dummy_transmitter.go b/core/services/llo/bm/dummy_transmitter.go index 06fd0915b3b..b7fa2bd9e15 100644 --- a/core/services/llo/bm/dummy_transmitter.go +++ b/core/services/llo/bm/dummy_transmitter.go @@ -107,7 +107,7 @@ func (t *transmitter) Transmit( } // FromAccount returns the stringified (hex) CSA public key -func (t *transmitter) FromAccount() (ocr2types.Account, error) { +func (t *transmitter) FromAccount(context.Context) (ocr2types.Account, error) { return ocr2types.Account(t.fromAccount), nil } diff --git a/core/services/llo/evm/report_codec.go b/core/services/llo/evm/report_codec.go index b5e13065843..b5a4ef9ffa7 100644 --- a/core/services/llo/evm/report_codec.go +++ b/core/services/llo/evm/report_codec.go @@ -1,6 +1,7 @@ package evm import ( + "context" "errors" "fmt" @@ -48,6 +49,6 @@ func NewReportCodec() ReportCodec { return ReportCodec{} } -func (ReportCodec) Encode(report llo.Report, cd llotypes.ChannelDefinition) ([]byte, error) { +func (ReportCodec) Encode(ctx context.Context, report llo.Report, cd llotypes.ChannelDefinition) ([]byte, error) { return nil, errors.New("not implemented") } diff --git a/core/services/llo/evm/report_codec_premium_legacy.go b/core/services/llo/evm/report_codec_premium_legacy.go index f8d72619ea1..572340e53f9 100644 --- a/core/services/llo/evm/report_codec_premium_legacy.go +++ b/core/services/llo/evm/report_codec_premium_legacy.go @@ -1,6 +1,7 @@ package evm import ( + "context" "encoding/json" "errors" "fmt" @@ -15,12 +16,12 @@ import ( llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo" v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" "github.com/smartcontractkit/chainlink-data-streams/llo" - ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" - "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury" - reporttypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3/types" + ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury" reportcodecv3 "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3/reportcodec" + reporttypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3/types" ) var ( @@ -54,7 +55,7 @@ func (r *ReportFormatEVMPremiumLegacyOpts) Decode(opts []byte) error { return json.Unmarshal(opts, r) } -func (r ReportCodecPremiumLegacy) Encode(report llo.Report, cd llotypes.ChannelDefinition) ([]byte, error) { +func (r ReportCodecPremiumLegacy) Encode(ctx context.Context, report llo.Report, cd llotypes.ChannelDefinition) ([]byte, error) { if report.Specimen { return nil, errors.New("ReportCodecPremiumLegacy does not support encoding specimen reports") } @@ -91,7 +92,7 @@ func (r ReportCodecPremiumLegacy) Encode(report llo.Report, cd llotypes.ChannelD Bid: quote.Bid.Mul(multiplier).BigInt(), Ask: quote.Ask.Mul(multiplier).BigInt(), } - return codec.BuildReport(rf) + return codec.BuildReport(ctx, rf) } func (r ReportCodecPremiumLegacy) Decode(b []byte) (*reporttypes.Report, error) { diff --git a/core/services/llo/evm/report_codec_premium_legacy_test.go b/core/services/llo/evm/report_codec_premium_legacy_test.go index dab2a8cf3fd..d88a1fc90ce 100644 --- a/core/services/llo/evm/report_codec_premium_legacy_test.go +++ b/core/services/llo/evm/report_codec_premium_legacy_test.go @@ -11,6 +11,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" reporttypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3/types" llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo" @@ -37,25 +38,28 @@ func Test_ReportCodecPremiumLegacy(t *testing.T) { cd := llotypes.ChannelDefinition{Opts: llotypes.ChannelOpts(fmt.Sprintf(`{"baseUSDFee":"10.50","expirationWindow":60,"feedId":"0x%x","multiplier":10}`, feedID))} t.Run("Encode errors if no values", func(t *testing.T) { - _, err := rc.Encode(llo.Report{}, cd) + ctx := tests.Context(t) + _, err := rc.Encode(ctx, llo.Report{}, cd) require.Error(t, err) assert.Contains(t, err.Error(), "ReportCodecPremiumLegacy cannot encode; got unusable report; ReportCodecPremiumLegacy requires exactly 3 values (NativePrice, LinkPrice, Quote{Bid, Mid, Ask}); got report.Values: []llo.StreamValue(nil)") }) t.Run("does not encode specimen reports", func(t *testing.T) { + ctx := tests.Context(t) report := newValidPremiumLegacyReport() report.Specimen = true - _, err := rc.Encode(report, cd) + _, err := rc.Encode(ctx, report, cd) require.Error(t, err) assert.EqualError(t, err, "ReportCodecPremiumLegacy does not support encoding specimen reports") }) t.Run("Encode constructs a report from observations", func(t *testing.T) { + ctx := tests.Context(t) report := newValidPremiumLegacyReport() - encoded, err := rc.Encode(report, cd) + encoded, err := rc.Encode(ctx, report, cd) require.NoError(t, err) assert.Len(t, encoded, 288) @@ -92,11 +96,12 @@ func Test_ReportCodecPremiumLegacy(t *testing.T) { }) t.Run("uses zero values if fees are missing", func(t *testing.T) { + ctx := tests.Context(t) report := llo.Report{ Values: []llo.StreamValue{nil, nil, &llo.Quote{Bid: decimal.NewFromInt(37), Benchmark: decimal.NewFromInt(38), Ask: decimal.NewFromInt(39)}}, } - encoded, err := rc.Encode(report, cd) + encoded, err := rc.Encode(ctx, report, cd) require.NoError(t, err) assert.Len(t, encoded, 288) diff --git a/core/services/llo/mercurytransmitter/transmitter.go b/core/services/llo/mercurytransmitter/transmitter.go index dc032a054dc..b84eddea7b9 100644 --- a/core/services/llo/mercurytransmitter/transmitter.go +++ b/core/services/llo/mercurytransmitter/transmitter.go @@ -249,6 +249,6 @@ func (mt *transmitter) Transmit( } // FromAccount returns the stringified (hex) CSA public key -func (mt *transmitter) FromAccount() (ocrtypes.Account, error) { +func (mt *transmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(mt.fromAccount), nil } diff --git a/core/services/llo/onchain_channel_definition_cache.go b/core/services/llo/onchain_channel_definition_cache.go index 6ff2058fb77..6bcc84ad424 100644 --- a/core/services/llo/onchain_channel_definition_cache.go +++ b/core/services/llo/onchain_channel_definition_cache.go @@ -180,6 +180,9 @@ func (c *channelDefinitionCache) Start(ctx context.Context) error { func (c *channelDefinitionCache) pollChainLoop() { defer c.wg.Done() + ctx, cancel := services.StopChan(c.chStop).NewCtx() + defer cancel() + pollT := services.NewTicker(c.logPollInterval) defer pollT.Stop() @@ -189,7 +192,7 @@ func (c *channelDefinitionCache) pollChainLoop() { return case <-pollT.C: // failures will be tried again on the next tick - if err := c.readLogs(); err != nil { + if err := c.readLogs(ctx); err != nil { c.lggr.Errorw("Failed to fetch channel definitions from chain", "err", err) continue } @@ -197,9 +200,7 @@ func (c *channelDefinitionCache) pollChainLoop() { } } -func (c *channelDefinitionCache) readLogs() (err error) { - ctx, cancel := services.StopChan(c.chStop).NewCtx() - defer cancel() +func (c *channelDefinitionCache) readLogs(ctx context.Context) (err error) { latestBlock, err := c.lp.LatestBlock(ctx) if errors.Is(err, sql.ErrNoRows) { c.lggr.Debug("Logpoller has no logs yet, skipping poll") diff --git a/core/services/llo/onchain_channel_definition_cache_test.go b/core/services/llo/onchain_channel_definition_cache_test.go index 78bbcef4283..7ebd2ef380d 100644 --- a/core/services/llo/onchain_channel_definition_cache_test.go +++ b/core/services/llo/onchain_channel_definition_cache_test.go @@ -128,55 +128,62 @@ func Test_ChannelDefinitionCache(t *testing.T) { cdc := &channelDefinitionCache{donID: donID, lp: lp, lggr: logger.TestSugared(t), newLogCh: newLogCh} t.Run("skips if logpoller has no blocks", func(t *testing.T) { - err := cdc.readLogs() + ctx := tests.Context(t) + err := cdc.readLogs(ctx) assert.NoError(t, err) assert.Nil(t, cdc.newLog) }) t.Run("returns error on LatestBlock failure", func(t *testing.T) { + ctx := tests.Context(t) lp.latestBlockErr = errors.New("test error") - err := cdc.readLogs() + err := cdc.readLogs(ctx) assert.EqualError(t, err, "test error") assert.Nil(t, cdc.newLog) }) t.Run("does nothing if LatestBlock older or the same as current channel definitions block", func(t *testing.T) { + ctx := tests.Context(t) lp.latestBlockErr = nil lp.latestBlock = logpoller.LogPollerBlock{BlockNumber: 42} cdc.definitionsBlockNum = 43 - err := cdc.readLogs() + err := cdc.readLogs(ctx) assert.NoError(t, err) assert.Nil(t, cdc.newLog) }) t.Run("returns error if LogsWithSigs fails", func(t *testing.T) { + ctx := tests.Context(t) cdc.definitionsBlockNum = 0 lp.logsWithSigsErr = errors.New("test error 2") - err := cdc.readLogs() + err := cdc.readLogs(ctx) assert.EqualError(t, err, "test error 2") assert.Nil(t, cdc.newLog) }) t.Run("ignores logs with different topic", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lp.logsWithSigs = []logpoller.Log{{EventSig: common.Hash{1, 2, 3, 4}}} - err := cdc.readLogs() + err := cdc.readLogs(ctx) assert.NoError(t, err) assert.Nil(t, cdc.newLog) }) t.Run("returns error if log is malformed", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lp.logsWithSigs = []logpoller.Log{{EventSig: topicNewChannelDefinition}} - err := cdc.readLogs() + err := cdc.readLogs(ctx) assert.EqualError(t, err, "failed to unpack log data: abi: attempting to unmarshal an empty string while arguments are expected") assert.Nil(t, cdc.newLog) }) t.Run("sets definitions and sends on channel if LogsWithSigs returns new event with a later version", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lp.logsWithSigs = []logpoller.Log{makeLog(t, donID, uint32(43), "http://example.com/xxx.json", [32]byte{1, 2, 3, 4})} - err := cdc.readLogs() + err := cdc.readLogs(ctx) require.NoError(t, err) require.NotNil(t, cdc.newLog) assert.Equal(t, uint32(43), cdc.newLog.Version) @@ -196,17 +203,19 @@ func Test_ChannelDefinitionCache(t *testing.T) { }() }) t.Run("does nothing if version older or the same as the one currently set", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lp.logsWithSigs = []logpoller.Log{ makeLog(t, donID, uint32(42), "http://example.com/xxx.json", [32]byte{1, 2, 3, 4}), makeLog(t, donID, uint32(43), "http://example.com/xxx.json", [32]byte{1, 2, 3, 4}), } - err := cdc.readLogs() + err := cdc.readLogs(ctx) require.NoError(t, err) assert.Equal(t, uint32(43), cdc.newLog.Version) }) t.Run("in case of multiple logs, takes the latest", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lp.logsWithSigs = []logpoller.Log{ makeLog(t, donID, uint32(42), "http://example.com/xxx.json", [32]byte{1, 2, 3, 4}), @@ -215,7 +224,7 @@ func Test_ChannelDefinitionCache(t *testing.T) { makeLog(t, donID, uint32(43), "http://example.com/xxx4.json", [32]byte{4, 2, 3, 4}), } - err := cdc.readLogs() + err := cdc.readLogs(ctx) require.NoError(t, err) assert.Equal(t, uint32(45), cdc.newLog.Version) assert.Equal(t, "http://example.com/xxx2.json", cdc.newLog.Url) @@ -234,12 +243,13 @@ func Test_ChannelDefinitionCache(t *testing.T) { }() }) t.Run("ignores logs with incorrect don ID", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lp.logsWithSigs = []logpoller.Log{ makeLog(t, donID+1, uint32(42), "http://example.com/xxx.json", [32]byte{1, 2, 3, 4}), } - err := cdc.readLogs() + err := cdc.readLogs(ctx) require.NoError(t, err) assert.Equal(t, uint32(45), cdc.newLog.Version) @@ -255,12 +265,13 @@ func Test_ChannelDefinitionCache(t *testing.T) { }() }) t.Run("ignores logs with wrong number of topics", func(t *testing.T) { + ctx := tests.Context(t) lp.logsWithSigsErr = nil lg := makeLog(t, donID, uint32(42), "http://example.com/xxx.json", [32]byte{1, 2, 3, 4}) lg.Topics = lg.Topics[:1] lp.logsWithSigs = []logpoller.Log{lg} - err := cdc.readLogs() + err := cdc.readLogs(ctx) require.NoError(t, err) assert.Equal(t, uint32(45), cdc.newLog.Version) diff --git a/core/services/llo/transmitter.go b/core/services/llo/transmitter.go index 3b7ef66e6a5..d0a45ba8f86 100644 --- a/core/services/llo/transmitter.go +++ b/core/services/llo/transmitter.go @@ -116,6 +116,6 @@ func (t *transmitter) Transmit( } // FromAccount returns the stringified (hex) CSA public key -func (t *transmitter) FromAccount() (ocr2types.Account, error) { +func (t *transmitter) FromAccount(ctx context.Context) (ocr2types.Account, error) { return ocr2types.Account(t.fromAccount), nil } diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index 18f4d6224e7..8a47fa33d9b 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -462,10 +462,12 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) ([]job.Servi } lggr.Infow("OCR2 job using local config", "BlockchainTimeout", lc.BlockchainTimeout, + "ContractConfigLoadTimeout", lc.ContractConfigLoadTimeout, "ContractConfigConfirmations", lc.ContractConfigConfirmations, "ContractConfigTrackerPollInterval", lc.ContractConfigTrackerPollInterval, "ContractTransmitterTransmitTimeout", lc.ContractTransmitterTransmitTimeout, "DatabaseTimeout", lc.DatabaseTimeout, + "DefaultMaxDurationInitialization", lc.DefaultMaxDurationInitialization, ) bootstrapPeers, err := ocrcommon.GetValidatedBootstrapPeers(spec.P2PV2Bootstrappers, d.peerWrapper.P2PConfig().V2().DefaultBootstrappers()) diff --git a/core/services/ocr2/delegate_test.go b/core/services/ocr2/delegate_test.go index 9015928ade1..04693061880 100644 --- a/core/services/ocr2/delegate_test.go +++ b/core/services/ocr2/delegate_test.go @@ -24,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" ocr2validate "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" ) @@ -46,9 +45,8 @@ func TestGetEVMEffectiveTransmitterID(t *testing.T) { lggr := logger.TestLogger(t) txManager := txmmocks.NewMockEvmTxManager(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth(), TxManager: txManager}) - require.True(t, relayExtenders.Len() > 0) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth(), TxManager: txManager}) + require.True(t, legacyChains.Len() > 0) type testCase struct { name string diff --git a/core/services/ocr2/plugins/ccip/ccipcommit/factory.go b/core/services/ocr2/plugins/ccip/ccipcommit/factory.go index 648f62a23a2..c7a18567d26 100644 --- a/core/services/ocr2/plugins/ccip/ccipcommit/factory.go +++ b/core/services/ocr2/plugins/ccip/ccipcommit/factory.go @@ -56,7 +56,7 @@ func (rf *CommitReportingPluginFactory) UpdateDynamicReaders(ctx context.Context } } - destPriceRegistryReader, err := rf.config.priceRegistryProvider.NewPriceRegistryReader(context.Background(), cciptypes.Address(newPriceRegAddr.String())) + destPriceRegistryReader, err := rf.config.priceRegistryProvider.NewPriceRegistryReader(ctx, cciptypes.Address(newPriceRegAddr.String())) if err != nil { return fmt.Errorf("init dynamic price registry: %w", err) } @@ -71,11 +71,11 @@ type reportingPluginAndInfo struct { } // NewReportingPlugin registers a new ReportingPlugin -func (rf *CommitReportingPluginFactory) NewReportingPlugin(config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { +func (rf *CommitReportingPluginFactory) NewReportingPlugin(ctx context.Context, config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { initialRetryDelay := rf.config.newReportingPluginRetryConfig.InitialDelay maxDelay := rf.config.newReportingPluginRetryConfig.MaxDelay - pluginAndInfo, err := ccipcommon.RetryUntilSuccess(rf.NewReportingPluginFn(config), initialRetryDelay, maxDelay) + pluginAndInfo, err := ccipcommon.RetryUntilSuccess(rf.NewReportingPluginFn(ctx, config), initialRetryDelay, maxDelay) if err != nil { return nil, types.ReportingPluginInfo{}, err } @@ -85,10 +85,8 @@ func (rf *CommitReportingPluginFactory) NewReportingPlugin(config types.Reportin // NewReportingPluginFn implements the NewReportingPlugin logic. It is defined as a function so that it can easily be // retried via RetryUntilSuccess. NewReportingPlugin must return successfully in order for the Commit plugin to // function, hence why we can only keep retrying it until it succeeds. -func (rf *CommitReportingPluginFactory) NewReportingPluginFn(config types.ReportingPluginConfig) func() (reportingPluginAndInfo, error) { +func (rf *CommitReportingPluginFactory) NewReportingPluginFn(ctx context.Context, config types.ReportingPluginConfig) func() (reportingPluginAndInfo, error) { return func() (reportingPluginAndInfo, error) { - ctx := context.Background() // todo: consider adding some timeout - destPriceReg, err := rf.config.commitStore.ChangeConfig(ctx, config.OnchainConfig, config.OffchainConfig) if err != nil { return reportingPluginAndInfo{}, err diff --git a/core/services/ocr2/plugins/ccip/ccipcommit/factory_test.go b/core/services/ocr2/plugins/ccip/ccipcommit/factory_test.go index 825026bd17e..44c63ec87e6 100644 --- a/core/services/ocr2/plugins/ccip/ccipcommit/factory_test.go +++ b/core/services/ocr2/plugins/ccip/ccipcommit/factory_test.go @@ -5,11 +5,14 @@ import ( "testing" "time" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" + "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata" ccipdataprovidermocks "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata/ccipdataprovider/mocks" @@ -23,6 +26,7 @@ import ( // first call to each of these functions to fail, then all subsequent calls succeed. We assert that NewReportingPlugin // retries a sufficient number of times to get through the transient errors and eventually succeed. func TestNewReportingPluginRetriesUntilSuccess(t *testing.T) { + ctx := tests.Context(t) commitConfig := CommitPluginStaticConfig{} // For this unit test, ensure that there is no delay between retries @@ -95,6 +99,6 @@ func TestNewReportingPluginRetriesUntilSuccess(t *testing.T) { reportingConfig.OffchainConfig = []byte{1, 2, 3} // Assert that NewReportingPlugin succeeds despite many transient internal failures (mocked out above) - _, _, err := factory.NewReportingPlugin(reportingConfig) + _, _, err := factory.NewReportingPlugin(ctx, reportingConfig) assert.Equal(t, nil, err) } diff --git a/core/services/ocr2/plugins/ccip/ccipcommit/ocr2.go b/core/services/ocr2/plugins/ccip/ccipcommit/ocr2.go index 2f0fc4e7956..55caf88f1c7 100644 --- a/core/services/ocr2/plugins/ccip/ccipcommit/ocr2.go +++ b/core/services/ocr2/plugins/ccip/ccipcommit/ocr2.go @@ -453,13 +453,13 @@ func (r *CommitReportingPlugin) selectPriceUpdates(ctx context.Context, now time return nil, nil, err } - return r.calculatePriceUpdates(gasPriceObs, tokenPriceObs, latestGasPrice, latestTokenPrices) + return r.calculatePriceUpdates(ctx, gasPriceObs, tokenPriceObs, latestGasPrice, latestTokenPrices) } // Note priceUpdates must be deterministic. // The provided gasPriceObs and tokenPriceObs should not contain nil values. // The returned latestGasPrice and latestTokenPrices should not contain nil values. -func (r *CommitReportingPlugin) calculatePriceUpdates(gasPriceObs map[uint64][]*big.Int, tokenPriceObs map[cciptypes.Address][]*big.Int, latestGasPrice map[uint64]update, latestTokenPrices map[cciptypes.Address]update) ([]cciptypes.GasPrice, []cciptypes.TokenPrice, error) { +func (r *CommitReportingPlugin) calculatePriceUpdates(ctx context.Context, gasPriceObs map[uint64][]*big.Int, tokenPriceObs map[cciptypes.Address][]*big.Int, latestGasPrice map[uint64]update, latestTokenPrices map[cciptypes.Address]update) ([]cciptypes.GasPrice, []cciptypes.TokenPrice, error) { var tokenPriceUpdates []cciptypes.TokenPrice for token, tokenPriceObservations := range tokenPriceObs { medianPrice := ccipcalc.BigIntSortedMiddle(tokenPriceObservations) @@ -488,7 +488,7 @@ func (r *CommitReportingPlugin) calculatePriceUpdates(gasPriceObs map[uint64][]* var gasPriceUpdate []cciptypes.GasPrice for chainSelector, gasPriceObservations := range gasPriceObs { - newGasPrice, err := r.gasPriceEstimator.Median(gasPriceObservations) // Compute the median price + newGasPrice, err := r.gasPriceEstimator.Median(ctx, gasPriceObservations) // Compute the median price if err != nil { return nil, nil, fmt.Errorf("failed to calculate median gas price for chain selector %d: %w", chainSelector, err) } @@ -497,7 +497,7 @@ func (r *CommitReportingPlugin) calculatePriceUpdates(gasPriceObs map[uint64][]* latestGasPrice, exists := latestGasPrice[chainSelector] if exists && latestGasPrice.value != nil { gasPriceUpdatedRecently := time.Since(latestGasPrice.timestamp) < r.offchainConfig.GasPriceHeartBeat - gasPriceDeviated, err := r.gasPriceEstimator.Deviates(newGasPrice, latestGasPrice.value) + gasPriceDeviated, err := r.gasPriceEstimator.Deviates(ctx, newGasPrice, latestGasPrice.value) if err != nil { return nil, nil, err } @@ -708,7 +708,7 @@ func (r *CommitReportingPlugin) isStaleGasPrice(ctx context.Context, lggr logger return false } - gasPriceDeviated, err := r.gasPriceEstimator.Deviates(gasPriceUpdate.Value, latestUpdate.value) + gasPriceDeviated, err := r.gasPriceEstimator.Deviates(ctx, gasPriceUpdate.Value, latestUpdate.value) if err != nil { lggr.Errorw("Gas price is stale because deviation check failed", "err", err) return true diff --git a/core/services/ocr2/plugins/ccip/ccipcommit/ocr2_test.go b/core/services/ocr2/plugins/ccip/ccipcommit/ocr2_test.go index 6cf7e4bec72..18e39f56be8 100644 --- a/core/services/ocr2/plugins/ccip/ccipcommit/ocr2_test.go +++ b/core/services/ocr2/plugins/ccip/ccipcommit/ocr2_test.go @@ -1402,6 +1402,7 @@ func TestCommitReportingPlugin_calculatePriceUpdates(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := testutils.Context(t) estimator, _ := prices.NewGasPriceEstimatorForCommitPlugin( *estimatorCSVer, evmEstimator, @@ -1433,7 +1434,7 @@ func TestCommitReportingPlugin_calculatePriceUpdates(t *testing.T) { } } - gotGas, gotTokens, err := r.calculatePriceUpdates(gasPriceObs, tokenPriceObs, tc.latestGasPrice, tc.latestTokenPrices) + gotGas, gotTokens, err := r.calculatePriceUpdates(ctx, gasPriceObs, tokenPriceObs, tc.latestGasPrice, tc.latestTokenPrices) assert.Equal(t, tc.expGasUpdates, gotGas) assert.Equal(t, tc.expTokenUpdates, gotTokens) diff --git a/core/services/ocr2/plugins/ccip/ccipexec/batching.go b/core/services/ocr2/plugins/ccip/ccipexec/batching.go index b457dd986d4..866a20c4cde 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/batching.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/batching.go @@ -256,7 +256,7 @@ func performCommonChecks( } // Fee boosting - execCostUsd, err1 := batchCtx.gasPriceEstimator.EstimateMsgCostUSD(batchCtx.gasPrice, dstWrappedNativePrice, msg) + execCostUsd, err1 := batchCtx.gasPriceEstimator.EstimateMsgCostUSD(ctx, batchCtx.gasPrice, dstWrappedNativePrice, msg) if err1 != nil { msgLggr.Errorw("Failed to estimate message cost USD", "err", err1) return "", 0, nil, nil, errors.New("failed to estimate message cost USD") diff --git a/core/services/ocr2/plugins/ccip/ccipexec/batching_test.go b/core/services/ocr2/plugins/ccip/ccipexec/batching_test.go index 3647556a6d5..0fd23496974 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/batching_test.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/batching_test.go @@ -807,9 +807,9 @@ func runBatchingStrategyTests(t *testing.T, strategy BatchingStrategy, available gasPriceEstimator := prices.NewMockGasPriceEstimatorExec(t) if !tc.skipGasPriceEstimator { if tc.expectedSeqNrs != nil { - gasPriceEstimator.On("EstimateMsgCostUSD", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(0), nil) + gasPriceEstimator.On("EstimateMsgCostUSD", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(0), nil) } else { - gasPriceEstimator.On("EstimateMsgCostUSD", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(0), errors.New("error")) + gasPriceEstimator.On("EstimateMsgCostUSD", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(0), errors.New("error")) } } diff --git a/core/services/ocr2/plugins/ccip/ccipexec/factory.go b/core/services/ocr2/plugins/ccip/ccipexec/factory.go index 97caf2e719c..646121bdba8 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/factory.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/factory.go @@ -53,7 +53,7 @@ func (rf *ExecutionReportingPluginFactory) UpdateDynamicReaders(ctx context.Cont } } - destPriceRegistryReader, err := rf.config.priceRegistryProvider.NewPriceRegistryReader(context.Background(), newPriceRegAddr) + destPriceRegistryReader, err := rf.config.priceRegistryProvider.NewPriceRegistryReader(ctx, newPriceRegAddr) if err != nil { return err } @@ -68,11 +68,11 @@ type reportingPluginAndInfo struct { } // NewReportingPlugin registers a new ReportingPlugin -func (rf *ExecutionReportingPluginFactory) NewReportingPlugin(config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { +func (rf *ExecutionReportingPluginFactory) NewReportingPlugin(ctx context.Context, config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { initialRetryDelay := rf.config.newReportingPluginRetryConfig.InitialDelay maxDelay := rf.config.newReportingPluginRetryConfig.MaxDelay - pluginAndInfo, err := ccipcommon.RetryUntilSuccess(rf.NewReportingPluginFn(config), initialRetryDelay, maxDelay) + pluginAndInfo, err := ccipcommon.RetryUntilSuccess(rf.NewReportingPluginFn(ctx, config), initialRetryDelay, maxDelay) if err != nil { return nil, types.ReportingPluginInfo{}, err } @@ -82,10 +82,8 @@ func (rf *ExecutionReportingPluginFactory) NewReportingPlugin(config types.Repor // NewReportingPluginFn implements the NewReportingPlugin logic. It is defined as a function so that it can easily be // retried via RetryUntilSuccess. NewReportingPlugin must return successfully in order for the Exec plugin to function, // hence why we can only keep retrying it until it succeeds. -func (rf *ExecutionReportingPluginFactory) NewReportingPluginFn(config types.ReportingPluginConfig) func() (reportingPluginAndInfo, error) { +func (rf *ExecutionReportingPluginFactory) NewReportingPluginFn(ctx context.Context, config types.ReportingPluginConfig) func() (reportingPluginAndInfo, error) { return func() (reportingPluginAndInfo, error) { - ctx := context.Background() // todo: consider setting a timeout - destPriceRegistry, destWrappedNative, err := rf.config.offRampReader.ChangeConfig(ctx, config.OnchainConfig, config.OffchainConfig) if err != nil { return reportingPluginAndInfo{}, err diff --git a/core/services/ocr2/plugins/ccip/ccipexec/factory_test.go b/core/services/ocr2/plugins/ccip/ccipexec/factory_test.go index 7bbb9be0c69..fe5e0ab1e23 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/factory_test.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/factory_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata" ccipdataprovidermocks "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipdata/ccipdataprovider/mocks" @@ -22,6 +23,7 @@ import ( // first call to each of these functions to fail, then all subsequent calls succeed. We assert that NewReportingPlugin // retries a sufficient number of times to get through the transient errors and eventually succeed. func TestNewReportingPluginRetriesUntilSuccess(t *testing.T) { + ctx := tests.Context(t) execConfig := ExecutionPluginStaticConfig{} // For this unit test, ensure that there is no delay between retries @@ -62,6 +64,6 @@ func TestNewReportingPluginRetriesUntilSuccess(t *testing.T) { reportingConfig.OffchainConfig = []byte{1, 2, 3} // Assert that NewReportingPlugin succeeds despite many transient internal failures (mocked out above) - _, _, err := factory.NewReportingPlugin(reportingConfig) + _, _, err := factory.NewReportingPlugin(ctx, reportingConfig) assert.Equal(t, nil, err) } diff --git a/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service.go b/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service.go index 2806c26e220..e8b9a4de721 100644 --- a/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service.go +++ b/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service.go @@ -298,7 +298,7 @@ func (p *priceService) observeGasPriceUpdates( if sourceGasPrice == nil { return nil, fmt.Errorf("missing gas price") } - sourceGasPriceUSD, err = p.gasPriceEstimator.DenoteInUSD(sourceGasPrice, sourceNativePriceUSD) + sourceGasPriceUSD, err = p.gasPriceEstimator.DenoteInUSD(ctx, sourceGasPrice, sourceNativePriceUSD) if err != nil { return nil, err } diff --git a/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service_test.go b/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service_test.go index a25c5d3c47e..d76044b2256 100644 --- a/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service_test.go +++ b/core/services/ocr2/plugins/ccip/internal/ccipdb/price_service_test.go @@ -251,7 +251,7 @@ func TestPriceService_observeGasPriceUpdates(t *testing.T) { gasPriceEstimator.On("GetGasPrice", mock.Anything).Return(tc.feeEstimatorRespFee, tc.feeEstimatorRespErr) if tc.feeEstimatorRespFee != nil { pUSD := ccipcalc.CalculateUsdPerUnitGas(tc.feeEstimatorRespFee, tc.priceGetterRespData[tc.sourceNativeToken]) - gasPriceEstimator.On("DenoteInUSD", mock.Anything, mock.Anything).Return(pUSD, nil) + gasPriceEstimator.On("DenoteInUSD", mock.Anything, mock.Anything, mock.Anything).Return(pUSD, nil) } } @@ -802,7 +802,7 @@ func TestPriceService_priceWriteInBackground(t *testing.T) { gasPriceEstimator.On("GetGasPrice", mock.Anything).Return(gasPrice, nil) pUSD := ccipcalc.CalculateUsdPerUnitGas(gasPrice, val1e18(tokenPrices[0])) - gasPriceEstimator.On("DenoteInUSD", mock.Anything, mock.Anything).Return(pUSD, nil) + gasPriceEstimator.On("DenoteInUSD", mock.Anything, mock.Anything, mock.Anything).Return(pUSD, nil) destPriceReg := ccipdatamocks.NewPriceRegistryReader(t) destPriceReg.On("GetTokensDecimals", mock.Anything, laneTokens).Return(laneTokenDecimals, nil).Maybe() diff --git a/core/services/ocr2/plugins/ccip/prices/da_price_estimator.go b/core/services/ocr2/plugins/ccip/prices/da_price_estimator.go index 7c75b9bdd99..d0093e5d672 100644 --- a/core/services/ocr2/plugins/ccip/prices/da_price_estimator.go +++ b/core/services/ocr2/plugins/ccip/prices/da_price_estimator.go @@ -66,7 +66,7 @@ func (g DAGasPriceEstimator) GetGasPrice(ctx context.Context) (*big.Int, error) return gasPrice, nil } -func (g DAGasPriceEstimator) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { +func (g DAGasPriceEstimator) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { daGasPrice, execGasPrice, err := g.parseEncodedGasPrice(p) if err != nil { return nil, err @@ -86,7 +86,7 @@ func (g DAGasPriceEstimator) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int return new(big.Int).Add(daUSD, execUSD), nil } -func (g DAGasPriceEstimator) Median(gasPrices []*big.Int) (*big.Int, error) { +func (g DAGasPriceEstimator) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { daPrices := make([]*big.Int, len(gasPrices)) execPrices := make([]*big.Int, len(gasPrices)) @@ -107,7 +107,7 @@ func (g DAGasPriceEstimator) Median(gasPrices []*big.Int) (*big.Int, error) { return new(big.Int).Add(daMedian, execMedian), nil } -func (g DAGasPriceEstimator) Deviates(p1, p2 *big.Int) (bool, error) { +func (g DAGasPriceEstimator) Deviates(ctx context.Context, p1, p2 *big.Int) (bool, error) { p1DAGasPrice, p1ExecGasPrice, err := g.parseEncodedGasPrice(p1) if err != nil { return false, err @@ -117,7 +117,7 @@ func (g DAGasPriceEstimator) Deviates(p1, p2 *big.Int) (bool, error) { return false, err } - execDeviates, err := g.execEstimator.Deviates(p1ExecGasPrice, p2ExecGasPrice) + execDeviates, err := g.execEstimator.Deviates(ctx, p1ExecGasPrice, p2ExecGasPrice) if err != nil { return false, err } @@ -128,13 +128,13 @@ func (g DAGasPriceEstimator) Deviates(p1, p2 *big.Int) (bool, error) { return ccipcalc.Deviates(p1DAGasPrice, p2DAGasPrice, g.daDeviationPPB), nil } -func (g DAGasPriceEstimator) EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { +func (g DAGasPriceEstimator) EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { daGasPrice, execGasPrice, err := g.parseEncodedGasPrice(p) if err != nil { return nil, err } - execCostUSD, err := g.execEstimator.EstimateMsgCostUSD(execGasPrice, wrappedNativePrice, msg) + execCostUSD, err := g.execEstimator.EstimateMsgCostUSD(ctx, execGasPrice, wrappedNativePrice, msg) if err != nil { return nil, err } diff --git a/core/services/ocr2/plugins/ccip/prices/da_price_estimator_test.go b/core/services/ocr2/plugins/ccip/prices/da_price_estimator_test.go index 2f8616a8669..2772042f68d 100644 --- a/core/services/ocr2/plugins/ccip/prices/da_price_estimator_test.go +++ b/core/services/ocr2/plugins/ccip/prices/da_price_estimator_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/mock" cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" + "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/gas/rollups/mocks" ) @@ -137,11 +138,12 @@ func TestDAPriceEstimator_DenoteInUSD(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := DAGasPriceEstimator{ priceEncodingLength: daGasPriceEncodingLength, } - gasPrice, err := g.DenoteInUSD(tc.gasPrice, tc.nativePrice) + gasPrice, err := g.DenoteInUSD(ctx, tc.gasPrice, tc.nativePrice) assert.NoError(t, err) assert.True(t, tc.expPrice.Cmp(gasPrice) == 0) }) @@ -222,11 +224,12 @@ func TestDAPriceEstimator_Median(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := DAGasPriceEstimator{ priceEncodingLength: daGasPriceEncodingLength, } - gasPrice, err := g.Median(tc.gasPrices) + gasPrice, err := g.Median(ctx, tc.gasPrices) assert.NoError(t, err) assert.True(t, tc.expMedian.Cmp(gasPrice) == 0) }) @@ -302,6 +305,7 @@ func TestDAPriceEstimator_Deviates(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := DAGasPriceEstimator{ execEstimator: ExecGasPriceEstimator{ deviationPPB: tc.execDeviationPPB, @@ -310,7 +314,7 @@ func TestDAPriceEstimator_Deviates(t *testing.T) { priceEncodingLength: daGasPriceEncodingLength, } - deviated, err := g.Deviates(tc.gasPrice1, tc.gasPrice2) + deviated, err := g.Deviates(ctx, tc.gasPrice1, tc.gasPrice2) assert.NoError(t, err) if tc.expDeviates { assert.True(t, deviated) @@ -420,9 +424,10 @@ func TestDAPriceEstimator_EstimateMsgCostUSD(t *testing.T) { for _, tc := range testCases { execEstimator := NewMockGasPriceEstimator(t) - execEstimator.On("EstimateMsgCostUSD", mock.Anything, tc.wrappedNativePrice, tc.msg).Return(execCostUSD, nil) + execEstimator.On("EstimateMsgCostUSD", mock.Anything, mock.Anything, tc.wrappedNativePrice, tc.msg).Return(execCostUSD, nil) t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := DAGasPriceEstimator{ execEstimator: execEstimator, l1Oracle: nil, @@ -432,7 +437,7 @@ func TestDAPriceEstimator_EstimateMsgCostUSD(t *testing.T) { daMultiplier: tc.daMultiplier, } - costUSD, err := g.EstimateMsgCostUSD(tc.gasPrice, tc.wrappedNativePrice, tc.msg) + costUSD, err := g.EstimateMsgCostUSD(ctx, tc.gasPrice, tc.wrappedNativePrice, tc.msg) assert.NoError(t, err) assert.Equal(t, tc.expUSD, costUSD) }) diff --git a/core/services/ocr2/plugins/ccip/prices/exec_price_estimator.go b/core/services/ocr2/plugins/ccip/prices/exec_price_estimator.go index 84a6014bef3..48f24c7c58b 100644 --- a/core/services/ocr2/plugins/ccip/prices/exec_price_estimator.go +++ b/core/services/ocr2/plugins/ccip/prices/exec_price_estimator.go @@ -42,19 +42,19 @@ func (g ExecGasPriceEstimator) GetGasPrice(ctx context.Context) (*big.Int, error return gasPrice, nil } -func (g ExecGasPriceEstimator) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { +func (g ExecGasPriceEstimator) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { return ccipcalc.CalculateUsdPerUnitGas(p, wrappedNativePrice), nil } -func (g ExecGasPriceEstimator) Median(gasPrices []*big.Int) (*big.Int, error) { +func (g ExecGasPriceEstimator) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { return ccipcalc.BigIntSortedMiddle(gasPrices), nil } -func (g ExecGasPriceEstimator) Deviates(p1 *big.Int, p2 *big.Int) (bool, error) { +func (g ExecGasPriceEstimator) Deviates(ctx context.Context, p1 *big.Int, p2 *big.Int) (bool, error) { return ccipcalc.Deviates(p1, p2, g.deviationPPB), nil } -func (g ExecGasPriceEstimator) EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { +func (g ExecGasPriceEstimator) EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg cciptypes.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { execGasAmount := new(big.Int).Add(big.NewInt(feeBoostingOverheadGas), msg.GasLimit) execGasAmount = new(big.Int).Add(execGasAmount, new(big.Int).Mul(big.NewInt(int64(len(msg.Data))), big.NewInt(execGasPerPayloadByte))) execGasAmount = new(big.Int).Add(execGasAmount, new(big.Int).Mul(big.NewInt(int64(len(msg.TokenAmounts))), big.NewInt(execGasPerToken))) diff --git a/core/services/ocr2/plugins/ccip/prices/exec_price_estimator_test.go b/core/services/ocr2/plugins/ccip/prices/exec_price_estimator_test.go index f9ba1523e52..ae1e8074c4b 100644 --- a/core/services/ocr2/plugins/ccip/prices/exec_price_estimator_test.go +++ b/core/services/ocr2/plugins/ccip/prices/exec_price_estimator_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/assert" cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" + "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/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" @@ -137,9 +138,10 @@ func TestExecPriceEstimator_DenoteInUSD(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := ExecGasPriceEstimator{} - gasPrice, err := g.DenoteInUSD(tc.gasPrice, tc.nativePrice) + gasPrice, err := g.DenoteInUSD(ctx, tc.gasPrice, tc.nativePrice) assert.NoError(t, err) assert.True(t, tc.expPrice.Cmp(gasPrice) == 0) }) @@ -188,9 +190,10 @@ func TestExecPriceEstimator_Median(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := ExecGasPriceEstimator{} - gasPrice, err := g.Median(tc.gasPrices) + gasPrice, err := g.Median(ctx, tc.gasPrices) assert.NoError(t, err) assert.True(t, tc.expMedian.Cmp(gasPrice) == 0) }) @@ -237,11 +240,12 @@ func TestExecPriceEstimator_Deviates(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := ExecGasPriceEstimator{ deviationPPB: tc.deviationPPB, } - deviated, err := g.Deviates(tc.gasPrice1, tc.gasPrice2) + deviated, err := g.Deviates(ctx, tc.gasPrice1, tc.gasPrice2) assert.NoError(t, err) if tc.expDeviates { assert.True(t, deviated) @@ -342,9 +346,10 @@ func TestExecPriceEstimator_EstimateMsgCostUSD(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) g := ExecGasPriceEstimator{} - costUSD, err := g.EstimateMsgCostUSD(tc.gasPrice, tc.wrappedNativePrice, tc.msg) + costUSD, err := g.EstimateMsgCostUSD(ctx, tc.gasPrice, tc.wrappedNativePrice, tc.msg) assert.NoError(t, err) assert.Equal(t, tc.expUSD, costUSD) }) diff --git a/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_commit_mock.go b/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_commit_mock.go index 0a366a66ac2..a5d284c327e 100644 --- a/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_commit_mock.go +++ b/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_commit_mock.go @@ -22,9 +22,9 @@ func (_m *MockGasPriceEstimatorCommit) EXPECT() *MockGasPriceEstimatorCommit_Exp return &MockGasPriceEstimatorCommit_Expecter{mock: &_m.Mock} } -// DenoteInUSD provides a mock function with given fields: p, wrappedNativePrice -func (_m *MockGasPriceEstimatorCommit) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { - ret := _m.Called(p, wrappedNativePrice) +// DenoteInUSD provides a mock function with given fields: ctx, p, wrappedNativePrice +func (_m *MockGasPriceEstimatorCommit) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { + ret := _m.Called(ctx, p, wrappedNativePrice) if len(ret) == 0 { panic("no return value specified for DenoteInUSD") @@ -32,19 +32,19 @@ func (_m *MockGasPriceEstimatorCommit) DenoteInUSD(p *big.Int, wrappedNativePric var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) (*big.Int, error)); ok { - return rf(p, wrappedNativePrice) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) (*big.Int, error)); ok { + return rf(ctx, p, wrappedNativePrice) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) *big.Int); ok { - r0 = rf(p, wrappedNativePrice) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) *big.Int); ok { + r0 = rf(ctx, p, wrappedNativePrice) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int) error); ok { - r1 = rf(p, wrappedNativePrice) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int) error); ok { + r1 = rf(ctx, p, wrappedNativePrice) } else { r1 = ret.Error(1) } @@ -58,15 +58,16 @@ type MockGasPriceEstimatorCommit_DenoteInUSD_Call struct { } // DenoteInUSD is a helper method to define mock.On call +// - ctx context.Context // - p *big.Int // - wrappedNativePrice *big.Int -func (_e *MockGasPriceEstimatorCommit_Expecter) DenoteInUSD(p interface{}, wrappedNativePrice interface{}) *MockGasPriceEstimatorCommit_DenoteInUSD_Call { - return &MockGasPriceEstimatorCommit_DenoteInUSD_Call{Call: _e.mock.On("DenoteInUSD", p, wrappedNativePrice)} +func (_e *MockGasPriceEstimatorCommit_Expecter) DenoteInUSD(ctx interface{}, p interface{}, wrappedNativePrice interface{}) *MockGasPriceEstimatorCommit_DenoteInUSD_Call { + return &MockGasPriceEstimatorCommit_DenoteInUSD_Call{Call: _e.mock.On("DenoteInUSD", ctx, p, wrappedNativePrice)} } -func (_c *MockGasPriceEstimatorCommit_DenoteInUSD_Call) Run(run func(p *big.Int, wrappedNativePrice *big.Int)) *MockGasPriceEstimatorCommit_DenoteInUSD_Call { +func (_c *MockGasPriceEstimatorCommit_DenoteInUSD_Call) Run(run func(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int)) *MockGasPriceEstimatorCommit_DenoteInUSD_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int)) }) return _c } @@ -76,14 +77,14 @@ func (_c *MockGasPriceEstimatorCommit_DenoteInUSD_Call) Return(_a0 *big.Int, _a1 return _c } -func (_c *MockGasPriceEstimatorCommit_DenoteInUSD_Call) RunAndReturn(run func(*big.Int, *big.Int) (*big.Int, error)) *MockGasPriceEstimatorCommit_DenoteInUSD_Call { +func (_c *MockGasPriceEstimatorCommit_DenoteInUSD_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int) (*big.Int, error)) *MockGasPriceEstimatorCommit_DenoteInUSD_Call { _c.Call.Return(run) return _c } -// Deviates provides a mock function with given fields: p1, p2 -func (_m *MockGasPriceEstimatorCommit) Deviates(p1 *big.Int, p2 *big.Int) (bool, error) { - ret := _m.Called(p1, p2) +// Deviates provides a mock function with given fields: ctx, p1, p2 +func (_m *MockGasPriceEstimatorCommit) Deviates(ctx context.Context, p1 *big.Int, p2 *big.Int) (bool, error) { + ret := _m.Called(ctx, p1, p2) if len(ret) == 0 { panic("no return value specified for Deviates") @@ -91,17 +92,17 @@ func (_m *MockGasPriceEstimatorCommit) Deviates(p1 *big.Int, p2 *big.Int) (bool, var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) (bool, error)); ok { - return rf(p1, p2) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) (bool, error)); ok { + return rf(ctx, p1, p2) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) bool); ok { - r0 = rf(p1, p2) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) bool); ok { + r0 = rf(ctx, p1, p2) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int) error); ok { - r1 = rf(p1, p2) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int) error); ok { + r1 = rf(ctx, p1, p2) } else { r1 = ret.Error(1) } @@ -115,15 +116,16 @@ type MockGasPriceEstimatorCommit_Deviates_Call struct { } // Deviates is a helper method to define mock.On call +// - ctx context.Context // - p1 *big.Int // - p2 *big.Int -func (_e *MockGasPriceEstimatorCommit_Expecter) Deviates(p1 interface{}, p2 interface{}) *MockGasPriceEstimatorCommit_Deviates_Call { - return &MockGasPriceEstimatorCommit_Deviates_Call{Call: _e.mock.On("Deviates", p1, p2)} +func (_e *MockGasPriceEstimatorCommit_Expecter) Deviates(ctx interface{}, p1 interface{}, p2 interface{}) *MockGasPriceEstimatorCommit_Deviates_Call { + return &MockGasPriceEstimatorCommit_Deviates_Call{Call: _e.mock.On("Deviates", ctx, p1, p2)} } -func (_c *MockGasPriceEstimatorCommit_Deviates_Call) Run(run func(p1 *big.Int, p2 *big.Int)) *MockGasPriceEstimatorCommit_Deviates_Call { +func (_c *MockGasPriceEstimatorCommit_Deviates_Call) Run(run func(ctx context.Context, p1 *big.Int, p2 *big.Int)) *MockGasPriceEstimatorCommit_Deviates_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int)) }) return _c } @@ -133,7 +135,7 @@ func (_c *MockGasPriceEstimatorCommit_Deviates_Call) Return(_a0 bool, _a1 error) return _c } -func (_c *MockGasPriceEstimatorCommit_Deviates_Call) RunAndReturn(run func(*big.Int, *big.Int) (bool, error)) *MockGasPriceEstimatorCommit_Deviates_Call { +func (_c *MockGasPriceEstimatorCommit_Deviates_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int) (bool, error)) *MockGasPriceEstimatorCommit_Deviates_Call { _c.Call.Return(run) return _c } @@ -196,9 +198,9 @@ func (_c *MockGasPriceEstimatorCommit_GetGasPrice_Call) RunAndReturn(run func(co return _c } -// Median provides a mock function with given fields: gasPrices -func (_m *MockGasPriceEstimatorCommit) Median(gasPrices []*big.Int) (*big.Int, error) { - ret := _m.Called(gasPrices) +// Median provides a mock function with given fields: ctx, gasPrices +func (_m *MockGasPriceEstimatorCommit) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { + ret := _m.Called(ctx, gasPrices) if len(ret) == 0 { panic("no return value specified for Median") @@ -206,19 +208,19 @@ func (_m *MockGasPriceEstimatorCommit) Median(gasPrices []*big.Int) (*big.Int, e var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func([]*big.Int) (*big.Int, error)); ok { - return rf(gasPrices) + if rf, ok := ret.Get(0).(func(context.Context, []*big.Int) (*big.Int, error)); ok { + return rf(ctx, gasPrices) } - if rf, ok := ret.Get(0).(func([]*big.Int) *big.Int); ok { - r0 = rf(gasPrices) + if rf, ok := ret.Get(0).(func(context.Context, []*big.Int) *big.Int); ok { + r0 = rf(ctx, gasPrices) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func([]*big.Int) error); ok { - r1 = rf(gasPrices) + if rf, ok := ret.Get(1).(func(context.Context, []*big.Int) error); ok { + r1 = rf(ctx, gasPrices) } else { r1 = ret.Error(1) } @@ -232,14 +234,15 @@ type MockGasPriceEstimatorCommit_Median_Call struct { } // Median is a helper method to define mock.On call +// - ctx context.Context // - gasPrices []*big.Int -func (_e *MockGasPriceEstimatorCommit_Expecter) Median(gasPrices interface{}) *MockGasPriceEstimatorCommit_Median_Call { - return &MockGasPriceEstimatorCommit_Median_Call{Call: _e.mock.On("Median", gasPrices)} +func (_e *MockGasPriceEstimatorCommit_Expecter) Median(ctx interface{}, gasPrices interface{}) *MockGasPriceEstimatorCommit_Median_Call { + return &MockGasPriceEstimatorCommit_Median_Call{Call: _e.mock.On("Median", ctx, gasPrices)} } -func (_c *MockGasPriceEstimatorCommit_Median_Call) Run(run func(gasPrices []*big.Int)) *MockGasPriceEstimatorCommit_Median_Call { +func (_c *MockGasPriceEstimatorCommit_Median_Call) Run(run func(ctx context.Context, gasPrices []*big.Int)) *MockGasPriceEstimatorCommit_Median_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]*big.Int)) + run(args[0].(context.Context), args[1].([]*big.Int)) }) return _c } @@ -249,7 +252,7 @@ func (_c *MockGasPriceEstimatorCommit_Median_Call) Return(_a0 *big.Int, _a1 erro return _c } -func (_c *MockGasPriceEstimatorCommit_Median_Call) RunAndReturn(run func([]*big.Int) (*big.Int, error)) *MockGasPriceEstimatorCommit_Median_Call { +func (_c *MockGasPriceEstimatorCommit_Median_Call) RunAndReturn(run func(context.Context, []*big.Int) (*big.Int, error)) *MockGasPriceEstimatorCommit_Median_Call { _c.Call.Return(run) return _c } diff --git a/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_exec_mock.go b/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_exec_mock.go index 8f778555b17..8eaaed9c7c7 100644 --- a/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_exec_mock.go +++ b/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_exec_mock.go @@ -24,9 +24,9 @@ func (_m *MockGasPriceEstimatorExec) EXPECT() *MockGasPriceEstimatorExec_Expecte return &MockGasPriceEstimatorExec_Expecter{mock: &_m.Mock} } -// DenoteInUSD provides a mock function with given fields: p, wrappedNativePrice -func (_m *MockGasPriceEstimatorExec) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { - ret := _m.Called(p, wrappedNativePrice) +// DenoteInUSD provides a mock function with given fields: ctx, p, wrappedNativePrice +func (_m *MockGasPriceEstimatorExec) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { + ret := _m.Called(ctx, p, wrappedNativePrice) if len(ret) == 0 { panic("no return value specified for DenoteInUSD") @@ -34,19 +34,19 @@ func (_m *MockGasPriceEstimatorExec) DenoteInUSD(p *big.Int, wrappedNativePrice var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) (*big.Int, error)); ok { - return rf(p, wrappedNativePrice) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) (*big.Int, error)); ok { + return rf(ctx, p, wrappedNativePrice) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) *big.Int); ok { - r0 = rf(p, wrappedNativePrice) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) *big.Int); ok { + r0 = rf(ctx, p, wrappedNativePrice) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int) error); ok { - r1 = rf(p, wrappedNativePrice) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int) error); ok { + r1 = rf(ctx, p, wrappedNativePrice) } else { r1 = ret.Error(1) } @@ -60,15 +60,16 @@ type MockGasPriceEstimatorExec_DenoteInUSD_Call struct { } // DenoteInUSD is a helper method to define mock.On call +// - ctx context.Context // - p *big.Int // - wrappedNativePrice *big.Int -func (_e *MockGasPriceEstimatorExec_Expecter) DenoteInUSD(p interface{}, wrappedNativePrice interface{}) *MockGasPriceEstimatorExec_DenoteInUSD_Call { - return &MockGasPriceEstimatorExec_DenoteInUSD_Call{Call: _e.mock.On("DenoteInUSD", p, wrappedNativePrice)} +func (_e *MockGasPriceEstimatorExec_Expecter) DenoteInUSD(ctx interface{}, p interface{}, wrappedNativePrice interface{}) *MockGasPriceEstimatorExec_DenoteInUSD_Call { + return &MockGasPriceEstimatorExec_DenoteInUSD_Call{Call: _e.mock.On("DenoteInUSD", ctx, p, wrappedNativePrice)} } -func (_c *MockGasPriceEstimatorExec_DenoteInUSD_Call) Run(run func(p *big.Int, wrappedNativePrice *big.Int)) *MockGasPriceEstimatorExec_DenoteInUSD_Call { +func (_c *MockGasPriceEstimatorExec_DenoteInUSD_Call) Run(run func(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int)) *MockGasPriceEstimatorExec_DenoteInUSD_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int)) }) return _c } @@ -78,14 +79,14 @@ func (_c *MockGasPriceEstimatorExec_DenoteInUSD_Call) Return(_a0 *big.Int, _a1 e return _c } -func (_c *MockGasPriceEstimatorExec_DenoteInUSD_Call) RunAndReturn(run func(*big.Int, *big.Int) (*big.Int, error)) *MockGasPriceEstimatorExec_DenoteInUSD_Call { +func (_c *MockGasPriceEstimatorExec_DenoteInUSD_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int) (*big.Int, error)) *MockGasPriceEstimatorExec_DenoteInUSD_Call { _c.Call.Return(run) return _c } -// EstimateMsgCostUSD provides a mock function with given fields: p, wrappedNativePrice, msg -func (_m *MockGasPriceEstimatorExec) EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { - ret := _m.Called(p, wrappedNativePrice, msg) +// EstimateMsgCostUSD provides a mock function with given fields: ctx, p, wrappedNativePrice, msg +func (_m *MockGasPriceEstimatorExec) EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { + ret := _m.Called(ctx, p, wrappedNativePrice, msg) if len(ret) == 0 { panic("no return value specified for EstimateMsgCostUSD") @@ -93,19 +94,19 @@ func (_m *MockGasPriceEstimatorExec) EstimateMsgCostUSD(p *big.Int, wrappedNativ var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)); ok { - return rf(p, wrappedNativePrice, msg) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)); ok { + return rf(ctx, p, wrappedNativePrice, msg) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) *big.Int); ok { - r0 = rf(p, wrappedNativePrice, msg) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) *big.Int); ok { + r0 = rf(ctx, p, wrappedNativePrice, msg) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) error); ok { - r1 = rf(p, wrappedNativePrice, msg) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) error); ok { + r1 = rf(ctx, p, wrappedNativePrice, msg) } else { r1 = ret.Error(1) } @@ -119,16 +120,17 @@ type MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call struct { } // EstimateMsgCostUSD is a helper method to define mock.On call +// - ctx context.Context // - p *big.Int // - wrappedNativePrice *big.Int // - msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta -func (_e *MockGasPriceEstimatorExec_Expecter) EstimateMsgCostUSD(p interface{}, wrappedNativePrice interface{}, msg interface{}) *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call { - return &MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call{Call: _e.mock.On("EstimateMsgCostUSD", p, wrappedNativePrice, msg)} +func (_e *MockGasPriceEstimatorExec_Expecter) EstimateMsgCostUSD(ctx interface{}, p interface{}, wrappedNativePrice interface{}, msg interface{}) *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call { + return &MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call{Call: _e.mock.On("EstimateMsgCostUSD", ctx, p, wrappedNativePrice, msg)} } -func (_c *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call) Run(run func(p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call { +func (_c *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call) Run(run func(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int), args[2].(ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int), args[3].(ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) }) return _c } @@ -138,7 +140,7 @@ func (_c *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call) Return(_a0 *big.Int return _c } -func (_c *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call) RunAndReturn(run func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)) *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call { +func (_c *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)) *MockGasPriceEstimatorExec_EstimateMsgCostUSD_Call { _c.Call.Return(run) return _c } @@ -201,9 +203,9 @@ func (_c *MockGasPriceEstimatorExec_GetGasPrice_Call) RunAndReturn(run func(cont return _c } -// Median provides a mock function with given fields: gasPrices -func (_m *MockGasPriceEstimatorExec) Median(gasPrices []*big.Int) (*big.Int, error) { - ret := _m.Called(gasPrices) +// Median provides a mock function with given fields: ctx, gasPrices +func (_m *MockGasPriceEstimatorExec) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { + ret := _m.Called(ctx, gasPrices) if len(ret) == 0 { panic("no return value specified for Median") @@ -211,19 +213,19 @@ func (_m *MockGasPriceEstimatorExec) Median(gasPrices []*big.Int) (*big.Int, err var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func([]*big.Int) (*big.Int, error)); ok { - return rf(gasPrices) + if rf, ok := ret.Get(0).(func(context.Context, []*big.Int) (*big.Int, error)); ok { + return rf(ctx, gasPrices) } - if rf, ok := ret.Get(0).(func([]*big.Int) *big.Int); ok { - r0 = rf(gasPrices) + if rf, ok := ret.Get(0).(func(context.Context, []*big.Int) *big.Int); ok { + r0 = rf(ctx, gasPrices) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func([]*big.Int) error); ok { - r1 = rf(gasPrices) + if rf, ok := ret.Get(1).(func(context.Context, []*big.Int) error); ok { + r1 = rf(ctx, gasPrices) } else { r1 = ret.Error(1) } @@ -237,14 +239,15 @@ type MockGasPriceEstimatorExec_Median_Call struct { } // Median is a helper method to define mock.On call +// - ctx context.Context // - gasPrices []*big.Int -func (_e *MockGasPriceEstimatorExec_Expecter) Median(gasPrices interface{}) *MockGasPriceEstimatorExec_Median_Call { - return &MockGasPriceEstimatorExec_Median_Call{Call: _e.mock.On("Median", gasPrices)} +func (_e *MockGasPriceEstimatorExec_Expecter) Median(ctx interface{}, gasPrices interface{}) *MockGasPriceEstimatorExec_Median_Call { + return &MockGasPriceEstimatorExec_Median_Call{Call: _e.mock.On("Median", ctx, gasPrices)} } -func (_c *MockGasPriceEstimatorExec_Median_Call) Run(run func(gasPrices []*big.Int)) *MockGasPriceEstimatorExec_Median_Call { +func (_c *MockGasPriceEstimatorExec_Median_Call) Run(run func(ctx context.Context, gasPrices []*big.Int)) *MockGasPriceEstimatorExec_Median_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]*big.Int)) + run(args[0].(context.Context), args[1].([]*big.Int)) }) return _c } @@ -254,7 +257,7 @@ func (_c *MockGasPriceEstimatorExec_Median_Call) Return(_a0 *big.Int, _a1 error) return _c } -func (_c *MockGasPriceEstimatorExec_Median_Call) RunAndReturn(run func([]*big.Int) (*big.Int, error)) *MockGasPriceEstimatorExec_Median_Call { +func (_c *MockGasPriceEstimatorExec_Median_Call) RunAndReturn(run func(context.Context, []*big.Int) (*big.Int, error)) *MockGasPriceEstimatorExec_Median_Call { _c.Call.Return(run) return _c } diff --git a/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_mock.go b/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_mock.go index a513083319d..6787863572d 100644 --- a/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_mock.go +++ b/core/services/ocr2/plugins/ccip/prices/gas_price_estimator_mock.go @@ -24,9 +24,9 @@ func (_m *MockGasPriceEstimator) EXPECT() *MockGasPriceEstimator_Expecter { return &MockGasPriceEstimator_Expecter{mock: &_m.Mock} } -// DenoteInUSD provides a mock function with given fields: p, wrappedNativePrice -func (_m *MockGasPriceEstimator) DenoteInUSD(p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { - ret := _m.Called(p, wrappedNativePrice) +// DenoteInUSD provides a mock function with given fields: ctx, p, wrappedNativePrice +func (_m *MockGasPriceEstimator) DenoteInUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int) (*big.Int, error) { + ret := _m.Called(ctx, p, wrappedNativePrice) if len(ret) == 0 { panic("no return value specified for DenoteInUSD") @@ -34,19 +34,19 @@ func (_m *MockGasPriceEstimator) DenoteInUSD(p *big.Int, wrappedNativePrice *big var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) (*big.Int, error)); ok { - return rf(p, wrappedNativePrice) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) (*big.Int, error)); ok { + return rf(ctx, p, wrappedNativePrice) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) *big.Int); ok { - r0 = rf(p, wrappedNativePrice) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) *big.Int); ok { + r0 = rf(ctx, p, wrappedNativePrice) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int) error); ok { - r1 = rf(p, wrappedNativePrice) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int) error); ok { + r1 = rf(ctx, p, wrappedNativePrice) } else { r1 = ret.Error(1) } @@ -60,15 +60,16 @@ type MockGasPriceEstimator_DenoteInUSD_Call struct { } // DenoteInUSD is a helper method to define mock.On call +// - ctx context.Context // - p *big.Int // - wrappedNativePrice *big.Int -func (_e *MockGasPriceEstimator_Expecter) DenoteInUSD(p interface{}, wrappedNativePrice interface{}) *MockGasPriceEstimator_DenoteInUSD_Call { - return &MockGasPriceEstimator_DenoteInUSD_Call{Call: _e.mock.On("DenoteInUSD", p, wrappedNativePrice)} +func (_e *MockGasPriceEstimator_Expecter) DenoteInUSD(ctx interface{}, p interface{}, wrappedNativePrice interface{}) *MockGasPriceEstimator_DenoteInUSD_Call { + return &MockGasPriceEstimator_DenoteInUSD_Call{Call: _e.mock.On("DenoteInUSD", ctx, p, wrappedNativePrice)} } -func (_c *MockGasPriceEstimator_DenoteInUSD_Call) Run(run func(p *big.Int, wrappedNativePrice *big.Int)) *MockGasPriceEstimator_DenoteInUSD_Call { +func (_c *MockGasPriceEstimator_DenoteInUSD_Call) Run(run func(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int)) *MockGasPriceEstimator_DenoteInUSD_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int)) }) return _c } @@ -78,14 +79,14 @@ func (_c *MockGasPriceEstimator_DenoteInUSD_Call) Return(_a0 *big.Int, _a1 error return _c } -func (_c *MockGasPriceEstimator_DenoteInUSD_Call) RunAndReturn(run func(*big.Int, *big.Int) (*big.Int, error)) *MockGasPriceEstimator_DenoteInUSD_Call { +func (_c *MockGasPriceEstimator_DenoteInUSD_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int) (*big.Int, error)) *MockGasPriceEstimator_DenoteInUSD_Call { _c.Call.Return(run) return _c } -// Deviates provides a mock function with given fields: p1, p2 -func (_m *MockGasPriceEstimator) Deviates(p1 *big.Int, p2 *big.Int) (bool, error) { - ret := _m.Called(p1, p2) +// Deviates provides a mock function with given fields: ctx, p1, p2 +func (_m *MockGasPriceEstimator) Deviates(ctx context.Context, p1 *big.Int, p2 *big.Int) (bool, error) { + ret := _m.Called(ctx, p1, p2) if len(ret) == 0 { panic("no return value specified for Deviates") @@ -93,17 +94,17 @@ func (_m *MockGasPriceEstimator) Deviates(p1 *big.Int, p2 *big.Int) (bool, error var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) (bool, error)); ok { - return rf(p1, p2) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) (bool, error)); ok { + return rf(ctx, p1, p2) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int) bool); ok { - r0 = rf(p1, p2) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int) bool); ok { + r0 = rf(ctx, p1, p2) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int) error); ok { - r1 = rf(p1, p2) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int) error); ok { + r1 = rf(ctx, p1, p2) } else { r1 = ret.Error(1) } @@ -117,15 +118,16 @@ type MockGasPriceEstimator_Deviates_Call struct { } // Deviates is a helper method to define mock.On call +// - ctx context.Context // - p1 *big.Int // - p2 *big.Int -func (_e *MockGasPriceEstimator_Expecter) Deviates(p1 interface{}, p2 interface{}) *MockGasPriceEstimator_Deviates_Call { - return &MockGasPriceEstimator_Deviates_Call{Call: _e.mock.On("Deviates", p1, p2)} +func (_e *MockGasPriceEstimator_Expecter) Deviates(ctx interface{}, p1 interface{}, p2 interface{}) *MockGasPriceEstimator_Deviates_Call { + return &MockGasPriceEstimator_Deviates_Call{Call: _e.mock.On("Deviates", ctx, p1, p2)} } -func (_c *MockGasPriceEstimator_Deviates_Call) Run(run func(p1 *big.Int, p2 *big.Int)) *MockGasPriceEstimator_Deviates_Call { +func (_c *MockGasPriceEstimator_Deviates_Call) Run(run func(ctx context.Context, p1 *big.Int, p2 *big.Int)) *MockGasPriceEstimator_Deviates_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int)) }) return _c } @@ -135,14 +137,14 @@ func (_c *MockGasPriceEstimator_Deviates_Call) Return(_a0 bool, _a1 error) *Mock return _c } -func (_c *MockGasPriceEstimator_Deviates_Call) RunAndReturn(run func(*big.Int, *big.Int) (bool, error)) *MockGasPriceEstimator_Deviates_Call { +func (_c *MockGasPriceEstimator_Deviates_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int) (bool, error)) *MockGasPriceEstimator_Deviates_Call { _c.Call.Return(run) return _c } -// EstimateMsgCostUSD provides a mock function with given fields: p, wrappedNativePrice, msg -func (_m *MockGasPriceEstimator) EstimateMsgCostUSD(p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { - ret := _m.Called(p, wrappedNativePrice, msg) +// EstimateMsgCostUSD provides a mock function with given fields: ctx, p, wrappedNativePrice, msg +func (_m *MockGasPriceEstimator) EstimateMsgCostUSD(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error) { + ret := _m.Called(ctx, p, wrappedNativePrice, msg) if len(ret) == 0 { panic("no return value specified for EstimateMsgCostUSD") @@ -150,19 +152,19 @@ func (_m *MockGasPriceEstimator) EstimateMsgCostUSD(p *big.Int, wrappedNativePri var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)); ok { - return rf(p, wrappedNativePrice, msg) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)); ok { + return rf(ctx, p, wrappedNativePrice, msg) } - if rf, ok := ret.Get(0).(func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) *big.Int); ok { - r0 = rf(p, wrappedNativePrice, msg) + if rf, ok := ret.Get(0).(func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) *big.Int); ok { + r0 = rf(ctx, p, wrappedNativePrice, msg) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) error); ok { - r1 = rf(p, wrappedNativePrice, msg) + if rf, ok := ret.Get(1).(func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) error); ok { + r1 = rf(ctx, p, wrappedNativePrice, msg) } else { r1 = ret.Error(1) } @@ -176,16 +178,17 @@ type MockGasPriceEstimator_EstimateMsgCostUSD_Call struct { } // EstimateMsgCostUSD is a helper method to define mock.On call +// - ctx context.Context // - p *big.Int // - wrappedNativePrice *big.Int // - msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta -func (_e *MockGasPriceEstimator_Expecter) EstimateMsgCostUSD(p interface{}, wrappedNativePrice interface{}, msg interface{}) *MockGasPriceEstimator_EstimateMsgCostUSD_Call { - return &MockGasPriceEstimator_EstimateMsgCostUSD_Call{Call: _e.mock.On("EstimateMsgCostUSD", p, wrappedNativePrice, msg)} +func (_e *MockGasPriceEstimator_Expecter) EstimateMsgCostUSD(ctx interface{}, p interface{}, wrappedNativePrice interface{}, msg interface{}) *MockGasPriceEstimator_EstimateMsgCostUSD_Call { + return &MockGasPriceEstimator_EstimateMsgCostUSD_Call{Call: _e.mock.On("EstimateMsgCostUSD", ctx, p, wrappedNativePrice, msg)} } -func (_c *MockGasPriceEstimator_EstimateMsgCostUSD_Call) Run(run func(p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) *MockGasPriceEstimator_EstimateMsgCostUSD_Call { +func (_c *MockGasPriceEstimator_EstimateMsgCostUSD_Call) Run(run func(ctx context.Context, p *big.Int, wrappedNativePrice *big.Int, msg ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) *MockGasPriceEstimator_EstimateMsgCostUSD_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*big.Int), args[1].(*big.Int), args[2].(ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) + run(args[0].(context.Context), args[1].(*big.Int), args[2].(*big.Int), args[3].(ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta)) }) return _c } @@ -195,7 +198,7 @@ func (_c *MockGasPriceEstimator_EstimateMsgCostUSD_Call) Return(_a0 *big.Int, _a return _c } -func (_c *MockGasPriceEstimator_EstimateMsgCostUSD_Call) RunAndReturn(run func(*big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)) *MockGasPriceEstimator_EstimateMsgCostUSD_Call { +func (_c *MockGasPriceEstimator_EstimateMsgCostUSD_Call) RunAndReturn(run func(context.Context, *big.Int, *big.Int, ccip.EVM2EVMOnRampCCIPSendRequestedWithMeta) (*big.Int, error)) *MockGasPriceEstimator_EstimateMsgCostUSD_Call { _c.Call.Return(run) return _c } @@ -258,9 +261,9 @@ func (_c *MockGasPriceEstimator_GetGasPrice_Call) RunAndReturn(run func(context. return _c } -// Median provides a mock function with given fields: gasPrices -func (_m *MockGasPriceEstimator) Median(gasPrices []*big.Int) (*big.Int, error) { - ret := _m.Called(gasPrices) +// Median provides a mock function with given fields: ctx, gasPrices +func (_m *MockGasPriceEstimator) Median(ctx context.Context, gasPrices []*big.Int) (*big.Int, error) { + ret := _m.Called(ctx, gasPrices) if len(ret) == 0 { panic("no return value specified for Median") @@ -268,19 +271,19 @@ func (_m *MockGasPriceEstimator) Median(gasPrices []*big.Int) (*big.Int, error) var r0 *big.Int var r1 error - if rf, ok := ret.Get(0).(func([]*big.Int) (*big.Int, error)); ok { - return rf(gasPrices) + if rf, ok := ret.Get(0).(func(context.Context, []*big.Int) (*big.Int, error)); ok { + return rf(ctx, gasPrices) } - if rf, ok := ret.Get(0).(func([]*big.Int) *big.Int); ok { - r0 = rf(gasPrices) + if rf, ok := ret.Get(0).(func(context.Context, []*big.Int) *big.Int); ok { + r0 = rf(ctx, gasPrices) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) } } - if rf, ok := ret.Get(1).(func([]*big.Int) error); ok { - r1 = rf(gasPrices) + if rf, ok := ret.Get(1).(func(context.Context, []*big.Int) error); ok { + r1 = rf(ctx, gasPrices) } else { r1 = ret.Error(1) } @@ -294,14 +297,15 @@ type MockGasPriceEstimator_Median_Call struct { } // Median is a helper method to define mock.On call +// - ctx context.Context // - gasPrices []*big.Int -func (_e *MockGasPriceEstimator_Expecter) Median(gasPrices interface{}) *MockGasPriceEstimator_Median_Call { - return &MockGasPriceEstimator_Median_Call{Call: _e.mock.On("Median", gasPrices)} +func (_e *MockGasPriceEstimator_Expecter) Median(ctx interface{}, gasPrices interface{}) *MockGasPriceEstimator_Median_Call { + return &MockGasPriceEstimator_Median_Call{Call: _e.mock.On("Median", ctx, gasPrices)} } -func (_c *MockGasPriceEstimator_Median_Call) Run(run func(gasPrices []*big.Int)) *MockGasPriceEstimator_Median_Call { +func (_c *MockGasPriceEstimator_Median_Call) Run(run func(ctx context.Context, gasPrices []*big.Int)) *MockGasPriceEstimator_Median_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]*big.Int)) + run(args[0].(context.Context), args[1].([]*big.Int)) }) return _c } @@ -311,7 +315,7 @@ func (_c *MockGasPriceEstimator_Median_Call) Return(_a0 *big.Int, _a1 error) *Mo return _c } -func (_c *MockGasPriceEstimator_Median_Call) RunAndReturn(run func([]*big.Int) (*big.Int, error)) *MockGasPriceEstimator_Median_Call { +func (_c *MockGasPriceEstimator_Median_Call) RunAndReturn(run func(context.Context, []*big.Int) (*big.Int, error)) *MockGasPriceEstimator_Median_Call { _c.Call.Return(run) return _c } diff --git a/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go b/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go index 7b3351ce062..cac2163ff07 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go @@ -509,6 +509,7 @@ func (c *CCIPContracts) DeriveOCR2Config(t *testing.T, oracles []confighelper.Or []int{1, 1, 1, 1}, oracles, rawOffchainConfig, + nil, 50*time.Millisecond, // Max duration query 1*time.Second, // Max duration observation 100*time.Millisecond, diff --git a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go index b8db2dfff7f..f50ceba3bec 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go @@ -514,6 +514,7 @@ func (c *CCIPContracts) DeriveOCR2Config(t *testing.T, oracles []confighelper.Or []int{1, 1, 1, 1}, oracles, rawOffchainConfig, + nil, 50*time.Millisecond, // Max duration query 1*time.Second, // Max duration observation 100*time.Millisecond, diff --git a/core/services/ocr2/plugins/ccip/transmitter/transmitter.go b/core/services/ocr2/plugins/ccip/transmitter/transmitter.go index 3e2962b33a9..24123d03337 100644 --- a/core/services/ocr2/plugins/ccip/transmitter/transmitter.go +++ b/core/services/ocr2/plugins/ccip/transmitter/transmitter.go @@ -11,7 +11,7 @@ import ( commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" - statuschecker "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/statuschecker" + "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/statuschecker" ) type roundRobinKeystore interface { @@ -25,7 +25,7 @@ type txManager interface { type Transmitter interface { CreateEthTransaction(ctx context.Context, toAddress common.Address, payload []byte, txMeta *txmgr.TxMeta) error - FromAddress() common.Address + FromAddress(context.Context) common.Address } type transmitter struct { @@ -129,7 +129,7 @@ func (t *transmitter) CreateEthTransaction(ctx context.Context, toAddress common return errors.Wrap(err, "skipped OCR transmission") } -func (t *transmitter) FromAddress() common.Address { +func (t *transmitter) FromAddress(ctx context.Context) common.Address { return t.effectiveTransmitterAddress } diff --git a/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go b/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go index 104e9f4da61..9840debf98a 100644 --- a/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go +++ b/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go @@ -80,6 +80,7 @@ func SetOracleConfig(t *testing.T, b *backends.SimulatedBackend, owner *bind.Tra S, // S (schedule of randomized transmission order) oracles, reportingPluginConfigBytes, + nil, 200*time.Millisecond, // maxDurationQuery 200*time.Millisecond, // maxDurationObservation 200*time.Millisecond, // maxDurationReport diff --git a/core/services/ocr2/plugins/functions/reporting.go b/core/services/ocr2/plugins/functions/reporting.go index f485ecb9d34..6236b762e18 100644 --- a/core/services/ocr2/plugins/functions/reporting.go +++ b/core/services/ocr2/plugins/functions/reporting.go @@ -91,7 +91,7 @@ func formatRequestId(requestId []byte) string { } // NewReportingPlugin complies with ReportingPluginFactory -func (f FunctionsReportingPluginFactory) NewReportingPlugin(rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { +func (f FunctionsReportingPluginFactory) NewReportingPlugin(ctx context.Context, rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { pluginConfig, err := config.DecodeReportingPluginConfig(rpConfig.OffchainConfig) if err != nil { f.Logger.Error("unable to decode reporting plugin config", commontypes.LogFields{ diff --git a/core/services/ocr2/plugins/functions/reporting_test.go b/core/services/ocr2/plugins/functions/reporting_test.go index 7d6686a0b4f..581e2de70b0 100644 --- a/core/services/ocr2/plugins/functions/reporting_test.go +++ b/core/services/ocr2/plugins/functions/reporting_test.go @@ -13,6 +13,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commonlogger "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" functions_srv "github.com/smartcontractkit/chainlink/v2/core/services/functions" @@ -42,7 +43,7 @@ func preparePlugin(t *testing.T, batchSize uint32, maxTotalGasLimit uint32) (typ } pluginConfigBytes, err := config.EncodeReportingPluginConfig(&pluginConfig) require.NoError(t, err) - plugin, _, err := factory.NewReportingPlugin(types.ReportingPluginConfig{ + plugin, _, err := factory.NewReportingPlugin(tests.Context(t), types.ReportingPluginConfig{ N: 4, F: 1, OffchainConfig: pluginConfigBytes, diff --git a/core/services/ocr2/plugins/llo/helpers_test.go b/core/services/ocr2/plugins/llo/helpers_test.go index bd73dcccfc8..452b2cde2dc 100644 --- a/core/services/ocr2/plugins/llo/helpers_test.go +++ b/core/services/ocr2/plugins/llo/helpers_test.go @@ -17,12 +17,12 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" "github.com/shopspring/decimal" + "github.com/smartcontractkit/wsrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" - "github.com/smartcontractkit/wsrpc" "github.com/smartcontractkit/wsrpc/credentials" "github.com/smartcontractkit/wsrpc/peer" diff --git a/core/services/ocr2/plugins/llo/integration_test.go b/core/services/ocr2/plugins/llo/integration_test.go index 2e49e989462..8d2738545bc 100644 --- a/core/services/ocr2/plugins/llo/integration_test.go +++ b/core/services/ocr2/plugins/llo/integration_test.go @@ -146,12 +146,13 @@ func generateConfig(t *testing.T, oracles []confighelper.OracleIdentityExtra) ( []int{len(oracles)}, // S oracles, reportingPluginConfig, // reportingPluginConfig []byte, - 0, // maxDurationQuery - 250*time.Millisecond, // maxDurationObservation - 0, // maxDurationShouldAcceptAttestedReport - 0, // maxDurationShouldTransmitAcceptedReport - int(fNodes), // f - onchainConfig, // encoded onchain config + nil, + 0, // maxDurationQuery + 250*time.Millisecond, // maxDurationObservation + 0, // maxDurationShouldAcceptAttestedReport + 0, // maxDurationShouldTransmitAcceptedReport + int(fNodes), // f + onchainConfig, // encoded onchain config ) require.NoError(t, err) diff --git a/core/services/ocr2/plugins/mercury/integration_test.go b/core/services/ocr2/plugins/mercury/integration_test.go index a8d49150b8a..653ea574631 100644 --- a/core/services/ocr2/plugins/mercury/integration_test.go +++ b/core/services/ocr2/plugins/mercury/integration_test.go @@ -159,7 +159,7 @@ func integration_MercuryV1(t *testing.T) { serverKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(-1)) serverPubKey := serverKey.PublicKey srv := NewMercuryServer(t, ed25519.PrivateKey(serverKey.Raw()), reqs, func() []byte { - report, err := (&reportcodecv1.ReportCodec{}).BuildReport(v1.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), CurrentBlockHash: make([]byte, 32)}) + report, err := (&reportcodecv1.ReportCodec{}).BuildReport(ctx, v1.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), CurrentBlockHash: make([]byte, 32)}) if err != nil { panic(err) } @@ -284,7 +284,7 @@ func integration_MercuryV1(t *testing.T) { } } // Setup config on contract - onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) + onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(ctx, rawOnchainConfig) require.NoError(t, err) reportingPluginConfig, err := json.Marshal(rawReportingPluginConfig) @@ -302,8 +302,9 @@ func integration_MercuryV1(t *testing.T) { []int{len(nodes)}, // S oracles, reportingPluginConfig, // reportingPluginConfig []byte, - 250*time.Millisecond, // Max duration observation - int(f), // f + nil, + 250*time.Millisecond, // Max duration observation + int(f), // f onchainConfig, ) @@ -345,6 +346,7 @@ func integration_MercuryV1(t *testing.T) { } t.Run("receives at least one report per feed from each oracle when EAs are at 100% reliability", func(t *testing.T) { + ctx := testutils.Context(t) // Expect at least one report per feed from each oracle seen := make(map[[32]byte]map[credentials.StaticSizedPublicKey]struct{}) for i := range feeds { @@ -372,9 +374,9 @@ func integration_MercuryV1(t *testing.T) { continue // already saw all oracles for this feed } - num, err := (&reportcodecv1.ReportCodec{}).CurrentBlockNumFromReport(ocr2types.Report(report.([]byte))) + num, err := (&reportcodecv1.ReportCodec{}).CurrentBlockNumFromReport(ctx, ocr2types.Report(report.([]byte))) require.NoError(t, err) - currentBlock, err := backend.BlockByNumber(testutils.Context(t), nil) + currentBlock, err := backend.BlockByNumber(ctx, nil) require.NoError(t, err) assert.GreaterOrEqual(t, currentBlock.Number().Int64(), num) @@ -407,6 +409,7 @@ func integration_MercuryV1(t *testing.T) { }) t.Run("receives at least one report per feed from each oracle when EAs are at 80% reliability", func(t *testing.T) { + ctx := testutils.Context(t) pError.Store(20) // 20% chance of EA error // Expect at least one report per feed from each oracle @@ -436,7 +439,7 @@ func integration_MercuryV1(t *testing.T) { continue // already saw all oracles for this feed } - num, err := (&reportcodecv1.ReportCodec{}).CurrentBlockNumFromReport(ocr2types.Report(report.([]byte))) + num, err := (&reportcodecv1.ReportCodec{}).CurrentBlockNumFromReport(ctx, ocr2types.Report(report.([]byte))) require.NoError(t, err) currentBlock, err := backend.BlockByNumber(testutils.Context(t), nil) require.NoError(t, err) @@ -516,7 +519,7 @@ func integration_MercuryV2(t *testing.T) { serverKey := csakey.MustNewV2XXXTestingOnly(big.NewInt(-1)) serverPubKey := serverKey.PublicKey srv := NewMercuryServer(t, ed25519.PrivateKey(serverKey.Raw()), reqs, func() []byte { - report, err := (&reportcodecv2.ReportCodec{}).BuildReport(v2.ReportFields{BenchmarkPrice: big.NewInt(234567), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)}) + report, err := (&reportcodecv2.ReportCodec{}).BuildReport(ctx, v2.ReportFields{BenchmarkPrice: big.NewInt(234567), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)}) if err != nil { panic(err) } @@ -635,7 +638,7 @@ func integration_MercuryV2(t *testing.T) { } // Setup config on contract - onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) + onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(ctx, rawOnchainConfig) require.NoError(t, err) reportingPluginConfig, err := json.Marshal(rawReportingPluginConfig) @@ -653,8 +656,9 @@ func integration_MercuryV2(t *testing.T) { []int{len(nodes)}, // S oracles, reportingPluginConfig, // reportingPluginConfig []byte, - 250*time.Millisecond, // Max duration observation - int(f), // f + nil, + 250*time.Millisecond, // Max duration observation + int(f), // f onchainConfig, ) @@ -810,7 +814,7 @@ func integration_MercuryV3(t *testing.T) { k := csakey.MustNewV2XXXTestingOnly(big.NewInt(int64(-(i + 1)))) reqs := make(chan request, 100) srv := NewMercuryServer(t, ed25519.PrivateKey(k.Raw()), reqs, func() []byte { - report, err := (&reportcodecv3.ReportCodec{}).BuildReport(v3.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)}) + report, err := (&reportcodecv3.ReportCodec{}).BuildReport(ctx, v3.ReportFields{BenchmarkPrice: big.NewInt(234567), Bid: big.NewInt(1), Ask: big.NewInt(1), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1)}) if err != nil { panic(err) } @@ -927,7 +931,7 @@ func integration_MercuryV3(t *testing.T) { } // Setup config on contract - onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) + onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(ctx, rawOnchainConfig) require.NoError(t, err) reportingPluginConfig, err := json.Marshal(rawReportingPluginConfig) @@ -945,8 +949,9 @@ func integration_MercuryV3(t *testing.T) { []int{len(nodes)}, // S oracles, reportingPluginConfig, // reportingPluginConfig []byte, - 250*time.Millisecond, // Max duration observation - int(f), // f + nil, + 250*time.Millisecond, // Max duration observation + int(f), // f onchainConfig, ) @@ -1105,7 +1110,7 @@ func integration_MercuryV4(t *testing.T) { k := csakey.MustNewV2XXXTestingOnly(big.NewInt(int64(-(i + 1)))) reqs := make(chan request, 100) srv := NewMercuryServer(t, ed25519.PrivateKey(k.Raw()), reqs, func() []byte { - report, err := (&reportcodecv4.ReportCodec{}).BuildReport(v4.ReportFields{BenchmarkPrice: big.NewInt(234567), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1), MarketStatus: 1}) + report, err := (&reportcodecv4.ReportCodec{}).BuildReport(ctx, v4.ReportFields{BenchmarkPrice: big.NewInt(234567), LinkFee: big.NewInt(1), NativeFee: big.NewInt(1), MarketStatus: 1}) if err != nil { panic(err) } @@ -1227,7 +1232,7 @@ func integration_MercuryV4(t *testing.T) { } // Setup config on contract - onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig) + onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(ctx, rawOnchainConfig) require.NoError(t, err) reportingPluginConfig, err := json.Marshal(rawReportingPluginConfig) @@ -1245,8 +1250,9 @@ func integration_MercuryV4(t *testing.T) { []int{len(nodes)}, // S oracles, reportingPluginConfig, // reportingPluginConfig []byte, - 250*time.Millisecond, // Max duration observation - int(f), // f + nil, + 250*time.Millisecond, // Max duration observation + int(f), // f onchainConfig, ) diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v20/log_provider.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v20/log_provider.go index 50c1e5b7c1a..1764fb7e7c3 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v20/log_provider.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v20/log_provider.go @@ -250,7 +250,7 @@ func (c *LogProvider) StaleReportLogs(ctx context.Context) ([]ocr2keepers.StaleR vals := []ocr2keepers.StaleReportLog{} for _, r := range reorged { upkeepId := ocr2keepers.UpkeepIdentifier(r.Id.String()) - checkBlockNumber, err := c.getCheckBlockNumberFromTxHash(r.TxHash, upkeepId) + checkBlockNumber, err := c.getCheckBlockNumberFromTxHash(ctx, r.TxHash, upkeepId) if err != nil { c.logger.Error("error while fetching checkBlockNumber from reorged report log: %w", err) continue @@ -265,7 +265,7 @@ func (c *LogProvider) StaleReportLogs(ctx context.Context) ([]ocr2keepers.StaleR } for _, r := range staleUpkeep { upkeepId := ocr2keepers.UpkeepIdentifier(r.Id.String()) - checkBlockNumber, err := c.getCheckBlockNumberFromTxHash(r.TxHash, upkeepId) + checkBlockNumber, err := c.getCheckBlockNumberFromTxHash(ctx, r.TxHash, upkeepId) if err != nil { c.logger.Error("error while fetching checkBlockNumber from stale report log: %w", err) continue @@ -280,7 +280,7 @@ func (c *LogProvider) StaleReportLogs(ctx context.Context) ([]ocr2keepers.StaleR } for _, r := range insufficientFunds { upkeepId := ocr2keepers.UpkeepIdentifier(r.Id.String()) - checkBlockNumber, err := c.getCheckBlockNumberFromTxHash(r.TxHash, upkeepId) + checkBlockNumber, err := c.getCheckBlockNumberFromTxHash(ctx, r.TxHash, upkeepId) if err != nil { c.logger.Error("error while fetching checkBlockNumber from insufficient funds report log: %w", err) continue @@ -411,7 +411,7 @@ func (c *LogProvider) unmarshalInsufficientFundsUpkeepLogs(logs []logpoller.Log) // Fetches the checkBlockNumber for a particular transaction and an upkeep ID. Requires a RPC call to get txData // so this function should not be used heavily -func (c *LogProvider) getCheckBlockNumberFromTxHash(txHash common.Hash, id ocr2keepers.UpkeepIdentifier) (bk ocr2keepers.BlockKey, e error) { +func (c *LogProvider) getCheckBlockNumberFromTxHash(ctx context.Context, txHash common.Hash, id ocr2keepers.UpkeepIdentifier) (bk ocr2keepers.BlockKey, e error) { defer func() { if r := recover(); r != nil { e = fmt.Errorf("recovered from panic in getCheckBlockNumberForUpkeep: %v", r) @@ -425,7 +425,7 @@ func (c *LogProvider) getCheckBlockNumberFromTxHash(txHash common.Hash, id ocr2k } var tx gethtypes.Transaction - err := c.client.CallContext(context.Background(), &tx, "eth_getTransactionByHash", txHash) + err := c.client.CallContext(ctx, &tx, "eth_getTransactionByHash", txHash) if err != nil { return "", err } diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go index 7f74f9a38a5..00c1469abab 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go @@ -716,6 +716,7 @@ func setupNodes(t *testing.T, nodeKeys [5]ethkey.KeyV2, registry *iregistry21.IK []int{1, 1, 1, 1}, // s []int, oracles, // oracles []OracleIdentityExtra, rawCfg, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 1600*time.Millisecond, // maxDurationObservation time.Duration, 20*time.Millisecond, // maxDurationShouldAcceptFinalizedReport time.Duration, diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_test.go index 4796c43569a..6ce0532f1b6 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_test.go @@ -347,7 +347,8 @@ func runKeeperPluginBasic(t *testing.T) { 3, // rMax uint8, []int{1, 1, 1, 1}, oracles, - offC, // reportingPluginConfig []byte, + offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // Max duration query 1600*time.Millisecond, // Max duration observation 800*time.Millisecond, @@ -602,7 +603,8 @@ func TestIntegration_KeeperPluginForwarderEnabled(t *testing.T) { 3, // rMax uint8, []int{1, 1, 1, 1}, oracles, - offC, // reportingPluginConfig []byte, + offC, // reportingPluginConfig []byte, + nil, 50*time.Millisecond, // Max duration query 1*time.Second, // Max duration observation 1*time.Second, diff --git a/core/services/ocr2/plugins/ocr2keeper/util.go b/core/services/ocr2/plugins/ocr2keeper/util.go index 339d8a89dfb..941e65b7b24 100644 --- a/core/services/ocr2/plugins/ocr2keeper/util.go +++ b/core/services/ocr2/plugins/ocr2keeper/util.go @@ -38,15 +38,11 @@ type Encoder21 interface { ocr2keepers21.Encoder } -var ( - ErrNoChainFromSpec = fmt.Errorf("could not create chain from spec") -) - -func EVMProvider(ds sqlutil.DataSource, chain legacyevm.Chain, lggr logger.Logger, spec job.Job, ethKeystore keystore.Eth) (evmrelay.OCR2KeeperProvider, error) { +func EVMProvider(ctx context.Context, ds sqlutil.DataSource, chain legacyevm.Chain, lggr logger.Logger, spec job.Job, ethKeystore keystore.Eth) (evmrelay.OCR2KeeperProvider, error) { oSpec := spec.OCR2OracleSpec ocr2keeperRelayer := evmrelay.NewOCR2KeeperRelayer(ds, chain, lggr.Named("OCR2KeeperRelayer"), ethKeystore) - keeperProvider, err := ocr2keeperRelayer.NewOCR2KeeperProvider( + keeperProvider, err := ocr2keeperRelayer.NewOCR2KeeperProvider(ctx, types.RelayArgs{ ExternalJobID: spec.ExternalJobID, JobID: oSpec.ID, @@ -79,7 +75,7 @@ func EVMDependencies20( var registry *evmregistry20.EvmRegistry // the provider will be returned as a dependency - if keeperProvider, err = EVMProvider(ds, chain, lggr, spec, ethKeystore); err != nil { + if keeperProvider, err = EVMProvider(ctx, ds, chain, lggr, spec, ethKeystore); err != nil { return nil, nil, nil, nil, err } diff --git a/core/services/ocr2/plugins/promwrapper/factory.go b/core/services/ocr2/plugins/promwrapper/factory.go index c3dffa55013..a3195ed88c9 100644 --- a/core/services/ocr2/plugins/promwrapper/factory.go +++ b/core/services/ocr2/plugins/promwrapper/factory.go @@ -1,6 +1,7 @@ package promwrapper import ( + "context" "math/big" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" @@ -15,8 +16,8 @@ type promFactory struct { chainID *big.Int } -func (p *promFactory) NewReportingPlugin(config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { - plugin, info, err := p.wrapped.NewReportingPlugin(config) +func (p *promFactory) NewReportingPlugin(ctx context.Context, config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { + plugin, info, err := p.wrapped.NewReportingPlugin(ctx, config) if err != nil { return nil, types.ReportingPluginInfo{}, err } diff --git a/core/services/ocr2/plugins/s4/factory.go b/core/services/ocr2/plugins/s4/factory.go index 54ed727ad78..3caff4e1866 100644 --- a/core/services/ocr2/plugins/s4/factory.go +++ b/core/services/ocr2/plugins/s4/factory.go @@ -1,6 +1,8 @@ package s4 import ( + "context" + s4_orm "github.com/smartcontractkit/chainlink/v2/core/services/s4" "github.com/smartcontractkit/libocr/commontypes" @@ -20,7 +22,7 @@ type S4ReportingPluginFactory struct { var _ types.ReportingPluginFactory = (*S4ReportingPluginFactory)(nil) // NewReportingPlugin complies with ReportingPluginFactory -func (f S4ReportingPluginFactory) NewReportingPlugin(rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { +func (f S4ReportingPluginFactory) NewReportingPlugin(ctx context.Context, rpConfig types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) { config, limits, err := f.ConfigDecoder(rpConfig.OffchainConfig) if err != nil { f.Logger.Error("unable to decode reporting plugin config", commontypes.LogFields{ diff --git a/core/services/ocr2/plugins/s4/factory_test.go b/core/services/ocr2/plugins/s4/factory_test.go index 13a36a53823..53129b18796 100644 --- a/core/services/ocr2/plugins/s4/factory_test.go +++ b/core/services/ocr2/plugins/s4/factory_test.go @@ -4,6 +4,7 @@ import ( "errors" "testing" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/s4" s4_mocks "github.com/smartcontractkit/chainlink/v2/core/services/s4/mocks" @@ -42,7 +43,7 @@ func TestS4ReportingPluginFactory_NewReportingPlugin(t *testing.T) { rpConfig := types.ReportingPluginConfig{ OffchainConfig: make([]byte, 100), } - plugin, pluginInfo, err := f.NewReportingPlugin(rpConfig) + plugin, pluginInfo, err := f.NewReportingPlugin(tests.Context(t), rpConfig) require.NoError(t, err) require.NotNil(t, plugin) require.Equal(t, types.ReportingPluginInfo{ @@ -67,7 +68,7 @@ func TestS4ReportingPluginFactory_NewReportingPlugin(t *testing.T) { rpConfig := types.ReportingPluginConfig{ OffchainConfig: make([]byte, 100), } - plugin, _, err := f.NewReportingPlugin(rpConfig) + plugin, _, err := f.NewReportingPlugin(tests.Context(t), rpConfig) require.ErrorContains(t, err, "some error") require.Nil(t, plugin) }) diff --git a/core/services/ocr2/validate/config.go b/core/services/ocr2/validate/config.go index 62815e19765..54c29e7d057 100644 --- a/core/services/ocr2/validate/config.go +++ b/core/services/ocr2/validate/config.go @@ -45,7 +45,9 @@ func ToLocalConfig(ocr2Config OCR2Config, insConf InsecureConfig, spec job.OCR2O ccTrackerPollInterval = ocr2Config.ContractPollInterval() } lc := types.LocalConfig{ + DefaultMaxDurationInitialization: 30 * time.Second, BlockchainTimeout: blockchainTimeout, + ContractConfigLoadTimeout: blockchainTimeout, ContractConfigConfirmations: ccConfirmations, ContractConfigTrackerPollInterval: ccTrackerPollInterval, ContractTransmitterTransmitTimeout: ocr2Config.ContractTransmitterTransmitTimeout(), diff --git a/core/services/ocrbootstrap/delegate.go b/core/services/ocrbootstrap/delegate.go index 10ac0cb45df..ad3a602d0bb 100644 --- a/core/services/ocrbootstrap/delegate.go +++ b/core/services/ocrbootstrap/delegate.go @@ -163,10 +163,12 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) (services [] lggr := d.lggr.With(ctxVals.Args()...) lggr.Infow("OCR2 job using local config", "BlockchainTimeout", lc.BlockchainTimeout, + "ContractConfigLoadTimeout", lc.ContractConfigLoadTimeout, "ContractConfigConfirmations", lc.ContractConfigConfirmations, "ContractConfigTrackerPollInterval", lc.ContractConfigTrackerPollInterval, "ContractTransmitterTransmitTimeout", lc.ContractTransmitterTransmitTimeout, "DatabaseTimeout", lc.DatabaseTimeout, + "DefaultMaxDurationInitialization", lc.DefaultMaxDurationInitialization, ) ocrLogger := ocrcommon.NewOCRWrapper(lggr.Named("OCRBootstrap"), d.ocr2Cfg.TraceLogging(), func(ctx context.Context, msg string) { logger.Sugared(lggr).ErrorIf(d.jobORM.RecordError(ctx, jb.ID, msg), "unable to record error") diff --git a/core/services/ocrcommon/adapters.go b/core/services/ocrcommon/adapters.go index b75a8a003c3..33e4971bc82 100644 --- a/core/services/ocrcommon/adapters.go +++ b/core/services/ocrcommon/adapters.go @@ -82,8 +82,8 @@ func (c *OCR3ContractTransmitterAdapter) Transmit(ctx context.Context, digest oc }, r.Report, signatures) } -func (c *OCR3ContractTransmitterAdapter) FromAccount() (ocrtypes.Account, error) { - return c.ct.FromAccount() +func (c *OCR3ContractTransmitterAdapter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { + return c.ct.FromAccount(ctx) } var _ ocr3types.OnchainKeyring[[]byte] = (*OCR3OnchainKeyringMultiChainAdapter)(nil) diff --git a/core/services/ocrcommon/adapters_test.go b/core/services/ocrcommon/adapters_test.go index fddfb297ecc..931d1dcf6c5 100644 --- a/core/services/ocrcommon/adapters_test.go +++ b/core/services/ocrcommon/adapters_test.go @@ -16,6 +16,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/structpb" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" @@ -258,16 +259,17 @@ func (f fakeContractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) panic("not implemented") } -func (f fakeContractTransmitter) FromAccount() (ocrtypes.Account, error) { +func (f fakeContractTransmitter) FromAccount(context.Context) (ocrtypes.Account, error) { return account, nil } func TestContractTransmitter(t *testing.T) { + ctx := testutils.Context(t) ct := ocrcommon.NewOCR3ContractTransmitterAdapter(fakeContractTransmitter{}) - require.NoError(t, ct.Transmit(context.Background(), configDigest, seqNr, rwi, signatures)) + require.NoError(t, ct.Transmit(ctx, configDigest, seqNr, rwi, signatures)) - a, err := ct.FromAccount() + a, err := ct.FromAccount(ctx) require.NoError(t, err) require.Equal(t, a, account) } diff --git a/core/services/ocrcommon/transmitter.go b/core/services/ocrcommon/transmitter.go index ccd2b010453..5d2de45295f 100644 --- a/core/services/ocrcommon/transmitter.go +++ b/core/services/ocrcommon/transmitter.go @@ -23,7 +23,7 @@ type txManager interface { type Transmitter interface { CreateEthTransaction(ctx context.Context, toAddress common.Address, payload []byte, txMeta *txmgr.TxMeta) error - FromAddress() common.Address + FromAddress(context.Context) common.Address } type transmitter struct { @@ -129,7 +129,7 @@ func (t *transmitter) CreateEthTransaction(ctx context.Context, toAddress common return errors.Wrap(err, "skipped OCR transmission") } -func (t *transmitter) FromAddress() common.Address { +func (t *transmitter) FromAddress(context.Context) common.Address { return t.effectiveTransmitterAddress } @@ -168,13 +168,13 @@ func (t *ocr2FeedsTransmitter) CreateEthTransaction(ctx context.Context, toAddre } // FromAddress for ocr2FeedsTransmitter returns valid forwarder or effectiveTransmitterAddress if forwarders are not set. -func (t *ocr2FeedsTransmitter) FromAddress() common.Address { - roundRobinFromAddress, err := t.keystore.GetRoundRobinAddress(context.Background(), t.chainID, t.fromAddresses...) +func (t *ocr2FeedsTransmitter) FromAddress(ctx context.Context) common.Address { + roundRobinFromAddress, err := t.keystore.GetRoundRobinAddress(ctx, t.chainID, t.fromAddresses...) if err != nil { return t.effectiveTransmitterAddress } - forwarderAddress, err := t.GetForwarderForEOAOCR2Feeds(context.Background(), roundRobinFromAddress, t.ocr2Aggregator) + forwarderAddress, err := t.GetForwarderForEOAOCR2Feeds(ctx, roundRobinFromAddress, t.ocr2Aggregator) if errors.Is(err, forwarders.ErrForwarderForEOANotFound) { // if there are no valid forwarders try to fallback to eoa return roundRobinFromAddress diff --git a/core/services/pipeline/runner_test.go b/core/services/pipeline/runner_test.go index 022a77c9471..d06c314aacc 100644 --- a/core/services/pipeline/runner_test.go +++ b/core/services/pipeline/runner_test.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/jmoiron/sqlx" "github.com/shopspring/decimal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -21,8 +22,6 @@ import ( "gopkg.in/guregu/null.v4" "github.com/smartcontractkit/chainlink-common/pkg/utils/jsonserializable" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" - "github.com/smartcontractkit/chainlink/v2/core/bridges" bridgesMocks "github.com/smartcontractkit/chainlink/v2/core/bridges/mocks" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" @@ -36,14 +35,11 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks" "github.com/smartcontractkit/chainlink/v2/core/utils" - - "github.com/jmoiron/sqlx" ) func newRunner(t testing.TB, db *sqlx.DB, bridgeORM bridges.ORM, cfg chainlink.GeneralConfig) (pipeline.Runner, *mocks.ORM) { ethKeyStore := cltest.NewKeyStore(t, db).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) orm := mocks.NewORM(t) c := clhttptest.NewTestLocalOnlyHTTPClient() r := pipeline.NewRunner(orm, bridgeORM, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ethKeyStore, nil, logger.TestLogger(t), c, c) @@ -468,8 +464,7 @@ func Test_PipelineRunner_HandleFaultsPersistRun(t *testing.T) { Return(nil) cfg := configtest.NewTestGeneralConfig(t) ethKeyStore := cltest.NewKeyStore(t, db).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) lggr := logger.TestLogger(t) r := pipeline.NewRunner(orm, btORM, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ethKeyStore, nil, lggr, nil, nil) @@ -508,8 +503,7 @@ func Test_PipelineRunner_ExecuteAndInsertFinishedRun_SavingTheSpec(t *testing.T) Return(nil) cfg := configtest.NewTestGeneralConfig(t) ethKeyStore := cltest.NewKeyStore(t, db).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) lggr := logger.TestLogger(t) r := pipeline.NewRunner(orm, btORM, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ethKeyStore, nil, lggr, nil, nil) @@ -978,8 +972,7 @@ func Test_PipelineRunner_ExecuteRun(t *testing.T) { db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) ethKeyStore := cltest.NewKeyStore(t, db).Eth() - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, KeyStore: ethKeyStore}) lggr := logger.TestLogger(t) r := pipeline.NewRunner(nil, nil, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ethKeyStore, nil, lggr, nil, nil) diff --git a/core/services/pipeline/task.eth_call_test.go b/core/services/pipeline/task.eth_call_test.go index b21b3065f8c..5106bb12d33 100644 --- a/core/services/pipeline/task.eth_call_test.go +++ b/core/services/pipeline/task.eth_call_test.go @@ -25,7 +25,6 @@ import ( keystoremocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" pipelinemocks "github.com/smartcontractkit/chainlink/v2/core/services/pipeline/mocks" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestETHCallTask(t *testing.T) { @@ -313,8 +312,7 @@ func TestETHCallTask(t *testing.T) { var legacyChains legacyevm.LegacyChainContainer if test.expectedErrorCause != nil || test.expectedErrorContains != "" { - exts := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, TxManager: txManager, KeyStore: keyStore}) - legacyChains = evmrelay.NewLegacyChainsFromRelayerExtenders(exts) + legacyChains = evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, TxManager: txManager, KeyStore: keyStore}) } else { legacyChains = cltest.NewLegacyChainsWithMockChain(t, ethClient, cfg) } diff --git a/core/services/pipeline/task.eth_tx_test.go b/core/services/pipeline/task.eth_tx_test.go index 5b9beeb43e1..57f7976f0ab 100644 --- a/core/services/pipeline/task.eth_tx_test.go +++ b/core/services/pipeline/task.eth_tx_test.go @@ -23,7 +23,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" keystoremocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" ) func TestETHTxTask(t *testing.T) { @@ -579,9 +578,8 @@ func TestETHTxTask(t *testing.T) { }) lggr := logger.TestLogger(t) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{DB: db, GeneralConfig: cfg, TxManager: txManager, KeyStore: keyStore}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) test.setupClientMocks(keyStore, txManager) task.HelperSetDependencies(legacyChains, keyStore, test.specGasLimit, pipeline.DirectRequestJobType) diff --git a/core/services/relay/dummy/config_digester.go b/core/services/relay/dummy/config_digester.go index a74e007b0ba..745402135f0 100644 --- a/core/services/relay/dummy/config_digester.go +++ b/core/services/relay/dummy/config_digester.go @@ -1,6 +1,8 @@ package dummy import ( + "context" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) @@ -16,11 +18,11 @@ func NewOffchainConfigDigester(cd ocrtypes.ConfigDigest) (ocrtypes.OffchainConfi // Compute ConfigDigest for the given ContractConfig. The first two bytes of the // ConfigDigest must be the big-endian encoding of ConfigDigestPrefix! -func (cd *configDigester) ConfigDigest(ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { +func (cd *configDigester) ConfigDigest(context.Context, ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { return cd.configDigest, nil } // This should return the same constant value on every invocation -func (cd *configDigester) ConfigDigestPrefix() (ocrtypes.ConfigDigestPrefix, error) { +func (cd *configDigester) ConfigDigestPrefix(ctx context.Context) (ocrtypes.ConfigDigestPrefix, error) { return ocrtypes.ConfigDigestPrefixFromConfigDigest(cd.configDigest), nil } diff --git a/core/services/relay/evm/config_poller_test.go b/core/services/relay/evm/config_poller_test.go index caf48caf490..0500b58a6e2 100644 --- a/core/services/relay/evm/config_poller_test.go +++ b/core/services/relay/evm/config_poller_test.go @@ -363,6 +363,7 @@ func setConfig(t *testing.T, pluginConfig median.OffchainConfig, ocrContract *oc []int{1, 1, 1, 1}, oracles, pluginConfig.Encode(), + nil, 50*time.Millisecond, 50*time.Millisecond, 50*time.Millisecond, diff --git a/core/services/relay/evm/contract_transmitter.go b/core/services/relay/evm/contract_transmitter.go index e2065bc60f7..2ec3eac0c41 100644 --- a/core/services/relay/evm/contract_transmitter.go +++ b/core/services/relay/evm/contract_transmitter.go @@ -33,7 +33,7 @@ var _ ContractTransmitter = &contractTransmitter{} type Transmitter interface { CreateEthTransaction(ctx context.Context, toAddress gethcommon.Address, payload []byte, txMeta *txmgr.TxMeta) error - FromAddress() gethcommon.Address + FromAddress(context.Context) gethcommon.Address } type ReportToEthMetadata func([]byte) (*txmgr.TxMeta, error) @@ -230,8 +230,8 @@ func (oc *contractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) ( } // FromAccount returns the account from which the transmitter invokes the contract -func (oc *contractTransmitter) FromAccount() (ocrtypes.Account, error) { - return ocrtypes.Account(oc.transmitter.FromAddress().String()), nil +func (oc *contractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { + return ocrtypes.Account(oc.transmitter.FromAddress(ctx).String()), nil } func (oc *contractTransmitter) Start(ctx context.Context) error { return nil } diff --git a/core/services/relay/evm/contract_transmitter_test.go b/core/services/relay/evm/contract_transmitter_test.go index 182cda63ced..5b9e1ae5981 100644 --- a/core/services/relay/evm/contract_transmitter_test.go +++ b/core/services/relay/evm/contract_transmitter_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" lpmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" @@ -38,7 +39,7 @@ func (m *mockTransmitter) CreateEthTransaction(ctx context.Context, toAddress ge return nil } -func (*mockTransmitter) FromAddress() gethcommon.Address { return sampleAddress } +func (*mockTransmitter) FromAddress(ctx context.Context) gethcommon.Address { return sampleAddress } func TestContractTransmitter(t *testing.T) { t.Parallel() @@ -83,7 +84,7 @@ func TestContractTransmitter(t *testing.T) { require.NoError(t, err) assert.Equal(t, "000130da6b9315bd59af6b0a3f5463c0d0a39e92eaa34cbcbdbace7b3bfcc777", hex.EncodeToString(digest[:])) assert.Equal(t, uint32(2), epoch) - from, err := ot.FromAccount() + from, err := ot.FromAccount(tests.Context(t)) require.NoError(t, err) assert.Equal(t, sampleAddress.String(), string(from)) } diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 880ad73ad21..05eaf226e3a 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "io" "math/big" "net/http" "strings" @@ -95,11 +96,11 @@ var _ commontypes.Relayer = &Relayer{} //nolint:staticcheck // [UnimplementedOffchainConfigDigester] satisfies the OCR OffchainConfigDigester interface type UnimplementedOffchainConfigDigester struct{} -func (e UnimplementedOffchainConfigDigester) ConfigDigest(config ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { +func (e UnimplementedOffchainConfigDigester) ConfigDigest(ctx context.Context, config ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { return ocrtypes.ConfigDigest{}, fmt.Errorf("unimplemented for this relayer") } -func (e UnimplementedOffchainConfigDigester) ConfigDigestPrefix() (ocrtypes.ConfigDigestPrefix, error) { +func (e UnimplementedOffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (ocrtypes.ConfigDigestPrefix, error) { return 0, fmt.Errorf("unimplemented for this relayer") } @@ -129,7 +130,7 @@ func (u UnimplementedContractTransmitter) Transmit(context.Context, ocrtypes.Rep return fmt.Errorf("unimplemented for this relayer") } -func (u UnimplementedContractTransmitter) FromAccount() (ocrtypes.Account, error) { +func (u UnimplementedContractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return "", fmt.Errorf("unimplemented for this relayer") } @@ -186,7 +187,7 @@ func (c RelayerOpts) Validate() error { return err } -func NewRelayer(lggr logger.Logger, chain legacyevm.Chain, opts RelayerOpts) (*Relayer, error) { +func NewRelayer(ctx context.Context, lggr logger.Logger, chain legacyevm.Chain, opts RelayerOpts) (*Relayer, error) { err := opts.Validate() if err != nil { return nil, fmt.Errorf("cannot create evm relayer: %w", err) @@ -215,7 +216,6 @@ func NewRelayer(lggr logger.Logger, chain legacyevm.Chain, opts RelayerOpts) (*R // Initialize write target capability if configuration is defined if chain.Config().EVM().Workflow().ForwarderAddress() != nil { - ctx := context.Background() if chain.Config().EVM().Workflow().GasLimitDefault() == nil { return nil, fmt.Errorf("unable to instantiate write target as default gas limit is not set") } @@ -238,16 +238,17 @@ func (r *Relayer) Name() string { return r.lggr.Name() } -// Start does noop: no subservices started on relay start, but when the first job is started -func (r *Relayer) Start(context.Context) error { - return nil +func (r *Relayer) Start(ctx context.Context) error { + return r.chain.Start(ctx) } func (r *Relayer) Close() error { + cs := make([]io.Closer, 0, 2) if r.triggerCapability != nil { - return r.triggerCapability.Close() + cs = append(cs, r.triggerCapability) } - return nil + cs = append(cs, r.chain) + return services.MultiCloser(cs).Close() } // Ready does noop: always ready @@ -256,11 +257,35 @@ func (r *Relayer) Ready() error { } func (r *Relayer) HealthReport() (report map[string]error) { - report = make(map[string]error) + report = map[string]error{r.Name(): r.Ready()} maps.Copy(report, r.chain.HealthReport()) return } +func (r *Relayer) LatestHead(ctx context.Context) (commontypes.Head, error) { + return r.chain.LatestHead(ctx) +} + +func (r *Relayer) GetChainStatus(ctx context.Context) (commontypes.ChainStatus, error) { + return r.chain.GetChainStatus(ctx) +} + +func (r *Relayer) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []commontypes.NodeStatus, nextPageToken string, total int, err error) { + return r.chain.ListNodeStatuses(ctx, pageSize, pageToken) +} + +func (r *Relayer) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { + return r.chain.Transact(ctx, from, to, amount, balanceCheck) +} + +func (r *Relayer) ID() string { + return r.chain.ID().String() +} + +func (r *Relayer) Chain() legacyevm.Chain { + return r.chain +} + func newOCR3CapabilityConfigProvider(ctx context.Context, lggr logger.Logger, chain legacyevm.Chain, opts *types.RelayOpts) (*configWatcher, error) { if !common.IsHexAddress(opts.ContractID) { return nil, errors.New("invalid contractID, expected hex address") @@ -275,9 +300,7 @@ func newOCR3CapabilityConfigProvider(ctx context.Context, lggr logger.Logger, ch } // NewPluginProvider, but customized to use a different config provider -func (r *Relayer) NewOCR3CapabilityProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.OCR3CapabilityProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() +func (r *Relayer) NewOCR3CapabilityProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.OCR3CapabilityProvider, error) { lggr := logger.Sugared(r.lggr).Named("PluginProvider").Named(rargs.ExternalJobID.String()) relayOpts := types.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() @@ -312,7 +335,7 @@ func (r *Relayer) NewOCR3CapabilityProvider(rargs commontypes.RelayArgs, pargs c lggr, ) - fromAccount, err := pp.ContractTransmitter().FromAccount() + fromAccount, err := pp.ContractTransmitter().FromAccount(ctx) if err != nil { return nil, err } @@ -323,9 +346,7 @@ func (r *Relayer) NewOCR3CapabilityProvider(rargs commontypes.RelayArgs, pargs c }, nil } -func (r *Relayer) NewPluginProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.PluginProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() +func (r *Relayer) NewPluginProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.PluginProvider, error) { lggr := logger.Sugared(r.lggr).Named("PluginProvider").Named(rargs.ExternalJobID.String()) relayOpts := types.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() @@ -361,9 +382,7 @@ func (r *Relayer) NewPluginProvider(rargs commontypes.RelayArgs, pargs commontyp ), nil } -func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MercuryProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() +func (r *Relayer) NewMercuryProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MercuryProvider, error) { lggr := logger.Sugared(r.lggr).Named("MercuryProvider").Named(rargs.ExternalJobID.String()) relayOpts := types.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() @@ -399,7 +418,7 @@ func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commonty clients := make(map[string]wsrpc.Client) for _, server := range mercuryConfig.GetServers() { - client, err := r.mercuryPool.Checkout(context.Background(), privKey, server.PubKey, server.URL) + client, err := r.mercuryPool.Checkout(ctx, privKey, server.PubKey, server.URL) if err != nil { return nil, err } @@ -448,10 +467,7 @@ func (r *Relayer) NewMercuryProvider(rargs commontypes.RelayArgs, pargs commonty return NewMercuryProvider(cp, r.codec, NewMercuryChainReader(r.chain.HeadTracker()), transmitter, reportCodecV1, reportCodecV2, reportCodecV3, reportCodecV4, lggr), nil } -func (r *Relayer) NewLLOProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.LLOProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *Relayer) NewLLOProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.LLOProvider, error) { relayOpts := types.NewRelayOpts(rargs) var relayConfig types.RelayConfig { @@ -495,7 +511,7 @@ func (r *Relayer) NewLLOProvider(rargs commontypes.RelayArgs, pargs commontypes. } else { clients := make(map[string]wsrpc.Client) for _, server := range lloCfg.GetServers() { - client, err2 := r.mercuryPool.Checkout(context.Background(), privKey, server.PubKey, server.URL) + client, err2 := r.mercuryPool.Checkout(ctx, privKey, server.PubKey, server.URL) if err2 != nil { return nil, err2 } @@ -526,20 +542,14 @@ func (r *Relayer) NewLLOProvider(rargs commontypes.RelayArgs, pargs commontypes. return NewLLOProvider(cp, transmitter, r.lggr, cdc), nil } -func (r *Relayer) NewFunctionsProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.FunctionsProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *Relayer) NewFunctionsProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.FunctionsProvider, error) { lggr := r.lggr.Named("FunctionsProvider").Named(rargs.ExternalJobID.String()) // TODO(FUN-668): Not ready yet (doesn't implement FunctionsEvents() properly) return NewFunctionsProvider(ctx, r.chain, rargs, pargs, lggr, r.ks.Eth(), functions.FunctionsPlugin) } // NewConfigProvider is called by bootstrap jobs -func (r *Relayer) NewConfigProvider(args commontypes.RelayArgs) (configProvider commontypes.ConfigProvider, err error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *Relayer) NewConfigProvider(ctx context.Context, args commontypes.RelayArgs) (configProvider commontypes.ConfigProvider, err error) { lggr := r.lggr.Named("ConfigProvider").Named(args.ExternalJobID.String()) relayOpts := types.NewRelayOpts(args) relayConfig, err := relayOpts.RelayConfig() @@ -795,8 +805,7 @@ func (r *Relayer) NewChainWriter(_ context.Context, config []byte) (commontypes. return NewChainWriterService(r.lggr, r.chain.Client(), r.chain.TxManager(), r.chain.GasEstimator(), cfg) } -func (r *Relayer) NewContractReader(chainReaderConfig []byte) (commontypes.ContractReader, error) { - ctx := context.Background() +func (r *Relayer) NewContractReader(ctx context.Context, chainReaderConfig []byte) (commontypes.ContractReader, error) { cfg := &types.ChainReaderConfig{} if err := json.Unmarshal(chainReaderConfig, cfg); err != nil { return nil, fmt.Errorf("failed to unmarshall chain reader config err: %s", err) @@ -805,10 +814,7 @@ func (r *Relayer) NewContractReader(chainReaderConfig []byte) (commontypes.Contr return NewChainReaderService(ctx, r.lggr, r.chain.LogPoller(), r.chain.HeadTracker(), r.chain.Client(), *cfg) } -func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MedianProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *Relayer) NewMedianProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.MedianProvider, error) { lggr := logger.Sugared(r.lggr).Named("MedianProvider").Named(rargs.ExternalJobID.String()) relayOpts := types.NewRelayOpts(rargs) relayConfig, err := relayOpts.RelayConfig() @@ -857,7 +863,7 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp } boundContracts := []commontypes.BoundContract{{Name: "median", Address: contractID.String()}} - if err = chainReaderService.Bind(context.Background(), boundContracts); err != nil { + if err = chainReaderService.Bind(ctx, boundContracts); err != nil { return nil, err } } else { @@ -877,11 +883,11 @@ func (r *Relayer) NewMedianProvider(rargs commontypes.RelayArgs, pargs commontyp return &medianProvider, nil } -func (r *Relayer) NewAutomationProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.AutomationProvider, error) { +func (r *Relayer) NewAutomationProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.AutomationProvider, error) { lggr := logger.Sugared(r.lggr).Named("AutomationProvider").Named(rargs.ExternalJobID.String()) ocr2keeperRelayer := NewOCR2KeeperRelayer(r.ds, r.chain, lggr.Named("OCR2KeeperRelayer"), r.ks.Eth()) - return ocr2keeperRelayer.NewOCR2KeeperProvider(rargs, pargs) + return ocr2keeperRelayer.NewOCR2KeeperProvider(ctx, rargs, pargs) } func chainToUUID(chainID *big.Int) uuid.UUID { @@ -901,10 +907,7 @@ func chainToUUID(chainID *big.Int) uuid.UUID { // which *type* (impl) of CCIPCommitProvider should be created. CCIP is currently a special case where the provider has a // subset of implementations of the complete interface as certain contracts in a CCIP lane are only deployed on the src // chain or on the dst chain. This results in the two implementations of providers: a src and dst implementation. -func (r *Relayer) NewCCIPCommitProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.CCIPCommitProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *Relayer) NewCCIPCommitProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.CCIPCommitProvider, error) { versionFinder := ccip.NewEvmVersionFinder() var commitPluginConfig ccipconfig.CommitPluginConfig @@ -968,10 +971,7 @@ func (r *Relayer) NewCCIPCommitProvider(rargs commontypes.RelayArgs, pargs commo // which *type* (impl) of CCIPExecProvider should be created. CCIP is currently a special case where the provider has a // subset of implementations of the complete interface as certain contracts in a CCIP lane are only deployed on the src // chain or on the dst chain. This results in the two implementations of providers: a src and dst implementation. -func (r *Relayer) NewCCIPExecProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.CCIPExecProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *Relayer) NewCCIPExecProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (commontypes.CCIPExecProvider, error) { versionFinder := ccip.NewEvmVersionFinder() var execPluginConfig ccipconfig.ExecPluginConfig diff --git a/core/services/relay/evm/functions/config_poller_test.go b/core/services/relay/evm/functions/config_poller_test.go index c44d64c5ba7..1d8ef2cde36 100644 --- a/core/services/relay/evm/functions/config_poller_test.go +++ b/core/services/relay/evm/functions/config_poller_test.go @@ -193,6 +193,7 @@ func setFunctionsConfig(t *testing.T, pluginConfig *functionsConfig.ReportingPlu []int{1, 1, 1, 1}, oracles, pluginConfigBytes, + nil, 50*time.Millisecond, 50*time.Millisecond, 50*time.Millisecond, diff --git a/core/services/relay/evm/functions/contract_transmitter.go b/core/services/relay/evm/functions/contract_transmitter.go index f588a02390c..94fbe83d51a 100644 --- a/core/services/relay/evm/functions/contract_transmitter.go +++ b/core/services/relay/evm/functions/contract_transmitter.go @@ -284,7 +284,7 @@ func (oc *contractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) ( } // FromAccount returns the account from which the transmitter invokes the contract -func (oc *contractTransmitter) FromAccount() (ocrtypes.Account, error) { +func (oc *contractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(oc.effectiveTransmitterAddress.String()), nil } diff --git a/core/services/relay/evm/functions/offchain_config_digester.go b/core/services/relay/evm/functions/offchain_config_digester.go index fa8199ec0a4..6aadaaea386 100644 --- a/core/services/relay/evm/functions/offchain_config_digester.go +++ b/core/services/relay/evm/functions/offchain_config_digester.go @@ -37,7 +37,7 @@ func NewFunctionsOffchainConfigDigester(pluginType FunctionsPluginType, chainID } } -func (d *functionsOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) (types.ConfigDigest, error) { +func (d *functionsOffchainConfigDigester) ConfigDigest(ctx context.Context, cc types.ContractConfig) (types.ConfigDigest, error) { contractAddress := d.contractAddress.Load() if contractAddress == nil { return types.ConfigDigest{}, errors.New("contract address not set") @@ -47,7 +47,7 @@ func (d *functionsOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) ContractAddress: *contractAddress, } - configDigest, err := baseDigester.ConfigDigest(cc) + configDigest, err := baseDigester.ConfigDigest(ctx, cc) if err != nil { return types.ConfigDigest{}, err } @@ -69,7 +69,7 @@ func (d *functionsOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) return configDigest, nil } -func (d *functionsOffchainConfigDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error) { +func (d *functionsOffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (types.ConfigDigestPrefix, error) { switch d.pluginType { case FunctionsPlugin: return FunctionsDigestPrefix, nil diff --git a/core/services/relay/evm/loop_impl.go b/core/services/relay/evm/loop_impl.go index aec956cd0d2..3fd1de910b3 100644 --- a/core/services/relay/evm/loop_impl.go +++ b/core/services/relay/evm/loop_impl.go @@ -2,30 +2,29 @@ package evm import ( "github.com/smartcontractkit/chainlink-common/pkg/loop" - "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/relay" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" ) -type LoopRelayAdapter interface { +type LOOPRelayAdapter interface { loop.Relayer Chain() legacyevm.Chain } -type LoopRelayer struct { +type loopRelayAdapter struct { loop.Relayer - ext EVMChainRelayerExtender + chain legacyevm.Chain } -var _ loop.Relayer = &LoopRelayer{} +var _ LOOPRelayAdapter = &loopRelayAdapter{} -func NewLoopRelayServerAdapter(r *Relayer, cs EVMChainRelayerExtender) *LoopRelayer { - ra := relay.NewServerAdapter(r, cs) - return &LoopRelayer{ - Relayer: ra, - ext: cs, +func NewLOOPRelayAdapter(r *Relayer) *loopRelayAdapter { + return &loopRelayAdapter{ + Relayer: relay.NewServerAdapter(r), + chain: r.chain, } } -func (la *LoopRelayer) Chain() legacyevm.Chain { - return la.ext.Chain() +func (la *loopRelayAdapter) Chain() legacyevm.Chain { + return la.chain } diff --git a/core/services/relay/evm/median_test.go b/core/services/relay/evm/median_test.go index a1578737b68..9fa612dabcd 100644 --- a/core/services/relay/evm/median_test.go +++ b/core/services/relay/evm/median_test.go @@ -32,7 +32,7 @@ func TestNewMedianProvider(t *testing.T) { rc, err2 := json.Marshal(&relayConfigBadChainID) rargs2 := commontypes.RelayArgs{ContractID: contractID.String(), RelayConfig: rc} require.NoError(t, err2) - _, err2 = relayer.NewMedianProvider(rargs2, pargs) + _, err2 = relayer.NewMedianProvider(testutils.Context(t), rargs2, pargs) assert.ErrorContains(t, err2, "chain id in spec does not match") }) @@ -41,7 +41,7 @@ func TestNewMedianProvider(t *testing.T) { rc, err2 := json.Marshal(&relayConfig) require.NoError(t, err2) rargsBadContractID := commontypes.RelayArgs{ContractID: "NotAContractID", RelayConfig: rc} - _, err2 = relayer.NewMedianProvider(rargsBadContractID, pargs) + _, err2 = relayer.NewMedianProvider(testutils.Context(t), rargsBadContractID, pargs) assert.ErrorContains(t, err2, "invalid contractID") }) } diff --git a/core/services/relay/evm/mercury/config_poller_test.go b/core/services/relay/evm/mercury/config_poller_test.go index f828938f954..400ecdaf244 100644 --- a/core/services/relay/evm/mercury/config_poller_test.go +++ b/core/services/relay/evm/mercury/config_poller_test.go @@ -62,7 +62,8 @@ func TestMercuryConfigPoller(t *testing.T) { 100, // rMax []int{len(oracles)}, // S oracles, - []byte{}, // reportingPluginConfig []byte, + []byte{}, // reportingPluginConfig []byte, + nil, 0, // Max duration query 250*time.Millisecond, // Max duration observation 250*time.Millisecond, // MaxDurationReport diff --git a/core/services/relay/evm/mercury/offchain_config_digester.go b/core/services/relay/evm/mercury/offchain_config_digester.go index 80b30054551..e771053c37b 100644 --- a/core/services/relay/evm/mercury/offchain_config_digester.go +++ b/core/services/relay/evm/mercury/offchain_config_digester.go @@ -1,6 +1,7 @@ package mercury import ( + "context" "crypto/ed25519" "encoding/hex" "math/big" @@ -29,7 +30,7 @@ type OffchainConfigDigester struct { Prefix ocrtypes.ConfigDigestPrefix } -func (d OffchainConfigDigester) ConfigDigest(cc ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { +func (d OffchainConfigDigester) ConfigDigest(ctx context.Context, cc ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { signers := []common.Address{} for i, signer := range cc.Signers { if len(signer) != 20 { @@ -68,6 +69,6 @@ func (d OffchainConfigDigester) ConfigDigest(cc ocrtypes.ContractConfig) (ocrtyp ), nil } -func (d OffchainConfigDigester) ConfigDigestPrefix() (ocrtypes.ConfigDigestPrefix, error) { +func (d OffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (ocrtypes.ConfigDigestPrefix, error) { return d.Prefix, nil } diff --git a/core/services/relay/evm/mercury/offchain_config_digester_test.go b/core/services/relay/evm/mercury/offchain_config_digester_test.go index c5d39926576..62869cf6f3d 100644 --- a/core/services/relay/evm/mercury/offchain_config_digester_test.go +++ b/core/services/relay/evm/mercury/offchain_config_digester_test.go @@ -7,17 +7,20 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func Test_OffchainConfigDigester_ConfigDigest(t *testing.T) { + ctx := tests.Context(t) // ChainID and ContractAddress are taken into account for computation - cd1, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(types.ContractConfig{}) + cd1, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) - cd2, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(types.ContractConfig{}) + cd2, err := OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) - cd3, err := OffchainConfigDigester{ChainID: big.NewInt(1)}.ConfigDigest(types.ContractConfig{}) + cd3, err := OffchainConfigDigester{ChainID: big.NewInt(1)}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) - cd4, err := OffchainConfigDigester{ChainID: big.NewInt(1), ContractAddress: common.Address{1}}.ConfigDigest(types.ContractConfig{}) + cd4, err := OffchainConfigDigester{ChainID: big.NewInt(1), ContractAddress: common.Address{1}}.ConfigDigest(ctx, types.ContractConfig{}) require.NoError(t, err) require.Equal(t, cd1, cd2) @@ -26,29 +29,29 @@ func Test_OffchainConfigDigester_ConfigDigest(t *testing.T) { require.NotEqual(t, cd3, cd4) // malformed signers - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Signers: []types.OnchainPublicKey{{1, 2}}, }) require.Error(t, err) // malformed transmitters - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"0x"}, }) require.Error(t, err) - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"7343581f55146951b0f678dc6cfa8fd360e2f353"}, }) require.Error(t, err) - _, err = OffchainConfigDigester{}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"7343581f55146951b0f678dc6cfa8fd360e2f353aabbccddeeffaaccddeeffaz"}, }) require.Error(t, err) // well-formed transmitters - _, err = OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(types.ContractConfig{ + _, err = OffchainConfigDigester{ChainID: big.NewInt(0)}.ConfigDigest(ctx, types.ContractConfig{ Transmitters: []types.Account{"7343581f55146951b0f678dc6cfa8fd360e2f353aabbccddeeffaaccddeeffaa"}, }) require.NoError(t, err) diff --git a/core/services/relay/evm/mercury/transmitter.go b/core/services/relay/evm/mercury/transmitter.go index b914e67b453..06279287d3d 100644 --- a/core/services/relay/evm/mercury/transmitter.go +++ b/core/services/relay/evm/mercury/transmitter.go @@ -97,8 +97,8 @@ type ConfigTracker interface { } type TransmitterReportDecoder interface { - BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error) - ObservationTimestampFromReport(report ocrtypes.Report) (uint32, error) + BenchmarkPriceFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) + ObservationTimestampFromReport(ctx context.Context, report ocrtypes.Report) (uint32, error) } var _ Transmitter = (*mercuryTransmitter)(nil) @@ -441,7 +441,7 @@ func (mt *mercuryTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.R Payload: payload, } - ts, err := mt.codec.ObservationTimestampFromReport(report) + ts, err := mt.codec.ObservationTimestampFromReport(ctx, report) if err != nil { mt.lggr.Warnw("Failed to get observation timestamp from report", "err", err) } @@ -467,7 +467,7 @@ func (mt *mercuryTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.R } // FromAccount returns the stringified (hex) CSA public key -func (mt *mercuryTransmitter) FromAccount() (ocrtypes.Account, error) { +func (mt *mercuryTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { return ocrtypes.Account(mt.fromAccount), nil } @@ -513,7 +513,7 @@ func (mt *mercuryTransmitter) LatestPrice(ctx context.Context, feedID [32]byte) if !is { return nil, fmt.Errorf("expected report to be []byte, but it was %T", m["report"]) } - return mt.codec.BenchmarkPriceFromReport(report) + return mt.codec.BenchmarkPriceFromReport(ctx, report) } // LatestTimestamp will return -1, nil if the feed is missing diff --git a/core/services/relay/evm/mercury/transmitter_test.go b/core/services/relay/evm/mercury/transmitter_test.go index 4eedc0c24a8..fc477350485 100644 --- a/core/services/relay/evm/mercury/transmitter_test.go +++ b/core/services/relay/evm/mercury/transmitter_test.go @@ -228,11 +228,11 @@ type mockCodec struct { var _ mercurytypes.ReportCodec = &mockCodec{} -func (m *mockCodec) BenchmarkPriceFromReport(_ ocrtypes.Report) (*big.Int, error) { +func (m *mockCodec) BenchmarkPriceFromReport(ctx context.Context, _ ocrtypes.Report) (*big.Int, error) { return m.val, m.err } -func (m *mockCodec) ObservationTimestampFromReport(report ocrtypes.Report) (uint32, error) { +func (m *mockCodec) ObservationTimestampFromReport(ctx context.Context, report ocrtypes.Report) (uint32, error) { return 0, nil } diff --git a/core/services/relay/evm/mercury/types/types.go b/core/services/relay/evm/mercury/types/types.go index 972367940b5..98910887111 100644 --- a/core/services/relay/evm/mercury/types/types.go +++ b/core/services/relay/evm/mercury/types/types.go @@ -14,7 +14,7 @@ type DataSourceORM interface { } type ReportCodec interface { - BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error) + BenchmarkPriceFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) } var ( diff --git a/core/services/relay/evm/mercury/v1/data_source.go b/core/services/relay/evm/mercury/v1/data_source.go index 5a9a11decaa..0b9b6727fcf 100644 --- a/core/services/relay/evm/mercury/v1/data_source.go +++ b/core/services/relay/evm/mercury/v1/data_source.go @@ -111,7 +111,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam return } if latest != nil { - obs.MaxFinalizedBlockNumber.Val, obs.MaxFinalizedBlockNumber.Err = ds.codec.CurrentBlockNumFromReport(latest) + obs.MaxFinalizedBlockNumber.Val, obs.MaxFinalizedBlockNumber.Err = ds.codec.CurrentBlockNumFromReport(ctx, latest) return } val, fetchErr := ds.fetcher.FetchInitialMaxFinalizedBlockNumber(ctx) diff --git a/core/services/relay/evm/mercury/v1/reportcodec/report_codec.go b/core/services/relay/evm/mercury/v1/reportcodec/report_codec.go index fb332dcc8ff..52cdeff96cb 100644 --- a/core/services/relay/evm/mercury/v1/reportcodec/report_codec.go +++ b/core/services/relay/evm/mercury/v1/reportcodec/report_codec.go @@ -1,6 +1,7 @@ package reportcodec import ( + "context" "errors" "fmt" "math" @@ -36,7 +37,7 @@ func NewReportCodec(feedID [32]byte, lggr logger.Logger) *ReportCodec { return &ReportCodec{lggr, feedID} } -func (r *ReportCodec) BuildReport(rf v1.ReportFields) (ocrtypes.Report, error) { +func (r *ReportCodec) BuildReport(ctx context.Context, rf v1.ReportFields) (ocrtypes.Report, error) { var merr error if rf.BenchmarkPrice == nil { merr = errors.Join(merr, errors.New("benchmarkPrice may not be nil")) @@ -62,11 +63,11 @@ func (r *ReportCodec) BuildReport(rf v1.ReportFields) (ocrtypes.Report, error) { // Maximum length in bytes of Report returned by BuildReport. Used for // defending against spam attacks. -func (r *ReportCodec) MaxReportLength(n int) (int, error) { +func (r *ReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return maxReportLength, nil } -func (r *ReportCodec) CurrentBlockNumFromReport(report ocrtypes.Report) (int64, error) { +func (r *ReportCodec) CurrentBlockNumFromReport(ctx context.Context, report ocrtypes.Report) (int64, error) { decoded, err := r.Decode(report) if err != nil { return 0, err @@ -77,22 +78,11 @@ func (r *ReportCodec) CurrentBlockNumFromReport(report ocrtypes.Report) (int64, return int64(decoded.CurrentBlockNum), nil } -func (r *ReportCodec) ValidFromBlockNumFromReport(report ocrtypes.Report) (int64, error) { - decoded, err := r.Decode(report) - if err != nil { - return 0, err - } - if decoded.ValidFromBlockNum > math.MaxInt64 { - return 0, fmt.Errorf("ValidFromBlockNum=%d overflows max int64", decoded.ValidFromBlockNum) - } - return int64(decoded.ValidFromBlockNum), nil -} - func (r *ReportCodec) Decode(report ocrtypes.Report) (*reporttypes.Report, error) { return reporttypes.Decode(report) } -func (r *ReportCodec) BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error) { +func (r *ReportCodec) BenchmarkPriceFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) { decoded, err := r.Decode(report) if err != nil { return nil, err @@ -100,7 +90,7 @@ func (r *ReportCodec) BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int return decoded.BenchmarkPrice, nil } -func (r *ReportCodec) ObservationTimestampFromReport(report ocrtypes.Report) (uint32, error) { +func (r *ReportCodec) ObservationTimestampFromReport(ctx context.Context, report ocrtypes.Report) (uint32, error) { decoded, err := r.Decode(report) if err != nil { return 0, err diff --git a/core/services/relay/evm/mercury/v1/reportcodec/report_codec_test.go b/core/services/relay/evm/mercury/v1/reportcodec/report_codec_test.go index 3e898d6c1da..f5e2c7453e8 100644 --- a/core/services/relay/evm/mercury/v1/reportcodec/report_codec_test.go +++ b/core/services/relay/evm/mercury/v1/reportcodec/report_codec_test.go @@ -1,11 +1,14 @@ package reportcodec import ( + "fmt" + "math" "math/big" "testing" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -13,6 +16,7 @@ import ( v1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" ) var hash = hexutil.MustDecode("0x552c2cea3ab43bae137d89ee6142a01db3ae2b5678bc3c9bd5f509f537bea57b") @@ -34,7 +38,8 @@ func Test_ReportCodec(t *testing.T) { r := ReportCodec{} t.Run("BuildReport errors on zero fields", func(t *testing.T) { - _, err := r.BuildReport(v1.ReportFields{}) + ctx := testutils.Context(t) + _, err := r.BuildReport(ctx, v1.ReportFields{}) require.Error(t, err) assert.Contains(t, err.Error(), "benchmarkPrice may not be nil") assert.Contains(t, err.Error(), "bid may not be nil") @@ -43,10 +48,11 @@ func Test_ReportCodec(t *testing.T) { }) t.Run("BuildReport constructs a report from observations", func(t *testing.T) { + ctx := testutils.Context(t) rf := newValidReportFields() // only need to test happy path since validations are done in relaymercury - report, err := r.BuildReport(rf) + report, err := r.BuildReport(ctx, rf) require.NoError(t, err) reportElems := make(map[string]interface{}) @@ -64,7 +70,7 @@ func Test_ReportCodec(t *testing.T) { assert.Equal(t, types.Report{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x55, 0x2c, 0x2c, 0xea, 0x3a, 0xb4, 0x3b, 0xae, 0x13, 0x7d, 0x89, 0xee, 0x61, 0x42, 0xa0, 0x1d, 0xb3, 0xae, 0x2b, 0x56, 0x78, 0xbc, 0x3c, 0x9b, 0xd5, 0xf5, 0x9, 0xf5, 0x37, 0xbe, 0xa5, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7b}, report) - max, err := r.MaxReportLength(4) + max, err := r.MaxReportLength(ctx, 4) require.NoError(t, err) assert.LessOrEqual(t, len(report), max) @@ -125,7 +131,8 @@ func Test_ReportCodec_CurrentBlockNumFromReport(t *testing.T) { t.Run("CurrentBlockNumFromReport extracts the current block number from a valid report", func(t *testing.T) { report := buildSampleReport(validBn, 143, feedID) - bn, err := r.CurrentBlockNumFromReport(report) + ctx := testutils.Context(t) + bn, err := r.CurrentBlockNumFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, validBn, bn) @@ -133,12 +140,26 @@ func Test_ReportCodec_CurrentBlockNumFromReport(t *testing.T) { t.Run("CurrentBlockNumFromReport returns error if block num is too large", func(t *testing.T) { report := buildSampleReport(invalidBn, 143, feedID) - _, err := r.CurrentBlockNumFromReport(report) + ctx := testutils.Context(t) + _, err := r.CurrentBlockNumFromReport(ctx, report) require.Error(t, err) assert.Contains(t, err.Error(), "CurrentBlockNum=18446744073709551615 overflows max int64") }) } + +func (r *ReportCodec) ValidFromBlockNumFromReport(report ocrtypes.Report) (int64, error) { + decoded, err := r.Decode(report) + if err != nil { + return 0, err + } + n := decoded.ValidFromBlockNum + if n > math.MaxInt64 { + return 0, fmt.Errorf("ValidFromBlockNum=%d overflows max int64", n) + } + return int64(n), nil +} + func Test_ReportCodec_ValidFromBlockNumFromReport(t *testing.T) { r := ReportCodec{} feedID := utils.NewHash() @@ -166,15 +187,17 @@ func Test_ReportCodec_BenchmarkPriceFromReport(t *testing.T) { feedID := utils.NewHash() t.Run("BenchmarkPriceFromReport extracts the benchmark price from valid report", func(t *testing.T) { + ctx := testutils.Context(t) report := buildSampleReport(42, 999, feedID) - bp, err := r.BenchmarkPriceFromReport(report) + bp, err := r.BenchmarkPriceFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, big.NewInt(242), bp) }) t.Run("BenchmarkPriceFromReport errors on invalid report", func(t *testing.T) { - _, err := r.BenchmarkPriceFromReport([]byte{1, 2, 3}) + ctx := testutils.Context(t) + _, err := r.BenchmarkPriceFromReport(ctx, []byte{1, 2, 3}) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") }) diff --git a/core/services/relay/evm/mercury/v2/data_source.go b/core/services/relay/evm/mercury/v2/data_source.go index d05bd00e25a..e5d844493a3 100644 --- a/core/services/relay/evm/mercury/v2/data_source.go +++ b/core/services/relay/evm/mercury/v2/data_source.go @@ -81,7 +81,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam return } if latest != nil { - maxFinalizedBlockNumber, decodeErr := ds.codec.ObservationTimestampFromReport(latest) + maxFinalizedBlockNumber, decodeErr := ds.codec.ObservationTimestampFromReport(ctx, latest) obs.MaxFinalizedTimestamp.Val, obs.MaxFinalizedTimestamp.Err = int64(maxFinalizedBlockNumber), decodeErr return } diff --git a/core/services/relay/evm/mercury/v2/reportcodec/report_codec.go b/core/services/relay/evm/mercury/v2/reportcodec/report_codec.go index ebbdfac66cd..d35621da01b 100644 --- a/core/services/relay/evm/mercury/v2/reportcodec/report_codec.go +++ b/core/services/relay/evm/mercury/v2/reportcodec/report_codec.go @@ -1,6 +1,7 @@ package reportcodec import ( + "context" "errors" "fmt" "math/big" @@ -31,7 +32,7 @@ func NewReportCodec(feedID [32]byte, lggr logger.Logger) *ReportCodec { return &ReportCodec{lggr, feedID} } -func (r *ReportCodec) BuildReport(rf v2.ReportFields) (ocrtypes.Report, error) { +func (r *ReportCodec) BuildReport(ctx context.Context, rf v2.ReportFields) (ocrtypes.Report, error) { var merr error if rf.BenchmarkPrice == nil { merr = errors.Join(merr, errors.New("benchmarkPrice may not be nil")) @@ -53,24 +54,24 @@ func (r *ReportCodec) BuildReport(rf v2.ReportFields) (ocrtypes.Report, error) { return ocrtypes.Report(reportBytes), pkgerrors.Wrap(err, "failed to pack report blob") } -func (r *ReportCodec) MaxReportLength(n int) (int, error) { +func (r *ReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return maxReportLength, nil } -func (r *ReportCodec) ObservationTimestampFromReport(report ocrtypes.Report) (uint32, error) { - decoded, err := r.Decode(report) +func (r *ReportCodec) ObservationTimestampFromReport(ctx context.Context, report ocrtypes.Report) (uint32, error) { + decoded, err := r.Decode(ctx, report) if err != nil { return 0, err } return decoded.ObservationsTimestamp, nil } -func (r *ReportCodec) Decode(report ocrtypes.Report) (*reporttypes.Report, error) { +func (r *ReportCodec) Decode(ctx context.Context, report ocrtypes.Report) (*reporttypes.Report, error) { return reporttypes.Decode(report) } -func (r *ReportCodec) BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error) { - decoded, err := r.Decode(report) +func (r *ReportCodec) BenchmarkPriceFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) { + decoded, err := r.Decode(ctx, report) if err != nil { return nil, err } diff --git a/core/services/relay/evm/mercury/v2/reportcodec/report_codec_test.go b/core/services/relay/evm/mercury/v2/reportcodec/report_codec_test.go index 36b3a443880..809869282b7 100644 --- a/core/services/relay/evm/mercury/v2/reportcodec/report_codec_test.go +++ b/core/services/relay/evm/mercury/v2/reportcodec/report_codec_test.go @@ -10,6 +10,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" v2 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" ) func newValidReportFields() v2.ReportFields { @@ -27,7 +28,8 @@ func Test_ReportCodec_BuildReport(t *testing.T) { r := ReportCodec{} t.Run("BuildReport errors on zero values", func(t *testing.T) { - _, err := r.BuildReport(v2.ReportFields{}) + ctx := testutils.Context(t) + _, err := r.BuildReport(ctx, v2.ReportFields{}) require.Error(t, err) assert.Contains(t, err.Error(), "benchmarkPrice may not be nil") assert.Contains(t, err.Error(), "linkFee may not be nil") @@ -35,10 +37,11 @@ func Test_ReportCodec_BuildReport(t *testing.T) { }) t.Run("BuildReport constructs a report from observations", func(t *testing.T) { + ctx := testutils.Context(t) rf := newValidReportFields() // only need to test happy path since validations are done in relaymercury - report, err := r.BuildReport(rf) + report, err := r.BuildReport(ctx, rf) require.NoError(t, err) reportElems := make(map[string]interface{}) @@ -53,12 +56,13 @@ func Test_ReportCodec_BuildReport(t *testing.T) { assert.Equal(t, reportElems["nativeFee"].(*big.Int).Int64(), int64(457)) assert.Equal(t, types.Report{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf3}, report) - max, err := r.MaxReportLength(4) + max, err := r.MaxReportLength(ctx, 4) require.NoError(t, err) assert.LessOrEqual(t, len(report), max) t.Run("Decode decodes the report", func(t *testing.T) { - decoded, err := r.Decode(report) + ctx := testutils.Context(t) + decoded, err := r.Decode(ctx, report) require.NoError(t, err) require.NotNil(t, decoded) @@ -76,7 +80,8 @@ func Test_ReportCodec_BuildReport(t *testing.T) { rf := newValidReportFields() rf.LinkFee = big.NewInt(-1) rf.NativeFee = big.NewInt(-1) - _, err := r.BuildReport(rf) + ctx := testutils.Context(t) + _, err := r.BuildReport(ctx, rf) require.Error(t, err) assert.Contains(t, err.Error(), "linkFee may not be negative (got: -1)") @@ -84,14 +89,15 @@ func Test_ReportCodec_BuildReport(t *testing.T) { }) t.Run("Decode errors on invalid report", func(t *testing.T) { - _, err := r.Decode([]byte{1, 2, 3}) + ctx := testutils.Context(t) + _, err := r.Decode(ctx, []byte{1, 2, 3}) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") longBad := make([]byte, 64) for i := 0; i < len(longBad); i++ { longBad[i] = byte(i) } - _, err = r.Decode(longBad) + _, err = r.Decode(ctx, longBad) assert.EqualError(t, err, "failed to decode report: abi: improperly encoded uint32 value") }) } @@ -118,7 +124,8 @@ func Test_ReportCodec_ObservationTimestampFromReport(t *testing.T) { t.Run("ObservationTimestampFromReport extracts observation timestamp from a valid report", func(t *testing.T) { report := buildSampleReport(123) - ts, err := r.ObservationTimestampFromReport(report) + ctx := testutils.Context(t) + ts, err := r.ObservationTimestampFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, ts, uint32(123)) @@ -126,7 +133,8 @@ func Test_ReportCodec_ObservationTimestampFromReport(t *testing.T) { t.Run("ObservationTimestampFromReport returns error when report is invalid", func(t *testing.T) { report := []byte{1, 2, 3} - _, err := r.ObservationTimestampFromReport(report) + ctx := testutils.Context(t) + _, err := r.ObservationTimestampFromReport(ctx, report) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") @@ -137,15 +145,17 @@ func Test_ReportCodec_BenchmarkPriceFromReport(t *testing.T) { r := ReportCodec{} t.Run("BenchmarkPriceFromReport extracts the benchmark price from valid report", func(t *testing.T) { + ctx := testutils.Context(t) report := buildSampleReport(123) - bp, err := r.BenchmarkPriceFromReport(report) + bp, err := r.BenchmarkPriceFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, big.NewInt(242), bp) }) t.Run("BenchmarkPriceFromReport errors on invalid report", func(t *testing.T) { - _, err := r.BenchmarkPriceFromReport([]byte{1, 2, 3}) + ctx := testutils.Context(t) + _, err := r.BenchmarkPriceFromReport(ctx, []byte{1, 2, 3}) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") }) diff --git a/core/services/relay/evm/mercury/v3/data_source.go b/core/services/relay/evm/mercury/v3/data_source.go index 48db946517f..c6eca678d1c 100644 --- a/core/services/relay/evm/mercury/v3/data_source.go +++ b/core/services/relay/evm/mercury/v3/data_source.go @@ -83,7 +83,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam return } if latest != nil { - maxFinalizedBlockNumber, decodeErr := ds.codec.ObservationTimestampFromReport(latest) + maxFinalizedBlockNumber, decodeErr := ds.codec.ObservationTimestampFromReport(ctx, latest) obs.MaxFinalizedTimestamp.Val, obs.MaxFinalizedTimestamp.Err = int64(maxFinalizedBlockNumber), decodeErr return } diff --git a/core/services/relay/evm/mercury/v3/reportcodec/report_codec.go b/core/services/relay/evm/mercury/v3/reportcodec/report_codec.go index 1bf750fbf97..d9420883b12 100644 --- a/core/services/relay/evm/mercury/v3/reportcodec/report_codec.go +++ b/core/services/relay/evm/mercury/v3/reportcodec/report_codec.go @@ -1,6 +1,7 @@ package reportcodec import ( + "context" "errors" "fmt" "math/big" @@ -31,7 +32,7 @@ func NewReportCodec(feedID [32]byte, lggr logger.Logger) *ReportCodec { return &ReportCodec{lggr, feedID} } -func (r *ReportCodec) BuildReport(rf v3.ReportFields) (ocrtypes.Report, error) { +func (r *ReportCodec) BuildReport(ctx context.Context, rf v3.ReportFields) (ocrtypes.Report, error) { var merr error if rf.BenchmarkPrice == nil { merr = errors.Join(merr, errors.New("benchmarkPrice may not be nil")) @@ -59,11 +60,11 @@ func (r *ReportCodec) BuildReport(rf v3.ReportFields) (ocrtypes.Report, error) { return ocrtypes.Report(reportBytes), pkgerrors.Wrap(err, "failed to pack report blob") } -func (r *ReportCodec) MaxReportLength(n int) (int, error) { +func (r *ReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return maxReportLength, nil } -func (r *ReportCodec) ObservationTimestampFromReport(report ocrtypes.Report) (uint32, error) { +func (r *ReportCodec) ObservationTimestampFromReport(ctx context.Context, report ocrtypes.Report) (uint32, error) { decoded, err := r.Decode(report) if err != nil { return 0, err @@ -75,7 +76,7 @@ func (r *ReportCodec) Decode(report ocrtypes.Report) (*reporttypes.Report, error return reporttypes.Decode(report) } -func (r *ReportCodec) BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error) { +func (r *ReportCodec) BenchmarkPriceFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) { decoded, err := r.Decode(report) if err != nil { return nil, err diff --git a/core/services/relay/evm/mercury/v3/reportcodec/report_codec_test.go b/core/services/relay/evm/mercury/v3/reportcodec/report_codec_test.go index 752e6ce34b5..2cfb162841b 100644 --- a/core/services/relay/evm/mercury/v3/reportcodec/report_codec_test.go +++ b/core/services/relay/evm/mercury/v3/reportcodec/report_codec_test.go @@ -10,6 +10,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" v3 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v3" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" ) func newValidReportFields() v3.ReportFields { @@ -29,7 +30,8 @@ func Test_ReportCodec_BuildReport(t *testing.T) { r := ReportCodec{} t.Run("BuildReport errors on zero values", func(t *testing.T) { - _, err := r.BuildReport(v3.ReportFields{}) + ctx := testutils.Context(t) + _, err := r.BuildReport(ctx, v3.ReportFields{}) require.Error(t, err) assert.Contains(t, err.Error(), "benchmarkPrice may not be nil") assert.Contains(t, err.Error(), "linkFee may not be nil") @@ -40,7 +42,8 @@ func Test_ReportCodec_BuildReport(t *testing.T) { rf := newValidReportFields() // only need to test happy path since validations are done in relaymercury - report, err := r.BuildReport(rf) + ctx := testutils.Context(t) + report, err := r.BuildReport(ctx, rf) require.NoError(t, err) reportElems := make(map[string]interface{}) @@ -57,7 +60,7 @@ func Test_ReportCodec_BuildReport(t *testing.T) { assert.Equal(t, reportElems["nativeFee"].(*big.Int).Int64(), int64(457)) assert.Equal(t, types.Report{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf5}, report) - max, err := r.MaxReportLength(4) + max, err := r.MaxReportLength(ctx, 4) require.NoError(t, err) assert.LessOrEqual(t, len(report), max) @@ -82,7 +85,8 @@ func Test_ReportCodec_BuildReport(t *testing.T) { rf := newValidReportFields() rf.LinkFee = big.NewInt(-1) rf.NativeFee = big.NewInt(-1) - _, err := r.BuildReport(rf) + ctx := testutils.Context(t) + _, err := r.BuildReport(ctx, rf) require.Error(t, err) assert.Contains(t, err.Error(), "linkFee may not be negative (got: -1)") @@ -126,7 +130,8 @@ func Test_ReportCodec_ObservationTimestampFromReport(t *testing.T) { t.Run("ObservationTimestampFromReport extracts observation timestamp from a valid report", func(t *testing.T) { report := buildSampleReport(123) - ts, err := r.ObservationTimestampFromReport(report) + ctx := testutils.Context(t) + ts, err := r.ObservationTimestampFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, ts, uint32(123)) @@ -134,7 +139,8 @@ func Test_ReportCodec_ObservationTimestampFromReport(t *testing.T) { t.Run("ObservationTimestampFromReport returns error when report is invalid", func(t *testing.T) { report := []byte{1, 2, 3} - _, err := r.ObservationTimestampFromReport(report) + ctx := testutils.Context(t) + _, err := r.ObservationTimestampFromReport(ctx, report) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") @@ -145,15 +151,17 @@ func Test_ReportCodec_BenchmarkPriceFromReport(t *testing.T) { r := ReportCodec{} t.Run("BenchmarkPriceFromReport extracts the benchmark price from valid report", func(t *testing.T) { + ctx := testutils.Context(t) report := buildSampleReport(123) - bp, err := r.BenchmarkPriceFromReport(report) + bp, err := r.BenchmarkPriceFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, big.NewInt(242), bp) }) t.Run("BenchmarkPriceFromReport errors on invalid report", func(t *testing.T) { - _, err := r.BenchmarkPriceFromReport([]byte{1, 2, 3}) + ctx := testutils.Context(t) + _, err := r.BenchmarkPriceFromReport(ctx, []byte{1, 2, 3}) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") }) diff --git a/core/services/relay/evm/mercury/v4/data_source.go b/core/services/relay/evm/mercury/v4/data_source.go index 05ec44dc78c..6e3a7ee2821 100644 --- a/core/services/relay/evm/mercury/v4/data_source.go +++ b/core/services/relay/evm/mercury/v4/data_source.go @@ -72,7 +72,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam return } if latest != nil { - maxFinalizedBlockNumber, decodeErr := ds.codec.ObservationTimestampFromReport(latest) + maxFinalizedBlockNumber, decodeErr := ds.codec.ObservationTimestampFromReport(ctx, latest) obs.MaxFinalizedTimestamp.Val, obs.MaxFinalizedTimestamp.Err = int64(maxFinalizedBlockNumber), decodeErr return } diff --git a/core/services/relay/evm/mercury/v4/reportcodec/report_codec.go b/core/services/relay/evm/mercury/v4/reportcodec/report_codec.go index dd98ef272e9..c5d32c02ed4 100644 --- a/core/services/relay/evm/mercury/v4/reportcodec/report_codec.go +++ b/core/services/relay/evm/mercury/v4/reportcodec/report_codec.go @@ -1,6 +1,7 @@ package reportcodec import ( + "context" "errors" "fmt" "math/big" @@ -30,7 +31,7 @@ func NewReportCodec(feedID [32]byte, lggr logger.Logger) *ReportCodec { return &ReportCodec{lggr, feedID} } -func (r *ReportCodec) BuildReport(rf v4.ReportFields) (ocrtypes.Report, error) { +func (r *ReportCodec) BuildReport(ctx context.Context, rf v4.ReportFields) (ocrtypes.Report, error) { var merr error if rf.BenchmarkPrice == nil { merr = errors.Join(merr, errors.New("benchmarkPrice may not be nil")) @@ -52,24 +53,24 @@ func (r *ReportCodec) BuildReport(rf v4.ReportFields) (ocrtypes.Report, error) { return ocrtypes.Report(reportBytes), pkgerrors.Wrap(err, "failed to pack report blob") } -func (r *ReportCodec) MaxReportLength(n int) (int, error) { +func (r *ReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return maxReportLength, nil } -func (r *ReportCodec) ObservationTimestampFromReport(report ocrtypes.Report) (uint32, error) { - decoded, err := r.Decode(report) +func (r *ReportCodec) ObservationTimestampFromReport(ctx context.Context, report ocrtypes.Report) (uint32, error) { + decoded, err := r.Decode(ctx, report) if err != nil { return 0, err } return decoded.ObservationsTimestamp, nil } -func (r *ReportCodec) Decode(report ocrtypes.Report) (*reporttypes.Report, error) { +func (r *ReportCodec) Decode(ctx context.Context, report ocrtypes.Report) (*reporttypes.Report, error) { return reporttypes.Decode(report) } -func (r *ReportCodec) BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error) { - decoded, err := r.Decode(report) +func (r *ReportCodec) BenchmarkPriceFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) { + decoded, err := r.Decode(ctx, report) if err != nil { return nil, err } diff --git a/core/services/relay/evm/mercury/v4/reportcodec/report_codec_test.go b/core/services/relay/evm/mercury/v4/reportcodec/report_codec_test.go index 7be81bf2796..9813d422cc1 100644 --- a/core/services/relay/evm/mercury/v4/reportcodec/report_codec_test.go +++ b/core/services/relay/evm/mercury/v4/reportcodec/report_codec_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" v4 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v4" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func newValidReportFields() v4.ReportFields { @@ -27,7 +28,8 @@ func Test_ReportCodec_BuildReport(t *testing.T) { r := ReportCodec{} t.Run("BuildReport errors on zero values", func(t *testing.T) { - _, err := r.BuildReport(v4.ReportFields{}) + ctx := tests.Context(t) + _, err := r.BuildReport(ctx, v4.ReportFields{}) require.Error(t, err) assert.Contains(t, err.Error(), "benchmarkPrice may not be nil") assert.Contains(t, err.Error(), "linkFee may not be nil") @@ -35,10 +37,11 @@ func Test_ReportCodec_BuildReport(t *testing.T) { }) t.Run("BuildReport constructs a report from observations", func(t *testing.T) { + ctx := tests.Context(t) rf := newValidReportFields() // only need to test happy path since validations are done in relaymercury - report, err := r.BuildReport(rf) + report, err := r.BuildReport(ctx, rf) require.NoError(t, err) reportElems := make(map[string]interface{}) @@ -54,12 +57,13 @@ func Test_ReportCodec_BuildReport(t *testing.T) { assert.Equal(t, reportElems["marketStatus"].(uint32), uint32(1)) assert.Equal(t, types.Report{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}, report) - max, err := r.MaxReportLength(4) + max, err := r.MaxReportLength(ctx, 4) require.NoError(t, err) assert.LessOrEqual(t, len(report), max) t.Run("Decode decodes the report", func(t *testing.T) { - decoded, err := r.Decode(report) + ctx := tests.Context(t) + decoded, err := r.Decode(ctx, report) require.NoError(t, err) require.NotNil(t, decoded) @@ -75,10 +79,11 @@ func Test_ReportCodec_BuildReport(t *testing.T) { }) t.Run("errors on negative fee", func(t *testing.T) { + ctx := tests.Context(t) rf := newValidReportFields() rf.LinkFee = big.NewInt(-1) rf.NativeFee = big.NewInt(-1) - _, err := r.BuildReport(rf) + _, err := r.BuildReport(ctx, rf) require.Error(t, err) assert.Contains(t, err.Error(), "linkFee may not be negative (got: -1)") @@ -86,14 +91,15 @@ func Test_ReportCodec_BuildReport(t *testing.T) { }) t.Run("Decode errors on invalid report", func(t *testing.T) { - _, err := r.Decode([]byte{1, 2, 3}) + ctx := tests.Context(t) + _, err := r.Decode(ctx, []byte{1, 2, 3}) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") longBad := make([]byte, 64) for i := 0; i < len(longBad); i++ { longBad[i] = byte(i) } - _, err = r.Decode(longBad) + _, err = r.Decode(ctx, longBad) assert.EqualError(t, err, "failed to decode report: abi: improperly encoded uint32 value") }) } @@ -119,17 +125,19 @@ func Test_ReportCodec_ObservationTimestampFromReport(t *testing.T) { r := ReportCodec{} t.Run("ObservationTimestampFromReport extracts observation timestamp from a valid report", func(t *testing.T) { + ctx := tests.Context(t) report := buildSampleReport(123) - ts, err := r.ObservationTimestampFromReport(report) + ts, err := r.ObservationTimestampFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, ts, uint32(123)) }) t.Run("ObservationTimestampFromReport returns error when report is invalid", func(t *testing.T) { + ctx := tests.Context(t) report := []byte{1, 2, 3} - _, err := r.ObservationTimestampFromReport(report) + _, err := r.ObservationTimestampFromReport(ctx, report) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") @@ -140,15 +148,17 @@ func Test_ReportCodec_BenchmarkPriceFromReport(t *testing.T) { r := ReportCodec{} t.Run("BenchmarkPriceFromReport extracts the benchmark price from valid report", func(t *testing.T) { + ctx := tests.Context(t) report := buildSampleReport(123) - bp, err := r.BenchmarkPriceFromReport(report) + bp, err := r.BenchmarkPriceFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, big.NewInt(242), bp) }) t.Run("BenchmarkPriceFromReport errors on invalid report", func(t *testing.T) { - _, err := r.BenchmarkPriceFromReport([]byte{1, 2, 3}) + ctx := tests.Context(t) + _, err := r.BenchmarkPriceFromReport(ctx, []byte{1, 2, 3}) require.Error(t, err) assert.EqualError(t, err, "failed to decode report: abi: cannot marshal in to go type: length insufficient 3 require 32") }) diff --git a/core/services/relay/evm/mocks/loop_relay_adapter.go b/core/services/relay/evm/mocks/loop_relay_adapter.go deleted file mode 100644 index 76579d4746a..00000000000 --- a/core/services/relay/evm/mocks/loop_relay_adapter.go +++ /dev/null @@ -1,849 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - big "math/big" - - legacyevm "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" - - mock "github.com/stretchr/testify/mock" - - types "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -// LoopRelayAdapter is an autogenerated mock type for the LoopRelayAdapter type -type LoopRelayAdapter struct { - mock.Mock -} - -type LoopRelayAdapter_Expecter struct { - mock *mock.Mock -} - -func (_m *LoopRelayAdapter) EXPECT() *LoopRelayAdapter_Expecter { - return &LoopRelayAdapter_Expecter{mock: &_m.Mock} -} - -// Chain provides a mock function with given fields: -func (_m *LoopRelayAdapter) Chain() legacyevm.Chain { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Chain") - } - - var r0 legacyevm.Chain - if rf, ok := ret.Get(0).(func() legacyevm.Chain); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(legacyevm.Chain) - } - } - - return r0 -} - -// LoopRelayAdapter_Chain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Chain' -type LoopRelayAdapter_Chain_Call struct { - *mock.Call -} - -// Chain is a helper method to define mock.On call -func (_e *LoopRelayAdapter_Expecter) Chain() *LoopRelayAdapter_Chain_Call { - return &LoopRelayAdapter_Chain_Call{Call: _e.mock.On("Chain")} -} - -func (_c *LoopRelayAdapter_Chain_Call) Run(run func()) *LoopRelayAdapter_Chain_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *LoopRelayAdapter_Chain_Call) Return(_a0 legacyevm.Chain) *LoopRelayAdapter_Chain_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_Chain_Call) RunAndReturn(run func() legacyevm.Chain) *LoopRelayAdapter_Chain_Call { - _c.Call.Return(run) - return _c -} - -// Close provides a mock function with given fields: -func (_m *LoopRelayAdapter) Close() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Close") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// LoopRelayAdapter_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' -type LoopRelayAdapter_Close_Call struct { - *mock.Call -} - -// Close is a helper method to define mock.On call -func (_e *LoopRelayAdapter_Expecter) Close() *LoopRelayAdapter_Close_Call { - return &LoopRelayAdapter_Close_Call{Call: _e.mock.On("Close")} -} - -func (_c *LoopRelayAdapter_Close_Call) Run(run func()) *LoopRelayAdapter_Close_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *LoopRelayAdapter_Close_Call) Return(_a0 error) *LoopRelayAdapter_Close_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_Close_Call) RunAndReturn(run func() error) *LoopRelayAdapter_Close_Call { - _c.Call.Return(run) - return _c -} - -// GetChainStatus provides a mock function with given fields: ctx -func (_m *LoopRelayAdapter) GetChainStatus(ctx context.Context) (types.ChainStatus, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetChainStatus") - } - - var r0 types.ChainStatus - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (types.ChainStatus, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) types.ChainStatus); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(types.ChainStatus) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_GetChainStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChainStatus' -type LoopRelayAdapter_GetChainStatus_Call struct { - *mock.Call -} - -// GetChainStatus is a helper method to define mock.On call -// - ctx context.Context -func (_e *LoopRelayAdapter_Expecter) GetChainStatus(ctx interface{}) *LoopRelayAdapter_GetChainStatus_Call { - return &LoopRelayAdapter_GetChainStatus_Call{Call: _e.mock.On("GetChainStatus", ctx)} -} - -func (_c *LoopRelayAdapter_GetChainStatus_Call) Run(run func(ctx context.Context)) *LoopRelayAdapter_GetChainStatus_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *LoopRelayAdapter_GetChainStatus_Call) Return(_a0 types.ChainStatus, _a1 error) *LoopRelayAdapter_GetChainStatus_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_GetChainStatus_Call) RunAndReturn(run func(context.Context) (types.ChainStatus, error)) *LoopRelayAdapter_GetChainStatus_Call { - _c.Call.Return(run) - return _c -} - -// HealthReport provides a mock function with given fields: -func (_m *LoopRelayAdapter) HealthReport() map[string]error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for HealthReport") - } - - var r0 map[string]error - if rf, ok := ret.Get(0).(func() map[string]error); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]error) - } - } - - return r0 -} - -// LoopRelayAdapter_HealthReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HealthReport' -type LoopRelayAdapter_HealthReport_Call struct { - *mock.Call -} - -// HealthReport is a helper method to define mock.On call -func (_e *LoopRelayAdapter_Expecter) HealthReport() *LoopRelayAdapter_HealthReport_Call { - return &LoopRelayAdapter_HealthReport_Call{Call: _e.mock.On("HealthReport")} -} - -func (_c *LoopRelayAdapter_HealthReport_Call) Run(run func()) *LoopRelayAdapter_HealthReport_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *LoopRelayAdapter_HealthReport_Call) Return(_a0 map[string]error) *LoopRelayAdapter_HealthReport_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_HealthReport_Call) RunAndReturn(run func() map[string]error) *LoopRelayAdapter_HealthReport_Call { - _c.Call.Return(run) - return _c -} - -// LatestHead provides a mock function with given fields: ctx -func (_m *LoopRelayAdapter) LatestHead(ctx context.Context) (types.Head, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for LatestHead") - } - - var r0 types.Head - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (types.Head, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) types.Head); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(types.Head) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_LatestHead_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestHead' -type LoopRelayAdapter_LatestHead_Call struct { - *mock.Call -} - -// LatestHead is a helper method to define mock.On call -// - ctx context.Context -func (_e *LoopRelayAdapter_Expecter) LatestHead(ctx interface{}) *LoopRelayAdapter_LatestHead_Call { - return &LoopRelayAdapter_LatestHead_Call{Call: _e.mock.On("LatestHead", ctx)} -} - -func (_c *LoopRelayAdapter_LatestHead_Call) Run(run func(ctx context.Context)) *LoopRelayAdapter_LatestHead_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *LoopRelayAdapter_LatestHead_Call) Return(_a0 types.Head, _a1 error) *LoopRelayAdapter_LatestHead_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_LatestHead_Call) RunAndReturn(run func(context.Context) (types.Head, error)) *LoopRelayAdapter_LatestHead_Call { - _c.Call.Return(run) - return _c -} - -// ListNodeStatuses provides a mock function with given fields: ctx, pageSize, pageToken -func (_m *LoopRelayAdapter) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) ([]types.NodeStatus, string, int, error) { - ret := _m.Called(ctx, pageSize, pageToken) - - if len(ret) == 0 { - panic("no return value specified for ListNodeStatuses") - } - - var r0 []types.NodeStatus - var r1 string - var r2 int - var r3 error - if rf, ok := ret.Get(0).(func(context.Context, int32, string) ([]types.NodeStatus, string, int, error)); ok { - return rf(ctx, pageSize, pageToken) - } - if rf, ok := ret.Get(0).(func(context.Context, int32, string) []types.NodeStatus); ok { - r0 = rf(ctx, pageSize, pageToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]types.NodeStatus) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, int32, string) string); ok { - r1 = rf(ctx, pageSize, pageToken) - } else { - r1 = ret.Get(1).(string) - } - - if rf, ok := ret.Get(2).(func(context.Context, int32, string) int); ok { - r2 = rf(ctx, pageSize, pageToken) - } else { - r2 = ret.Get(2).(int) - } - - if rf, ok := ret.Get(3).(func(context.Context, int32, string) error); ok { - r3 = rf(ctx, pageSize, pageToken) - } else { - r3 = ret.Error(3) - } - - return r0, r1, r2, r3 -} - -// LoopRelayAdapter_ListNodeStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListNodeStatuses' -type LoopRelayAdapter_ListNodeStatuses_Call struct { - *mock.Call -} - -// ListNodeStatuses is a helper method to define mock.On call -// - ctx context.Context -// - pageSize int32 -// - pageToken string -func (_e *LoopRelayAdapter_Expecter) ListNodeStatuses(ctx interface{}, pageSize interface{}, pageToken interface{}) *LoopRelayAdapter_ListNodeStatuses_Call { - return &LoopRelayAdapter_ListNodeStatuses_Call{Call: _e.mock.On("ListNodeStatuses", ctx, pageSize, pageToken)} -} - -func (_c *LoopRelayAdapter_ListNodeStatuses_Call) Run(run func(ctx context.Context, pageSize int32, pageToken string)) *LoopRelayAdapter_ListNodeStatuses_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(int32), args[2].(string)) - }) - return _c -} - -func (_c *LoopRelayAdapter_ListNodeStatuses_Call) Return(stats []types.NodeStatus, nextPageToken string, total int, err error) *LoopRelayAdapter_ListNodeStatuses_Call { - _c.Call.Return(stats, nextPageToken, total, err) - return _c -} - -func (_c *LoopRelayAdapter_ListNodeStatuses_Call) RunAndReturn(run func(context.Context, int32, string) ([]types.NodeStatus, string, int, error)) *LoopRelayAdapter_ListNodeStatuses_Call { - _c.Call.Return(run) - return _c -} - -// Name provides a mock function with given fields: -func (_m *LoopRelayAdapter) Name() string { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Name") - } - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// LoopRelayAdapter_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' -type LoopRelayAdapter_Name_Call struct { - *mock.Call -} - -// Name is a helper method to define mock.On call -func (_e *LoopRelayAdapter_Expecter) Name() *LoopRelayAdapter_Name_Call { - return &LoopRelayAdapter_Name_Call{Call: _e.mock.On("Name")} -} - -func (_c *LoopRelayAdapter_Name_Call) Run(run func()) *LoopRelayAdapter_Name_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *LoopRelayAdapter_Name_Call) Return(_a0 string) *LoopRelayAdapter_Name_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_Name_Call) RunAndReturn(run func() string) *LoopRelayAdapter_Name_Call { - _c.Call.Return(run) - return _c -} - -// NewChainWriter provides a mock function with given fields: ctx, chainWriterConfig -func (_m *LoopRelayAdapter) NewChainWriter(ctx context.Context, chainWriterConfig []byte) (types.ChainWriter, error) { - ret := _m.Called(ctx, chainWriterConfig) - - if len(ret) == 0 { - panic("no return value specified for NewChainWriter") - } - - var r0 types.ChainWriter - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []byte) (types.ChainWriter, error)); ok { - return rf(ctx, chainWriterConfig) - } - if rf, ok := ret.Get(0).(func(context.Context, []byte) types.ChainWriter); ok { - r0 = rf(ctx, chainWriterConfig) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.ChainWriter) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, []byte) error); ok { - r1 = rf(ctx, chainWriterConfig) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_NewChainWriter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewChainWriter' -type LoopRelayAdapter_NewChainWriter_Call struct { - *mock.Call -} - -// NewChainWriter is a helper method to define mock.On call -// - ctx context.Context -// - chainWriterConfig []byte -func (_e *LoopRelayAdapter_Expecter) NewChainWriter(ctx interface{}, chainWriterConfig interface{}) *LoopRelayAdapter_NewChainWriter_Call { - return &LoopRelayAdapter_NewChainWriter_Call{Call: _e.mock.On("NewChainWriter", ctx, chainWriterConfig)} -} - -func (_c *LoopRelayAdapter_NewChainWriter_Call) Run(run func(ctx context.Context, chainWriterConfig []byte)) *LoopRelayAdapter_NewChainWriter_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]byte)) - }) - return _c -} - -func (_c *LoopRelayAdapter_NewChainWriter_Call) Return(_a0 types.ChainWriter, _a1 error) *LoopRelayAdapter_NewChainWriter_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_NewChainWriter_Call) RunAndReturn(run func(context.Context, []byte) (types.ChainWriter, error)) *LoopRelayAdapter_NewChainWriter_Call { - _c.Call.Return(run) - return _c -} - -// NewConfigProvider provides a mock function with given fields: _a0, _a1 -func (_m *LoopRelayAdapter) NewConfigProvider(_a0 context.Context, _a1 types.RelayArgs) (types.ConfigProvider, error) { - ret := _m.Called(_a0, _a1) - - if len(ret) == 0 { - panic("no return value specified for NewConfigProvider") - } - - var r0 types.ConfigProvider - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs) (types.ConfigProvider, error)); ok { - return rf(_a0, _a1) - } - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs) types.ConfigProvider); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.ConfigProvider) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.RelayArgs) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_NewConfigProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewConfigProvider' -type LoopRelayAdapter_NewConfigProvider_Call struct { - *mock.Call -} - -// NewConfigProvider is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 types.RelayArgs -func (_e *LoopRelayAdapter_Expecter) NewConfigProvider(_a0 interface{}, _a1 interface{}) *LoopRelayAdapter_NewConfigProvider_Call { - return &LoopRelayAdapter_NewConfigProvider_Call{Call: _e.mock.On("NewConfigProvider", _a0, _a1)} -} - -func (_c *LoopRelayAdapter_NewConfigProvider_Call) Run(run func(_a0 context.Context, _a1 types.RelayArgs)) *LoopRelayAdapter_NewConfigProvider_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(types.RelayArgs)) - }) - return _c -} - -func (_c *LoopRelayAdapter_NewConfigProvider_Call) Return(_a0 types.ConfigProvider, _a1 error) *LoopRelayAdapter_NewConfigProvider_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_NewConfigProvider_Call) RunAndReturn(run func(context.Context, types.RelayArgs) (types.ConfigProvider, error)) *LoopRelayAdapter_NewConfigProvider_Call { - _c.Call.Return(run) - return _c -} - -// NewContractReader provides a mock function with given fields: ctx, contractReaderConfig -func (_m *LoopRelayAdapter) NewContractReader(ctx context.Context, contractReaderConfig []byte) (types.ContractReader, error) { - ret := _m.Called(ctx, contractReaderConfig) - - if len(ret) == 0 { - panic("no return value specified for NewContractReader") - } - - var r0 types.ContractReader - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []byte) (types.ContractReader, error)); ok { - return rf(ctx, contractReaderConfig) - } - if rf, ok := ret.Get(0).(func(context.Context, []byte) types.ContractReader); ok { - r0 = rf(ctx, contractReaderConfig) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.ContractReader) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, []byte) error); ok { - r1 = rf(ctx, contractReaderConfig) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_NewContractReader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewContractReader' -type LoopRelayAdapter_NewContractReader_Call struct { - *mock.Call -} - -// NewContractReader is a helper method to define mock.On call -// - ctx context.Context -// - contractReaderConfig []byte -func (_e *LoopRelayAdapter_Expecter) NewContractReader(ctx interface{}, contractReaderConfig interface{}) *LoopRelayAdapter_NewContractReader_Call { - return &LoopRelayAdapter_NewContractReader_Call{Call: _e.mock.On("NewContractReader", ctx, contractReaderConfig)} -} - -func (_c *LoopRelayAdapter_NewContractReader_Call) Run(run func(ctx context.Context, contractReaderConfig []byte)) *LoopRelayAdapter_NewContractReader_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]byte)) - }) - return _c -} - -func (_c *LoopRelayAdapter_NewContractReader_Call) Return(_a0 types.ContractReader, _a1 error) *LoopRelayAdapter_NewContractReader_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_NewContractReader_Call) RunAndReturn(run func(context.Context, []byte) (types.ContractReader, error)) *LoopRelayAdapter_NewContractReader_Call { - _c.Call.Return(run) - return _c -} - -// NewLLOProvider provides a mock function with given fields: _a0, _a1, _a2 -func (_m *LoopRelayAdapter) NewLLOProvider(_a0 context.Context, _a1 types.RelayArgs, _a2 types.PluginArgs) (types.LLOProvider, error) { - ret := _m.Called(_a0, _a1, _a2) - - if len(ret) == 0 { - panic("no return value specified for NewLLOProvider") - } - - var r0 types.LLOProvider - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs, types.PluginArgs) (types.LLOProvider, error)); ok { - return rf(_a0, _a1, _a2) - } - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs, types.PluginArgs) types.LLOProvider); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.LLOProvider) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.RelayArgs, types.PluginArgs) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_NewLLOProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewLLOProvider' -type LoopRelayAdapter_NewLLOProvider_Call struct { - *mock.Call -} - -// NewLLOProvider is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 types.RelayArgs -// - _a2 types.PluginArgs -func (_e *LoopRelayAdapter_Expecter) NewLLOProvider(_a0 interface{}, _a1 interface{}, _a2 interface{}) *LoopRelayAdapter_NewLLOProvider_Call { - return &LoopRelayAdapter_NewLLOProvider_Call{Call: _e.mock.On("NewLLOProvider", _a0, _a1, _a2)} -} - -func (_c *LoopRelayAdapter_NewLLOProvider_Call) Run(run func(_a0 context.Context, _a1 types.RelayArgs, _a2 types.PluginArgs)) *LoopRelayAdapter_NewLLOProvider_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(types.RelayArgs), args[2].(types.PluginArgs)) - }) - return _c -} - -func (_c *LoopRelayAdapter_NewLLOProvider_Call) Return(_a0 types.LLOProvider, _a1 error) *LoopRelayAdapter_NewLLOProvider_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_NewLLOProvider_Call) RunAndReturn(run func(context.Context, types.RelayArgs, types.PluginArgs) (types.LLOProvider, error)) *LoopRelayAdapter_NewLLOProvider_Call { - _c.Call.Return(run) - return _c -} - -// NewPluginProvider provides a mock function with given fields: _a0, _a1, _a2 -func (_m *LoopRelayAdapter) NewPluginProvider(_a0 context.Context, _a1 types.RelayArgs, _a2 types.PluginArgs) (types.PluginProvider, error) { - ret := _m.Called(_a0, _a1, _a2) - - if len(ret) == 0 { - panic("no return value specified for NewPluginProvider") - } - - var r0 types.PluginProvider - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs, types.PluginArgs) (types.PluginProvider, error)); ok { - return rf(_a0, _a1, _a2) - } - if rf, ok := ret.Get(0).(func(context.Context, types.RelayArgs, types.PluginArgs) types.PluginProvider); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.PluginProvider) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.RelayArgs, types.PluginArgs) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// LoopRelayAdapter_NewPluginProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewPluginProvider' -type LoopRelayAdapter_NewPluginProvider_Call struct { - *mock.Call -} - -// NewPluginProvider is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 types.RelayArgs -// - _a2 types.PluginArgs -func (_e *LoopRelayAdapter_Expecter) NewPluginProvider(_a0 interface{}, _a1 interface{}, _a2 interface{}) *LoopRelayAdapter_NewPluginProvider_Call { - return &LoopRelayAdapter_NewPluginProvider_Call{Call: _e.mock.On("NewPluginProvider", _a0, _a1, _a2)} -} - -func (_c *LoopRelayAdapter_NewPluginProvider_Call) Run(run func(_a0 context.Context, _a1 types.RelayArgs, _a2 types.PluginArgs)) *LoopRelayAdapter_NewPluginProvider_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(types.RelayArgs), args[2].(types.PluginArgs)) - }) - return _c -} - -func (_c *LoopRelayAdapter_NewPluginProvider_Call) Return(_a0 types.PluginProvider, _a1 error) *LoopRelayAdapter_NewPluginProvider_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *LoopRelayAdapter_NewPluginProvider_Call) RunAndReturn(run func(context.Context, types.RelayArgs, types.PluginArgs) (types.PluginProvider, error)) *LoopRelayAdapter_NewPluginProvider_Call { - _c.Call.Return(run) - return _c -} - -// Ready provides a mock function with given fields: -func (_m *LoopRelayAdapter) Ready() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Ready") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// LoopRelayAdapter_Ready_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ready' -type LoopRelayAdapter_Ready_Call struct { - *mock.Call -} - -// Ready is a helper method to define mock.On call -func (_e *LoopRelayAdapter_Expecter) Ready() *LoopRelayAdapter_Ready_Call { - return &LoopRelayAdapter_Ready_Call{Call: _e.mock.On("Ready")} -} - -func (_c *LoopRelayAdapter_Ready_Call) Run(run func()) *LoopRelayAdapter_Ready_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *LoopRelayAdapter_Ready_Call) Return(_a0 error) *LoopRelayAdapter_Ready_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_Ready_Call) RunAndReturn(run func() error) *LoopRelayAdapter_Ready_Call { - _c.Call.Return(run) - return _c -} - -// Start provides a mock function with given fields: _a0 -func (_m *LoopRelayAdapter) Start(_a0 context.Context) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for Start") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// LoopRelayAdapter_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' -type LoopRelayAdapter_Start_Call struct { - *mock.Call -} - -// Start is a helper method to define mock.On call -// - _a0 context.Context -func (_e *LoopRelayAdapter_Expecter) Start(_a0 interface{}) *LoopRelayAdapter_Start_Call { - return &LoopRelayAdapter_Start_Call{Call: _e.mock.On("Start", _a0)} -} - -func (_c *LoopRelayAdapter_Start_Call) Run(run func(_a0 context.Context)) *LoopRelayAdapter_Start_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *LoopRelayAdapter_Start_Call) Return(_a0 error) *LoopRelayAdapter_Start_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_Start_Call) RunAndReturn(run func(context.Context) error) *LoopRelayAdapter_Start_Call { - _c.Call.Return(run) - return _c -} - -// Transact provides a mock function with given fields: ctx, from, to, amount, balanceCheck -func (_m *LoopRelayAdapter) Transact(ctx context.Context, from string, to string, amount *big.Int, balanceCheck bool) error { - ret := _m.Called(ctx, from, to, amount, balanceCheck) - - if len(ret) == 0 { - panic("no return value specified for Transact") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string, *big.Int, bool) error); ok { - r0 = rf(ctx, from, to, amount, balanceCheck) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// LoopRelayAdapter_Transact_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Transact' -type LoopRelayAdapter_Transact_Call struct { - *mock.Call -} - -// Transact is a helper method to define mock.On call -// - ctx context.Context -// - from string -// - to string -// - amount *big.Int -// - balanceCheck bool -func (_e *LoopRelayAdapter_Expecter) Transact(ctx interface{}, from interface{}, to interface{}, amount interface{}, balanceCheck interface{}) *LoopRelayAdapter_Transact_Call { - return &LoopRelayAdapter_Transact_Call{Call: _e.mock.On("Transact", ctx, from, to, amount, balanceCheck)} -} - -func (_c *LoopRelayAdapter_Transact_Call) Run(run func(ctx context.Context, from string, to string, amount *big.Int, balanceCheck bool)) *LoopRelayAdapter_Transact_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(*big.Int), args[4].(bool)) - }) - return _c -} - -func (_c *LoopRelayAdapter_Transact_Call) Return(_a0 error) *LoopRelayAdapter_Transact_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *LoopRelayAdapter_Transact_Call) RunAndReturn(run func(context.Context, string, string, *big.Int, bool) error) *LoopRelayAdapter_Transact_Call { - _c.Call.Return(run) - return _c -} - -// NewLoopRelayAdapter creates a new instance of LoopRelayAdapter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewLoopRelayAdapter(t interface { - mock.TestingT - Cleanup(func()) -}) *LoopRelayAdapter { - mock := &LoopRelayAdapter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/core/services/relay/evm/ocr2keeper.go b/core/services/relay/evm/ocr2keeper.go index 625ee71c182..db96afee7d7 100644 --- a/core/services/relay/evm/ocr2keeper.go +++ b/core/services/relay/evm/ocr2keeper.go @@ -59,7 +59,7 @@ type OCR2KeeperProvider interface { // OCR2KeeperRelayer contains the relayer and instantiating functions for OCR2Keeper providers. type OCR2KeeperRelayer interface { - NewOCR2KeeperProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (OCR2KeeperProvider, error) + NewOCR2KeeperProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (OCR2KeeperProvider, error) } // ocr2keeperRelayer is the relayer with added DKG and OCR2Keeper provider functions. @@ -80,10 +80,7 @@ func NewOCR2KeeperRelayer(ds sqlutil.DataSource, chain legacyevm.Chain, lggr log } } -func (r *ocr2keeperRelayer) NewOCR2KeeperProvider(rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (OCR2KeeperProvider, error) { - // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 - ctx := context.Background() - +func (r *ocr2keeperRelayer) NewOCR2KeeperProvider(ctx context.Context, rargs commontypes.RelayArgs, pargs commontypes.PluginArgs) (OCR2KeeperProvider, error) { cfgWatcher, err := newOCR2KeeperConfigProvider(ctx, r.lggr, r.chain, rargs) if err != nil { return nil, err @@ -174,8 +171,8 @@ func (t *ocr3keeperProviderContractTransmitter) Transmit( ) } -func (t *ocr3keeperProviderContractTransmitter) FromAccount() (ocrtypes.Account, error) { - return t.contractTransmitter.FromAccount() +func (t *ocr3keeperProviderContractTransmitter) FromAccount(ctx context.Context) (ocrtypes.Account, error) { + return t.contractTransmitter.FromAccount(ctx) } type ocr2keeperProvider struct { diff --git a/core/services/relay/evm/ocr3_capability_provider.go b/core/services/relay/evm/ocr3_capability_provider.go index ca41466570c..56a8d37bbe9 100644 --- a/core/services/relay/evm/ocr3_capability_provider.go +++ b/core/services/relay/evm/ocr3_capability_provider.go @@ -1,8 +1,11 @@ package evm import ( + "context" "encoding/hex" "fmt" + "math/big" + "strings" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -11,9 +14,6 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types" - "math/big" - "strings" - "github.com/ethereum/go-ethereum/crypto" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability" @@ -108,7 +108,7 @@ type OCR3CapabilityOffchainConfigDigester struct { ContractAddress common.Address } -func (d OCR3CapabilityOffchainConfigDigester) ConfigDigest(cc ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { +func (d OCR3CapabilityOffchainConfigDigester) ConfigDigest(ctx context.Context, cc ocrtypes.ContractConfig) (ocrtypes.ConfigDigest, error) { signers := [][]byte{} for _, signer := range cc.Signers { signers = append(signers, signer) @@ -137,7 +137,7 @@ func (d OCR3CapabilityOffchainConfigDigester) ConfigDigest(cc ocrtypes.ContractC const ConfigDigestPrefixKeystoneOCR3Capability ocrtypes.ConfigDigestPrefix = 0x000e -func (d OCR3CapabilityOffchainConfigDigester) ConfigDigestPrefix() (ocrtypes.ConfigDigestPrefix, error) { +func (d OCR3CapabilityOffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (ocrtypes.ConfigDigestPrefix, error) { return ConfigDigestPrefixKeystoneOCR3Capability, nil } diff --git a/core/services/relay/evm/relayer_extender.go b/core/services/relay/evm/relayer_extender.go index f4477491577..884597df718 100644 --- a/core/services/relay/evm/relayer_extender.go +++ b/core/services/relay/evm/relayer_extender.go @@ -2,15 +2,11 @@ package evm import ( "context" + "errors" "fmt" - "math/big" - "github.com/pkg/errors" "go.uber.org/multierr" - "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/relay" - commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" ) @@ -18,111 +14,30 @@ import ( // ErrNoChains indicates that no EVM chains have been started var ErrNoChains = errors.New("no EVM chains loaded") -type EVMChainRelayerExtender interface { - relay.RelayerExt - Chain() legacyevm.Chain -} - -type EVMChainRelayerExtenderSlicer interface { - Slice() []EVMChainRelayerExtender - Len() int - AppConfig() legacyevm.AppConfig -} - -type ChainRelayerExtenders struct { - exts []EVMChainRelayerExtender - cfg legacyevm.AppConfig +type LegacyChainsAndConfig struct { + rs []legacyevm.Chain + cfg toml.EVMConfigs } -var _ EVMChainRelayerExtenderSlicer = &ChainRelayerExtenders{} - -func NewLegacyChainsFromRelayerExtenders(exts EVMChainRelayerExtenderSlicer) *legacyevm.LegacyChains { +func (r *LegacyChainsAndConfig) NewLegacyChains() *legacyevm.LegacyChains { m := make(map[string]legacyevm.Chain) - for _, r := range exts.Slice() { - m[r.Chain().ID().String()] = r.Chain() - } - return legacyevm.NewLegacyChains(m, exts.AppConfig().EVMConfigs()) -} - -func newChainRelayerExtsFromSlice(exts []*ChainRelayerExt, appConfig legacyevm.AppConfig) *ChainRelayerExtenders { - temp := make([]EVMChainRelayerExtender, len(exts)) - for i := range exts { - temp[i] = exts[i] - } - return &ChainRelayerExtenders{ - exts: temp, - cfg: appConfig, + for _, r := range r.Slice() { + m[r.ID().String()] = r } + return legacyevm.NewLegacyChains(m, r.cfg) } -func (c *ChainRelayerExtenders) AppConfig() legacyevm.AppConfig { - return c.cfg -} - -func (c *ChainRelayerExtenders) Slice() []EVMChainRelayerExtender { - return c.exts -} - -func (c *ChainRelayerExtenders) Len() int { - return len(c.exts) -} - -// implements OneChain -type ChainRelayerExt struct { - chain legacyevm.Chain -} - -var _ EVMChainRelayerExtender = &ChainRelayerExt{} - -func (s *ChainRelayerExt) LatestHead(ctx context.Context) (commontypes.Head, error) { - return s.chain.LatestHead(ctx) -} - -func (s *ChainRelayerExt) GetChainStatus(ctx context.Context) (commontypes.ChainStatus, error) { - return s.chain.GetChainStatus(ctx) -} - -func (s *ChainRelayerExt) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []commontypes.NodeStatus, nextPageToken string, total int, err error) { - return s.chain.ListNodeStatuses(ctx, pageSize, pageToken) -} - -func (s *ChainRelayerExt) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { - return s.chain.Transact(ctx, from, to, amount, balanceCheck) -} - -func (s *ChainRelayerExt) ID() string { - return s.chain.ID().String() -} - -func (s *ChainRelayerExt) Chain() legacyevm.Chain { - return s.chain -} - -var ErrCorruptEVMChain = errors.New("corrupt evm chain") - -func (s *ChainRelayerExt) Start(ctx context.Context) error { - return s.chain.Start(ctx) -} - -func (s *ChainRelayerExt) Close() (err error) { - return s.chain.Close() -} - -func (s *ChainRelayerExt) Name() string { - return s.chain.Name() -} - -func (s *ChainRelayerExt) HealthReport() map[string]error { - return s.chain.HealthReport() +func (r *LegacyChainsAndConfig) Slice() []legacyevm.Chain { + return r.rs } -func (s *ChainRelayerExt) Ready() (err error) { - return s.chain.Ready() +func (r *LegacyChainsAndConfig) Len() int { + return len(r.rs) } -func NewChainRelayerExtenders(ctx context.Context, opts legacyevm.ChainRelayExtenderConfig) (*ChainRelayerExtenders, error) { - if err := opts.Validate(); err != nil { - return nil, err +func NewLegacyChains(ctx context.Context, opts legacyevm.ChainRelayOpts) (result []legacyevm.Chain, err error) { + if err = opts.Validate(); err != nil { + return } unique := make(map[string]struct{}) @@ -140,11 +55,9 @@ func NewChainRelayerExtenders(ctx context.Context, opts legacyevm.ChainRelayExte } } - var result []*ChainRelayerExt - var err error for i := range enabled { cid := enabled[i].ChainID.String() - privOpts := legacyevm.ChainRelayExtenderConfig{ + privOpts := legacyevm.ChainRelayOpts{ Logger: opts.Logger.Named(cid), ChainOpts: opts.ChainOpts, KeyStore: opts.KeyStore, @@ -157,11 +70,12 @@ func NewChainRelayerExtenders(ctx context.Context, opts legacyevm.ChainRelayExte continue } - s := &ChainRelayerExt{ - chain: chain, - } - result = append(result, s) + result = append(result, chain) } + return +} +func NewLegacyChainsAndConfig(ctx context.Context, opts legacyevm.ChainRelayOpts) (*LegacyChainsAndConfig, error) { + result, err := NewLegacyChains(ctx, opts) // always return because it's accumulating errors - return newChainRelayerExtsFromSlice(result, opts.AppConfig), err + return &LegacyChainsAndConfig{result, opts.AppConfig.EVMConfigs()}, err } diff --git a/core/services/relay/evm/relayer_extender_test.go b/core/services/relay/evm/relayer_extender_test.go index f2bc3a33a93..3be2bbcb5e7 100644 --- a/core/services/relay/evm/relayer_extender_test.go +++ b/core/services/relay/evm/relayer_extender_test.go @@ -35,31 +35,31 @@ func TestChainRelayExtenders(t *testing.T) { kst := cltest.NewKeyStore(t, db) require.NoError(t, kst.Unlock(ctx, cltest.Password)) - opts := evmtest.NewChainRelayExtOpts(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg}) + opts := evmtest.NewChainOpts(t, evmtest.TestChainOpts{DB: db, KeyStore: kst.Eth(), GeneralConfig: cfg}) opts.GenEthClient = func(*big.Int) evmclient.Client { return cltest.NewEthMocksWithStartupAssertions(t) } - relayExtenders, err := evmrelay.NewChainRelayerExtenders(testutils.Context(t), opts) + relayExtenders, err := evmrelay.NewLegacyChains(testutils.Context(t), opts) require.NoError(t, err) - require.Equal(t, relayExtenders.Len(), 2) - relayExtendersInstances := relayExtenders.Slice() + require.Equal(t, len(relayExtenders), 2) + relayExtendersInstances := relayExtenders for _, c := range relayExtendersInstances { require.NoError(t, c.Start(testutils.Context(t))) require.NoError(t, c.Ready()) } - require.NotEqual(t, relayExtendersInstances[0].Chain().ID().String(), relayExtendersInstances[1].Chain().ID().String()) + require.NotEqual(t, relayExtendersInstances[0].ID().String(), relayExtendersInstances[1].ID().String()) for _, c := range relayExtendersInstances { require.NoError(t, c.Close()) } - relayExtendersInstances[0].Chain().Client().(*evmclimocks.Client).AssertCalled(t, "Close") - relayExtendersInstances[1].Chain().Client().(*evmclimocks.Client).AssertCalled(t, "Close") + relayExtendersInstances[0].Client().(*evmclimocks.Client).AssertCalled(t, "Close") + relayExtendersInstances[1].Client().(*evmclimocks.Client).AssertCalled(t, "Close") - assert.Error(t, relayExtendersInstances[0].Chain().Ready()) - assert.Error(t, relayExtendersInstances[1].Chain().Ready()) + assert.Error(t, relayExtendersInstances[0].Ready()) + assert.Error(t, relayExtendersInstances[1].Ready()) // test extender methods on single instance relayExt := relayExtendersInstances[0] diff --git a/core/services/relay/evm/write_target.go b/core/services/relay/evm/write_target.go index 14e6d1bf348..cd30e8ab3c3 100644 --- a/core/services/relay/evm/write_target.go +++ b/core/services/relay/evm/write_target.go @@ -42,7 +42,7 @@ func NewWriteTarget(ctx context.Context, relayer *Relayer, chain legacyevm.Chain if err != nil { return nil, fmt.Errorf("failed to marshal contract reader config %v", err) } - cr, err := relayer.NewContractReader(contractReaderConfigEncoded) + cr, err := relayer.NewContractReader(ctx, contractReaderConfigEncoded) if err != nil { return nil, err } diff --git a/core/services/relay/evm/write_target_test.go b/core/services/relay/evm/write_target_test.go index 94b2367b6d6..245fd974783 100644 --- a/core/services/relay/evm/write_target_test.go +++ b/core/services/relay/evm/write_target_test.go @@ -142,7 +142,7 @@ func TestEvmWrite(t *testing.T) { keyStore := cltest.NewKeyStore(t, db) lggr := logger.TestLogger(t) - relayer, err := relayevm.NewRelayer(lggr, chain, relayevm.RelayerOpts{ + relayer, err := relayevm.NewRelayer(testutils.Context(t), lggr, chain, relayevm.RelayerOpts{ DS: db, CSAETHKeystore: keyStore, CapabilitiesRegistry: evmcapabilities.NewRegistry(lggr), diff --git a/core/services/relay/relay.go b/core/services/relay/relay.go index a2681418cee..6f3438e1b94 100644 --- a/core/services/relay/relay.go +++ b/core/services/relay/relay.go @@ -1,5 +1,13 @@ package relay +import ( + "context" + "fmt" + + "github.com/smartcontractkit/chainlink-common/pkg/loop" + "github.com/smartcontractkit/chainlink-common/pkg/types" +) + const ( NetworkEVM = "evm" NetworkCosmos = "cosmos" @@ -19,3 +27,36 @@ var SupportedNetworks = map[string]struct{}{ NetworkDummy: {}, } + +var _ loop.Relayer = (*ServerAdapter)(nil) + +// ServerAdapter extends [loop.RelayerAdapter] by overriding NewPluginProvider to dispatches calls according to `RelayArgs.ProviderType`. +// This should only be used to adapt relayers not running via GRPC in a LOOPP. +type ServerAdapter struct { + types.Relayer +} + +// NewServerAdapter returns a new ServerAdapter. +func NewServerAdapter(r types.Relayer) *ServerAdapter { //nolint:staticcheck + return &ServerAdapter{Relayer: r} +} + +func (r *ServerAdapter) NewPluginProvider(ctx context.Context, rargs types.RelayArgs, pargs types.PluginArgs) (types.PluginProvider, error) { + switch types.OCR2PluginType(rargs.ProviderType) { + case types.Median: + return r.NewMedianProvider(ctx, rargs, pargs) + case types.Functions: + return r.NewFunctionsProvider(ctx, rargs, pargs) + case types.Mercury: + return r.NewMercuryProvider(ctx, rargs, pargs) + case types.OCR2Keeper: + return r.NewAutomationProvider(ctx, rargs, pargs) + case types.OCR3Capability: + return r.NewOCR3CapabilityProvider(ctx, rargs, pargs) + case types.DKG, types.OCR2VRF, types.GenericPlugin: + return r.Relayer.NewPluginProvider(ctx, rargs, pargs) + case types.LLO, types.CCIPCommit, types.CCIPExecution: + return nil, fmt.Errorf("provider type not supported: %s", rargs.ProviderType) + } + return nil, fmt.Errorf("provider type not recognized: %s", rargs.ProviderType) +} diff --git a/core/services/streams/stream_registry.go b/core/services/streams/stream_registry.go index 9d3fcda7109..9ab2df11d33 100644 --- a/core/services/streams/stream_registry.go +++ b/core/services/streams/stream_registry.go @@ -4,14 +4,14 @@ import ( "fmt" "sync" - llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo" + "github.com/smartcontractkit/chainlink-common/pkg/types/llo" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" ) // alias for easier refactoring -type StreamID = llotypes.StreamID +type StreamID = llo.StreamID type Registry interface { Getter diff --git a/core/services/vrf/delegate_test.go b/core/services/vrf/delegate_test.go index 9718dc376a7..7f94e98ff9f 100644 --- a/core/services/vrf/delegate_test.go +++ b/core/services/vrf/delegate_test.go @@ -40,7 +40,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" "github.com/smartcontractkit/chainlink/v2/core/services/vrf" vrf_mocks "github.com/smartcontractkit/chainlink/v2/core/services/vrf/mocks" @@ -88,8 +87,7 @@ func buildVrfUni(t *testing.T, db *sqlx.DB, cfg chainlink.GeneralConfig) vrfUniv require.NoError(t, orm.IdempotentInsertHead(testutils.Context(t), cltest.Head(51))) jrm := job.NewORM(db, prm, btORM, ks, lggr) t.Cleanup(func() { assert.NoError(t, jrm.Close()) }) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{LogBroadcaster: lb, KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{LogBroadcaster: lb, KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) pr := pipeline.NewRunner(prm, btORM, cfg.JobPipeline(), cfg.WebServer(), legacyChains, ks.Eth(), ks.VRF(), lggr, nil, nil) require.NoError(t, ks.Unlock(ctx, testutils.Password)) k, err2 := ks.Eth().Create(testutils.Context(t), testutils.FixtureChainID) diff --git a/core/services/vrf/v2/integration_v2_test.go b/core/services/vrf/v2/integration_v2_test.go index 33ed5a76b5c..46fd5602595 100644 --- a/core/services/vrf/v2/integration_v2_test.go +++ b/core/services/vrf/v2/integration_v2_test.go @@ -73,7 +73,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" - evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/proof" v1 "github.com/smartcontractkit/chainlink/v2/core/services/vrf/v1" @@ -2047,8 +2046,7 @@ func TestStartingCountsV1(t *testing.T) { ec.On("ConfiguredChainID").Return(testutils.SimulatedChainID) ec.On("LatestBlockHeight", mock.Anything).Return(big.NewInt(2), nil).Maybe() txm := makeTestTxm(t, txStore, ks, ec) - relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) - legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{KeyStore: ks.Eth(), Client: ec, DB: db, GeneralConfig: cfg, TxManager: txm}) chain, err := legacyChains.Get(testutils.SimulatedChainID.String()) require.NoError(t, err) listenerV1 := &v1.Listener{ diff --git a/core/web/chains_controller.go b/core/web/chains_controller.go index bcaaf909540..6bc5ee4daa3 100644 --- a/core/web/chains_controller.go +++ b/core/web/chains_controller.go @@ -58,7 +58,7 @@ func (cc *chainsController[R]) Index(c *gin.Context, size, page, offset int) { jsonAPIError(c, http.StatusBadRequest, cc.errNotEnabled) return } - chains, count, err := cc.chainStats.ChainStatuses(c, offset, size) + chains, count, err := cc.chainStats.ChainStatuses(c.Request.Context(), offset, size) if err != nil { jsonAPIError(c, http.StatusBadRequest, err) @@ -79,7 +79,7 @@ func (cc *chainsController[R]) Show(c *gin.Context) { return } relayID := types.RelayID{Network: cc.network, ChainID: c.Param("ID")} - chain, err := cc.chainStats.ChainStatus(c, relayID) + chain, err := cc.chainStats.ChainStatus(c.Request.Context(), relayID) if err != nil { jsonAPIError(c, http.StatusBadRequest, err) return diff --git a/core/web/jobs_controller.go b/core/web/jobs_controller.go index b11f6e61094..48921cc4f90 100644 --- a/core/web/jobs_controller.go +++ b/core/web/jobs_controller.go @@ -75,7 +75,7 @@ func (jc *JobsController) Show(c *gin.Context) { jobSpec, err = jc.App.JobORM().FindJobByExternalJobID(ctx, externalJobID) } else if pErr = jobSpec.SetID(c.Param("ID")); pErr == nil { // Find a job by job ID - jobSpec, err = jc.App.JobORM().FindJobTx(ctx, jobSpec.ID) + jobSpec, err = jc.App.JobORM().FindJob(ctx, jobSpec.ID) } else { jsonAPIError(c, http.StatusUnprocessableEntity, pErr) return diff --git a/core/web/nodes_controller.go b/core/web/nodes_controller.go index bf5bb0e65e1..0e43316629a 100644 --- a/core/web/nodes_controller.go +++ b/core/web/nodes_controller.go @@ -68,9 +68,10 @@ func (n *nodesController[R]) Index(c *gin.Context, size, page, offset int) { var count int var err error + ctx := c.Request.Context() if id == "" { // fetch all nodes - nodes, count, err = n.nodeSet.NodeStatuses(c, offset, size) + nodes, count, err = n.nodeSet.NodeStatuses(ctx, offset, size) } else { // fetch nodes for chain ID // backward compatibility @@ -80,7 +81,7 @@ func (n *nodesController[R]) Index(c *gin.Context, size, page, offset int) { rid.ChainID = id rid.Network = n.nodeSet.network } - nodes, count, err = n.nodeSet.NodeStatuses(c, offset, size, rid) + nodes, count, err = n.nodeSet.NodeStatuses(ctx, offset, size, rid) } var resources []R diff --git a/core/web/solana_transfer_controller.go b/core/web/solana_transfer_controller.go index db93401d0d7..07c629a7dd1 100644 --- a/core/web/solana_transfer_controller.go +++ b/core/web/solana_transfer_controller.go @@ -60,7 +60,7 @@ func (tc *SolanaTransfersController) Create(c *gin.Context) { return } - err = relayer.Transact(c, tr.From.String(), tr.To.String(), amount, !tr.AllowHigherAmounts) + err = relayer.Transact(c.Request.Context(), tr.From.String(), tr.To.String(), amount, !tr.AllowHigherAmounts) if err != nil { if errors.Is(err, chains.ErrNotFound) || errors.Is(err, chains.ErrChainIDEmpty) { jsonAPIError(c, http.StatusBadRequest, err) diff --git a/core/web/testdata/body/health.html b/core/web/testdata/body/health.html index d2b6db906b4..5c53a8051c1 100644 --- a/core/web/testdata/body/health.html +++ b/core/web/testdata/body/health.html @@ -52,6 +52,9 @@
LogBroadcaster
+
+ Relayer +
Txm
diff --git a/core/web/testdata/body/health.json b/core/web/testdata/body/health.json index 81ed7ff6d11..5005f08efc7 100644 --- a/core/web/testdata/body/health.json +++ b/core/web/testdata/body/health.json @@ -54,6 +54,15 @@ "output": "" } }, + { + "type": "checks", + "id": "EVM.0.Relayer", + "attributes": { + "name": "EVM.0.Relayer", + "status": "passing", + "output": "" + } + }, { "type": "checks", "id": "EVM.0.Txm", diff --git a/core/web/testdata/body/health.txt b/core/web/testdata/body/health.txt index 6b165d26d99..ef428694849 100644 --- a/core/web/testdata/body/health.txt +++ b/core/web/testdata/body/health.txt @@ -5,6 +5,7 @@ ok EVM.0.HeadTracker ! EVM.0.HeadTracker.HeadListener Listener is not connected ok EVM.0.LogBroadcaster +ok EVM.0.Relayer ok EVM.0.Txm ok EVM.0.Txm.BlockHistoryEstimator ok EVM.0.Txm.Broadcaster diff --git a/go.mod b/go.mod index 405a6b46680..cd026ba5b53 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/dominikbraun/graph v0.23.0 github.com/esote/minmaxheap v1.0.0 github.com/ethereum/go-ethereum v1.13.8 - github.com/fatih/color v1.16.0 + github.com/fatih/color v1.17.0 github.com/fxamacker/cbor/v2 v2.7.0 github.com/gagliardetto/solana-go v1.8.4 github.com/getsentry/sentry-go v0.23.0 @@ -73,17 +73,17 @@ require ( github.com/shirou/gopsutil/v3 v3.24.3 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chain-selectors v1.0.23 - github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 - github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae - github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 - github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 - github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 + github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 + github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a + github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac + github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 + github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 github.com/smartcontractkit/wsrpc v0.8.2 github.com/spf13/cast v1.6.0 github.com/stretchr/testify v1.9.0 @@ -104,14 +104,14 @@ require ( go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.27.0 - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa - golang.org/x/mod v0.20.0 + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 + golang.org/x/mod v0.21.0 golang.org/x/net v0.29.0 golang.org/x/sync v0.8.0 golang.org/x/term v0.24.0 golang.org/x/text v0.18.0 golang.org/x/time v0.6.0 - golang.org/x/tools v0.24.0 + golang.org/x/tools v0.25.0 gonum.org/v1/gonum v0.15.0 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 @@ -121,11 +121,6 @@ require ( ) require ( - cloud.google.com/go/auth v0.7.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect - cloud.google.com/go/compute/metadata v0.5.0 // indirect - cloud.google.com/go/iam v1.1.11 // indirect - cloud.google.com/go/storage v1.43.0 // indirect contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect @@ -223,6 +218,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-tpm v0.9.0 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/googleapis/gax-go/v2 v2.12.5 // indirect github.com/gorilla/context v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect @@ -331,7 +327,6 @@ require ( go.mongodb.org/mongo-driver v1.15.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240823153156-2a54df7bffb9 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect @@ -348,7 +343,6 @@ require ( go.uber.org/ratelimit v0.3.0 // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/sys v0.25.0 // indirect - google.golang.org/api v0.188.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect @@ -363,7 +357,7 @@ require ( replace ( // until merged upstream: https://github.com/omissis/go-jsonschema/pull/264 - github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-rtinianov + github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-smallSizedInts // replicating the replace directive on cosmos SDK github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index 9854253863b..9dac5425a72 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,7 @@ cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/compute v1.27.2 h1:5cE5hdrwJV/92ravlwIFRGnyH9CpLGhh4N0ZDVTU+BA= cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= @@ -335,8 +336,8 @@ github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+ne github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -1040,30 +1041,30 @@ 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.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnjjIQAEBnutCtksPzVDY= github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= -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-ccip v0.0.0-20240916150615-85b8aa5fa7e6 h1:cbHlV2CSphQ+ghDye21M8ym0aAO/Y649H2Mg60M2AuE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf h1:1AlTUkT5D8HmvU9bwDoIN54/EFyOnRBl7gnXZVrYXEA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf/go.mod h1:l8NTByXUdGGJX+vyKYI6yX1/HIpM14F8Wm9BkU3Q4Qo= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2/go.mod h1:rNhNSrrRMvkgAm5SA6bNTdh2340bTQQZdUVNtZ2o2bk= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f h1:p4p3jBT91EQyLuAMvHD+zNJsuAYI/QjJbzuGUJ7wIgg= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f/go.mod h1:FLlWBt2hwiMVgt9AcSo6wBJYIRd/nsc8ENbV1Wir1bw= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 h1:JPs35oSO07PK3Qv7Kyv0GJHVLacIE1IkrvefaPyBjKs= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664/go.mod h1:iJ9DKYo0F64ue7IogAIELwU2DfrhEAh76eSmZOilT8A= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae h1:d+B8y2Nd/PrnPMNoaSPn3eDgUgxcVcIqAxGrvYu/gGw= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae/go.mod h1:ec/a20UZ7YRK4oxJcnTBFzp1+DBcJcwqEaerUMsktMs= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc h1:7HsLUzUQRIbfCukKvYU9XCNq2UEln1GwogHpUhy+a/k= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc/go.mod h1:4+dzRyvI4lVZe6OJxO9Z+wd6YhJKPiHYL1nTATkEIWg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f h1:pNhHmwBpb8YFiwd7d4D4U7sVgK1LSQHpoacxfQyDXpg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f/go.mod h1:q7AATJ7zSPB86ORu0pyu7ySAhCxJD04scKJnFztTUWU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 h1:gA5i53h0RvT3Nip2m5V6GFxXvmKc7b/f5un8ZAMD8Gw= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5/go.mod h1:llM0s/N/PAE3LOaZ6kiC7nzw9/0KPJoiziGgLraOoS0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 h1:/Isyny7N6lRayJwIn4cY9TYmT9UdxvsxqWiq12rzAeg= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7/go.mod h1:25aVOs3Z3Un/Iux8Ak9y3dIVqVTtk7eR85dhynmWxiM= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 h1:+f25XTEd4VQu/a7wV7ynVxepKK84Zvkia5BRVqBrlVk= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0/go.mod h1:hRZixlXa4dtA1J3iZPhleWenxHlEro49ZDK3j73MlnM= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 h1:MNuAkek6lUrq3r0f1ixdFHRjO6NcQqauT7oWn87v/EQ= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350/go.mod h1:kkGccKLSkEm+SAqIZdB2mC1/fYaqj/o/n5zt3kDIWMo= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb h1:dy265V6XxfVjgMGFq6VZfo7KsDbl/7Q05+lUOZyOPNA= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb/go.mod h1:CFiZ6DGbcMKjvxOmr75cwCi5LZgsIbgYgmISZ43mSKM= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a h1:grNwfsQUl5eY7fRxNbpPFPcHlq4bTNF7TgiZjoJjtBU= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a/go.mod h1:WnqjsdxI5x1V0Lpov0QEEHvW/f2H64eAQpE6B/3KjnI= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac h1:jo3kFDcpF4/hfBLNMhLL7bvjdnJkEaUhbxXIFiC9lVs= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 h1:yyzB+d9AaOqgtoKYW+Uiak7/HMX8aK16yEWtnhaEnOA= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:tEwKLdONxgNpde1JA7/XxmIAq3wqD6efSOX/UWtqkZQ= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 h1:0JAy7OlCERnznorGxooCN5rwzEYvHnR4Y6IqVBqfxxY= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:JjP0TZ026rjAlFuj3SMcC/WO93SBV5vbMr8wTbFpaIg= github.com/smartcontractkit/wsrpc v0.8.2 h1:XB/xcn/MMseHW+8JE8+a/rceA86ck7Ur6cEa9LiUC8M= github.com/smartcontractkit/wsrpc v0.8.2/go.mod h1:2u/wfnhl5R4RlSXseN4n6HHIWk8w1Am3AT6gWftQbNg= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1334,8 +1335,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1360,8 +1361,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1572,8 +1573,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/integration-tests/actions/automation_ocr_helpers.go b/integration-tests/actions/automation_ocr_helpers.go index df9168e25de..bb4440045e4 100644 --- a/integration-tests/actions/automation_ocr_helpers.go +++ b/integration-tests/actions/automation_ocr_helpers.go @@ -105,6 +105,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndex( S, // s []int, oracleIdentities, // oracles []OracleIdentityExtra, offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 20*time.Millisecond, // maxDurationObservation time.Duration, // good to here 1200*time.Millisecond, // maxDurationShouldAcceptAttestedReport time.Duration, @@ -140,6 +141,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndex( S, // s []int, oracleIdentities, // oracles []OracleIdentityExtra, offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 20*time.Millisecond, // maxDurationObservation time.Duration, 1200*time.Millisecond, // maxDurationReport time.Duration, diff --git a/integration-tests/actions/automation_ocr_helpers_local.go b/integration-tests/actions/automation_ocr_helpers_local.go index d513f1875a4..f0364185440 100644 --- a/integration-tests/actions/automation_ocr_helpers_local.go +++ b/integration-tests/actions/automation_ocr_helpers_local.go @@ -108,6 +108,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( S, // s []int, oracleIdentities, // oracles []OracleIdentityExtra, offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 20*time.Millisecond, // maxDurationObservation time.Duration, // good to here 1200*time.Millisecond, // maxDurationShouldAcceptAttestedReport time.Duration, @@ -143,6 +144,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( S, // s []int, oracleIdentities, // oracles []OracleIdentityExtra, offC, // reportingPluginConfig []byte, + nil, 20*time.Millisecond, // maxDurationQuery time.Duration, 20*time.Millisecond, // maxDurationObservation time.Duration, 1200*time.Millisecond, // maxDurationReport time.Duration, diff --git a/integration-tests/actions/automationv2/actions.go b/integration-tests/actions/automationv2/actions.go index 0aebec546db..38cc0f95bab 100644 --- a/integration-tests/actions/automationv2/actions.go +++ b/integration-tests/actions/automationv2/actions.go @@ -629,6 +629,7 @@ func calculateOCR2ConfigArgs(a *AutomationTest, S []int, oracleIdentities []conf a.PublicConfig.DeltaRound, a.PublicConfig.DeltaGrace, a.PublicConfig.DeltaStage, uint8(a.PublicConfig.RMax), S, oracleIdentities, offC, + nil, a.PublicConfig.MaxDurationQuery, a.PublicConfig.MaxDurationObservation, 1200*time.Millisecond, a.PublicConfig.MaxDurationShouldAcceptAttestedReport, @@ -653,7 +654,7 @@ func calculateOCR3ConfigArgs(a *AutomationTest, S []int, oracleIdentities []conf a.PublicConfig.DeltaRound, a.PublicConfig.DeltaGrace, a.PublicConfig.DeltaCertifiedCommitRequest, a.PublicConfig.DeltaStage, a.PublicConfig.RMax, S, oracleIdentities, offC, - a.PublicConfig.MaxDurationQuery, a.PublicConfig.MaxDurationObservation, + nil, a.PublicConfig.MaxDurationQuery, a.PublicConfig.MaxDurationObservation, a.PublicConfig.MaxDurationShouldAcceptAttestedReport, a.PublicConfig.MaxDurationShouldTransmitAcceptedReport, a.PublicConfig.F, a.PublicConfig.OnchainConfig, diff --git a/integration-tests/actions/ocr2_helpers.go b/integration-tests/actions/ocr2_helpers.go index f487368dfd2..7fd16f524a0 100644 --- a/integration-tests/actions/ocr2_helpers.go +++ b/integration-tests/actions/ocr2_helpers.go @@ -54,6 +54,7 @@ func BuildMedianOCR2Config( AlphaAcceptPPB: 1, DeltaC: time.Minute * 30, }.Encode(), // reportingPluginConfig []byte, + nil, 5*time.Second, // maxDurationQuery time.Duration, 5*time.Second, // maxDurationObservation time.Duration, 5*time.Second, // maxDurationReport time.Duration, diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go index 3667aa1ef0e..fca334b8f80 100644 --- a/integration-tests/actions/ocr2_helpers_local.go +++ b/integration-tests/actions/ocr2_helpers_local.go @@ -198,6 +198,7 @@ func BuildMedianOCR2ConfigLocal(workerNodes []*client.ChainlinkClient, ocrOffcha AlphaAcceptPPB: 1, DeltaC: time.Minute * 30, }.Encode(), // reportingPluginConfig []byte, + nil, 5*time.Second, // maxDurationQuery time.Duration, 5*time.Second, // maxDurationObservation time.Duration, 5*time.Second, // maxDurationReport time.Duration, diff --git a/integration-tests/ccip-tests/contracts/contract_deployer.go b/integration-tests/ccip-tests/contracts/contract_deployer.go index 211bbc1ebb4..edc7ad1c543 100644 --- a/integration-tests/ccip-tests/contracts/contract_deployer.go +++ b/integration-tests/ccip-tests/contracts/contract_deployer.go @@ -1566,6 +1566,7 @@ func NewOffChainAggregatorV2ConfigForCCIPPlugin[T ccipconfig.OffchainConfig]( ocrConfig.S, ocrConfig.Oracles, ocrConfig.ReportingPluginConfig, + nil, ocrConfig.MaxDurationQuery.Duration(), ocrConfig.MaxDurationObservation.Duration(), ocrConfig.MaxDurationReport.Duration(), diff --git a/integration-tests/go.mod b/integration-tests/go.mod index f7922b245db..aac9767a7d3 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -37,16 +37,16 @@ require ( github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badcfb5 github.com/smartcontractkit/chain-selectors v1.0.23 - github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf + github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 - github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 + github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 github.com/subosito/gotenv v1.6.0 @@ -57,7 +57,7 @@ require ( go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.27.0 - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 golang.org/x/sync v0.8.0 golang.org/x/text v0.18.0 google.golang.org/grpc v1.65.0 @@ -199,7 +199,7 @@ require ( github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect github.com/fatih/camelcase v1.0.0 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -405,14 +405,14 @@ require ( github.com/shirou/gopsutil/v3 v3.24.3 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.9.3 // 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 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 // indirect + github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // 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 + github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 // indirect + github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 // indirect github.com/smartcontractkit/wsrpc v0.8.2 // indirect github.com/soheilhy/cmux v0.1.5 // indirect github.com/sony/gobreaker v0.5.0 // indirect @@ -481,13 +481,13 @@ require ( go.uber.org/ratelimit v0.3.0 // indirect go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/arch v0.8.0 // indirect - golang.org/x/mod v0.20.0 // indirect + golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/term v0.24.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.25.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect @@ -523,7 +523,7 @@ exclude github.com/chaos-mesh/chaos-mesh/api/v1alpha1 v0.0.0-20220226050744-7994 replace ( // until merged upstream: https://github.com/omissis/go-jsonschema/pull/264 - github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-rtinianov + github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-smallSizedInts github.com/go-kit/log => github.com/go-kit/log v0.2.1 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 673a1e94e18..758653ff94b 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -512,8 +512,8 @@ github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwo github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -801,8 +801,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= -github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= github.com/gophercloud/gophercloud v1.5.0 h1:cDN6XFCLKiiqvYpjQLq9AiM7RDRbIC9450WpPH+yvXo= github.com/gophercloud/gophercloud v1.5.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -1421,22 +1421,22 @@ github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badc github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240910151738-3f318badcfb5/go.mod h1:N60/wwocvZ5A3RGmYaMWo0fPFa5tTMlhI9lJ22DRktM= github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnjjIQAEBnutCtksPzVDY= github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= -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-ccip v0.0.0-20240916150615-85b8aa5fa7e6 h1:cbHlV2CSphQ+ghDye21M8ym0aAO/Y649H2Mg60M2AuE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf h1:1AlTUkT5D8HmvU9bwDoIN54/EFyOnRBl7gnXZVrYXEA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf/go.mod h1:l8NTByXUdGGJX+vyKYI6yX1/HIpM14F8Wm9BkU3Q4Qo= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2/go.mod h1:rNhNSrrRMvkgAm5SA6bNTdh2340bTQQZdUVNtZ2o2bk= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f h1:p4p3jBT91EQyLuAMvHD+zNJsuAYI/QjJbzuGUJ7wIgg= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f/go.mod h1:FLlWBt2hwiMVgt9AcSo6wBJYIRd/nsc8ENbV1Wir1bw= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 h1:JPs35oSO07PK3Qv7Kyv0GJHVLacIE1IkrvefaPyBjKs= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664/go.mod h1:iJ9DKYo0F64ue7IogAIELwU2DfrhEAh76eSmZOilT8A= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae h1:d+B8y2Nd/PrnPMNoaSPn3eDgUgxcVcIqAxGrvYu/gGw= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae/go.mod h1:ec/a20UZ7YRK4oxJcnTBFzp1+DBcJcwqEaerUMsktMs= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc h1:7HsLUzUQRIbfCukKvYU9XCNq2UEln1GwogHpUhy+a/k= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc/go.mod h1:4+dzRyvI4lVZe6OJxO9Z+wd6YhJKPiHYL1nTATkEIWg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f h1:pNhHmwBpb8YFiwd7d4D4U7sVgK1LSQHpoacxfQyDXpg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f/go.mod h1:q7AATJ7zSPB86ORu0pyu7ySAhCxJD04scKJnFztTUWU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 h1:gA5i53h0RvT3Nip2m5V6GFxXvmKc7b/f5un8ZAMD8Gw= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5/go.mod h1:llM0s/N/PAE3LOaZ6kiC7nzw9/0KPJoiziGgLraOoS0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 h1:/Isyny7N6lRayJwIn4cY9TYmT9UdxvsxqWiq12rzAeg= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7/go.mod h1:25aVOs3Z3Un/Iux8Ak9y3dIVqVTtk7eR85dhynmWxiM= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 h1:+f25XTEd4VQu/a7wV7ynVxepKK84Zvkia5BRVqBrlVk= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0/go.mod h1:hRZixlXa4dtA1J3iZPhleWenxHlEro49ZDK3j73MlnM= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 h1:MNuAkek6lUrq3r0f1ixdFHRjO6NcQqauT7oWn87v/EQ= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350/go.mod h1:kkGccKLSkEm+SAqIZdB2mC1/fYaqj/o/n5zt3kDIWMo= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb h1:dy265V6XxfVjgMGFq6VZfo7KsDbl/7Q05+lUOZyOPNA= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb/go.mod h1:CFiZ6DGbcMKjvxOmr75cwCi5LZgsIbgYgmISZ43mSKM= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a h1:grNwfsQUl5eY7fRxNbpPFPcHlq4bTNF7TgiZjoJjtBU= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a/go.mod h1:WnqjsdxI5x1V0Lpov0QEEHvW/f2H64eAQpE6B/3KjnI= github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 h1:mgjBQIEy+3V3G6K8e+6by3xndgsXdYYsdy+7kzQZwSk= github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0/go.mod h1:pdIxrooP5CFGmC0p5NTOBiZAFtMw+5pTT4de5GY3ywA= github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 h1:Owb1MQZn0NZHwtZAnPZE6TVoTx6xLrfPaUdeOYswE9M= @@ -1449,12 +1449,12 @@ github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 h1:gfhfTn7H github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0/go.mod h1:tqajhpUJA/9OaMCLitghBXjAgqYO4i27St0F4TUO3+M= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac h1:jo3kFDcpF4/hfBLNMhLL7bvjdnJkEaUhbxXIFiC9lVs= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 h1:yyzB+d9AaOqgtoKYW+Uiak7/HMX8aK16yEWtnhaEnOA= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:tEwKLdONxgNpde1JA7/XxmIAq3wqD6efSOX/UWtqkZQ= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 h1:0JAy7OlCERnznorGxooCN5rwzEYvHnR4Y6IqVBqfxxY= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:JjP0TZ026rjAlFuj3SMcC/WO93SBV5vbMr8wTbFpaIg= github.com/smartcontractkit/wsrpc v0.8.2 h1:XB/xcn/MMseHW+8JE8+a/rceA86ck7Ur6cEa9LiUC8M= github.com/smartcontractkit/wsrpc v0.8.2/go.mod h1:2u/wfnhl5R4RlSXseN4n6HHIWk8w1Am3AT6gWftQbNg= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1764,8 +1764,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1790,8 +1790,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2058,8 +2058,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 3f99fa1e4af..46fb36cc35f 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -15,15 +15,15 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf + github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240214231432-4ad5eb95178c github.com/smartcontractkit/chainlink/v2 v2.9.0-beta0.0.20240216210048-da02459ddad8 - github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 - github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 + github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac + github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 github.com/stretchr/testify v1.9.0 github.com/wiremock/go-wiremock v1.9.0 go.uber.org/ratelimit v0.3.0 @@ -164,7 +164,7 @@ require ( github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect github.com/fatih/camelcase v1.0.0 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fvbommel/sortorder v1.1.0 // indirect @@ -384,16 +384,16 @@ require ( github.com/shopspring/decimal v1.4.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/chain-selectors v1.0.23 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6 // 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 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 // indirect + github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a // indirect github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect - github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect + github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 // indirect github.com/smartcontractkit/wsrpc v0.8.2 // indirect github.com/soheilhy/cmux v0.1.5 // indirect github.com/sony/gobreaker v0.5.0 // indirect @@ -470,8 +470,8 @@ require ( go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect - golang.org/x/mod v0.20.0 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -479,7 +479,7 @@ require ( golang.org/x/term v0.24.0 // indirect golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.25.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240711142825-46eb208f015d // indirect @@ -520,7 +520,7 @@ exclude github.com/hashicorp/consul v1.2.1 replace ( // until merged upstream: https://github.com/omissis/go-jsonschema/pull/264 - github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-rtinianov + github.com/atombender/go-jsonschema => github.com/nolag/go-jsonschema v0.16.0-smallSizedInts github.com/go-kit/log => github.com/go-kit/log v0.2.1 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 5a51e7c4973..171b3cfd387 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -494,8 +494,8 @@ github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwo github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -785,8 +785,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= -github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= github.com/gophercloud/gophercloud v1.5.0 h1:cDN6XFCLKiiqvYpjQLq9AiM7RDRbIC9450WpPH+yvXo= github.com/gophercloud/gophercloud v1.5.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -1395,22 +1395,22 @@ 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.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnjjIQAEBnutCtksPzVDY= github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= -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-ccip v0.0.0-20240916150615-85b8aa5fa7e6 h1:cbHlV2CSphQ+ghDye21M8ym0aAO/Y649H2Mg60M2AuE= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240916150615-85b8aa5fa7e6/go.mod h1:Lv77O13ZxOdmlvnu2vaUC0Lg+t3JAL+N+9K8dRsgmDI= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf h1:1AlTUkT5D8HmvU9bwDoIN54/EFyOnRBl7gnXZVrYXEA= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916150342-36cb47701edf/go.mod h1:l8NTByXUdGGJX+vyKYI6yX1/HIpM14F8Wm9BkU3Q4Qo= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2/go.mod h1:rNhNSrrRMvkgAm5SA6bNTdh2340bTQQZdUVNtZ2o2bk= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f h1:p4p3jBT91EQyLuAMvHD+zNJsuAYI/QjJbzuGUJ7wIgg= -github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f/go.mod h1:FLlWBt2hwiMVgt9AcSo6wBJYIRd/nsc8ENbV1Wir1bw= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 h1:JPs35oSO07PK3Qv7Kyv0GJHVLacIE1IkrvefaPyBjKs= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664/go.mod h1:iJ9DKYo0F64ue7IogAIELwU2DfrhEAh76eSmZOilT8A= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae h1:d+B8y2Nd/PrnPMNoaSPn3eDgUgxcVcIqAxGrvYu/gGw= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae/go.mod h1:ec/a20UZ7YRK4oxJcnTBFzp1+DBcJcwqEaerUMsktMs= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc h1:7HsLUzUQRIbfCukKvYU9XCNq2UEln1GwogHpUhy+a/k= +github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240917215113-d5a4d24746cc/go.mod h1:4+dzRyvI4lVZe6OJxO9Z+wd6YhJKPiHYL1nTATkEIWg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f h1:pNhHmwBpb8YFiwd7d4D4U7sVgK1LSQHpoacxfQyDXpg= +github.com/smartcontractkit/chainlink-ccip v0.0.0-20240917215933-9c2109cefb1f/go.mod h1:q7AATJ7zSPB86ORu0pyu7ySAhCxJD04scKJnFztTUWU= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5 h1:gA5i53h0RvT3Nip2m5V6GFxXvmKc7b/f5un8ZAMD8Gw= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240917215517-c5fee41079c5/go.mod h1:llM0s/N/PAE3LOaZ6kiC7nzw9/0KPJoiziGgLraOoS0= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7 h1:/Isyny7N6lRayJwIn4cY9TYmT9UdxvsxqWiq12rzAeg= +github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240917220114-c5ac5291aca7/go.mod h1:25aVOs3Z3Un/Iux8Ak9y3dIVqVTtk7eR85dhynmWxiM= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0 h1:+f25XTEd4VQu/a7wV7ynVxepKK84Zvkia5BRVqBrlVk= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240917214453-911783cd26e0/go.mod h1:hRZixlXa4dtA1J3iZPhleWenxHlEro49ZDK3j73MlnM= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350 h1:MNuAkek6lUrq3r0f1ixdFHRjO6NcQqauT7oWn87v/EQ= +github.com/smartcontractkit/chainlink-feeds v0.0.0-20240917214742-0a55a40ac350/go.mod h1:kkGccKLSkEm+SAqIZdB2mC1/fYaqj/o/n5zt3kDIWMo= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb h1:dy265V6XxfVjgMGFq6VZfo7KsDbl/7Q05+lUOZyOPNA= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240917220147-edf4b329baeb/go.mod h1:CFiZ6DGbcMKjvxOmr75cwCi5LZgsIbgYgmISZ43mSKM= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a h1:grNwfsQUl5eY7fRxNbpPFPcHlq4bTNF7TgiZjoJjtBU= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240917220333-00d6b237e01a/go.mod h1:WnqjsdxI5x1V0Lpov0QEEHvW/f2H64eAQpE6B/3KjnI= github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 h1:mgjBQIEy+3V3G6K8e+6by3xndgsXdYYsdy+7kzQZwSk= github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0/go.mod h1:pdIxrooP5CFGmC0p5NTOBiZAFtMw+5pTT4de5GY3ywA= github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 h1:Owb1MQZn0NZHwtZAnPZE6TVoTx6xLrfPaUdeOYswE9M= @@ -1423,12 +1423,12 @@ github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 h1:gfhfTn7H github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0/go.mod h1:tqajhpUJA/9OaMCLitghBXjAgqYO4i27St0F4TUO3+M= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= -github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 h1:yiKnypAqP8l0OX0P3klzZ7SCcBUxy5KqTAKZmQOvSQE= -github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:q6f4fe39oZPdsh1i57WznEZgxd8siidMaSFq3wdPmVg= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 h1:Dai1bn+Q5cpeGMQwRdjOdVjG8mmFFROVkSKuUgBErRQ= -github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1/go.mod h1:G5Sd/yzHWf26rQ+X0nG9E0buKPqRGPMJAfk2gwCzOOw= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac h1:jo3kFDcpF4/hfBLNMhLL7bvjdnJkEaUhbxXIFiC9lVs= +github.com/smartcontractkit/libocr v0.0.0-20240830084433-f4f9f401c0ac/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 h1:yyzB+d9AaOqgtoKYW+Uiak7/HMX8aK16yEWtnhaEnOA= +github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:tEwKLdONxgNpde1JA7/XxmIAq3wqD6efSOX/UWtqkZQ= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 h1:0JAy7OlCERnznorGxooCN5rwzEYvHnR4Y6IqVBqfxxY= +github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35/go.mod h1:JjP0TZ026rjAlFuj3SMcC/WO93SBV5vbMr8wTbFpaIg= github.com/smartcontractkit/wsrpc v0.8.2 h1:XB/xcn/MMseHW+8JE8+a/rceA86ck7Ur6cEa9LiUC8M= github.com/smartcontractkit/wsrpc v0.8.2/go.mod h1:2u/wfnhl5R4RlSXseN4n6HHIWk8w1Am3AT6gWftQbNg= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1738,8 +1738,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1764,8 +1764,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2030,8 +2030,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/testdata/scripts/health/default.txtar b/testdata/scripts/health/default.txtar index 8480345e273..e1dbebe3015 100644 --- a/testdata/scripts/health/default.txtar +++ b/testdata/scripts/health/default.txtar @@ -29,6 +29,8 @@ fj293fbBnlQ!f9vNs -- config.toml.tmpl -- [Webserver] HTTPPort = $PORT +[WebServer.TLS] +HTTPSPort = 0 -- out.txt -- ok HeadReporter diff --git a/testdata/scripts/health/multi-chain.txtar b/testdata/scripts/health/multi-chain.txtar index bba3b3e111f..cbca9cc20ad 100644 --- a/testdata/scripts/health/multi-chain.txtar +++ b/testdata/scripts/health/multi-chain.txtar @@ -78,6 +78,7 @@ ok EVM.1.HeadTracker ! EVM.1.HeadTracker.HeadListener Listener is not connected ok EVM.1.LogBroadcaster +ok EVM.1.Relayer ok EVM.1.Txm ok EVM.1.Txm.BlockHistoryEstimator ok EVM.1.Txm.Broadcaster @@ -92,8 +93,10 @@ ok Mercury.WSRPCPool.CacheSet ok PipelineORM ok PipelineRunner ok PipelineRunner.BridgeCache -ok Solana.Bar -ok StarkNet.Baz +ok Solana.Bar.Chain +ok Solana.Bar.Relayer +ok Solana.Bar.Txm +ok StarkNet.Baz.Relayer ok TelemetryManager -- out-unhealthy.txt -- @@ -184,6 +187,15 @@ ok TelemetryManager "output": "" } }, + { + "type": "checks", + "id": "EVM.1.Relayer", + "attributes": { + "name": "EVM.1.Relayer", + "status": "passing", + "output": "" + } + }, { "type": "checks", "id": "EVM.1.Txm", @@ -312,18 +324,36 @@ ok TelemetryManager }, { "type": "checks", - "id": "Solana.Bar", + "id": "Solana.Bar.Chain", + "attributes": { + "name": "Solana.Bar.Chain", + "status": "passing", + "output": "" + } + }, + { + "type": "checks", + "id": "Solana.Bar.Relayer", + "attributes": { + "name": "Solana.Bar.Relayer", + "status": "passing", + "output": "" + } + }, + { + "type": "checks", + "id": "Solana.Bar.Txm", "attributes": { - "name": "Solana.Bar", + "name": "Solana.Bar.Txm", "status": "passing", "output": "" } }, { "type": "checks", - "id": "StarkNet.Baz", + "id": "StarkNet.Baz.Relayer", "attributes": { - "name": "StarkNet.Baz", + "name": "StarkNet.Baz.Relayer", "status": "passing", "output": "" }