Skip to content

executor multiplicative latency fix#1229

Open
mchain0 wants to merge 2 commits into
mainfrom
fix-executor-multiplicative-latency
Open

executor multiplicative latency fix#1229
mchain0 wants to merge 2 commits into
mainfrom
fix-executor-multiplicative-latency

Conversation

@mchain0

@mchain0 mchain0 commented Jul 3, 2026

Copy link
Copy Markdown

Executor Multiplicative Latency Fix

tl;dr

Multi-CCV messages that previously waited 15–60s after the first CCV was indexed now retry in ~1–4s once remaining verifier data lands, while post-transmit duplicate-execution protection is unchanged.

Problem description

A message flows: source chain -> Verifier -> Aggregator -> Indexer -> Executor -> destination OffRamp.

The indexer publishes a message record to its messages endpoint as soon as the FIRST verification is discovered (from the aggregator), not when the full CCV set is indexed. The executor's streamer polls that endpoint every 1s (indexerPollingInterval = 1 * time.Second, cmd/executor/service.go) and picks the message up immediately.

For any message needing more than one CCV (essentially every token transfer: committee + CCTP/Lombard), the leader executor attempts it before the second CCV is indexed and hits a "not enough verifier data" or ErrInsufficientVerifiers. It returns shouldRetry=true.

The coordinator then re-schedules using a SINGLE retry delay for ALL retries.

GetRetryDelay = len(pool) * executionInterval from executor/pkg/leaderelector/hash_based_elector.go:167-177, with executionInterval = 15s (devenv) or executionInterval = 60s (default). So a message whose data lands milliseconds later still idles 15-60s per pool member.

This delay is CORRECT for post-transmit retries (staggering executors avoids duplicate on-chain execution/gas), but WRONG for pre-transmit "data not ready" waits where no tx was broadcast.

Solution

Classify each retry as either data-not-ready (pre-transmit) or execution-contended (post-transmit), and apply a short (bounded-exponential) backoff to the former while keeping the staggered delay for the latter.

Shortening only pre-transmit retries cannot cause duplicate execution because (a) each executor's INITIAL attempt is still staggered by GetReadyTimestamp, and (b) before transmitting, HandleMessage calls HasHonestAttempt and skips if another executor already executed. We only speed up an executor that is actively waiting on data and has not broadcast anything.

Changes

Minimal changes made to make it work:

  • added necessary types
  • wrapped post-transmit retry error
  • added field to track attempts
  • coordinator & executor update
  • added necessary configs
  • tests

@mchain0 mchain0 requested a review from a team as a code owner July 3, 2026 07:28
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

👋 mchain0, 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

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Code coverage report:

Package main fix-executor-multiplicative-latency Diff
github.com/smartcontractkit/chainlink-ccv/aggregator 49.54% 49.57% +0.03%
github.com/smartcontractkit/chainlink-ccv/bootstrap 54.49% 54.49% +0.00%
github.com/smartcontractkit/chainlink-ccv/cli 65.13% 65.13% +0.00%
github.com/smartcontractkit/chainlink-ccv/cmd 13.55% 13.55% +0.00%
github.com/smartcontractkit/chainlink-ccv/common 52.79% 52.79% +0.00%
github.com/smartcontractkit/chainlink-ccv/executor 45.28% 46.88% +1.60%
github.com/smartcontractkit/chainlink-ccv/indexer 35.54% 35.59% +0.05%
github.com/smartcontractkit/chainlink-ccv/integration 46.16% 46.16% +0.00%
github.com/smartcontractkit/chainlink-ccv/pkg 100.00% 100.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/pricer 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 63.06% 63.06% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 35.17% 35.18% +0.01%
Total 46.80% 46.80% +0.00%

@mchain0 mchain0 requested review from KodeyThomas and RensR July 3, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants