Repository navigation
Writes you can reason about: atomic batches, recovery from "unknown", and ProblemDetails for your API #128
monsieurleberre
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Three pieces of 0.8.0 answer one question, "what happened to my write?"
1. Several commands, one transaction.
CommandBatchgives each generated choice or template payload you add a typed handle, andTrySubmitBatchAsynccommits all of them or none:results.Get(handle)returns that command's choice result or createdContractId<T>. A rejection names every command, hereAsset.Create ×2, Marker.Mint. If a result cannot be decoded, the outcome isCommittedUndecodable: the batch is on the ledger, so do not resubmit it. It works over gRPC, the JSON Ledger API andFakeLedgerClient.2. Resolving "unknown". When a write fails with
CommitState.Unknown, the participant may have accepted it.RecoverAsyncreads the completion stream to find out:It returns
RecoveryOutcome.Committedwith the update id,Rejectedwith the status, orLost. Capture the ledger end withGetLedgerEndAsyncbefore you submit, and take the command id fromLedgerOperationException.CommandId.maxRecordTimeis your submit time, plus the synchronizer'sledgerTimeRecordTimeTolerance(60 seconds by default), plus a margin for clock skew. The method's documentation lists the known gaps.3. Honest HTTP status codes.
Canton.Ledger.AspNetCoreturns aLedgerOperationExceptionfrom a controller or minimal-API handler into an RFC 9457ProblemDetailsresponse:Contention or a vanished contract is
409. A command that committed but whose result could not be used is202withcommandIdandupdateId, never a500, so the caller re-reads instead of retrying. An unknown outcome is502. Responses never carry Daml error metadata, so they do not leak party or contract ids.Tell us how it went and anything you'd improve. Bugs are easiest to track as issues.
All reactions