Skip to content

chore: source ABI and Bytecode directly from gobindings for ops gen#956

Merged
RayXpub merged 8 commits intomainfrom
chore/source-ops-gen-abi-from-go-bindings
Apr 24, 2026
Merged

chore: source ABI and Bytecode directly from gobindings for ops gen#956
RayXpub merged 8 commits intomainfrom
chore/source-ops-gen-abi-from-go-bindings

Conversation

@RayXpub
Copy link
Copy Markdown
Contributor

@RayXpub RayXpub commented Apr 24, 2026

Summary

Refactors operations-gen EVM ABI loading to read ABI definitions from abigen-generated Go bindings instead of local ABI JSON files.

The generator now uses golang.org/x/tools/go/packages to resolve the configured gobindings_package, parses the returned Go files with go/parser, and extracts <ContractName>MetaData.ABI from the generated binding source.

Changes

  • Replaced file-based ABI loading with gobindings-based ABI extraction.

  • Removed ABI/bytecode strings from ContractInfo and template data where they are no longer needed.

  • Removed EVMInputConfig.

  • Updated EVM tests/config fixtures to use gobindings_package as the ABI source.

  • Updated README documentation to describe gobindings-based input requirements.

  • Added golang.org/x/tools dependency for packages.Load.

    Notes

  • Bytecode is no longer read by operations-gen, generated code already references bytecode from the gobindings metadata.

  • ABI extraction targets <ContractName>MetaData.ABI, matching standard abigen output.

  • The package must be resolvable by go/packages from the generator’s module/workspace context, consistent with mockery-style package loading.

Testing

Ran targeted EVM ABI tests locally. Package loading depends on the configured gobindings package being resolvable in the local Go module/workspace context.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

⚠️ No Changeset found

Latest commit: 5ed9b69

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 April 24, 2026 09:11
Copilot AI review requested due to automatic review settings April 24, 2026 09:11
@RayXpub RayXpub requested a review from a team as a code owner April 24, 2026 09:11
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 refactors tools/operations-gen EVM ABI handling to source ABI definitions directly from abigen-generated Go bindings (via go/packages + AST parsing), removing the previous file-based ABI/bytecode input layout and simplifying the EVM config surface.

Changes:

  • Replace ABI/bytecode file loading with extraction of <ContractName>MetaData.ABI from a configured gobindings_package.
  • Remove EvmInputConfig, abi_file, and ABI/bytecode fields from internal ContractInfo/template data.
  • Update test fixtures/golden outputs and documentation; add golang.org/x/tools dependency.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/operations-gen/internal/families/evm/abi.go Implements gobindings-based ABI extraction using go/packages and go/parser.
tools/operations-gen/internal/families/evm/evm.go Removes input config handling; wires extraction using only output config.
tools/operations-gen/internal/families/evm/contract.go Drops embedded ABI/bytecode strings; uses ReadABI(cfg) for parsing.
tools/operations-gen/internal/families/evm/config.go Removes EvmInputConfig and abi_file; makes gobindings_package the required source.
tools/operations-gen/internal/families/evm/codegen.go Removes ABI/bytecode from template data.
tools/operations-gen/internal/families/evm/abi_test.go Updates ABI read test to load ABI from an external gobindings package.
tools/operations-gen/internal/families/evm/evm_golden_test.go Updates golden tests to no longer override input paths; relies on gobindings package resolution.
tools/operations-gen/testdata/evm/operations_gen_config.yaml Updates fixture to use gobindings_package only (external package).
tools/operations-gen/testdata/evm/operations_gen_mcms_config.yaml Updates MCMS fixture to use external gobindings_package.
tools/operations-gen/testdata/evm/link_token.golden.go Updates expected generated output based on ABI sourced from gobindings.
tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go Updates expected generated output; tuple typing degrades to any in args.
tools/operations-gen/testdata/evm/gobindings/v1_0_0/link_token/link_token.go Removes local abigen fixture bindings.
tools/operations-gen/testdata/evm/gobindings/v1_0_0/many_chain_multi_sig/many_chain_multi_sig.go Removes local abigen fixture bindings.
tools/operations-gen/README.md Updates documentation to describe gobindings-based input requirements.
tools/operations-gen/go.mod Adds golang.org/x/tools and many new indirect requirements.
tools/operations-gen/go.sum Updates sums for new dependency graph.
Comments suppressed due to low confidence (1)

tools/operations-gen/internal/families/evm/evm_golden_test.go:53

  • Golden generation tests now rely on whatever gobindings_package points to in the YAML fixtures (which were switched to external modules). That makes the end-to-end tests non-hermetic and potentially brittle/offline-unfriendly because Generate will invoke go/packages over those import paths. Consider restoring local gobindings fixtures for testdata or stubbing a tiny package in-repo so golden tests don’t depend on fetching/compiling external modules.
	// Override output path to an isolated temp dir.
	tmpDir := t.TempDir()
	cfg.Output = mustYAMLNode(t, evm.EvmOutputConfig{BasePath: tmpDir})
	cfg.ConfigDir = ""


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

Comment thread tools/operations-gen/internal/families/evm/abi.go Outdated
Comment thread tools/operations-gen/internal/families/evm/abi.go
Comment thread tools/operations-gen/internal/families/evm/evm.go
Comment thread tools/operations-gen/internal/families/evm/abi_test.go
Comment thread tools/operations-gen/go.mod
Comment thread tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go Outdated
Comment thread tools/operations-gen/testdata/evm/link_token.golden.go
@RayXpub RayXpub marked this pull request as draft April 24, 2026 10: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 12 out of 13 changed files in this pull request and generated 1 comment.


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

Comment thread tools/operations-gen/internal/families/evm/abi.go Outdated
@RayXpub RayXpub marked this pull request as ready for review April 24, 2026 10:38
Copilot AI review requested due to automatic review settings April 24, 2026 10:38
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 12 out of 13 changed files in this pull request and generated 3 comments.


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

Comment thread tools/operations-gen/internal/families/evm/abi.go
Comment thread tools/operations-gen/internal/families/evm/abi.go
Comment thread tools/operations-gen/internal/families/evm/contract.go Outdated
@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

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

See analysis details on SonarQube

Copy link
Copy Markdown
Collaborator

@graham-chainlink graham-chainlink left a comment

Choose a reason for hiding this comment

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

LGTM

@RayXpub RayXpub added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit 4bb1307 Apr 24, 2026
25 of 26 checks passed
@RayXpub RayXpub deleted the chore/source-ops-gen-abi-from-go-bindings branch April 24, 2026 12:45
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