Skip to content

Commit 28db39a

Browse files
committed
Remove wsrpc
1 parent 1d31103 commit 28db39a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+29
-3153
lines changed

.changeset/moody-swans-worry.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
---
44

55
Remove support for mercury #removed
6+
7+
Remove support for wsrpc protocol for LLO
8+
9+
Remove `Mercury.Cache` configuration options

core/cmd/shell.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ import (
4949
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
5050
"github.com/smartcontractkit/chainlink/v2/core/services/llo"
5151
"github.com/smartcontractkit/chainlink/v2/core/services/periodicbackup"
52-
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
53-
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc/cache"
5452
"github.com/smartcontractkit/chainlink/v2/core/services/versioning"
5553
"github.com/smartcontractkit/chainlink/v2/core/services/webhook"
5654
"github.com/smartcontractkit/chainlink/v2/core/services/workflows"
@@ -231,12 +229,6 @@ func (n ChainlinkAppFactory) NewApplication(ctx context.Context, cfg chainlink.G
231229

232230
loopRegistry := plugins.NewLoopRegistry(appLggr, cfg.Database(), cfg.Tracing(), cfg.Telemetry(), beholderAuthHeaders, csaPubKeyHex)
233231

234-
mercuryPool := wsrpc.NewPool(appLggr, cache.Config{
235-
LatestReportTTL: cfg.Mercury().Cache().LatestReportTTL(),
236-
MaxStaleAge: cfg.Mercury().Cache().MaxStaleAge(),
237-
LatestReportDeadline: cfg.Mercury().Cache().LatestReportDeadline(),
238-
})
239-
240232
capabilitiesRegistry := capabilities.NewRegistry(appLggr)
241233

242234
retirementReportCache := llo.NewRetirementReportCache(appLggr, ds)
@@ -249,7 +241,6 @@ func (n ChainlinkAppFactory) NewApplication(ctx context.Context, cfg chainlink.G
249241
Registerer: appRegisterer,
250242
LoopRegistry: loopRegistry,
251243
GRPCOpts: grpcOpts,
252-
MercuryPool: mercuryPool,
253244
CapabilitiesRegistry: capabilitiesRegistry,
254245
HTTPClient: unrestrictedClient,
255246
RetirementReportCache: retirementReportCache,
@@ -325,7 +316,6 @@ func (n ChainlinkAppFactory) NewApplication(ctx context.Context, cfg chainlink.G
325316
SecretGenerator: chainlink.FilePersistedSecretGenerator{},
326317
LoopRegistry: loopRegistry,
327318
GRPCOpts: grpcOpts,
328-
MercuryPool: mercuryPool,
329319
RetirementReportCache: retirementReportCache,
330320
LLOTransmissionReaper: lloReaper,
331321
})

core/config/docs/core.toml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -683,27 +683,6 @@ env = 'test' # Example
683683
# by default.
684684
VerboseLogging = false # Default
685685

686-
# Mercury.Cache controls settings for the price retrieval cache querying a mercury server
687-
[Mercury.Cache]
688-
# LatestReportTTL controls how "stale" we will allow a price to be e.g. if
689-
# set to 1s, a new price will always be fetched if the last result was
690-
# from 1 second ago or older.
691-
#
692-
# Another way of looking at it is such: the cache will _never_ return a
693-
# price that was queried from now-LatestReportTTL or before.
694-
#
695-
# Setting to zero disables caching entirely.
696-
LatestReportTTL = "1s" # Default
697-
# MaxStaleAge is that maximum amount of time that a value can be stale
698-
# before it is deleted from the cache (a form of garbage collection).
699-
#
700-
# This should generally be set to something much larger than
701-
# LatestReportTTL. Setting to zero disables garbage collection.
702-
MaxStaleAge = "1h" # Default
703-
# LatestReportDeadline controls how long to wait for a response from the
704-
# mercury server before retrying. Setting this to zero will wait indefinitely.
705-
LatestReportDeadline = "5s" # Default
706-
707686
# Mercury.TLS controls client settings for when the node talks to traditional web servers or load balancers.
708687
[Mercury.TLS]
709688
# CertFile is the path to a PEM file of trusted root certificate authority certificates
@@ -713,8 +692,7 @@ CertFile = "/path/to/client/certs.pem" # Example
713692
[Mercury.Transmitter]
714693
# Protocol is the protocol to use for the transmitter.
715694
#
716-
# Options are either:
717-
# - "wsrpc" for the legacy websocket protocol
695+
# Options are currently:
718696
# - "grpc" for the gRPC protocol
719697
Protocol = "grpc" # Default
720698
# TransmitQueueMaxSize controls the size of the transmit queue. This is scoped

core/config/mercury_config.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,19 @@ package config
22

33
import (
44
"fmt"
5-
"time"
65

76
commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
87
"github.com/smartcontractkit/chainlink-common/pkg/types"
98
)
109

11-
type MercuryCache interface {
12-
LatestReportTTL() time.Duration
13-
MaxStaleAge() time.Duration
14-
LatestReportDeadline() time.Duration
15-
}
16-
1710
type MercuryTLS interface {
1811
CertFile() string
1912
}
2013

2114
type MercuryTransmitterProtocol string
2215

2316
const (
24-
MercuryTransmitterProtocolWSRPC MercuryTransmitterProtocol = "wsrpc"
25-
MercuryTransmitterProtocolGRPC MercuryTransmitterProtocol = "grpc"
17+
MercuryTransmitterProtocolGRPC MercuryTransmitterProtocol = "grpc"
2618
)
2719

2820
func (m MercuryTransmitterProtocol) String() string {
@@ -31,8 +23,6 @@ func (m MercuryTransmitterProtocol) String() string {
3123

3224
func (m *MercuryTransmitterProtocol) UnmarshalText(text []byte) error {
3325
switch string(text) {
34-
case "wsrpc":
35-
*m = MercuryTransmitterProtocolWSRPC
3626
case "grpc":
3727
*m = MercuryTransmitterProtocolGRPC
3828
default:
@@ -52,7 +42,6 @@ type MercuryTransmitter interface {
5242

5343
type Mercury interface {
5444
Credentials(credName string) *types.MercuryCredentials
55-
Cache() MercuryCache
5645
TLS() MercuryTLS
5746
Transmitter() MercuryTransmitter
5847
VerboseLogging() bool

core/config/toml/types.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,24 +1422,6 @@ func (ins *Insecure) setFrom(f *Insecure) {
14221422
}
14231423
}
14241424

1425-
type MercuryCache struct {
1426-
LatestReportTTL *commonconfig.Duration
1427-
MaxStaleAge *commonconfig.Duration
1428-
LatestReportDeadline *commonconfig.Duration
1429-
}
1430-
1431-
func (mc *MercuryCache) setFrom(f *MercuryCache) {
1432-
if v := f.LatestReportTTL; v != nil {
1433-
mc.LatestReportTTL = v
1434-
}
1435-
if v := f.MaxStaleAge; v != nil {
1436-
mc.MaxStaleAge = v
1437-
}
1438-
if v := f.LatestReportDeadline; v != nil {
1439-
mc.LatestReportDeadline = v
1440-
}
1441-
}
1442-
14431425
type MercuryTLS struct {
14441426
CertFile *string
14451427
}
@@ -1490,14 +1472,12 @@ func (m *MercuryTransmitter) setFrom(f *MercuryTransmitter) {
14901472
}
14911473

14921474
type Mercury struct {
1493-
Cache MercuryCache `toml:",omitempty"`
14941475
TLS MercuryTLS `toml:",omitempty"`
14951476
Transmitter MercuryTransmitter `toml:",omitempty"`
14961477
VerboseLogging *bool `toml:",omitempty"`
14971478
}
14981479

14991480
func (m *Mercury) setFrom(f *Mercury) {
1500-
m.Cache.setFrom(&f.Cache)
15011481
m.TLS.setFrom(&f.TLS)
15021482
m.Transmitter.setFrom(&f.Transmitter)
15031483
if v := f.VerboseLogging; v != nil {

core/internal/cltest/cltest.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ import (
8686
p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types"
8787
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
8888
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
89-
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
90-
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc/cache"
9189
"github.com/smartcontractkit/chainlink/v2/core/services/standardcapabilities"
9290
"github.com/smartcontractkit/chainlink/v2/core/services/webhook"
9391
clsessions "github.com/smartcontractkit/chainlink/v2/core/sessions"
@@ -415,20 +413,13 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn
415413
mailMon := mailbox.NewMonitor(cfg.AppID().String(), lggr.Named("Mailbox"))
416414
loopRegistry := plugins.NewLoopRegistry(lggr, cfg.Database(), cfg.Tracing(), cfg.Telemetry(), nil, "")
417415

418-
mercuryPool := wsrpc.NewPool(lggr, cache.Config{
419-
LatestReportTTL: cfg.Mercury().Cache().LatestReportTTL(),
420-
MaxStaleAge: cfg.Mercury().Cache().MaxStaleAge(),
421-
LatestReportDeadline: cfg.Mercury().Cache().LatestReportDeadline(),
422-
})
423-
424416
c := clhttptest.NewTestLocalOnlyHTTPClient()
425417
retirementReportCache := llo.NewRetirementReportCache(lggr, ds)
426418
relayerFactory := chainlink.RelayerFactory{
427419
Logger: lggr,
428420
LoopRegistry: loopRegistry,
429421
GRPCOpts: loop.GRPCOpts{},
430422
Registerer: prometheus.NewRegistry(), // Don't use global registry here since otherwise multiple apps can create name conflicts. Could also potentially give a mock registry to test prometheus.
431-
MercuryPool: mercuryPool,
432423
CapabilitiesRegistry: capabilitiesRegistry,
433424
HTTPClient: c,
434425
RetirementReportCache: retirementReportCache,
@@ -510,7 +501,9 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn
510501
UnrestrictedHTTPClient: c,
511502
SecretGenerator: MockSecretGenerator{},
512503
LoopRegistry: plugins.NewTestLoopRegistry(lggr),
513-
MercuryPool: mercuryPool,
504+
CapabilitiesRegistry: capabilitiesRegistry,
505+
CapabilitiesDispatcher: dispatcher,
506+
CapabilitiesPeerWrapper: peerWrapper,
514507
NewOracleFactoryFn: newOracleFactoryFn,
515508
RetirementReportCache: retirementReportCache,
516509
LLOTransmissionReaper: llo.NewTransmissionReaper(ds, lggr, cfg.Mercury().Transmitter().ReaperFrequency().Duration(), cfg.Mercury().Transmitter().ReaperMaxAge().Duration()),

core/services/chainlink/application.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import (
6767
"github.com/smartcontractkit/chainlink/v2/core/services/periodicbackup"
6868
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
6969
"github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer"
70-
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
7170
"github.com/smartcontractkit/chainlink/v2/core/services/standardcapabilities"
7271
"github.com/smartcontractkit/chainlink/v2/core/services/streams"
7372
"github.com/smartcontractkit/chainlink/v2/core/services/telemetry"
@@ -194,7 +193,6 @@ type ApplicationOpts struct {
194193
SecretGenerator SecretGenerator
195194
LoopRegistry *plugins.LoopRegistry
196195
GRPCOpts loop.GRPCOpts
197-
MercuryPool wsrpc.Pool
198196
RetirementReportCache llo.RetirementReportCache
199197
LLOTransmissionReaper services.ServiceCtx
200198
NewOracleFactoryFn standardcapabilities.NewOracleFactoryFn
@@ -348,10 +346,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
348346
globalLogger.Info("DatabaseBackup: periodic database backups are disabled. To enable automatic backups, set Database.Backup.Mode=lite or Database.Backup.Mode=full")
349347
}
350348

351-
// pool must be started before all relayers and stopped after them
352-
if opts.MercuryPool != nil {
353-
srvcs = append(srvcs, opts.MercuryPool)
354-
}
349+
// LLO-related services
355350
if opts.RetirementReportCache != nil {
356351
srvcs = append(srvcs, opts.RetirementReportCache)
357352
}

core/services/chainlink/config_mercury.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,13 @@
11
package chainlink
22

33
import (
4-
"time"
5-
64
commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
75
"github.com/smartcontractkit/chainlink-common/pkg/types"
86

97
"github.com/smartcontractkit/chainlink/v2/core/config"
108
"github.com/smartcontractkit/chainlink/v2/core/config/toml"
119
)
1210

13-
var _ config.MercuryCache = (*mercuryCacheConfig)(nil)
14-
15-
type mercuryCacheConfig struct {
16-
c toml.MercuryCache
17-
}
18-
19-
func (m *mercuryCacheConfig) LatestReportTTL() time.Duration {
20-
return m.c.LatestReportTTL.Duration()
21-
}
22-
func (m *mercuryCacheConfig) MaxStaleAge() time.Duration {
23-
return m.c.MaxStaleAge.Duration()
24-
}
25-
func (m *mercuryCacheConfig) LatestReportDeadline() time.Duration {
26-
return m.c.LatestReportDeadline.Duration()
27-
}
28-
2911
var _ config.MercuryTLS = (*mercuryTLSConfig)(nil)
3012

3113
type mercuryTLSConfig struct {
@@ -86,10 +68,6 @@ func (m *mercuryConfig) Credentials(credName string) *types.MercuryCredentials {
8668
return nil
8769
}
8870

89-
func (m *mercuryConfig) Cache() config.MercuryCache {
90-
return &mercuryCacheConfig{c: m.c.Cache}
91-
}
92-
9371
func (m *mercuryConfig) TLS() config.MercuryTLS {
9472
return &mercuryTLSConfig{c: m.c.TLS}
9573
}

core/services/chainlink/config_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,6 @@ func TestConfig_Marshal(t *testing.T) {
789789
},
790790
}
791791
full.Mercury = toml.Mercury{
792-
Cache: toml.MercuryCache{
793-
LatestReportTTL: commoncfg.MustNewDuration(100 * time.Second),
794-
MaxStaleAge: commoncfg.MustNewDuration(101 * time.Second),
795-
LatestReportDeadline: commoncfg.MustNewDuration(102 * time.Second),
796-
},
797792
TLS: toml.MercuryTLS{
798793
CertFile: ptr("/path/to/cert.pem"),
799794
},
@@ -1268,11 +1263,6 @@ SendOnly = true
12681263
{"Mercury", Config{Core: toml.Core{Mercury: full.Mercury}}, `[Mercury]
12691264
VerboseLogging = true
12701265
1271-
[Mercury.Cache]
1272-
LatestReportTTL = '1m40s'
1273-
MaxStaleAge = '1m41s'
1274-
LatestReportDeadline = '1m42s'
1275-
12761266
[Mercury.TLS]
12771267
CertFile = '/path/to/cert.pem'
12781268

core/services/chainlink/relayer_factory.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/smartcontractkit/chainlink/v2/core/services/relay"
2626
"github.com/smartcontractkit/chainlink/v2/core/services/relay/dummy"
2727
evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
28-
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
2928
"github.com/smartcontractkit/chainlink/v2/plugins"
3029
)
3130

@@ -34,7 +33,6 @@ type RelayerFactory struct {
3433
*plugins.LoopRegistry
3534
loop.GRPCOpts
3635
Registerer prometheus.Registerer
37-
MercuryPool wsrpc.Pool
3836
CapabilitiesRegistry coretypes.CapabilitiesRegistry
3937
HTTPClient *http.Client
4038
RetirementReportCache llo.RetirementReportCache
@@ -80,7 +78,6 @@ func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (m
8078
DS: ccOpts.DS,
8179
Registerer: r.Registerer,
8280
CSAETHKeystore: config.CSAETHKeystore,
83-
MercuryPool: r.MercuryPool,
8481
MercuryConfig: config.MercuryConfig,
8582
CapabilitiesRegistry: r.CapabilitiesRegistry,
8683
HTTPClient: r.HTTPClient,

0 commit comments

Comments
 (0)