Skip to content

feat(operations-gen): add deploy_contract_types for same-ABI multi-label deploy#1056

Merged
graham-chainlink merged 1 commit into
mainfrom
ggoh/operations-gen-deploy-contract-types
Jun 17, 2026
Merged

feat(operations-gen): add deploy_contract_types for same-ABI multi-label deploy#1056
graham-chainlink merged 1 commit into
mainfrom
ggoh/operations-gen-deploy-contract-types

Conversation

@graham-chainlink

@graham-chainlink graham-chainlink commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Currently operations-gen does not support generating operation with the same contract byte code but each with different contract types (MCMS setup - proposer,canceller,bypasser).

Adds a new deploy_contract_types field to the EVM contract config that allows a single contract entry to register multiple ContractType labels (e.g. ProposerManyChainMultiSig, BypasserManyChainMultiSig, CancellerManyChainMultiSig) in the generated BytecodeByTypeAndVersion map.

version: "1.0.0"
chain_family: evm
input:
  gobindings_package: "github.com/smartcontractkit/chainlink-deployments-framework/tools/operations-gen/testdata/evm/gobindings"
  zksync_bindings_package: "github.com/smartcontractkit/chainlink-deployments-framework/tools/operations-gen/testdata/evm/zksync_bindings"
output:
  base_path: "."
contracts:
  - contract_name: ManyChainMultiSig
    version: "1.0.0"
    package_name: many_chain_multi_sig
    zksync_bytecode: ManyChainMultiSigZkBytecode
    deploy_contract_types:
      - ProposerManyChainMultiSig
      - BypasserManyChainMultiSig
      - CancellerManyChainMultiSig
    functions:
      - name: owner
        access: public

will generate

...
var ProposerManyChainMultiSigContractType cldf_deployment.ContractType = "ProposerManyChainMultiSig"
var ProposerManyChainMultiSigTypeAndVersion = cldf_deployment.NewTypeAndVersion(ProposerManyChainMultiSigContractType, *Version)
var BypasserManyChainMultiSigContractType cldf_deployment.ContractType = "BypasserManyChainMultiSig"
var BypasserManyChainMultiSigTypeAndVersion = cldf_deployment.NewTypeAndVersion(BypasserManyChainMultiSigContractType, *Version)
var CancellerManyChainMultiSigContractType cldf_deployment.ContractType = "CancellerManyChainMultiSig"
var CancellerManyChainMultiSigTypeAndVersion = cldf_deployment.NewTypeAndVersion(CancellerManyChainMultiSigContractType, *Version)

var Deploy = contract.NewDeploy(contract.DeployParams[ConstructorArgs]{
	Name:             "many-chain-multi-sig:deploy",
	Version:          Version,
	Description:      "Deploys the ManyChainMultiSig contract",
	ContractMetadata: gobindings.ManyChainMultiSigMetaData,
	BytecodeByTypeAndVersion: map[string]contract.Bytecode{
		ProposerManyChainMultiSigTypeAndVersion.String(): {
			EVM:      common.FromHex(gobindings.ManyChainMultiSigMetaData.Bin),
			ZkSyncVM: zkbindings.ManyChainMultiSigZkBytecode,
		},
		BypasserManyChainMultiSigTypeAndVersion.String(): {
			EVM:      common.FromHex(gobindings.ManyChainMultiSigMetaData.Bin),
			ZkSyncVM: zkbindings.ManyChainMultiSigZkBytecode,
		},
		CancellerManyChainMultiSigTypeAndVersion.String(): {
			EVM:      common.FromHex(gobindings.ManyChainMultiSigMetaData.Bin),
			ZkSyncVM: zkbindings.ManyChainMultiSigZkBytecode,
		},
	},
})
...

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4addbe3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
operations-gen Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support in operations-gen for registering multiple ContractType labels for a single EVM contract entry (same ABI/bytecode) via a new deploy_contract_types YAML field, enabling role-based multi-deploy patterns (e.g., proposer/bypasser/canceller) without duplicating generated packages.

Changes:

  • Introduces deploy_contract_types in EVM contract config/IR/template-data and uses it to emit multiple BytecodeByTypeAndVersion entries for one contract.
  • Updates the EVM operations template to generate extra <Label>ContractType vars and to key deploy bytecode by those labels.
  • Adds tests, updates README + fixtures/golden output, and includes a changeset for the feature release.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/operations-gen/testdata/evm/operations_gen_mcms_config.yaml Adds deploy_contract_types example to MCMS fixture config.
tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go Updates golden output to include role contract types + bytecode map keys.
tools/operations-gen/README.md Documents deploy_contract_types, rules, and usage example.
tools/operations-gen/internal/families/evm/evm_test.go Adds generation + validation error tests for deploy_contract_types.
tools/operations-gen/internal/families/evm/contract.go Threads DeployContractTypes through IR and adds validation hook.
tools/operations-gen/internal/families/evm/config.go Adds YAML decoding field deploy_contract_types.
tools/operations-gen/internal/families/evm/codegen.go Passes DeployContractTypes into template data.
tools/operations-gen/generate/templates/evm/operations.tmpl Emits extra ContractType vars and deploy bytecode entries per label.
.changeset/long-times-divide.md Declares a minor version bump for the feature.
Files not reviewed (1)
  • tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go: Generated file

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

Comment thread tools/operations-gen/internal/families/evm/contract.go
Comment thread tools/operations-gen/generate/templates/evm/operations.tmpl

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Files not reviewed (1)
  • tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go: Generated file

Comment thread tools/operations-gen/README.md Outdated
Comment thread tools/operations-gen/README.md Outdated
…bel deploy

Adds a new `deploy_contract_types` field to the EVM contract config that
allows a single contract entry to register multiple ContractType labels
(e.g. ProposerManyChainMultiSig, BypasserManyChainMultiSig,
CancellerManyChainMultiSig) in the generated BytecodeByTypeAndVersion map.

When set, only the listed labels appear as bytecode map keys — the base
contract_name type is excluded. Each label also gets an exported
`var <Label>ContractType` declaration so callers can reference types
without hardcoding strings.

This replaces the previous pattern of duplicating the same contract three
times in YAML with different package_name overrides, which produced three
near-identical generated files and still broke on the TypeAndVersion lookup
since the bytecode map only contained the base type key.

Validation rejects: empty labels, duplicates, a label equal to the base
contract_name, and combining with omit_deploy.
@graham-chainlink graham-chainlink force-pushed the ggoh/operations-gen-deploy-contract-types branch from f1a3b08 to 4addbe3 Compare June 17, 2026 07:13
@cl-sonarqube-production

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

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

See analysis details on SonarQube

@graham-chainlink graham-chainlink marked this pull request as ready for review June 17, 2026 07:52
@graham-chainlink graham-chainlink requested a review from a team as a code owner June 17, 2026 07:52
Copilot AI review requested due to automatic review settings June 17, 2026 07:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Files not reviewed (1)
  • tools/operations-gen/testdata/evm/many_chain_multi_sig.golden.go: Generated file

@graham-chainlink graham-chainlink added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit 15d3401 Jun 17, 2026
29 of 30 checks passed
@graham-chainlink graham-chainlink deleted the ggoh/operations-gen-deploy-contract-types branch June 17, 2026 14:39
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.

5 participants