Repository navigation
fix(identity): keep back the balance the network needs for a transfer out of an identity - #1083
Conversation
… out of an identity Max and the check made before sending kept back the minimum fee of the network: 100,000 credits for a transfer to another identity and 6,500,000 for a transfer to a Platform address. The network accepts a transfer only while the identity holds its own advance estimate of the fee above the amount, about 8.76 million and 17.3 million credits, so a Max transfer passed the check and was refused after it was sent. Both estimates now return that balance with a 10% margin, and never less than the minimum fee. The figures were read from Platform's engine at the pinned revision and agree with two refusals seen on testnet to 0.02%; the design note records the method and the tables. The network charges less than it wants kept back, and the rest stays in the identity. The estimate for funding an address from the wallet was derived from the address transfer estimate; it keeps its own figure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit 96fd12c) · triage: low · Phase 2 only (no Phase 1 for this repository) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (no Phase 1 for this repository)
The exact-head diff and surrounding callers support the supplied clean reviews: identity transfers now reserve the higher advance balance requirement with a margin, while retaining multiplier scaling, minimum-fee floors, and the previous wallet address-funding estimate. No actionable in-scope defects were identified; the documented shared Send-screen limitation predates this change. Validation was static only: the supplied CI snapshot shows Clippy and the Platform pin guard passing, with the Test Suite still in progress.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The diff makes a small, contained change to fee-reserve arithmetic in src/model/fee_estimation.rs with focused regression tests, rather than a large or intricate change to funds movement. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort medium); agentphase2-reviewer
|
Ready for review — files with no dedicated owner: lklimek. |
TL;DR: Sending credits out of an identity kept back far less than the network requires, so a Max transfer passed the app's own check and was then refused by the network. The app now keeps back what the network actually asks for, with a small margin, for transfers to another identity and to a Platform address.
User story
As a user moving credits out of my identity, I want Max and the check before sending to leave what the network needs, so that a transfer the app accepts is not refused after I confirm it.
Scenario
Base flow
Actual behavior
The form fills almost the whole balance and says about 0.000001 DASH is reserved for fees. After confirmation the network refuses the transfer: "Not enough balance. You have 0.0101 DASH but this operation requires 0.0101865572 DASH."
Expected behavior
Max leaves about 0.000096 DASH for a transfer to another identity and about 0.000192 DASH for a transfer to a Platform address, and an amount that leaves less is refused before it is sent. The network then charges less than that (about 0.00003 DASH for a transfer to another identity); the rest stays in the identity.
Detailed discussion
Found by driving the application on a real display against testnet. The same behaviour exists on
v1.0-devin the identity transfer screen; nothing here depends on #1074.What was done
src/model/fee_estimation.rs:estimate_credit_transfer()andestimate_credit_transfer_to_addresses(n)returned Platform's minimum fee (100,000 and 6,500,000 credits). Platform accepts a transfer out of an identity only while the balance holds, above the amount, its own advance estimate of the cost (validate_fees_of_event_v0), which is far higher than the minimum fee and higher than what it finally charges. Both functions now return that requirement with a 10% margin, never less than the minimum fee, scaled by the fee multiplier:nPlatform addresses: (11,261,680 + 6,176,980 × n) × 1.10, i.e. 19,182,526 credits for one address.docs/ai-design/2026-10-13-identity-transfer-fee-reserve/README.mdrecords where the figures come from.Platform has no client-side function for this requirement (dashpay/platform#5265 asks for one), so the figures are fitted constants, as for username registration in #1075. They were read from Platform's engine offline at the pinned revision (9f7ed169), each confirmed by a refusal one credit below, for protocol versions 11 to 14, ECDSA and BLS keys, and one to three addresses. The engine agrees with the two refusals seen on testnet to 0.02%. The requirement does not depend on the amount for a transfer to an identity; for an address it rises once by 109,600 credits per address when the address receives 2,147,483,648 credits or more, and the constants are fitted to the higher figure.
Known limitations:
v1.0-devthe wallet send form uses the identity estimate when the source is an identity and the destination a Platform address, so there it keeps back 0.000096 DASH instead of 0.000192 DASH and a Max transfer can still be refused. feat(identity): align Home and reuse identity-bound send flows #1074 makes that form use the address estimate; the identity transfer screen already does.Testing
Breaking changes
None.
Prior work
🤖 Generated with Claude Code
https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
🤖 Co-authored by Claudius the Magnificent AI Agent
PR Hygiene ·
96fd12cCHANGELOG.md,docs/ai-design/2026-10-13-identity-transfer-fee-reserve/README.md,src/model/fee_estimation.rs) — lklimekWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit