Skip to content

Commit d2068cf

Browse files
committed
linting fixes
1 parent 228fe8f commit d2068cf

File tree

7 files changed

+43
-20
lines changed

7 files changed

+43
-20
lines changed

.github/workflows/golangci_lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
args: --config=${{ github.workspace }}/.golangci.yml
4040
only-new-issues: true
41-
version: v1.62.2
41+
version: v1.64.2
4242
working-directory: ${{ matrix.module }}
4343

4444
# Per https://github.com/orgs/community/discussions/4324, we need to capture a matrix-job result

capabilities/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/smartcontractkit/chainlink-framework/capabilities
33
go 1.24.0
44

55
require (
6-
github.com/smartcontractkit/chainlink-common v0.6.1-0.20250402175937-0977083b40c8
6+
github.com/smartcontractkit/chainlink-common v0.6.1-0.20250403193957-16ffa613b9da
77
github.com/stretchr/testify v1.10.0
88
go.opentelemetry.io/otel v1.30.0
99
go.opentelemetry.io/otel/trace v1.30.0

capabilities/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.2.0 h1:WCcC4vZDS1tYNxjWlwRJZQy28r8CM
8383
github.com/santhosh-tekuri/jsonschema/v5 v5.2.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0=
8484
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
8585
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
86-
github.com/smartcontractkit/chainlink-common v0.6.1-0.20250402175937-0977083b40c8 h1:XeYSkeCUo8wD0QlE9E1vajcGljSVGJKek2pvKkjlBnw=
87-
github.com/smartcontractkit/chainlink-common v0.6.1-0.20250402175937-0977083b40c8/go.mod h1:iLcYzfd2ijOSJtUgnH1fY6oCR4ao5inskIpEgdtrSbg=
86+
github.com/smartcontractkit/chainlink-common v0.6.1-0.20250403193957-16ffa613b9da h1:h+H275JG69+OYLEjIpqJB3Q3MfB1Hq9Mqv9jlBFTgs4=
87+
github.com/smartcontractkit/chainlink-common v0.6.1-0.20250403193957-16ffa613b9da/go.mod h1:WLiAjc+Q5VazhqSSxCgbN/S8eUHhinNFK+B3hHz5yJI=
8888
github.com/smartcontractkit/libocr v0.0.0-20250220133800-f3b940c4f298 h1:PKiqnVOTChlH4a4ljJKL3OKGRgYfIpJS4YD1daAIKks=
8989
github.com/smartcontractkit/libocr v0.0.0-20250220133800-f3b940c4f298/go.mod h1:Mb7+/LC4edz7HyHxX4QkE42pSuov4AV68+AxBXAap0o=
9090
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package write_target
1+
package writetarget
22

33
import (
44
"time"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
package write_target
1+
//nolint:gosec // disable G115
2+
package writetarget
23

34
import (
45
"encoding/hex"
Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// NOTE: file is based on the generic write target capability, but we're slightly modifying it until the two implementations can be merged
2-
// in particular, we need to invert the calling flow for Aptos so receiver is the entrypoint
3-
package write_target
1+
//nolint:gosec,revive // disable G115,revive
2+
package writetarget
43

54
import (
65
"context"
@@ -227,12 +226,19 @@ func (c *writeTarget) Execute(ctx context.Context, request capabilities.Capabili
227226
// Source the report ID from the input
228227
info.reportInfo.reportID = binary.BigEndian.Uint16(inputs.ID)
229228

230-
c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteInitiated(info))
229+
// TODO: Not sure if I should be returning the error here or just logging it as I am now.
230+
err = c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteInitiated(info))
231+
if err != nil {
232+
c.lggr.Errorw("failed to emit write initiated", "err", err)
233+
}
231234

232235
// Check whether the report is valid (e.g., not empty)
233236
if len(inputs.Report) == 0 {
234237
// We received any empty report -- this means we should skip transmission.
235-
c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteSkipped(info, "empty report"))
238+
err = c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteSkipped(info, "empty report"))
239+
if err != nil {
240+
c.lggr.Errorw("failed to emit write skipped", "err", err)
241+
}
236242
return success(), nil
237243
}
238244

@@ -290,7 +296,10 @@ func (c *writeTarget) Execute(ctx context.Context, request capabilities.Capabili
290296
// Source the transmitter address from the on-chain state
291297
info.reportTransmissionState = state
292298

293-
c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteConfirmed(info, head))
299+
err = c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteConfirmed(info, head))
300+
if err != nil {
301+
c.lggr.Errorw("failed to emit write confirmed", "err", err)
302+
}
294303
return success(), nil
295304
}
296305

@@ -304,11 +313,15 @@ func (c *writeTarget) Execute(ctx context.Context, request capabilities.Capabili
304313

305314
txID, err := c.targetStrategy.TransmitReport(ctx, info.receiver, inputs.Report, inputs.Context, inputs.Signatures, request.Metadata.WorkflowExecutionID)
306315
c.lggr.Debugw("Transaction submitted", "request", request, "transaction-id", txID)
307-
c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteSent(info, head, txID))
308316
if err != nil {
309317
msg := builder.buildWriteError(info, 0, "failed to transmit the report", err.Error())
310318
return capabilities.CapabilityResponse{}, c.asEmittedError(ctx, msg)
311319
}
320+
err = c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteSent(info, head, txID))
321+
if err != nil {
322+
c.lggr.Errorw("failed to emit write sent", "err", err)
323+
}
324+
312325
// TODO: implement a background WriteTxConfirmer to periodically source new events/transactions,
313326
// relevant to this forwarder), and emit write-tx-accepted/confirmed events.
314327

@@ -382,7 +395,10 @@ func (c *writeTarget) acceptAndConfirmWrite(ctx context.Context, info requestInf
382395
select {
383396
case <-ctx.Done():
384397
// We (eventually) failed to confirm the report was transmitted
385-
c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteError(&info, 0, "write confirmation - failed", "timed out"))
398+
err := c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteError(&info, 0, "write confirmation - failed", "timed out"))
399+
if err != nil {
400+
lggr.Errorw("failed to emit write error", "err", err)
401+
}
386402
return
387403
case <-ticker.C:
388404
// Fetch the latest head from the chain (timestamp)
@@ -394,9 +410,9 @@ func (c *writeTarget) acceptAndConfirmWrite(ctx context.Context, info requestInf
394410

395411
if !accepted {
396412
// Check acceptance status
397-
status, accepted, err := checkAcceptedStatus(ctx)
398-
if err != nil {
399-
lggr.Errorw("failed to check accepted status", "txID", txID, "err", err)
413+
status, accepted, statusErr := checkAcceptedStatus(ctx)
414+
if statusErr != nil {
415+
lggr.Errorw("failed to check accepted status", "txID", txID, "err", statusErr)
400416
continue
401417
}
402418

@@ -413,7 +429,10 @@ func (c *writeTarget) acceptAndConfirmWrite(ctx context.Context, info requestInf
413429
// Notice: this functionality is not available in the current CW/TXM API
414430
acceptedWithErr := false
415431
if acceptedWithErr {
416-
// TODO: [Beholder] Emit 'platform.write-target.WriteError' if accepted with an error (surface specific on-chain error)
432+
err = c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteError(&info, 0, "write error", "accepted with error"))
433+
if err != nil {
434+
lggr.Errorw("failed to emit write error", "err", err)
435+
}
417436
// Notice: no return, we continue to check for confirmation (tx could be accepted by another node)
418437
}
419438
}
@@ -437,7 +456,10 @@ func (c *writeTarget) acceptAndConfirmWrite(ctx context.Context, info requestInf
437456
// Source the transmitter address from the on-chain state
438457
info.reportTransmissionState = state
439458

440-
c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteConfirmed(&info, head))
459+
err = c.beholder.ProtoEmitter.EmitWithLog(ctx, builder.buildWriteConfirmed(&info, head))
460+
if err != nil {
461+
lggr.Errorw("failed to emit write confirmed", "err", err)
462+
}
441463
return
442464
}
443465
}

capabilities/write_target/write_target_test.go renamed to capabilities/writetarget/write_target_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package write_target
1+
package writetarget
22

33
import (
44
"testing"

0 commit comments

Comments
 (0)