Skip to content

feat: add ChipIngress batch emitter support#21327

Open
thomaska wants to merge 8 commits intodevelopfrom
infoplat-3436-chipingress-publishBatch
Open

feat: add ChipIngress batch emitter support#21327
thomaska wants to merge 8 commits intodevelopfrom
infoplat-3436-chipingress-publishBatch

Conversation

@thomaska
Copy link

@thomaska thomaska commented Feb 27, 2026

Ticket: https://smartcontract-it.atlassian.net/browse/INFOPLAT-3436

Summary

  • Add ChipIngressBatchEmitterEnabled telemetry config flag (default false)
    to toggle batch mode per-node without a code change
  • Implement PublishBatch on the chip-testsink gRPC server so CRE system tests
    work when batch mode is enabled
  • Bump chainlink-common to include batch-emitter feature-flag support

Detail

Config flag – new ChipIngressBatchEmitterEnabled boolean in [Telemetry].
Wired through the config interface, TOML types, beholder globals, docs, and
test fixtures.

chip-testsink – the test-helper server only had single-event Publish,
inheriting UNIMPLEMENTED for PublishBatch. Now delegates each batch event to
the configured PublishFunc and forwards the full batch upstream in one RPC.

Why

9 CRE system tests depend on chip-testsink. Without this change they get gRPC
UNIMPLEMENTED errors once batch mode is the default.

Requires

smartcontractkit/chainlink-common#1862

@github-actions
Copy link
Contributor

👋 thomaska, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

✅ No conflicts with other open PRs targeting develop

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds PublishBatch support to the chip-testsink gRPC server so CRE/system tests don’t fail with UNIMPLEMENTED when nodes emit batched ChIP ingress events.

Changes:

  • Implement PublishBatch on the chip-testsink ChipIngressServer.
  • Delegate batch handling to the existing Publish flow (including configured PublishFunc and optional upstream forwarding).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

for _, event := range batch.Events {
if _, err := s.Publish(ctx, event); err != nil {
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling s.Publish() inside the batch loop triggers the per-event async upstream forwarding goroutine in Publish(). For large batches this can create a burst of goroutines and N upstream RPCs. Consider handling upstream forwarding in PublishBatch with a single PublishBatch call (or at least a bounded worker/pool), and calling the configured PublishFunc directly for local handling to avoid unbounded goroutine/RPC fan-out per batch.

Suggested change
if _, err := s.Publish(ctx, event); err != nil {
// Forward upstream synchronously to avoid spawning a goroutine per event.
if s.cfg.UpstreamEndpoint != "" {
forwardCtx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second)
_, err := s.upstream.Publish(forwardCtx, event)
cancelFn()
if err != nil {
log.Printf("failed to forward to upstream: %v", err)
}
}
if _, err := s.cfg.PublishFunc(ctx, event); err != nil {

Copilot uses AI. Check for mistakes.
Comment on lines +124 to +125
// It delegates each event in the batch to the configured PublishFunc,
// mirroring how the real ChIP Ingress processes batches atomically.
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment claims this mirrors how the real ChIP ingress processes batches "atomically", but this implementation is not atomic: it publishes events one-by-one and can return an error after earlier events have already been accepted/forwarded. Please either adjust the comment to reflect best-effort sequential processing, or change the implementation to provide the atomicity guarantees being documented.

Suggested change
// It delegates each event in the batch to the configured PublishFunc,
// mirroring how the real ChIP Ingress processes batches atomically.
// It delegates each event in the batch to the configured PublishFunc
// sequentially, returning an error on the first failure. Earlier events
// in the batch may already have been published or forwarded when an error
// is returned, so processing is best-effort rather than atomic.

Copilot uses AI. Check for mistakes.
@trunk-io
Copy link

trunk-io bot commented Feb 27, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

jmank88
jmank88 previously approved these changes Feb 27, 2026
@pkcll pkcll added the build-publish Build and Publish image to SDLC label Feb 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@thomaska thomaska requested a review from a team as a code owner March 2, 2026 14:02
@cl-sonarqube-production
Copy link

@thomaska thomaska changed the title Amend chip-testsink feat: add ChipIngress batch emitter support Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-publish Build and Publish image to SDLC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants