Skip to content

feat: add packageIdSelectionPreference and rework batch-delete example#22

Draft
scolear wants to merge 1 commit into
mainfrom
feat/batch-delete-package-preference
Draft

feat: add packageIdSelectionPreference and rework batch-delete example#22
scolear wants to merge 1 commit into
mainfrom
feat/batch-delete-package-preference

Conversation

@scolear

@scolear scolear commented Jun 24, 2026

Copy link
Copy Markdown
Member

What

Adds a packageIdSelectionPreference field to Submission and reworks the
delete_executed_transfers example to use it.

This is the work-in-progress that was sitting uncommitted on the old
I11-endpoint-migration branch. The endpoint migration itself already landed on
main (squash-merged as #13), so this PR carries only the remaining follow-on
changes, replanted onto current main.

Changes

common

  • Add Submission.package_id_selection_preference (serialized as
    packageIdSelectionPreference, omitted when empty). Lets callers pin Canton's
    package-name resolution to specific package hashes instead of relying on its
    default smart-upgrade selection — needed when a participant has multiple vetted
    versions of a package and the choice you need only exists in one of them.

examples/delete_executed_transfers

  • Call CBTCGovernanceRules_BatchDeleteExecutedTransfers.
  • Pass RegistrarService as a choice argument with read-as visibility on the
    decentralized party — no disclosed_contracts blob required.
  • New PACKAGE_ID_PREFERENCE env var, fed into packageIdSelectionPreference.
  • Configurable BATCH_SIZE with automatic bisection on PACKAGE_SELECTION_FAILED
    (a failed batch is split in half and retried, so a few bad contracts don't sink
    the whole batch).
  • Append successfully-processed and individually-failed contract IDs to CSV files
    (PROCESSED_CSV / FAILED_CSV) for safe, resumable re-runs.

Replant notes

Rebased cleanly onto current main; verified the following improvements that
main made after the WIP's base were preserved (not reverted):

Verification

  • cargo clippy -p examples -p common --all-targets — clean, no warnings.
  • cargo fmt was not run repo-wide: main is not rustfmt-clean (23 dirty
    files under the pinned toolchain) and there's no fmt CI gate. Only the reworked
    example file was formatted, to keep this diff focused.

Add Submission.package_id_selection_preference (serialized as
packageIdSelectionPreference) so callers can pin Canton's package-name
resolution to specific package hashes instead of its default smart-upgrade
selection.

Rework the delete_executed_transfers example to use it:
- call CBTCGovernanceRules_BatchDeleteExecutedTransfers
- pass RegistrarService via a choice arg with read-as visibility (no
  disclosed_contracts blob)
- configurable BATCH_SIZE with automatic bisection on PACKAGE_SELECTION_FAILED
- append processed/failed contract IDs to CSV files for safe re-runs
@scolear scolear marked this pull request as draft June 24, 2026 12:03
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.

1 participant