Skip to content

feat(canton): integrate Canton support#613

Merged
stackman27 merged 1 commit into
mainfrom
canton-main
Jun 5, 2026
Merged

feat(canton): integrate Canton support#613
stackman27 merged 1 commit into
mainfrom
canton-main

Conversation

@RodrigoAD

@RodrigoAD RodrigoAD commented Feb 6, 2026

Copy link
Copy Markdown
Member

This pull request adds support for the Canton blockchain.

Comment thread sdk/canton/resolver.go Fixed
Comment thread sdk/canton/resolver.go Fixed
Comment thread sdk/canton/resolver.go Fixed
Comment thread sdk/canton/resolver.go Fixed
@stackman27 stackman27 changed the title [WIP] Canton integration feat(canton): integrate Canton support May 28, 2026
@stackman27 stackman27 marked this pull request as ready for review May 28, 2026 03:22
@stackman27 stackman27 requested a review from a team as a code owner May 28, 2026 03:22
Copilot AI review requested due to automatic review settings May 28, 2026 03:22

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

Integrates Canton (Daml-based) chain support into MCMS by adding a new sdk/canton package implementing the Encoder/Inspector/Executor/Configurer/Timelock interfaces against the chainlink-canton bindings, wiring Canton into the factory, validation, chain selectors, and chain-wrapper builders, and adding an e2e test suite plus task entry.

Changes:

  • New sdk/canton package: Merkle hashing matching the Daml Crypto.daml layout, MCMS/timelock SetConfig/SetRoot/Execute/Schedule/Cancel/Bypass, InstanceAddress→contract-ID resolver, and metadata inference for timelock proposal conversion.
  • Wire Canton into shared infrastructure: factory.go, validation.go, types/chain_selector.go, timelock_proposal.go (Canton-only EnsureChainMetadata step), chainwrappers/* (new CantonChain accessor + mock), go.mod deps + replace directives.
  • New e2e/tests/canton suite (configurer, inspector, timelock proposal/cancel/bypass, set-root/execute) and e2e:canton task.

Reviewed changes

Copilot reviewed 38 out of 40 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
validation.go Adds Canton case to validateChainMetadata (per-tx validator not wired).
types/chain_selector.go Adds FamilyCanton to supported families.
timelock_proposal.go Adds Canton-only EnsureChainMetadata step during Convert.
factory.go Registers Canton encoder and OperationID.
go.mod Adds Canton/Daml deps and replace directives.
taskfiles/test/Taskfile.yml Adds e2e:canton task.
sdk/canton/chain_metadata.go Defines TimelockRole, AdditionalFieldsMetadata, and NewChainMetadata.
sdk/canton/chain_metadata_infer.go Infers metadata using hard-coded instance ID candidates and default chain id 1.
sdk/canton/chain_metadata_infer_test.go Unit test for inference happy path.
sdk/canton/encoder.go Merkle leaf hashing with domain separators and length prefixes.
sdk/canton/configurer.go SetConfig against MCMS contract; sets Hash to a literal "tx.Digest".
sdk/canton/inspector.go Reads config/op count/root/root metadata; converts MultisigConfig to types.Config.
sdk/canton/inspector_test.go E2E-tagged unit tests for toConfig hierarchy.
sdk/canton/executor.go ExecuteOperation/SetRoot; manual map-based metadata parsing; value receivers; dead PadLeft32.
sdk/canton/timelock_converter.go Schedule/Bypass/Cancel encoding and OperationID.
sdk/canton/timelock_crypto.go HashTimelockOpId matching Daml hashing.
sdk/canton/timelock_executor.go ExecuteScheduledBatch submission.
sdk/canton/timelock_inspector.go Read-only choices (IsOperation*, GetMinDelay) and role getters.
sdk/canton/resolver.go Resolves InstanceAddress hex to active contract ID.
sdk/canton/helpers.go Template ID parsing/formatting and constants.
chainwrappers/chainaccessor.go Adds CantonChain(selector) and fixes a Sui alias.
chainwrappers/mocks/chain_accessor.go Generated CantonChain mock.
chainwrappers/converters.go Canton converter case.
chainwrappers/inspectors.go Canton inspector case + cantonRole helper.
chainwrappers/executors.go Canton executor case (requires *cantonsdk.Encoder).
chainwrappers/timelock_executors.go Canton timelock executor case.
e2e/tests/setup.go Adds CantonChain config and CantonBlockchain to shared setup.
e2e/tests/runner_test.go Registers TestCantonSuite.
e2e/config.canton.toml Canton e2e config.
e2e/tests/canton/* New e2e suites; timelock_cancel.go contains a non-compiling salt expression.
Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

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

Comment thread e2e/tests/canton/timelock_cancel.go Outdated
Comment thread sdk/canton/configurer.go Outdated
Comment thread sdk/canton/executor.go Outdated
Comment thread validation.go
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/executor.go
}, nil
}

func (e Executor) ExecuteOperation(
Comment thread sdk/canton/chain_metadata_infer.go Outdated
Comment thread sdk/canton/chain_metadata_infer.go Outdated
Comment thread chainwrappers/chainaccessor.go Outdated

@gustavogama-cll gustavogama-cll 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.

Submitting a few thoughts after a shallow initial pass because I think there is one request (the last comment) that might require a bigger refactoring.

Comment thread chainwrappers/executors.go Outdated
Comment thread chainwrappers/executors.go
Comment thread chainwrappers/inspectors.go Outdated
Comment thread chainwrappers/inspectors.go Outdated
Comment thread chainwrappers/timelock_executors.go Outdated
Comment thread timelock_proposal.go Outdated
Copilot AI review requested due to automatic review settings May 29, 2026 21:07

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 41 out of 43 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

Comment thread e2e/tests/canton/timelock_cancel.go Outdated
Comment thread sdk/canton/configurer.go Outdated
Comment thread validation.go
Comment thread chainwrappers/timelock_executors.go
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/configurer.go
Comment on lines +79 to +114
// Build exercise command using generated bindings
mcmsContract := mcmscore.MCMS{}
exerciseCmd := mcmsContract.SetConfig(mcmsContractID, input)

// Parse template ID
packageID, moduleName, entityName, err := parseTemplateIDFromString(mcmsContract.GetTemplateID())
if err != nil {
return types.TransactionResult{}, fmt.Errorf("failed to parse template ID: %w", err)
}

// Convert input to choice argument
choiceArgument := ledger.MapToValue(input)

commandID := uuid.Must(uuid.NewUUID()).String()
submitResp, err := c.client.SubmitAndWaitForTransaction(ctx, &apiv2.SubmitAndWaitForTransactionRequest{
Commands: &apiv2.Commands{
WorkflowId: "mcms-set-config",
CommandId: commandID,
ActAs: []string{c.mcmsParties[0]},
ReadAs: c.mcmsParties,
Commands: []*apiv2.Command{{
Command: &apiv2.Command_Exercise{
Exercise: &apiv2.ExerciseCommand{
TemplateId: &apiv2.Identifier{
PackageId: packageID,
ModuleName: moduleName,
EntityName: entityName,
},
ContractId: exerciseCmd.ContractID,
Choice: exerciseCmd.Choice,
ChoiceArgument: choiceArgument,
},
},
}},
},
})
Copilot AI review requested due to automatic review settings May 31, 2026 16:31

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings June 1, 2026 19:37

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 42 out of 44 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

Comment thread sdk/canton/helpers.go Outdated
Comment thread sdk/canton/configurer.go Outdated
Comment thread sdk/canton/configurer.go
Comment thread e2e/tests/canton/timelock_cancel.go
Comment thread sdk/canton/timelock_crypto.go
Comment thread validation.go
Copilot AI review requested due to automatic review settings June 2, 2026 20:01

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

Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

Comment thread sdk/canton/configurer.go
Comment thread sdk/canton/helpers.go
Comment thread sdk/canton/timelock_crypto.go
Comment thread sdk/canton/transaction.go
Comment thread sdk/canton/chain_metadata.go Outdated
Comment thread chainwrappers/chainaccessor.go
Comment thread sdk/canton/executor.go Outdated
Comment thread e2e/tests/canton/timelock_cancel.go

@gustavogama-cll gustavogama-cll 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.

Need to take a break and will resume later. As a general comment, I find the test coverage pretty lacking. According to Sonarqube we're at ~9%. We have the e2e tests, which are definitely important but I do feel like there's a lot of missing unit tests which would help us maintain and validate the scenarios that deviate from the happy paths.

Comment thread sdk/canton/chain_metadata.go Outdated
Comment thread sdk/canton/configurer.go Outdated
Comment thread chainwrappers/executors.go
Comment thread chainwrappers/chainaccessor.go
Comment thread sdk/canton/encoder.go Outdated
Comment thread sdk/canton/encoder.go
Comment thread sdk/canton/helpers.go Outdated
Comment thread sdk/canton/helpers.go Outdated
Comment thread sdk/canton/helpers.go Outdated
Comment thread sdk/canton/configurer.go Outdated

@gustavogama-cll gustavogama-cll 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.

another quick round, will resume later

Comment thread sdk/canton/inspector.go Outdated
Comment thread sdk/canton/inspector.go Outdated
Comment thread sdk/canton/inspector.go Outdated
Comment thread sdk/canton/inspector.go Outdated
Comment thread sdk/canton/inspector_test.go Outdated
Comment thread sdk/canton/canton_helpers.go Outdated
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/timelock_converter.go Outdated
Comment thread sdk/canton/timelock_crypto.go Outdated
Comment thread sdk/canton/timelock_crypto.go Outdated
Comment thread sdk/canton/timelock_crypto.go
Comment thread sdk/canton/timelock_crypto.go
Copilot AI review requested due to automatic review settings June 4, 2026 02:09

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 47 out of 49 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

Comment thread e2e/tests/canton/timelock_cancel.go
Comment thread sdk/canton/helpers.go
Comment thread sdk/canton/helpers_test.go
Comment thread sdk/canton/transaction.go
Comment thread sdk/canton/executor.go Outdated
Comment thread sdk/canton/chain_metadata.go
Comment thread sdk/canton/transaction.go
Comment thread sdk/canton/transaction.go
Comment thread sdk/canton/chain_metadata.go
Comment thread sdk/canton/encoder.go
Comment thread sdk/canton/helpers.go
Comment thread sdk/canton/inspector.go Outdated
Comment thread sdk/canton/timelock_converter.go Outdated
Comment thread sdk/canton/chain_metadata_infer.go Outdated
Copilot AI review requested due to automatic review settings June 4, 2026 23:11

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 47 out of 49 changed files in this pull request and generated 11 comments.

Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

Comment thread e2e/tests/canton/timelock_proposal.go
Comment thread e2e/tests/canton/timelock_cancel.go
Comment thread e2e/tests/canton/timelock_inspection.go
Comment thread e2e/tests/canton/set_root_execute.go
Comment thread e2e/tests/canton/set_root_execute.go
Comment thread e2e/tests/canton/timelock_bypass.go
Comment thread sdk/canton/configurer.go
Comment thread sdk/canton/transaction.go
Comment thread sdk/canton/helpers.go
Comment thread sdk/canton/resolver.go

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 47 out of 49 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • chainwrappers/mocks/chain_accessor.go: Language not supported

Comment thread sdk/canton/helpers.go
Comment thread sdk/canton/transaction.go
Comment thread sdk/canton/configurer.go
Comment thread sdk/canton/helpers_test.go
Squash of canton-main for signed commit history. Original branch preserved
as canton-main-backup-20260604.
@cl-sonarqube-production

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
23.2% Coverage on New Code (required ≥ 75%)

See analysis details on SonarQube

@stackman27 stackman27 merged commit d1e8d62 into main Jun 5, 2026
20 of 21 checks passed
@stackman27 stackman27 deleted the canton-main branch June 5, 2026 01:01
@smartcontractkit smartcontractkit deleted a comment from changeset-bot Bot Jun 5, 2026
ecPablo pushed a commit that referenced this pull request Jun 5, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.46.0](v0.45.1...v0.46.0)
(2026-06-05)


### Features

* **canton:** integrate Canton support
([#613](#613))
([d1e8d62](d1e8d62))


### Bug Fixes

* replace sender to timelock address during error decoding
([#775](#775))
([7da8a8e](7da8a8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: app-token-issuer-ops-platform[bot] <275822481+app-token-issuer-ops-platform[bot]@users.noreply.github.com>
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