Skip to content

v0.8.2

Latest

Choose a tag to compare

@github-actions github-actions released this 27 Nov 18:03
Immutable release. Only release title and notes can be modified.
024344b

πŸš€ Canton .NET SDK: 0.8.2

TL;DR: every library now ships for both net10.0 and net11.0 βœ…, dotnet new canton-app starts a working Canton project from one command βœ…, and the REST and token-registry clients move to Refit 17 βœ…. A few collection members became read-only and some invalid options now fail at startup, so read the upgrade notes below before bumping.

πŸ’₯ Upgrading from 0.8.1

⚠️ Bump every package to 0.8.2 together, then regenerate your bindings. Delete the generated directory once so files from before the upgrade are cleared.

  • πŸ”Œ Canton.Ledger.Rest, Canton.Ledger.Rest.Client and Splice.Api.Token.Registry.Client require Refit 17.0.0. Code generated by Refit 16 does not link against Refit 17, so restore Refit 17 and rebuild; these packages cannot be mixed with Refit 16. If you build one of our interfaces yourself with RestService.For, call RestService.ForGenerated with the same settings, or reference Refit.Reflection. Requests on the wire are unchanged.
  • πŸ”’ Collections handed out by the runtime and by generated records are read-only. Set<T>.Elements, Map<TKey, TValue>.Entries, NonEmpty<T>.Tl, DamlRecord.Fields, CommandsSubmission.Commands and the List, TextMap and Map fields of generated records now return read-only wrappers. A cast back to T[], HashSet<T> or Dictionary<TKey, TValue> fails and a write through the interface throws NotSupportedException: copy the collection instead.
  • πŸ›‘οΈ The token-registry client treats the registry as untrusted. It no longer follows redirects, bounds every call to 30 seconds and refuses a response body above 16 MiB. Override the timeout with ConfigureHttpClient on the builder that AddSpliceTokenRegistryClients returns.
  • ⏱️ Retry backoff is capped by RetryOptions.MaxDelay, 30 seconds by default. A configuration whose Delay is above 30 seconds must now set MaxDelay too, or options validation fails.
  • 🚦 Timeouts that cannot work fail early. LedgerClientOptions.Timeout of zero or less fails options validation at startup on the gRPC client, as it already did on the JSON client. The snapshot reads throw ArgumentOutOfRangeException for the timeout parameter at the call, for a negative value other than Timeout.InfiniteTimeSpan.

Coming from before 0.8.1? See the [0.8.1] section of the CHANGELOG first.

✨ Highlights

  • 🎯 Two targets, net10.0 and net11.0: a project on either SDK restores the asset built for its own framework, and the Microsoft packages follow it, 10.0.x on net10.0 and 11.0.x on net11.0. A machine with only the .NET 10 SDK still restores, generates bindings and builds.
  • 🧰 dotnet new canton-app: the new Canton.ProjectTemplates package generates a Daml contract, a contracts project that builds it into C# bindings with no JDK, and a console app that uploads the DAR to a LocalNet participant, creates the contract and reads it back.
    dotnet new install Canton.ProjectTemplates
    dotnet new canton-app --name MyCantonApp
  • πŸ†• Bindings compile as C# 14 and C# 15: the generated code is proven to build under the language version of the .NET 10 SDK and of the .NET 11 SDK.
  • 🧩 Collections of Optional generate compilable code: a List, TextMap or Map whose element is an Optional now produces bindings that build.
  • 🧯 Sharper failures in the codegen tools: --root emits output that compiles, --namespace rejects a value that is not a C# namespace before writing anything, and a malformed DAR is refused with an InvalidDataException instead of a NullReferenceException.

πŸ› Fixed

  • πŸ”‘ ClientCredentialsProvider accepts a token response whose expires_in is fractional or a numeric string, and logs only the OAuth error fields of a failed fetch instead of the raw body.
  • ❓ RecoverAsync reports a completion-stream fault as CommitState.Unknown, where it reported CommitState.NotCommitted, whose contract says a retry is safe.
  • 🧾 Canton.Ledger.AspNetCore keeps a participant's error id out of the problem detail, the log and the span unless it is shaped like an error code.

The full list is in the CHANGELOG.

πŸ“¦ What's in the release

All 18 SDK packages ship on the single 0.8.2 version line, Canton.ProjectTemplates being the new one, with the dpm codegen-cs component at oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.8.2. The Splice.* bindings stay generated from Splice 0.10.0 and the Daml.Finance.* bindings from Daml Finance 2.10.0, each versioned after its DAR and built for net10.0, which a net11.0 project consumes as it is. The Daml SDK stays at 3.7.1 and the Ledger API stubs are pinned to Canton 3.7.4.

πŸ”— Links