Skip to content

chore: split root and ops gen contract package#966

Merged
RayXpub merged 9 commits intomainfrom
chore/duplicate-deploy-package-for-ops-gen
May 6, 2026
Merged

chore: split root and ops gen contract package#966
RayXpub merged 9 commits intomainfrom
chore/duplicate-deploy-package-for-ops-gen

Conversation

@RayXpub
Copy link
Copy Markdown
Contributor

@RayXpub RayXpub commented May 5, 2026

Summary

  • Restores chain/evm/operations/contract package to pre ops-gen rework state (2194dcd): this is meant to be temporary to avoid break changes while downstream user migrate to the new tool (e.g. https://github.com/smartcontractkit/chainlink-ccip/blob/96113614447dbaebf9a08f98811caf7f5fcb7120/chains/evm/deployment/v2_0_0/operations/committee_verifier/committee_verifier.go). The updated package has been moved into a separate operations2 package.
  • Fixed read operation code generation for Solidity functions with multiple named return values. Previously, the generator always created a local multi-return struct, even when abigen already generates a named struct in the Go bindings. This caused duplicate type definitions and compilation errors. New behavior is:
    • When all return parameters are named, the generated code now references the existing gobindings. struct directly instead of re-declaring it.
    • Removed default no-op Validate functions from the deploy and write operation templates, as they are unnecessary.
  • Removes the generated Validate function which was unused.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

⚠️ No Changeset found

Latest commit: 1488f8e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@RayXpub RayXpub marked this pull request as ready for review May 6, 2026 06:01
@RayXpub RayXpub requested a review from a team as a code owner May 6, 2026 06:01
Copilot AI review requested due to automatic review settings May 6, 2026 06:01
@RayXpub RayXpub marked this pull request as draft May 6, 2026 06:01
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

This PR separates the EVM “contract operations” helper code into two distinct packages: a restored runtime package under chain/evm/operations/contract (to preserve downstream compatibility during migration) and a generator-owned package under tools/operations-gen/contract. It also fixes EVM read-operation codegen for Solidity methods with multiple named return values by reusing abigen’s generated return structs instead of re-declaring duplicates.

Changes:

  • Moved generator-consumed contract helpers to tools/operations-gen/contract and updated codegen templates + golden files to import that package.
  • Fixed read op codegen for multi-return named outputs by referencing gobindings.<MethodName> rather than generating a new <MethodName>Result type.
  • Simplified generated deploy/write operations by removing default no-op Validate functions; expanded/updated module dependencies for tools/operations-gen.

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/operations-gen/testdata/evm/rbac_timelock.golden.go Updates generated output to import tools/operations-gen/contract and removes no-op Validate.
tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go Updates generated output to import tools/operations-gen/contract and removes no-op Validate.
tools/operations-gen/testdata/evm/link_token.golden.go Updates generated output to import tools/operations-gen/contract and removes no-op Validate.
tools/operations-gen/internal/families/evm/contract.go Skips generating local multi-return structs when all return params are named.
tools/operations-gen/internal/families/evm/codegen.go Uses gobindings.<MethodName> as return type for multi-return named outputs.
tools/operations-gen/internal/families/evm/abi.go Tracks AllReturnParamsNamed during ABI parsing.
tools/operations-gen/go.sum Records expanded dependency graph for the tools module.
tools/operations-gen/go.mod Updates Go/tool deps and adds required module dependencies for new contract helpers.
tools/operations-gen/generate/templates/evm/operations.tmpl Switches generated imports to tools/operations-gen/contract and removes no-op Validate.
tools/operations-gen/contract/write.go Adds generator-owned write helpers (incl. retries, role/owner gating, batch builder).
tools/operations-gen/contract/write_test.go Adds unit tests for generator-owned write helpers.
tools/operations-gen/contract/read.go Adds generator-owned read operation wrapper.
tools/operations-gen/contract/read_test.go Adds unit tests for generator-owned read wrapper.
tools/operations-gen/contract/mocks/mock_access_control_contract.go Adds mock for AccessControlContract (for generator-owned helpers).
tools/operations-gen/contract/function.go Defines generator-owned FunctionInput.
tools/operations-gen/contract/function_test.go Provides test contract + rpc error helpers for generator-owned contract tests.
tools/operations-gen/contract/deployment_test.go Adds unit tests for generator-owned deploy helpers.
tools/operations-gen/contract/deploy.go Adds generator-owned deploy helpers and supporting utilities.
chain/evm/operations/contract/write.go Restores/adjusts runtime write op API to bind contracts by address (NewContract) and adds chain/address validation.
chain/evm/operations/contract/write_test.go Updates tests for runtime write op API and removes HasRole/RetryContractCall tests.
chain/evm/operations/contract/read.go Restores/adjusts runtime read op API to bind contracts by address (NewContract) and adds chain/address validation.
chain/evm/operations/contract/read_test.go Updates tests for runtime read op API and adds selector/address validation cases.
chain/evm/operations/contract/function.go Expands runtime FunctionInput to include contract address + chain selector.
chain/evm/operations/contract/function_test.go Updates test contract constructor signature to match NewContract pattern.
chain/evm/operations/contract/deployment_test.go Updates runtime deploy tests to include chain selector input validation.
chain/evm/operations/contract/deploy.go Adds chain selector into runtime deploy input/output and validates selector match.
.mockery.yml Redirects mock output dir for AccessControlContract mocks (but package target needs updating).

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

Comment thread chain/evm/operations/contract/read.go
Comment thread chain/evm/operations/contract/write.go
Comment thread chain/evm/operations/contract/deploy.go
Comment thread .mockery.yml Outdated
@RayXpub RayXpub marked this pull request as ready for review May 6, 2026 06:50
Copilot AI review requested due to automatic review settings May 6, 2026 06:50
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

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

Comment thread tools/operations-gen/go.mod Outdated
Comment thread tools/operations-gen/internal/families/evm/codegen.go
Copilot AI review requested due to automatic review settings May 6, 2026 07:12
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

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Comment thread chain/evm/operations/contract/write.go
Comment thread chain/evm/operations/contract/function.go
Comment thread chain/evm/operations/contract/write.go
Comment thread tools/operations-gen/go.mod Outdated
@RayXpub RayXpub requested a review from RensR May 6, 2026 07:26
RensR
RensR previously approved these changes May 6, 2026
Copilot AI review requested due to automatic review settings May 6, 2026 08:36
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

Copilot reviewed 27 out of 28 changed files in this pull request and generated 5 comments.

Comment thread tools/operations-gen/go.mod Outdated
Comment thread chain/evm/operations2/contract/write.go
Comment thread chain/evm/operations2/contract/write.go
Comment thread chain/evm/operations2/contract/deploy.go
Comment thread chain/evm/operations2/contract/deploy.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 08:45
@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
70.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

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

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

Comment thread chain/evm/operations/contract/read.go
Comment thread chain/evm/operations/contract/write.go
@RayXpub RayXpub added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit 92d00db May 6, 2026
32 of 33 checks passed
@RayXpub RayXpub deleted the chore/duplicate-deploy-package-for-ops-gen branch May 6, 2026 10:52
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.

4 participants