Upgrading Daml packages across a distributed network leaves no room for guesswork. You need to verify both that the compiler accepts the upgrade and that workflows continue to function with mixed package versions.Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
Type-Level Compatibility Tests
A type-level compatibility test checks whether the old and new versions of a package with the same name can coexist without breaking. The easiest way to test this during development is to use thedpm upgrade-check command.
It is also recommended to do this as part of CI by uploading both old and new versions to a fresh
participant node using the DAR files that will be in production. Ideally, these should be stored in a dedicated artifact repository, but given their small sizes (typically under 1 MB), they may also be checked into source control.
In practice, this means your CI pipeline should:
- Build the v2 DAR with
dpm build - Start a sandbox with
dpm sandbox - Upload the production v1 DAR
- Upload the v2 DAR
- If both uploads succeed without errors, type-level compatibility is confirmed
Workflow-Level Compatibility Tests
A workflow-level compatibility test verifies that core business processes continue to function correctly after an upgrade. A basic integration test should follow these steps:- Start the application with v2 software, but upload only the v1 DAR file to test backward compatibility.
- Initialize the application and start one instance of every core workflow.
- Upload the v2 DAR.
- Update the configuration to instruct the backends to start using the v2 DAR.
- Verify that the workflows remain in the correct state and can continue without issues.
Daml Script Upgrade Tests
Write Daml Script tests that explicitly test cross-version scenarios. The key patterns to cover:Creating v1 contracts, reading with v2
Exercising v2 choices on existing contracts
Testing incompatible downgrades
True cross-version downgrade testing requires uploading both v1 and v2 DARs to a sandbox and exercising contracts across version boundaries. This cannot be done in a single Daml Script test because Daml Script runs within a single package version. Use the workflow-level testing approach described above: upload both DARs to a sandbox, create contracts with v2 data (non-None optional fields), then verify that v1 code fails to fetch them as expected.
Regression Testing
Every upgrade should run your full existing test suite against the new package version. Your v1 tests should pass unchanged when run against v2 — if they don’t, you have a backward-compatibility issue. Structure your test packages so that regression tests are separate from upgrade-specific tests:CI Integration
Add upgrade testing to your CI pipeline as a separate stage that runs after the standard build and test:Next Steps
- Deploying Upgrades — Rolling out tested upgrades across environments
- Upgrade Compatibility — Reference for what changes are allowed