-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add changeset tx type #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
269dfa1 to
50cfb19
Compare
505c3b5 to
860ef4d
Compare
bf17e12 to
9084157
Compare
21c38d8 to
4095e5e
Compare
4095e5e to
fc0af95
Compare
6a1a1c8 to
4e1b37b
Compare
6e2acaa to
0004d77
Compare
0004d77 to
ee5a065
Compare
timothyF95
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits and questions but overall LGTM. Nice feature 👍
| @@ -0,0 +1,93 @@ | |||
| package settings | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The pattern for filename would be settings_cld.go
| return buildCmd | ||
| } | ||
|
|
||
| func WriteChangesetFile(fileName string, changesetFile *inttypes.ChangesetFile, settings *settings.Settings) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you choose the same changeset filename twice it duplicates the contents instead of replace. Is this intended?
| Args: cmdCommon.ToStringSlice(args), | ||
| }, | ||
| }, nil | ||
| case Changeset: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: When you run both flags - e.g.cre workflow deploy tf-wf-3 --changeset --unsigned results in --unsigned behaviour only and no --changeset or feedback message. This is not a blocker but could create confusion.
|
|
||
| func AddRawTxFlag(cmd *cobra.Command) { | ||
| cmd.Flags().Bool(Flags.RawTxFlag.Name, false, "If set, the command will either return the raw transaction instead of sending it to the network or execute the second step of secrets operations using a previously generated raw transaction") | ||
| cmd.Flags().Bool(Flags.Changeset.Name, false, "If set, the command will output a changeset YAML for use with CLD instead of sending the transaction to the network") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: feedback implicates the wrong flag when owner is missing. I imagine this is due to go validators. Not a blocker but could be confusing.
➜ project2 cre workflow deploy tf-wf-3 --changeset
missing workflow owner: when using --unsigned you must set "staging-settings.account.workflow-owner-address" in your config
| mcmstypes "github.com/smartcontractkit/mcms/types" | ||
| ) | ||
|
|
||
| type CLDSettings struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: I know this is a hidden feature but where do we get an example of cld settings:
staging-settings:
account:
workflow-owner-address: "0x2e...."
rpcs:
- chain-name: ethereum-testnet-sepolia
url: https://ethereum-sepolia-rpc.publicnode.com
cld-settings:
cld-path: "/Users/timfunnell/Documents/repos/chainlink-deployments"
domain: "cre"
environment: "staging"
mcms-settings:
mcms-action: "schedule"
min-delay: "0s"
valid-duration: "72h"
override-root: false
timelock-qualifier: ""
| return cldSettings, nil | ||
| } | ||
|
|
||
| func GetMCMSConfig(settings *Settings, chainSelector uint64) (*crecontracts.MCMSConfig, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: Would these benefit from some unit tests?
DEVSVCS-3460
This pull request introduces support for a new "Changeset" transaction type across several CLI commands, enabling users to output changes as YAML files for MCMS owned workflows. The implementation includes generating and writing changeset YAML files, updating handler logic to support the new transaction type, and refactoring CLI flags for consistency.
Support for "Changeset" Transaction Type and YAML File Generation:
Changesettransaction type to the transaction handling logic, enabling commands to output changes as YAML files instead of sending transactions directly. (cmd/client/tx.go[1] [2];cmd/client/client_factory.go[3]WriteChangesetFileutility to generate or append to changeset YAML files in the appropriate directory structure, supporting workflows that require durable, auditable change records. (cmd/common/utils.gocmd/common/utils.goR220-R263)cmd/account/link_key/link_key.go[1];cmd/account/unlink_key/unlink_key.go[2];cmd/secrets/common/handler.go[3] [4]Refactoring and Consistency Improvements:
AddRawTxFlagfunction withAddTxnTypeFlagsand ensuredAddSkipConfirmationis consistently used across all relevant CLI commands, allowing users to select transaction output type (regular, raw, ledger, or changeset) more flexibly. (cmd/account/link_key/link_key.go[1];cmd/account/unlink_key/unlink_key.go[2];cmd/secrets/create/create.go[3];cmd/secrets/delete/delete.go[4]Handler and Dependency Updates:
cmd/secrets/common/handler.go[1] [2];cmd/account/link_key/link_key.go[3];cmd/account/unlink_key/unlink_key.go[4];cmd/secrets/common/handler.go[5];cmd/secrets/delete/delete.go[6]Smart Contract Client Updates:
AllowlistRequestmethod in the workflow registry client to return a transaction output, supporting the new transaction type and enabling downstream logic to handle changeset generation. (cmd/client/workflow_registry_v2_client.gocmd/client/workflow_registry_v2_client.goL681-R712)