Skip to content

Share the one-time funding-role definition with the asset-lock writer #6111

Open

Description

@thepastaclaw

PastaClaw flagged this while reviewing #5210, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.

Share the one-time funding-role definition with the asset-lock writer (suggestion)

Where: packages/rs-platform-wallet-storage/src/sqlite/schema/core_pool.rs:556-572 at ce03450e2daa:

/// Labels of the accounts whose keys each fund one asset lock.
///
/// Such a key leaves the wallet — an invitation exports it — and never shows
/// up as a coin, so the `used` flag or reservation on its pool row is the
/// only record that it is gone. The set is the one the wallet snapshots after
/// an asset-lock build (`persist_asset_lock_account_pools` in
/// `rs-platform-wallet`'s `wallet/asset_lock/build.rs`), which this crate
/// cannot name from there; `one_time_funding_labels_match_the_asset_lock_writer`
/// holds the two together.
const ONE_TIME_FUNDING_LABELS: [&str; 6] = [
"identity_registration",
"identity_topup",
"identity_topup_unbound",
"identity_invitation",
"asset_lock_address_topup",
"asset_lock_shielded_topup",
];

ONE_TIME_FUNDING_LABELS independently reproduces the funding-account classification in wallet/asset_lock/build.rs::persist_asset_lock_account_pools. The sets currently agree, but their connection is enforced by a test that reads and parses the private writer's source syntax. This makes maintenance of the fail-closed restoration rule depend on another crate's implementation text rather than a typed wallet-domain contract. Export a shared AccountType predicate or equivalent classification API from platform-wallet's asset_lock module and consume it in both paths. Keep database labels, coordinate validation and Strict/Recovery handling in SQLite; translating the shared roles through account_type_db_label removes the parallel semantic lists without moving backend policy into the wallet layer.

Origin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions