Skip to content

Commit 3d3da9b

Browse files
authored
Merge branch 'release/2.19.0-aptos' into aptos-init
2 parents fb21d3e + ab4887c commit 3d3da9b

25 files changed

Lines changed: 517 additions & 151 deletions

File tree

.changeset/big-camels-report.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#bugfix fix missing unregister in mercury job loop

core/capabilities/launcher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ func (w *launcher) addToRegistryAndSetDispatcher(ctx context.Context, capability
387387
}
388388

389389
var (
390-
defaultTargetRequestTimeout = time.Minute
390+
// TODO: make this configurable
391+
defaultTargetRequestTimeout = 8 * time.Minute
391392
)
392393

393394
func (w *launcher) exposeCapabilities(ctx context.Context, myPeerID p2ptypes.PeerID, don registrysyncer.DON, state *registrysyncer.LocalRegistry, remoteWorkflowDONs []registrysyncer.DON) error {

core/capabilities/remote/executable/client.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ var _ commoncap.ExecutableCapability = &client{}
4141
var _ types.Receiver = &client{}
4242
var _ services.Service = &client{}
4343

44+
const expiryCheckInterval = 30 * time.Second
45+
4446
func NewClient(remoteCapabilityInfo commoncap.CapabilityInfo, localDonInfo commoncap.DON, dispatcher types.Dispatcher,
4547
requestTimeout time.Duration, lggr logger.Logger) *client {
4648
return &client{
@@ -98,7 +100,11 @@ func (c *client) checkDispatcherReady() {
98100
}
99101

100102
func (c *client) checkForExpiredRequests() {
101-
ticker := time.NewTicker(c.requestTimeout)
103+
tickerInterval := expiryCheckInterval
104+
if c.requestTimeout < tickerInterval {
105+
tickerInterval = c.requestTimeout
106+
}
107+
ticker := time.NewTicker(tickerInterval)
102108
defer ticker.Stop()
103109
for {
104110
select {
@@ -116,7 +122,7 @@ func (c *client) expireRequests() {
116122

117123
for messageID, req := range c.requestIDToCallerRequest {
118124
if req.Expired() {
119-
req.Cancel(errors.New("request expired"))
125+
req.Cancel(errors.New("request expired by executable client"))
120126
delete(c.requestIDToCallerRequest, messageID)
121127
}
122128

core/capabilities/remote/executable/endtoend_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func Test_RemoteExecutionCapability_CapabilityError(t *testing.T) {
132132

133133
methods = append(methods, func(ctx context.Context, caller commoncap.ExecutableCapability) {
134134
executeCapability(ctx, t, caller, transmissionSchedule, func(t *testing.T, responseCh commoncap.CapabilityResponse, responseError error) {
135-
assert.Equal(t, "error executing request: failed to execute capability: an error", responseError.Error())
135+
assert.Equal(t, "error executing request: failed to execute capability", responseError.Error())
136136
})
137137
})
138138

@@ -156,12 +156,12 @@ func Test_RemoteExecutableCapability_RandomCapabilityError(t *testing.T) {
156156

157157
methods = append(methods, func(ctx context.Context, caller commoncap.ExecutableCapability) {
158158
executeCapability(ctx, t, caller, transmissionSchedule, func(t *testing.T, responseCh commoncap.CapabilityResponse, responseError error) {
159-
assert.Equal(t, "error executing request: request expired", responseError.Error())
159+
assert.Equal(t, "error executing request: failed to execute capability", responseError.Error())
160160
})
161161
})
162162

163163
for _, method := range methods {
164-
testRemoteExecutableCapability(ctx, t, capability, 10, 9, 10*time.Millisecond, 10, 9, 10*time.Minute,
164+
testRemoteExecutableCapability(ctx, t, capability, 10, 9, 1*time.Second, 10, 9, 10*time.Minute,
165165
method)
166166
}
167167
}

core/capabilities/remote/executable/request/server_request.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package request
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"sync"
78
"time"
@@ -48,6 +49,8 @@ type ServerRequest struct {
4849
lggr logger.Logger
4950
}
5051

52+
var errExternalErrorMsg = errors.New("failed to execute capability")
53+
5154
func NewServerRequest(capability capabilities.ExecutableCapability, method string, capabilityID string, capabilityDonID uint32,
5255
capabilityPeerID p2ptypes.PeerID,
5356
callingDon commoncap.DON, requestID string,
@@ -228,20 +231,22 @@ func executeCapabilityRequest(ctx context.Context, lggr logger.Logger, capabilit
228231
payload []byte) ([]byte, error) {
229232
capabilityRequest, err := pb.UnmarshalCapabilityRequest(payload)
230233
if err != nil {
231-
return nil, fmt.Errorf("failed to unmarshal capability request: %w", err)
234+
lggr.Errorw("failed to unmarshal capability request", "err", err)
235+
return nil, errExternalErrorMsg
232236
}
233237

234238
lggr.Debugw("executing capability", "metadata", capabilityRequest.Metadata)
235239
capResponse, err := capability.Execute(ctx, capabilityRequest)
236240

237241
if err != nil {
238-
lggr.Debugw("received execution error", "workflowExecutionID", capabilityRequest.Metadata.WorkflowExecutionID, "error", err)
239-
return nil, fmt.Errorf("failed to execute capability: %w", err)
242+
lggr.Errorw("received execution error", "workflowExecutionID", capabilityRequest.Metadata.WorkflowExecutionID, "error", err)
243+
return nil, errExternalErrorMsg
240244
}
241245

242246
responsePayload, err := pb.MarshalCapabilityResponse(capResponse)
243247
if err != nil {
244-
return nil, fmt.Errorf("failed to marshal capability response: %w", err)
248+
lggr.Errorw("failed to marshal capability request", "err", err)
249+
return nil, errExternalErrorMsg
245250
}
246251

247252
lggr.Debugw("received execution results", "workflowExecutionID", capabilityRequest.Metadata.WorkflowExecutionID)

core/capabilities/remote/executable/request/server_request_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ func Test_ServerRequest_MessageValidation(t *testing.T) {
136136
require.NoError(t, err)
137137
assert.Len(t, dispatcher.msgs, 2)
138138
assert.Equal(t, types.Error_INTERNAL_ERROR, dispatcher.msgs[0].Error)
139-
assert.Equal(t, "failed to execute capability: an error", dispatcher.msgs[0].ErrorMsg)
139+
assert.Equal(t, "failed to execute capability", dispatcher.msgs[0].ErrorMsg)
140140
assert.Equal(t, types.Error_INTERNAL_ERROR, dispatcher.msgs[1].Error)
141-
assert.Equal(t, "failed to execute capability: an error", dispatcher.msgs[1].ErrorMsg)
141+
assert.Equal(t, "failed to execute capability", dispatcher.msgs[1].ErrorMsg)
142142
})
143143

144144
t.Run("Execute capability", func(t *testing.T) {

core/capabilities/remote/executable/server.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ func (r *server) Start(ctx context.Context) error {
8787
r.wg.Add(1)
8888
go func() {
8989
defer r.wg.Done()
90-
ticker := time.NewTicker(r.requestTimeout)
90+
tickerInterval := expiryCheckInterval
91+
if r.requestTimeout < tickerInterval {
92+
tickerInterval = r.requestTimeout
93+
}
94+
ticker := time.NewTicker(tickerInterval)
9195
defer ticker.Stop()
9296
r.lggr.Info("executable capability server started")
9397
for {
@@ -118,7 +122,7 @@ func (r *server) expireRequests() {
118122

119123
for requestID, executeReq := range r.requestIDToRequest {
120124
if executeReq.request.Expired() {
121-
err := executeReq.request.Cancel(types.Error_TIMEOUT, "request expired")
125+
err := executeReq.request.Cancel(types.Error_TIMEOUT, "request expired by executable server")
122126
if err != nil {
123127
r.lggr.Errorw("failed to cancel request", "request", executeReq, "err", err)
124128
}

core/cmd/shell.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import (
5151
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc/cache"
5252
"github.com/smartcontractkit/chainlink/v2/core/services/versioning"
5353
"github.com/smartcontractkit/chainlink/v2/core/services/webhook"
54+
"github.com/smartcontractkit/chainlink/v2/core/services/workflows"
5455
"github.com/smartcontractkit/chainlink/v2/core/sessions"
5556
"github.com/smartcontractkit/chainlink/v2/core/static"
5657
"github.com/smartcontractkit/chainlink/v2/core/store/migrate"
@@ -109,6 +110,10 @@ func initGlobals(cfgProm config.Prometheus, cfgTracing config.Tracing, cfgTeleme
109110
AuthPublicKeyHex: csaPubKeyHex,
110111
AuthHeaders: beholderAuthHeaders,
111112
}
113+
// note: due to the OTEL specification, all histogram buckets
114+
// must be defined when the beholder client is created
115+
clientCfg.MetricViews = append(clientCfg.MetricViews, workflows.MetricViews()...)
116+
112117
if tracingCfg.Enabled {
113118
clientCfg.TraceSpanExporter, err = tracingCfg.NewSpanExporter()
114119
if err != nil {

core/scripts/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/prometheus/client_golang v1.20.5
2525
github.com/shopspring/decimal v1.4.0
2626
github.com/smartcontractkit/chainlink-automation v0.8.1
27-
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241114134822-aadff98ef068
27+
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241210195010-36d99fa35f9f
2828
github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000
2929
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a
3030
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
@@ -421,7 +421,7 @@ require (
421421
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
422422
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect
423423
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de // indirect
424-
github.com/smartcontractkit/wsrpc v0.8.2 // indirect
424+
github.com/smartcontractkit/wsrpc v0.8.3 // indirect
425425
github.com/soheilhy/cmux v0.1.5 // indirect
426426
github.com/sony/gobreaker v0.5.0 // indirect
427427
github.com/sourcegraph/conc v0.3.0 // indirect

core/scripts/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
14091409
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
14101410
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec h1:5vS1k8Qn09p8SQ3JzvS8iy4Pve7s3aVq+UPIdl74smY=
14111411
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
1412-
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241114134822-aadff98ef068 h1:2llRW4Tn9W/EZp2XvXclQ9IjeTBwwxVPrrqaerX+vCE=
1413-
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241114134822-aadff98ef068/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
1412+
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241210195010-36d99fa35f9f h1:RZ90dXrz+nQsM5+7Rz/+ZvUs9WgZj1ZqGuRxtsMwgV8=
1413+
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241210195010-36d99fa35f9f/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
14141414
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
14151415
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
14161416
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
@@ -1441,8 +1441,8 @@ github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-
14411441
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o=
14421442
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc=
14431443
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:NSc7hgOQbXG3DAwkOdWnZzLTZENXSwDJ7Va1nBp0YU0=
1444-
github.com/smartcontractkit/wsrpc v0.8.2 h1:XB/xcn/MMseHW+8JE8+a/rceA86ck7Ur6cEa9LiUC8M=
1445-
github.com/smartcontractkit/wsrpc v0.8.2/go.mod h1:2u/wfnhl5R4RlSXseN4n6HHIWk8w1Am3AT6gWftQbNg=
1444+
github.com/smartcontractkit/wsrpc v0.8.3 h1:9tDf7Ut61g36RJIyxV9iI73SqoOMasKPfURV9oMLrPg=
1445+
github.com/smartcontractkit/wsrpc v0.8.3/go.mod h1:2u/wfnhl5R4RlSXseN4n6HHIWk8w1Am3AT6gWftQbNg=
14461446
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
14471447
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
14481448
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=

0 commit comments

Comments
 (0)