Skip to content

Expand ocr3 config in add_capabilities changeset#22015

Open
yashnevatia wants to merge 6 commits intodevelopfrom
aptos-cap-cld-debug
Open

Expand ocr3 config in add_capabilities changeset#22015
yashnevatia wants to merge 6 commits intodevelopfrom
aptos-cap-cld-debug

Conversation

@yashnevatia
Copy link
Copy Markdown
Contributor

@yashnevatia yashnevatia commented Apr 14, 2026

This pull request enhances the AddCapabilities changeset logic for the Capabilities Registry v2 by integrating OCR3 configuration expansion.

OCR3 Configuration Support and Expansion:

  • The Apply method in AddCapabilities now retrieves the registry contract, fetches DON nodes, and expands OCR3 capability configurations using the new expandOCR3Configs logic, which incorporates the current OCR3 config count and ensures proper config structure for each DON.
  • Its done the same way in the UpdateDon and ConfigureCapabilityRegistry changesets

@yashnevatia yashnevatia requested review from a team as code owners April 14, 2026 19:40
Copilot AI review requested due to automatic review settings April 14, 2026 19:40
@github-actions
Copy link
Copy Markdown
Contributor

👋 yashnevatia, 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!

@yashnevatia yashnevatia changed the title Aptos cap cld debug Expand ocr3 config in add_capabilities changeset Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

✅ No conflicts with other open PRs targeting develop

Copy link
Copy Markdown
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

Risk Rating: HIGH — changes modify deployment-time config generation for OCR3 and add new on-chain reads; current implementation can produce incorrect OCR3 config counts and can panic if Env.Offchain is missing.

This PR adds OCR3 config expansion to the AddCapabilities changeset so that capability configs containing ocr3Configs with an offchainConfig map are expanded into full OCR3 configs before being written on-chain.

Changes:

  • Expand OCR3 configs (inject signers/transmitters + base64 offchain config) during AddCapabilities.Apply.
  • Add an integration test verifying OCR3 config expansion is present in the DON’s stored capability configuration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
deployment/cre/capabilities_registry/v2/changeset/add_capabilities.go Adds pre-processing to expand OCR3 configs by reading DON nodes and mutating the input configs before executing the add-capabilities sequence.
deployment/cre/capabilities_registry/v2/changeset/add_capabilities_test.go Adds a test that applies AddCapabilities with an OCR3 config map and asserts the stored config is expanded (signers/transmitters present, offchainConfig becomes base64 string).

Comment on lines +95 to +97
if expandErr := expandOCR3Configs(e, config.RegistryChainSel, nodes, ocr3CapConfigs, firstConfigCount); expandErr != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("DON %q: failed to expand OCR3 configs: %w", donName, expandErr)
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

expandOCR3Configs will call into ocr3.ComputeOCR3Config, which calls deployment.NodeInfo(..., env.Offchain) and will panic if e.Offchain is nil when an ocr3Configs[*].offchainConfig map needs expansion. AddCapabilities should fail gracefully instead of panicking (e.g., detect whether any entry requires expansion and return a clear error if e.Offchain/e.OCRSecrets are missing).

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +88
for donName, donCapConfigs := range config.DonCapabilityConfigs {
_, nodes, donErr := sequences.GetDonNodes(donName, capReg)
if donErr != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("DON %q: failed to get nodes: %w", donName, donErr)
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This pre-processing loop fetches DON + node info from the registry (GetDonNodes) for every DON, but the sequences.AddCapabilities sequence also calls GetDonNodes again. This doubles the on-chain read calls and adds latency even when there are no OCR3 configs to expand. Consider either (a) scanning the input configs first and only fetching nodes for DONs that actually need OCR3 expansion, or (b) moving OCR3 expansion into the AddCapabilities sequence after it already has don/nodes available.

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

trunk-io bot commented Apr 14, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestConfigureCCTPMessageTransmitterProxy The test failed without a specific error message indicating what went wrong. Logs ↗︎

View Full Report ↗︎Docs

vyzaldysanchez
vyzaldysanchez previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@vyzaldysanchez vyzaldysanchez left a comment

Choose a reason for hiding this comment

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

lgtm

@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
10.3% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube

@justinkaseman justinkaseman added this pull request to the merge queue Apr 14, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 14, 2026
@justinkaseman justinkaseman added this pull request to the merge queue Apr 15, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 15, 2026
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.

5 participants