Skip to content

Commit 27bfcc7

Browse files
authored
core: misc cleanup and deprecation (#21552)
1 parent a9d281b commit 27bfcc7

7 files changed

Lines changed: 39 additions & 28 deletions

File tree

core/internal/cltest/cltest.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import (
5050
"github.com/smartcontractkit/chainlink/v2/core/capabilities/compute"
5151

5252
"github.com/smartcontractkit/chainlink-evm/pkg/assets"
53-
"github.com/smartcontractkit/chainlink-evm/pkg/chains/legacyevm"
5453
evmclient "github.com/smartcontractkit/chainlink-evm/pkg/client"
5554
"github.com/smartcontractkit/chainlink-evm/pkg/client/clienttest"
5655
"github.com/smartcontractkit/chainlink-evm/pkg/txmgr"
@@ -163,6 +162,7 @@ func init() {
163162
}
164163
}
165164

165+
// Deprecated: use rand/v2
166166
func NewRandomPositiveInt64() int64 {
167167
id := rand.Int63()
168168
return id
@@ -183,30 +183,6 @@ func FormatWithPrefixedChainID(chainID, id string) string {
183183
return fmt.Sprintf("%s/%s", chainID, id)
184184
}
185185

186-
type JobPipelineV2TestHelper struct {
187-
Prm pipeline.ORM
188-
Jrm job.ORM
189-
Pr pipeline.Runner
190-
}
191-
192-
type JobPipelineConfig interface {
193-
pipeline.Config
194-
MaxSuccessfulRuns() uint64
195-
}
196-
197-
func NewJobPipelineV2(t testing.TB, cfg pipeline.BridgeConfig, jpcfg JobPipelineConfig, legacyChains legacyevm.LegacyChainContainer, db *sqlx.DB, keyStore keystore.Master, restrictedHTTPClient, unrestrictedHTTPClient *http.Client) JobPipelineV2TestHelper {
198-
lggr := logger.TestLogger(t)
199-
prm := pipeline.NewORM(db, lggr, jpcfg.MaxSuccessfulRuns())
200-
btORM := bridges.NewORM(db)
201-
jrm := job.NewORM(db, prm, btORM, keyStore, lggr)
202-
pr := pipeline.NewRunner(prm, btORM, jpcfg, cfg, legacyChains, keyStore.Eth(), keyStore.VRF(), lggr, restrictedHTTPClient, unrestrictedHTTPClient)
203-
return JobPipelineV2TestHelper{
204-
prm,
205-
jrm,
206-
pr,
207-
}
208-
}
209-
210186
// TestApplication holds the test application and test servers
211187
type TestApplication struct {
212188
t testing.TB

core/internal/testutils/testutils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func WaitTimeout(t *testing.T) time.Duration {
9898
}
9999

100100
// Context returns a context with the test's deadline, if available.
101+
// Deprecated: use [testing.TB.Context] directly
101102
func Context(tb testing.TB) context.Context {
102103
return tb.Context()
103104
}

core/services/chainlink/relayer_chain_interoperators.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ type LoopRelayerStorer interface {
4646
// LegacyChainer is an interface for getting legacy chains
4747
// This will be deprecated/removed when products depend only
4848
// on the relayer interface.
49+
// Deprecated: use the Relayer interface
4950
type LegacyChainer interface {
51+
// Deprecated: use the relayer interface
5052
LegacyEVMChains() legacyevm.LegacyChainContainer
5153
}
5254

@@ -294,6 +296,7 @@ func (rs *CoreRelayerChainInteroperators) GetIDToRelayerMap() map[types.RelayID]
294296

295297
// LegacyEVMChains returns a container with all the evm chains
296298
// TODO BCF-2511
299+
// Deprecated: use the Relayer interface
297300
func (rs *CoreRelayerChainInteroperators) LegacyEVMChains() legacyevm.LegacyChainContainer {
298301
rs.mu.Lock()
299302
defer rs.mu.Unlock()

core/services/keeper/integration_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package keeper_test
33
import (
44
"fmt"
55
"math/big"
6+
"net/http"
67
"testing"
78
"time"
89

910
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1011
"github.com/ethereum/go-ethereum/common"
1112
"github.com/ethereum/go-ethereum/core/types"
1213
"github.com/ethereum/go-ethereum/eth/ethconfig"
14+
"github.com/jmoiron/sqlx"
1315
"github.com/onsi/gomega"
1416
"github.com/pkg/errors"
1517
"github.com/stretchr/testify/require"
@@ -20,6 +22,9 @@ import (
2022
commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
2123
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
2224
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
25+
"github.com/smartcontractkit/chainlink/v2/core/bridges"
26+
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
27+
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
2328

2429
"github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/basic_upkeep_contract"
2530
"github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_logic1_3"
@@ -602,3 +607,27 @@ func TestMaxPerformDataSize(t *testing.T) {
602607
g.Eventually(receivedBytes, 20*time.Second, cltest.DBPollingInterval).Should(gomega.Equal(smallPayload))
603608
})
604609
}
610+
611+
type JobPipelineV2TestHelper struct {
612+
Prm pipeline.ORM
613+
Jrm job.ORM
614+
Pr pipeline.Runner
615+
}
616+
617+
type JobPipelineConfig interface {
618+
pipeline.Config
619+
MaxSuccessfulRuns() uint64
620+
}
621+
622+
func NewJobPipelineV2(t testing.TB, cfg pipeline.BridgeConfig, jpcfg JobPipelineConfig, legacyChains legacyevm.LegacyChainContainer, db *sqlx.DB, keyStore keystore.Master, restrictedHTTPClient, unrestrictedHTTPClient *http.Client) JobPipelineV2TestHelper {
623+
lggr := logger.TestLogger(t)
624+
prm := pipeline.NewORM(db, lggr, jpcfg.MaxSuccessfulRuns())
625+
btORM := bridges.NewORM(db)
626+
jrm := job.NewORM(db, prm, btORM, keyStore, lggr)
627+
pr := pipeline.NewRunner(prm, btORM, jpcfg, cfg, legacyChains, keyStore.Eth(), keyStore.VRF(), lggr, restrictedHTTPClient, unrestrictedHTTPClient)
628+
return JobPipelineV2TestHelper{
629+
prm,
630+
jrm,
631+
pr,
632+
}
633+
}

core/services/keeper/registry_synchronizer_helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func setupRegistrySync(t *testing.T, version keeper.RegistryVersion) (
5353
ListenerConfig: cfg.Database().Listener(),
5454
KeyStore: keyStore.Eth(),
5555
})
56-
jpv2 := cltest.NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), legacyChains, db, keyStore, nil, nil)
56+
jpv2 := NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), legacyChains, db, keyStore, nil, nil)
5757
contractAddress := j.KeeperSpec.ContractAddress.Address()
5858

5959
switch version {

core/services/keeper/upkeep_executer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func setup(t *testing.T, overrideFn func(c *chainlink.Config, s *chainlink.Secre
4949
keeper.Registry,
5050
keeper.UpkeepRegistration,
5151
job.Job,
52-
cltest.JobPipelineV2TestHelper,
52+
JobPipelineV2TestHelper,
5353
*txmmocks.MockEvmTxManager,
5454
keystore.Master,
5555
legacyevm.Chain,
@@ -78,7 +78,7 @@ func setup(t *testing.T, overrideFn func(c *chainlink.Config, s *chainlink.Secre
7878
FeatureConfig: cfg.Feature(),
7979
ListenerConfig: cfg.Database().Listener(),
8080
})
81-
jpv2 := cltest.NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), legacyChains, db, keyStore, nil, nil)
81+
jpv2 := NewJobPipelineV2(t, cfg.WebServer(), cfg.JobPipeline(), legacyChains, db, keyStore, nil, nil)
8282
ch := evmtest.MustGetDefaultChain(t, legacyChains)
8383
orm := keeper.NewORM(db, logger.TestLogger(t))
8484
registry, jb := cltest.MustInsertKeeperRegistry(t, db, orm, keyStore.Eth(), 0, 1, 20)

core/services/relay/evm/relayer_extender.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ func NewLegacyChains(
8181
}
8282
return
8383
}
84+
85+
// Deprecated: use the Relayer interface
8486
func NewLegacyChainsAndConfig(
8587
lggr logger.Logger,
8688
ks keystore.Eth,

0 commit comments

Comments
 (0)