chore: source ABI and Bytecode directly from gobindings for ops gen#956
chore: source ABI and Bytecode directly from gobindings for ops gen#956
Conversation
|
There was a problem hiding this comment.
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.ABIfrom a configuredgobindings_package. - Remove
EvmInputConfig,abi_file, and ABI/bytecode fields from internalContractInfo/template data. - Update test fixtures/golden outputs and documentation; add
golang.org/x/toolsdependency.
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_packagepoints 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|


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 withgo/parser, and extracts<ContractName>MetaData.ABIfrom the generated binding source.Changes
Replaced file-based ABI loading with gobindings-based ABI extraction.
Removed ABI/bytecode strings from
ContractInfoand 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.