Skip to content

workflows/syncer: adaptive, configurable WorkflowRegistry page size - #24231

Open
prashantkumar1982 wants to merge 5 commits into
developfrom
adaptive-workflow-registry-page-size
Open

prashantkumar1982 wants to merge 5 commits into
developfrom
adaptive-workflow-registry-page-size

Conversation

@prashantkumar1982

@prashantkumar1982 prashantkumar1982 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Requires

Summary

  • Page size for paged WorkflowRegistry reads now comes from the cresettings limit WorkflowRegistryMaxResultsPerQuery (default 300, was a hardcoded 1000), re-read on every call.
  • On any gas error (error message contains "gas") the page is halved (floor 10) and the same range is retried, so nothing is skipped or duplicated. The reduction is remembered across ticks and dropped if the configured value changes.
  • Applies to getWorkflowListByDON (ContractWorkflowSource) and getActiveAllowlistedRequestsReverse (allowlist sync). The latter returns fixed-size structs so it has more headroom, but shared the same constant.

Why

On CRE mainline staging Zone-A, getWorkflowListByDON(zone-a, 0, 1000) needs ~17M gas, above the RPC node's eth_call cap of 16,777,216. Every reconciliation tick failed and the whole contract source was skipped.

The syncer paged WorkflowRegistry reads with a hardcoded 1000 items. On
staging Zone-A getWorkflowListByDON at that size needs ~17M gas, over the
RPC node's eth_call cap (16,777,216), so every reconciliation tick failed.

- Page size now comes from the cresettings limit
  WorkflowRegistryMaxResultsPerQuery (default 300), re-read each call.
- On any gas error the page size is halved (floor 10) and the same range
  retried; the reduction is kept across ticks and dropped if the
  configured value changes.
- Applies to getWorkflowListByDON and getActiveAllowlistedRequestsReverse.

Requires the chainlink-common change adding the limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

prashantkumar1982 and others added 4 commits November 18, 2026 10:05
When a registry read still hits the RPC gas cap at the minimum page size,
adaptive paging has run out of options. Log at critical level so it can
be alerted on, for both getWorkflowListByDON and
getActiveAllowlistedRequestsReverse.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Picks up the WorkflowRegistryMaxResultsPerQuery cresettings limit
(chainlink-common#2560) used by the syncer's adaptive page size.
Ran make gomodtidy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolved go.mod/go.sum conflicts by taking develop and re-applying the
chainlink-common bump to d1731bf4579a, then ran make gomodtidy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Fixes prealloc lint findings.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Paginated reads can combine different block states and activate paused workflows, while invalid defaults and misclassified transport errors can disrupt or slow synchronization.

3 open issues
What changed in this PR

Makes WorkflowRegistry pagination configurable and adaptive so workflow and allowlist synchronization can stay within RPC gas limits.

Changes:

  • Replaces the hardcoded 1,000-item page size with a runtime setting defaulting to 300.
  • Halves pages after gas errors, down to 10, and remembers reductions until configuration changes.
  • Adds pagination tests and updates chainlink-common across modules.
File Description
system-tests/​tests/​go.sum Updates dependency checksums.
system-tests/​tests/​go.mod Updates chainlink-common.
system-tests/​lib/​go.sum Updates dependency checksums.
system-tests/​lib/​go.mod Updates chainlink-common.
integration-tests/​load/​go.sum Updates dependency checksums.
integration-tests/​load/​go.mod Updates chainlink-common.
integration-tests/​go.sum Updates dependency checksums.
integration-tests/​go.mod Updates chainlink-common.
go.sum Updates root dependency checksums.
go.mod Adds the dependency revision providing the new setting.
deployment/​go.sum Updates dependency checksums.
deployment/​go.mod Updates chainlink-common.
core/​services/​workflows/​syncer/​v2/​workflow_syncer_v2_test.go Adjusts pagination setup to the configured default.
core/​services/​workflows/​syncer/​v2/​workflow_registry.go Wires settings and adaptive allowlist pagination.
core/​services/​workflows/​syncer/​v2/​page_size.go Adds shared page-size configuration and reduction logic.
core/​services/​workflows/​syncer/​v2/​contract_workflow_source.go Applies adaptive pagination to workflow reads.
core/​services/​workflows/​syncer/​v2/​contract_workflow_source_test.go Tests workflow pagination, configuration, and error handling.
core/​services/​workflows/​syncer/​v2/​allowlist_page_size_test.go Tests allowlist page reduction and minimum-size failures.
core/​scripts/​go.sum Updates dependency checksums.
core/​scripts/​go.mod Updates chainlink-common.

Review effort: Balanced

Comment on lines +93 to +94
pageSize := c.pageSizer.current(ctx, c.lggr)
params.Limit = big.NewInt(pageSize)
lggr.Warnw("Failed to read WorkflowRegistryMaxResultsPerQuery, using default", "err", err)
}
if v < 1 {
v = setting.DefaultValue
next := max(failed/2, minRegistryPageSize)
p.mu.Lock()
defer p.mu.Unlock()
p.reduced = next

This branch has not been deployed

No deployments
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