Skip to content

feat: use geth abi parsing and inherit gobindings for ops gen#953

Open
RayXpub wants to merge 10 commits intomainfrom
chore/ops-gen-geth-abi-parsing
Open

feat: use geth abi parsing and inherit gobindings for ops gen#953
RayXpub wants to merge 10 commits intomainfrom
chore/ops-gen-geth-abi-parsing

Conversation

@RayXpub
Copy link
Copy Markdown
Contributor

@RayXpub RayXpub commented Apr 23, 2026

Summary

This PR introduces the following changes

Type-safe ABI parsing via go-ethereum/accounts/abi

Previous implementation parsed the ABI using encoding/json and a static typeMap for Solidity→Go type conversion. The map only covers explicitly listed sizes (uint96, uint128, uint256; bytes4, bytes16, bytes32; etc.); any type not in the map silently falls back to any.

The code now relies on github.com/ethereum/go-ethereum/accounts/abi directly, which gives the same complete, size-aware type resolution that abigen uses. It also gives TupleRawName (the exact struct name abigen assigns to tuple types) and automatic overloaded-function disambiguation.

No generated contract struct or interface

Previous implementation generated a XxxContract struct wrapping bind.BoundContract, with a NewXxxContract constructor and delegating implementations of every selected method plus Address(), Owner(), etc.

Go bindings already generate XxxInterface with all contract methods. So the new generator instead uses geth_bindings.XxxInterface directly as the contract type parameter in WriteParams and ReadParams. Essentially, generated operations now rely as much as possible on the pre existing gobindings.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

⚠️ No Changeset found

Latest commit: c86212e

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 23, 2026 09:44
@RayXpub RayXpub requested a review from a team as a code owner April 23, 2026 09:44
Copilot AI review requested due to automatic review settings April 23, 2026 09:44
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 updates the EVM operations generator to rely on go-ethereum’s ABI parsing and to generate operations that leverage existing abigen gobindings (interfaces + metadata) rather than generating a custom BoundContract wrapper per contract.

Changes:

  • Add gobindings_package to EVM contract YAML config and pass it through to templates for importing gobindings.
  • Switch ABI parsing to github.com/ethereum/go-ethereum/accounts/abi and update function/parameter extraction accordingly (including overload handling).
  • Update the EVM operations template + golden fixtures to use gobindings metadata/interfaces and adjust generator tests.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/operations-gen/testdata/evm/operations_gen_mcms_config.yaml Adds gobindings_package to MCMS test config fixture.
tools/operations-gen/testdata/evm/operations_gen_config.yaml Adds gobindings_package to LinkToken test config fixture.
tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go Updates expected generated output for MCMS to use gobindings (golden).
tools/operations-gen/testdata/evm/link_token.golden.go Updates expected generated output for LinkToken to use gobindings (golden).
tools/operations-gen/templates/evm/operations.tmpl Changes the generated code shape to reference gobindings metadata/interfaces and new op constructors.
tools/operations-gen/internal/families/evm/evm.go Simplifies access-control constants used by the EVM generator.
tools/operations-gen/internal/families/evm/contract.go Adds gobindings package to ContractInfo, switches to geth ABI parsing, updates function extraction.
tools/operations-gen/internal/families/evm/config.go Adds required gobindings_package field to YAML config struct.
tools/operations-gen/internal/families/evm/codegen_test.go Updates tests to avoid removed ABI-entry parsing helpers.
tools/operations-gen/internal/families/evm/codegen.go Updates template data types and adds multi-return packing support.
tools/operations-gen/internal/families/evm/abi_test.go Reworks ABI type mapping tests to use geth abi.Type.
tools/operations-gen/internal/families/evm/abi.go Replaces string-based ABI parsing/type mapping with geth ABI parsing + new mapping logic.
tools/operations-gen/go.mod Adds go-ethereum dependency (and tidies module).
tools/operations-gen/go.sum Adds corresponding checksums for new dependencies.
Comments suppressed due to low confidence (1)

tools/operations-gen/internal/families/evm/contract.go:154

  • EvmFunctionConfig.Access is tagged omitempty (implying it’s optional), but extractFunctions currently treats an empty access value as an error (falls into the default case). This is a breaking behavior change for configs that omit access. Consider treating "" the same as public (as the previous implementation did), or remove omitempty / document it as required.
			switch funcCfg.Access {
			case accessOwner:
				fi.AccessControl = accessOwner
			case accessPublic:
			default:
				return fmt.Errorf("unknown access control '%s' for function %s (use 'owner' or 'public')",
					funcCfg.Access, funcCfg.Name)
			}

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

Comment thread tools/operations-gen/templates/evm/operations.tmpl
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/abi.go
Comment thread tools/operations-gen/internal/families/evm/contract.go
Comment thread tools/operations-gen/templates/evm/operations.tmpl
@RayXpub RayXpub marked this pull request as draft April 23, 2026 09:55
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.

Some of the copliot comments may be worth looking into.

Also we can also update the readme to include gobindings_package or we can do it at the end as well

Comment thread tools/operations-gen/internal/families/evm/abi.go Outdated
Comment on lines 13 to 14
version: "1.0.0"
abi_file: "link_token.json"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we cant get rid of abi_file field yet right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not yet, I'll remove it in next PR to source it directly from the bindings.

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 19 out of 20 changed files in this pull request and generated 9 comments.


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

Comment thread chain/evm/operations/contract/write.go
Comment thread chain/evm/operations/contract/write.go
Comment thread chain/evm/operations/contract/read.go Outdated
Comment thread chain/evm/operations/contract/read.go
Comment thread tools/operations-gen/internal/families/evm/abi.go
Comment thread tools/operations-gen/internal/families/evm/codegen.go
Comment thread tools/operations-gen/internal/families/evm/contract.go Outdated
Comment thread tools/operations-gen/README.md Outdated
Comment thread chain/evm/operations/contract/read.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 14:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 19 out of 20 changed files in this pull request and generated 2 comments.


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

Comment thread chain/evm/operations/contract/write.go Outdated
Comment thread tools/operations-gen/internal/families/evm/abi.go
…ractkit/chainlink-deployments-framework into chore/ops-gen-geth-abi-parsing
@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

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

See analysis details on SonarQube

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