[CLD-1777]: feat(operations-gen): add evm support#910
[CLD-1777]: feat(operations-gen): add evm support#910graham-chainlink wants to merge 1 commit intomainfrom
Conversation
|
There was a problem hiding this comment.
file mainly copied from https://github.com/smartcontractkit/chainlink-ccip/blob/main/chains/evm/cmd/operations-gen/main.go and adapted to the new design and added tests.
I will update the ported code in chainlink-ccip to point to this one when this PR is merged.
There was a problem hiding this comment.
Pull request overview
Adds EVM support to the tools/operations-gen CLI so it can generate type-safe Go operation wrappers from Solidity ABIs/bytecode, using an EVM-specific handler and template.
Changes:
- Registers the
evmchain-family handler and introduces EVM extraction/generation logic. - Adds an EVM operations template plus supporting utilities (type mapping, ABI parsing, overload handling).
- Adds documentation and unit tests for key EVM helpers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tools/operations-gen/README.md | Documents the CLI, config schema, and input/output layouts for EVM generation. |
| tools/operations-gen/main.go | Enables EVM by registering evmHandler in chainFamilies. |
| tools/operations-gen/evm.go | Implements EVM handler: config decoding, ABI/bytecode reading, ABI parsing, template data preparation, and codegen helpers. |
| tools/operations-gen/evm_test.go | Adds unit tests for EVM naming/type mapping utilities and overload handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3df479d to
0d43e7b
Compare
tools/operations-gen/evm.go
Outdated
| var nameOverrides = map[string]string{ | ||
| "OnRamp": "onramp", | ||
| "OffRamp": "offramp", | ||
| } |
There was a problem hiding this comment.
I don't think we actually want to support this product specific overrides. Can ythey do it in configuration instead?
There was a problem hiding this comment.
good point, i was thinking to not make any breaking change in order to let existing users have a smooth migration.
Removed it, after looking at the code, user can override the package name by specifying the package_name field
jkongie
left a comment
There was a problem hiding this comment.
We should add more documentation to this
tools/operations-gen/README.md
Outdated
| ```bash | ||
| task generate:operations CONFIG=/path/to/operations_gen_config.yaml | ||
| ``` |
There was a problem hiding this comment.
Is this applicable? task seems like a repo specific wrapper
There was a problem hiding this comment.
i was thinking it could be used to test the cli locally, but i can live without it too, will remove it !
| input: | ||
| base_path: "." # Directory containing abi/ and bytecode/ subdirectories | ||
|
|
||
| output: | ||
| base_path: "." # Directory where generated operations/ folders are written |
There was a problem hiding this comment.
Can we always assume that the contracts will be in a single base path?
There was a problem hiding this comment.
hmmm, hard to say, but users can move them into a single base path if it is not? Or do you think is it worth supporting multiple base path? I was also thinking to avoid many breaking user facing changes with the existing cli too.
@jkongie do you think the current readme is lacking any other information? I also plan to add something to the https://docs.cld.cldev.sh/ too. |
0d43e7b to
8a090ef
Compare
340cea6 to
4924b93
Compare
| desc: Generate mocks for interfaces | ||
| cmds: | ||
| - mockery | ||
|
|
There was a problem hiding this comment.
removed per discussion as taskfile is more of a repo wide command
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
taskfiles/generate/Taskfile.yml:12
generate:operationswas removed, buttools/operations-gen/README.mdstill documentstask generate:operations .... This will break the documented workflow; either re-add anoperationstask here (wrappinggo run ./tools/operations-gen -config ...) or update the README to match the new invocation.
tasks:
mocks:
desc: Generate mocks for interfaces
cmds:
- mockery
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4924b93 to
e63b65b
Compare
e63b65b to
e6bcc9a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
taskfiles/generate/Taskfile.yml:12
- This change removes the
generate:operationstask entirely. If contributors rely ontask generate:operations CONFIG=...(especially since the task handled resolving relative CONFIG paths from the repo root), this is a workflow regression and it’s not mentioned in the PR description. Consider keeping the task (or replacing it with an equivalent) so there remains a documented, one-command way to run operations-gen from the repo root.
tasks:
mocks:
desc: Generate mocks for interfaces
cmds:
- mockery
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add evm support for the operations-gen cli, basically ported the code from https://github.com/smartcontractkit/chainlink-ccip/blob/main/chains/evm/cmd/operations-gen/main.go and adapted it to the new design JIRA: https://smartcontract-it.atlassian.net/browse/CLD-1777
e6bcc9a to
e94ae22
Compare
|


Add evm support for the operations-gen cli, basically ported the code from https://github.com/smartcontractkit/chainlink-ccip/blob/main/chains/evm/cmd/operations-gen/main.go and adapted it to the new design
JIRA: https://smartcontract-it.atlassian.net/browse/CLD-1777