Repository navigation
fix(platform-wallet): classify asset locks funding foreign credits as outgoing - #5787
Draft
Claudius-Maginificent wants to merge 4 commits into
Draft
Claudius-Maginificent wants to merge 4 commits into
Claudius-Maginificent wants to merge 4 commits into
Conversation
Skeleton commit for the follow-up to #5150 that classifies asset locks funding foreign Platform credit outputs as outgoing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
8 of 14 tasks
Collaborator
|
🕓 Review not started yet because this PR is a draft.
Commit df0c158. Normal review starts when eligible; priority review starts as soon as a slot is available. |
…eys as outgoing `wallet_direction` called every asset lock that spends wallet inputs and pays no external ordinary output `Internal`, without looking at the payload's credit outputs. A lock whose credits pay keys the wallet does not own moves value out of the wallet and is now `Outgoing`; it is `Internal` only when every credit pays a key of one of the wallet's own (non-contact) accounts. The net amount is unchanged. The decision stays in one place: `wallet_accounting` takes the owned credit scripts and both callers supply them from wallet knowledge. - Live projection: the wallet's in-memory address pools, read under the same guard as the projected slices. - SQLite repair: the persisted `core_address_pool` rows. The live projection emits the owning keys (unused ones as `addresses_derived`, used ones as `addresses_marked_used`), and the store inserts their pool rows before the record and its repair, never rewriting a stored row. A credit key the wallet derived past its persisted snapshot therefore cannot make the repair read the wallet's own lock as `Outgoing`. `asset_lock_credit_outputs` is the shared accessor for the payload's credit outputs. `test_support::fold_wallet_records` takes the owned credit scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e live and SQLite paths - Emit a credit key as a derived address only while it is `Available`. Hosts store a derived entry as unused, so a reserved key sent that way lost its reservation; used and reserved keys now go out as marked-used entries carrying their state. - Count a credit as owned live only when its key is emitted as evidence, so an available key with no ECDSA public key is not claimed by the live projection while the SQLite repair cannot see it. - Exclude `platform_payment` pool rows from the repair's ownership set: the live projection reads key-wallet's `all_accounts()`, which holds no PlatformPayment pools. - Skip, with a warning, a credit-key evidence row that contradicts stored key material instead of failing the whole Core write; pool snapshots still fail on a conflict. - Point the `wallet_direction` docs at the Swift mirror in #5417 rather than a Swift function this branch does not have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Swift's history reconciliation in #5417 calls the Rust rule rather than reimplementing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
TL;DR
What this does: Shows an asset lock as a payment when it funds someone else's Platform credits, instead of as a transfer within the wallet.
Value: Wallet history no longer labels money sent to another party as moving between the wallet's own accounts.
Risks: Work in progress. The amount shown is already correct; only the direction label changes. No consensus change.
Issue being fixed or feature implemented
Follow-up to #5150, addressing its review threads on asset-lock direction (CodeRabbit, thepastaclaw).
As a wallet user, I want an asset lock that pays another party's Platform credits to appear as outgoing, so my history does not present it as a self-transfer.
Actual behavior
An asset lock spending the wallet's coins, with no ordinary output leaving the wallet, is labelled
Internaleven when its credit outputs pay keys the wallet does not own. The wallet's own builder never produces this shape; it requires an externally built transaction signed with the wallet's keys.Expected behavior
The lock is
Internalonly when the wallet owns every credit output; otherwise it isOutgoing.What was done?
Work in progress. Planned:
How Has This Been Tested?
Pending — foreign-credit regression tests for live accounting and SQLite repair.
Breaking Changes
None expected. To be confirmed once the public
wallet_direction/wallet_accountingsignatures settle.Checklist:
🤖 Generated with Claude Code
🤖 Co-authored by Claudius the Magnificent AI Agent