Open
Conversation
[ci] Signed-off-by: Jagath Weerasinghe <jagath.weerasinghe@digitalasset.com>
[ci] Signed-off-by: Jagath Weerasinghe <jagath.weerasinghe@digitalasset.com>
Contributor
There was a problem hiding this comment.
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 APIByteString). - Plumb
externalTransactionHashthrough 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
hexHashOptionhand-rolls ByteString -> hex encoding via string formatting, while decoding usesHexFormat.parseHex. There is already a sharedcom.digitalasset.canton.util.HexStringutility 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
externalTransactionHashviaHexFormat.of().parseHexwill throw anIllegalArgumentExceptionon 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Cluster Testing
/cluster_teston this PR to request it, and ping someone with access to the DA-internal system to approve it./hdm_teston this PR to request it, and ping someone with access to the DA-internal system to approve it.PR Guidelines
Fixes #n, and mention issues worked on using#nMerge Guidelines