Skip to content

v0.3.3 - review fixes, onboarding on protocol 37, and a Scan client

Latest

Choose a tag to compare

@dmitryk-cf dmitryk-cf released this 27 Nov 10:53
ec21fc7

Version 0.3.3: the findings filed against 0.3.2 (#18–#22, #26), the three pull requests from Equilibrium's review (#23–#25), onboarding on protocol version 37, and a client for Splice Scan. Additive to the public API; cargo update brings it to every project on 0.3.

The findings filed against 0.3.2 by Silvana (#18–#22, and the rest of the
review they came from) and by Rumble Fish (#26), fixed, and the three pull
requests from Equilibrium's review of 0.3.2 (#23–#25), merged. One more fix
came out of running them: external-party onboarding did not work at all
against a participant on protocol version 37, which is what the Canton
Network DevNet runs now.

The behaviour changes are listed first because they can turn a call that
succeeded into one that is refused. Each refuses what should not have been
accepted or signed for, and the public API only grows, so they ship as a
patch: cargo update brings them to every project on 0.3.

Changed — behaviour

  • An external-party onboarding reply is accepted only if it is the
    onboarding of the caller's own key
    (#22, reported by Silvana).
    AdminClient::generate_external_party_topology returns a hash the caller
    signs, and the signature authorizes whatever the participant's reply
    contains. The reply was checked too loosely for the single
    PartyToParticipant transaction that Canton 3.4.9 and later send: an extra
    signing key, an extra hosting participant, or a party in a namespace the
    participant chose all passed. A participant, or anything able to alter its
    reply, could add a key that submits as the party or a host that receives its
    transactions, and the allocation looked normal to the caller. The reply is
    now held to what Canton generates for the request this SDK sends:

    • the key's fingerprint is computed from the caller's key
      (SHA-256 over purpose 12 and the key, as Canton's Fingerprint.create
      does; for Ed25519 over the 32-byte key whether it was given raw or as
      DER), not taken from the reply, and the party must be
      <hint>::<that fingerprint>;
    • there is exactly one transaction, adding one PartyToParticipant
      mapping for that party;
    • the party is hosted by one participant, with confirmation permission,
      a threshold of one, and not in an onboarding state;
    • the party's signing keys are the caller's key alone, with a threshold
      of one, registered for the three uses Canton gives an external party's
      key. Keys are compared by spec and key material, since Canton returns an
      Ed25519 key as DER also when it was sent raw;
    • the transaction has serial 1, a party's first hosting, as Canton
      generates it and requires it again when the transaction is submitted;
    • the transaction carries nothing this build does not read: it must
      re-encode to the bytes that will be signed, so a field a later Canton adds
      is refused rather than signed for unseen.

    Anything else is Error::UnexpectedResponse. The three-transaction reply of
    Canton before 3.4.9 is refused; the supported range starts at 3.5. A public
    key whose fingerprint cannot be computed (an Ed25519 key that is not 32
    bytes) is Error::InvalidRequest. So is a signature that names another key
    than the one the onboarding registers, which allocate_external_party now
    refuses before sending.

  • A max record time is signed for, or refused (#26, reported by Rumble
    Fish). Prepare::with_max_record_time promises that past the deadline the
    participant refuses the transaction. That holds only if the signature covers
    the deadline, and hashing scheme V2, the default, does not hash it: an
    executing participant can move or drop it and the signature still verifies.
    A Prepare with a max record time now asks for V3, which hashes it, unless
    a scheme was chosen. One that sets a max record time and chooses V2 is
    refused as Error::InvalidRequest before it is sent, and
    hashing::hash_prepared_transaction refuses a V2 transaction that carries
    one, as Digital Asset's own hashing library does. The prepared transaction
    must then carry exactly the deadline that was asked for: one that comes back
    without it, with another, or with one nobody asked for is refused as
    Error::UnexpectedResponse before anything is signed, since hashing the
    field is no use if the participant chose its value. A deadline finer than a
    microsecond, which is what a SystemTime gives on Linux, is rounded down to
    the microsecond before it is sent, as Canton would round it. V3 needs a
    synchronizer at protocol version 35 (Canton 3.5.1), so
    on an older one a max record time cannot be used. Without a max record time
    nothing changes.

  • Prepare now checks the command id and acting parties in the response
    (#24, contributed by Equilibrium).
    The participant dedups on the command id in the prepared transaction's
    submitter_info, not the one in the execute request. When the two differed,
    Prepared::change_id named a command that was never filed, and
    await_completion waited for a completion that never arrives. The hash check
    did not catch it. A participant that changes the command id and hashes the
    changed metadata still passes. prepare_submission now compares both
    against the request and refuses a mismatch as Error::UnexpectedResponse.
    Acting parties are compared as a set.

  • A token fetch that fails in transport is no longer reported as a
    credential rejection
    (#25, contributed by Equilibrium). Error::Auth's
    doc says a token-transport failure surfaces as Error::Connection or
    Error::Http, and the comment above the token fetch says the same. In 0.3.2
    a TLS certificate that could not be verified, and a request that could not
    be built, came back as Error::Auth anyway, and an operator reading
    "authentication failed" might rotate a working secret. Both are
    Error::InvalidRequest now. An unreachable endpoint is Error::Connection
    and a deadline Error::Timeout, as before, and a 401 or 403 stays
    Error::Auth. Two corrections were made on top, in this fetch and in the
    registry, Scan and JSON clients, which read the same verdict off the error
    text: a peer that hangs up during the TLS handshake is a retriable
    Error::Connection, not a certificate failure (the registry client
    reported it as permanent), and the request URL is no longer part of the
    text that is read, so a URL with "certificate" in it does not decide the
    verdict. The URL is still in the message, redacted.

  • A contract id must be lower-case hex (#18). See Fixed.

Added

  • A client for Splice Scan and a validator's scan-proxy (#21, requested
    by Silvana): canton_token::scan::ScanClient, canton::token::scan through
    the facade.
    • ScanClient::new asks a Scan at <scan>/api/scan;
      ScanClient::through_validator asks a validator's scan-proxy at
      <validator>/api/validator, which answers from several Super Validators'
      Scans. The reads the proxy does not serve are refused before they are
      sent.
    • Contracts ready to disclose: amulet_rules(),
      latest_open_mining_round() (the highest-numbered round whose opening
      time has passed, as Splice's selectLatestOpenMiningRound picks, not the
      lowest, which is archived next) and transfer_preapproval_by_party(party),
      with disclosed() for gRPC and disclosed_json() for the JSON Ledger
      API; and featured_app_right(provider), whose contract comes without a
      synchronizer and is disclosed with disclosed(synchronizer_id).
    • The external API: dso(), dso_party_id(), scans(),
      open_and_issuing_mining_rounds(), closed_rounds(),
      member_traffic_status(), updates() and update(), events(),
      acs_snapshot_timestamp(), acs_snapshot(), holdings_state(),
      holdings_summary(), and the name service. get_json and post_json
      reach the rest.
    • Two of those calls, featured_app_right and
      transfer_preapproval_by_party, reach endpoints Splice tags internal
      when asked of a Scan directly. They need
      ScanClient::with_internal_endpoints() there, and nothing through a
      validator. amulet_rules() needs it nowhere: a Scan is asked for the
      rules through the external API, with the DSO's other contracts.
    • The same hardening as the registry client: no redirects, a bounded reply,
      percent-encoded path segments, a 30-second deadline.
    • Written against the documents of Splice 0.10.3. dso() asks /v1/dso,
      which is 0.10's, and falls back to the /v0/dso every release serves.
      The two snapshot page reads (acs_snapshot, holdings_state) need
      Splice 0.7.5, where their paths appeared, and holdings_summary needs
      0.6.3. The rest is served by Splice 0.6.0 and later.
    • Not included: comparing several Scans' answers. A Scan asked directly is
      one Super Validator's word; the scan-proxy is the route that compares.
  • Bearer tokens for RegistryClient and ScanClient (#21): with_token
    and with_token_source, which takes a canton_auth::TokenProvider. The
    registry client can now use the registry routes a validator serves under
    /api/validator/v0/scan-proxy, which authenticate.
  • Onboarding in two sittings (requested by Silvana). When the signature
    comes later (a wallet approval, a signing queue, a restart in between), the
    topology is stored, and what was stored is input again when it is read
    back. ExternalPartyTopology::from_parts(party_id, transactions, key, expected) rebuilds it and runs the checks
    generate_external_party_topology ran on it again, recomputing the
    fingerprint and the multi-hash rather than reading them back. The party's
    hint is the one thing it cannot check, having only the stored party id to
    go by.
    AdminClient::allocate_external_party_with_signature takes the signature
    that was made in between.
  • The host can be held to a participant: ExpectedHosting::participant(uid)
    with AdminClient::generate_external_party_topology_with and with
    from_parts. The SDK knows the endpoint it called, not which participant
    answers there, so which participant hosts the party can be checked only
    against an id the caller supplies. ExternalPartyTopology::hosting_participant()
    reports the host either way.
  • PublicKey::fingerprint() and PublicKey::is_same_key() in canton-signer:
    Canton's fingerprint of a key, computed from the key, and a comparison of two
    keys whichever format each is written in.
  • A live test that commits a transaction with a max record time, and the
    Scan live suite (canton-token's scan_live), which the LocalNet workflow
    now runs.
  • A CI check, in a crate of its own outside the workspace, that builds with
    both rustls crypto providers and none installed (#20).
  • Lints against panics on input (suggested by Silvana), on for the whole
    workspace: clippy::panic, unreachable, todo, unimplemented,
    indexing_slicing and string_slice, and arithmetic_side_effects in the
    two modules that read a participant's bytes before signing (the hasher and
    the onboarding check). The two dozen sites they flagged outside tests are
    rewritten with checked access.
  • Mutation tests for the hasher and for the onboarding check: tens of
    thousands of overwritten, cut and extended inputs from a fixed generator,
    none of which may panic, stall, or in the onboarding check's case pass.
    The first run of the onboarding one found the serial and the key's uses
    unread. fuzz/ holds cargo-fuzz targets for the same two, for Daml value
    decoding and for DAR reading.

Fixed

  • External-party onboarding failed against a participant on protocol
    version 37.
    From protocol version 37 (Canton 3.7) a topology transaction
    is written in a newer format, in which a hosting participant carries a state
    instead of an onboarding flag and the party's signing keys are a different
    field. The SDK decoded every onboarding transaction in the older format, so
    generate_external_party_topology returned Error::UnexpectedResponse
    ("does not decode") on such a participant, which the Canton Network DevNet
    is as of Canton 3.7.3. Both formats are now read, by the format the
    transaction names, and a format this build does not know is refused.

  • A contract id that is not ASCII panicked the hash check (#18, reported
    by Silvana). The id was sliced two bytes at a time, and a multi-byte
    character fell across a slice, so a prepare response with such a contract id
    panicked prepare_submission and the public hashing functions instead of
    returning an error. The id is now decoded byte by byte. It is also held to
    what Canton accepts, lower-case base16: an id written with upper-case digits
    or a leading + used to decode and is now refused.

  • Hashing a prepared transaction could take exponential time (#19,
    reported by Silvana). A node listed by two parents was hashed once per
    listing, so a transaction whose nodes each list the next one twice cost two
    to the power of its depth: seconds at 23 levels, and no end at 60. A crafted
    prepare response could hold a runtime worker that way. Each node is now
    hashed once per transaction, which changes no hash, and a node that is its
    own descendant is refused.

  • An error reply with a long body lost its status in the registry
    client. A body over the 64 KiB kept for the message was refused for its
    size, so a gateway's 503 page came back as a permanent "body above the
    limit" rather than a retriable 503. An error body is now cut at the limit
    and the status kept.

  • A wss connection with no CA configured, on a machine with no root
    certificates, says so (Error::InvalidRequest) rather than failing every
    handshake as an unknown issuer.

  • A token fetch that times out while the body is read is Error::Timeout,
    as one that times out earlier already was.

  • A retry or reconnect delay could overflow and panic. Duration * u32
    panics when the product does not fit. The retry backoff doubled that way and
    the resumable streams multiplied their step by the reconnect count, on both
    transports, so a RetryConfig with a very large backoff, which is how "no
    cap" tends to be written, brought the caller's task down. Both saturate now.

  • TLS setup panicked in an application with two rustls crypto providers
    (#20, reported by Silvana). canton-pqs (tls) and canton-ledger (ws,
    when no TLS configuration was given) built their rustls configuration with
    ClientConfig::builder(), which panics when both ring and aws-lc-rs are
    compiled in and the application installed neither. The SDK enables only
    ring, but aws-lc-rs is a rustls default feature, so another dependency
    of the application can add it. Both now name the provider: the one the
    application installed for the process when there is one, as the gRPC and
    HTTP transports already do, and ring otherwise. A wss stream always gets
    the SDK's own connector, with the platform's root certificates.

  • The metadata hash depended on the order two fields arrived in (#23,
    contributed by Equilibrium). Canton
    hashes the acting parties as a SortedSet. It hashes the disclosed contracts
    as a SortedMap keyed by contract id. Order and repetition are not part of
    the hash. The hashing functions took both in wire order. The hashes still matched
    because PreparedTransactionEncoder sorts both before sending. The proto
    does not require that sort. A participant that skips it makes the SDK
    compute a different hash. The SDK then refuses to sign a valid transaction.
    The acting parties are now sorted and deduplicated. The disclosed contracts
    are now keyed by contract id. The hashes in Canton's own vectors are
    unchanged because their inputs are already sorted.

  • The lockfile, which canton-codegen-cli installs with under --locked,
    moves past the RustSec advisories published since 0.3.2: pulldown-cmark
    0.13.6 (RUSTSEC-2026-0414) and url 2.5.9 (RUSTSEC-2026-0592). Three more
    against zip (RUSTSEC-2026-0429, -0545, -0548) are fixed only in zip 9 and
    concern what canton-lf does not use: extract(), AES entries (zip is
    built with deflate alone) and ZipStreamReader. Moving to zip 9 changes
    a public error type and waits for 0.4, as before.

Documentation

  • Scan and the validator's scan-proxy: a guide page for the new client.
  • A documentation site, built from book/ with mdBook and published to
    GitHub Pages: guides for getting started, local development, reading the
    ledger, codegen, the token standard, interactive submission, PQS, and the
    admin API and telemetry. The compatibility matrix, the ADRs, the changelog
    and the project files are copied in at build time, so the site and the
    repository cannot drift apart, and CI fails on a link inside it that points
    at nothing.
  • MAINTENANCE.md: what is maintained, in what order (security fixes,
    then critical bugs, then new Canton releases), how releases are made, and
    what is not promised.
  • SECURITY.md: a report is acknowledged within five business days while
    the Canton Dev Fund grant runs (was three), and on a best-effort basis after
    it.
  • Corrected while writing the guides:
    • turning off the facade's default features drops the in-memory key type,
      not ring, which the TLS stack uses;
    • codegen runs ahead of time, not from a build script;
    • JsonClient::with_max_decoding_message_size also caps HTTP response
      bodies;
    • PQS Predicate::eq compares the stored text, and compare with Op::Eq
      does no numeric cast (only the ordered operators do), so numeric equality
      across scales needs Op::Ge plus Op::Le;
    • the compatibility matrix's live-test counts and its LocalNet settlement
      row were stale.