fix(ledger): emit LF-v2 #package-name references for --template filters - #262
Closed
srikanth-bitdynamics wants to merge 1 commit into
Closed
fix(ledger): emit LF-v2 #package-name references for --template filters#262srikanth-bitdynamics wants to merge 1 commit into
srikanth-bitdynamics wants to merge 1 commit into
Conversation
BuildTemplateFilters put the user's package selector straight into
TemplateId.PackageId, which a Daml-LF-v2 / Splice 0.6.x participant
rejects in every documented form: an empty package id ("Module:Entity"),
a bare name, or a concrete id on a package-name-scoped participant. Only
the LF-v2 "#name" reference resolved.
Normalise the selector via packageRef: a bare "pkg-name:Module:Entity"
becomes "#pkg-name" so the participant resolves it to the highest vetted
version; a 64-hex id stays an exact pin; an already-"#"-prefixed value
passes through. The shared ledger package backs both the CLI
(contracts/tx) and the Web UI Explorer handlers, so both surfaces get
the fix. Flag help, the UI 400 hint, and docs/explorer.md now show the
"#pkg-name:Module:Entity" form (quoted, since a bare leading # is a
shell comment).
Also fix the related wart: --template without --party fell back to the
any-party wildcard and PermissionDenied on Splice's default user-id
tokens. resolveDefaultParties (CLI) and the transactions handler (UI)
now resolve the JWT's own parties in that path too, applying the
template per party, mirroring the flag-less default.
Collaborator
Author
|
Superseded by #263 (branch renamed to fix/template-package-name-refs; same commit). |
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.
Problem
BuildTemplateFiltersput the user's package selector straight intoTemplateId.PackageId, but against a Daml-LF-v2 / Splice 0.6.x participant that fails in every documented form (verified live on instancedemo, app-user participant):Splice.Amulet:Amulet(2-part)Daml-LF Package ID is empty<hex-id>:Splice.Amulet:Amuletexpected a package name(this participant is package-name-scoped)splice-amulet:Splice.Amulet:Amulet(bare name)expected a package name#splice-amulet:Splice.Amulet:AmuletOnly the LF-v2
#-prefixed package-name reference resolves — but the code and its own doc comment claimed the bare forms were package-name matches.Fix
packageRefnormalisation (internal/canton/ledger/filter.go): a barepkg-name:Module:Entitybecomes#pkg-name(participant resolves it to the highest vetted version); a concrete 64-hex id stays an exact pin; an already-#-prefixed value passes through. Applied at the singlePackageIdassignment.ledgerpackage backs both the CLI (contracts/tx) and the Web UI Explorer handlers, so both get the fix from one change.--templateflag help (all sites + thelslong description), the UI400hint, the parse-error message, anddocs/explorer.mdnow show#pkg-name:Module:Entity— quoted, since a bare leading#is a shell comment.--templatewithout--partyfell back to the any-party wildcard and PermissionDenied on Splice's default user-id tokens.resolveDefaultParties(CLI) and the transactions handler (UI) now resolve the JWT's own parties in that path too, applying the template per party — mirroring the flag-less default. The now-deadtemplatesparam was dropped fromresolveDefaultParties.Note: the bare 2-part
Module:Entityform still emits an emptyPackageId(it has no name to reference) and remains non-functional on LF-v2 — docs/help steer users to the#pkg-nameform.Tests
internal/canton/ledger/filter_test.gotable test: 2-part name-only →"", 3-part name →#name, 3-part#name→ unchanged, 3-part hex → exact pin, plusisHexPackageIDedges.FiltersByPartywith#-normalised template attached per party.go build ./...,go vet,gofmt, andgo test ./...all pass.