Skip to content

Add ext txn hash to update api#4199

Open
jagathweerasinghe-da wants to merge 3 commits intomainfrom
wee/add_ext_txn_hash_to_update_api
Open

Add ext txn hash to update api#4199
jagathweerasinghe-da wants to merge 3 commits intomainfrom
wee/add_ext_txn_hash_to_update_api

Conversation

@jagathweerasinghe-da
Copy link
Contributor

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

[ci]

Signed-off-by: Jagath Weerasinghe <jagath.weerasinghe@digitalasset.com>
[ci]

Signed-off-by: Jagath Weerasinghe <jagath.weerasinghe@digitalasset.com>
[ci]

Signed-off-by: Jagath Weerasinghe <jagath.weerasinghe@digitalasset.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for propagating an externally-signed transaction hash through Scan’s update history HTTP API encoding/decoding and API schema, so clients can correlate external submissions with committed transactions.

Changes:

  • Extend update-history transaction encodings to include externalTransactionHash (HTTP string ↔ Ledger API ByteString).
  • Plumb externalTransactionHash through v1→v2 update conversion in the Scan HTTP handler.
  • Update OpenAPI schema and adjust tests to cover the new field.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/admin/http/ScanHttpEncodings.scala Adds encoding/decoding of externalTransactionHash between Ledger API transactions and HTTP update-history payloads.
apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/admin/http/HttpScanHandler.scala Ensures the hash is preserved when converting update-history transactions to the v2 representation.
apps/scan/src/main/openapi/scan.yaml Documents the new external_transaction_hash field on update-history transaction schemas.
apps/scan/src/test/scala/org/lfdecentralizedtrust/splice/scan/admin/http/ScanHttpEncodingsTest.scala Extends round-trip encoding tests to include an external transaction hash.
apps/common/src/test/scala/org/lfdecentralizedtrust/splice/store/StoreTestBase.scala Updates test transaction builder to accept an external transaction hash.
Comments suppressed due to low confidence (4)

apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/admin/http/ScanHttpEncodings.scala:47

  • hexHashOption hand-rolls ByteString -> hex encoding via string formatting, while decoding uses HexFormat.parseHex. There is already a shared com.digitalasset.canton.util.HexString utility in the codebase for hex encoding/decoding; using it here would keep encoding/decoding symmetric and avoids maintaining custom formatting logic.
  private def hexHashOption(extTxnHash: ByteString): Option[String] = {
    if (extTxnHash.isEmpty) {
      None
    } else {
      Some(extTxnHash.toByteArray.map("%02x" format _).mkString)
    }

apps/scan/src/main/scala/org/lfdecentralizedtrust/splice/scan/admin/http/ScanHttpEncodings.scala:271

  • Decoding externalTransactionHash via HexFormat.of().parseHex will throw an IllegalArgumentException on invalid input, which will bubble up without context. Consider using the existing hex parsing utility (e.g., HexString.parseToByteString) and failing with a clearer error message if the string is not valid hex.
            http.externalTransactionHash
              .map(hex => ByteString.copyFrom(HexFormat.of().parseHex(hex)))
              .getOrElse(ByteString.EMPTY),

apps/scan/src/main/openapi/scan.yaml:2388

  • Grammar: "For transaction externally signed" is ungrammatical/ambiguous. Consider rewording to something like "For externally signed transactions" (and optionally clarify that the value is a hex-encoded hash).
            For transaction externally signed, contains the external transaction hash
            signed by the external party. Can be used to correlate an external submission with a committed transaction.

apps/scan/src/main/openapi/scan.yaml:2451

  • Grammar: "For transaction externally signed" is ungrammatical/ambiguous. Consider rewording to something like "For externally signed transactions" (and optionally clarify that the value is a hex-encoded hash).
            For transaction externally signed, contains the external transaction hash
            signed by the external party. Can be used to correlate an external submission with a committed transaction.

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.

2 participants