scripts: devnet testing scripts for USDCx and Splice token-standard#256
scripts: devnet testing scripts for USDCx and Splice token-standard#256salindne wants to merge 1 commit into
Conversation
Adds 10 standalone Go scripts (build tag `ignore`) for probing Canton devnet behavior outside the main API-server flow, and a TLS/ALPN fix to grant-any-party-rights.go so it works against TLS-enabled devnet endpoints (not just local). Scripts are self-contained: each takes flags for config and (where needed) a credentials file, and runs through the existing cantonsdk client. Useful for exercising new ledger features and validating end-to-end USDCx flows before porting into the middleware proper. scripts/testing/: - allocate-standalone-party.go — AllocateExternalParty + write keys to a credentials file; bypasses the middleware DB. - check-party-hosted.go — verify a party is IsLocal on our participant via PartyManagementService.GetParties. - check-holdings.go — query Splice HoldingV1 interface holdings for a given party. - list-all-contracts.go — wildcard ACS query, prints every contract visible to a party with a template + arg summary. - list-packages.go — call PackageService.ListPackages. - find-transfer-rule.go — wildcard query for TransferRule contracts via filters_for_any_party. - inspect-package.go — printable-string extractor over a Canton package archive (useful for discovering choice/module names without LF parsing). - accept-usdcx-transfer.go — direct TransferOffer_Accept template exercise (negative-result reference: confirms the choice is not on the concrete template). - accept-via-interface.go — full reference implementation of the USDCx receive path: registrar choice-context HTTP call, AnyValue encoder, DisclosedContracts builder, TransferInstruction_Accept exercise via Interactive Submission. Validated end-to-end on chainsafe devnet. - create-holder-service-request.go — create a HolderServiceRequest (kept as reference for the xReserve bridge flow; not needed for basic USDCx transfers). scripts/remote/grant-any-party-rights.go: dial with NewTLSWithALPNDisabled when TLS is enabled in config, falling back to insecure when not. Mirrors the SDK ledger client.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #256 +/- ##
=======================================
Coverage ? 32.33%
=======================================
Files ? 127
Lines ? 8968
Branches ? 0
=======================================
Hits ? 2900
Misses ? 5818
Partials ? 250
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces a suite of testing and utility scripts for the Canton middleware, covering party allocation, contract discovery, and USDCx transfer acceptance. It also updates existing scripts to support TLS for gRPC connections. The review feedback correctly identifies multiple instances where the import paths for the Canton V2 API violate the repository style guide; specifically, Rule 1 requires using pkg/canton/lapi/v2 (and its subpackages) instead of pkg/cantonsdk/lapi/v2.
| "time" | ||
|
|
||
| canton "github.com/chainsafe/canton-middleware/pkg/cantonsdk/client" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| canton "github.com/chainsafe/canton-middleware/pkg/cantonsdk/client" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| canton "github.com/chainsafe/canton-middleware/pkg/cantonsdk/client" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| cfgpkg "github.com/chainsafe/canton-middleware/pkg/config" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| cfgpkg "github.com/chainsafe/canton-middleware/pkg/config" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| cfgpkg "github.com/chainsafe/canton-middleware/pkg/config" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| cfgpkg "github.com/chainsafe/canton-middleware/pkg/config" | ||
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2 violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2 with alias lapiv2.
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2" | |
| lapiv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| @@ -33,6 +33,9 @@ import ( | |||
| adminv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2/admin" | |||
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2/admin violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2/admin.
| adminv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2/admin" | |
| adminv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2/admin" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
| "time" | ||
|
|
||
| cfgpkg "github.com/chainsafe/canton-middleware/pkg/config" | ||
| adminv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2/admin" |
There was a problem hiding this comment.
The import path github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2/admin violates the Repository Style Guide (Rule 1). Please use github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2/admin.
| adminv2 "github.com/chainsafe/canton-middleware/pkg/cantonsdk/lapi/v2/admin" | |
| adminv2 "github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2/admin" |
References
- ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. (link)
dhyaniarun1993
left a comment
There was a problem hiding this comment.
Do we want to merge this in main?
Summary
Adds 10 standalone Go scripts (
//go:build ignore) underscripts/testing/for probing Canton devnet behavior outside the main API-server code paths, plus a TLS/ALPN fix toscripts/remote/grant-any-party-rights.goso it works against TLS-enabled devnet endpoints (not just local).The headline script is
accept-via-interface.go— a full reference implementation of the USDCx receive path: registrar HTTP choice-context call, AnyValue ADT encoder, DisclosedContracts builder, andTransferInstruction_Acceptexercise via Interactive Submission. Validated end-to-end against chainsafe devnet 2026-05-06 (10 USDCx received from a Loop wallet).This is a tools-only PR — no library or API server changes. The scripts are self-contained, gated by
//go:build ignoreso they don't affectgo build ./...or test runs.What each script does
allocate-standalone-party.goAllocateExternalParty+ write keys to a credentials file; bypasses the middleware DBcheck-party-hosted.goIsLocalon our participant viaPartyManagementService.GetPartiescheck-holdings.goHoldingV1interface holdings for a given partylist-all-contracts.golist-packages.goPackageService.ListPackagesfind-transfer-rule.goTransferRulecontracts viafilters_for_any_partyinspect-package.goaccept-usdcx-transfer.goTransferOffer_Accepttemplate exercise (negative-result reference — confirms the choice is not on the concrete template)accept-via-interface.gocreate-holder-service-request.goHolderServiceRequest(kept as reference for the xReserve bridge flow; not needed for basic USDCx transfers)TLS/ALPN fix
scripts/remote/grant-any-party-rights.gonow dials withNewTLSWithALPNDisabledwhen TLS is enabled in config, falling back toinsecurewhen not — mirroring the SDK ledger client. Without this, the script can't reach devnet's TLS-fronted gRPC endpoint.Why this matters
accept-via-interface.gois the executable spec for the USDCx receive flow that the middleware needs to support (custodial auto-accept worker + non-custodial dApp-driven accept). It demonstrates:POST {host}/api/token-standard/v0/registrars/{registrar}/registry/transfer-instruction/v1/{cid}/choice-contexts/accept)choiceContextisMap Text AnyValue(notMap Text Textas PR Integrate Transfer Factory Registry API for USDCx transfers #214 assumed) — fullAV_*tag encoder includeddisclosedContractstemplateIdarrives in string form (<pkgHex>:<Module.Path>:<Entity>) andsynchronizerIdis empty (fall back tocfg.Canton.DomainID)Test plan
go build ./...still passes (scripts are gated by//go:build ignore)go test ./...still passes (no library code touched)make lintcleango run scripts/testing/list-packages.go -config config.api-server.devnet-test.yamlreturns >0 packagesgo run scripts/testing/accept-via-interface.go -dry-runprints a registrar response and disclosed-contract count without submitting