Skip to content

Conversation

@anirudhwarrier
Copy link
Collaborator

@anirudhwarrier anirudhwarrier commented Nov 21, 2025

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:

  • Added a new Changeset transaction 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]
  • Implemented the WriteChangesetFile utility to generate or append to changeset YAML files in the appropriate directory structure, supporting workflows that require durable, auditable change records. (cmd/common/utils.go cmd/common/utils.goR220-R263)
  • Updated all commands to support the new changeset flow, including constructing the correct YAML payloads and calling the new file-writing utility. (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:

  • Replaced the AddRawTxFlag function with AddTxnTypeFlags and ensured AddSkipConfirmation is 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:

  • Refactored handler structs and constructors to pass and use the updated settings and types required for changeset file generation, and to support the new transaction type throughout the command logic. (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:

  • Updated the AllowlistRequest method 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.go cmd/client/workflow_registry_v2_client.goL681-R712)

@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch from 269dfa1 to 50cfb19 Compare November 21, 2025 11:37
@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch from 505c3b5 to 860ef4d Compare December 31, 2025 16:31
@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch from bf17e12 to 9084157 Compare January 2, 2026 09:16
@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch 4 times, most recently from 21c38d8 to 4095e5e Compare January 2, 2026 10:40
@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch from 4095e5e to fc0af95 Compare January 2, 2026 11:05
@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch from 6a1a1c8 to 4e1b37b Compare January 6, 2026 20:05
@anirudhwarrier anirudhwarrier requested a review from Copilot January 6, 2026 20:06

This comment was marked as resolved.

@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch 3 times, most recently from 6e2acaa to 0004d77 Compare January 7, 2026 10:15
@anirudhwarrier anirudhwarrier force-pushed the DEVSVCS-3154/add-changeset-txtype branch from 0004d77 to ee5a065 Compare January 7, 2026 10:21
@anirudhwarrier anirudhwarrier marked this pull request as ready for review January 12, 2026 07:53
@anirudhwarrier anirudhwarrier requested a review from a team as a code owner January 12, 2026 07:53
Copy link
Contributor

@timothyF95 timothyF95 left a 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
Copy link
Contributor

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 {
Copy link
Contributor

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:
Copy link
Contributor

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")
Copy link
Contributor

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 {
Copy link
Contributor

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) {
Copy link
Contributor

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?

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.

2 participants