Skip to content

test(wallet): add cross-wallet top-up isolation e2e coverage - #956

Draft
Claudius-Maginificent wants to merge 1 commit into
v1.0-devfrom
test/cross-wallet-topup-e2e
Draft

test(wallet): add cross-wallet top-up isolation e2e coverage#956
Claudius-Maginificent wants to merge 1 commit into
v1.0-devfrom
test/cross-wallet-topup-e2e

Conversation

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

TL;DR: Adds a live-testnet end-to-end test proving cross-wallet identity top-up no longer corrupts the paying wallet — regression coverage for a fix (#954) that merged without its test.

User story

As a developer maintaining Dash Evo Tool's wallet top-up flow, I want an end-to-end regression test for cross-wallet top-up isolation, so a future change can't silently reintroduce the corruption #954 fixed.

Scenario

Base flow

One wallet (the payer) funds another wallet's identity top-up using an asset lock.

Actual behavior

#954 fixed cross-wallet top-up corrupting the payer wallet's own state, and was developed with a matching end-to-end test — but the PR landed as a squash merge that didn't include the test file, so the fix shipped with no regression coverage on v1.0-dev.

Expected behavior

A backend-e2e test (cross_wallet_topup_e2e) exercises the real flow against Dash testnet and asserts: the payer wallet's own identity/UTXO state stays intact, both wallets reload cleanly afterward, resuming a spent unbound asset-lock is correctly refused, and the existing owned-identity top-up path still works.

Detailed discussion

What was done

Recovered tests/backend-e2e/cross_wallet_topup.rs and its tests/backend-e2e/main.rs module registration from the branch that originally accompanied #954's fix, rebased cleanly onto current v1.0-dev, and cleaned up references that had gone stale in the rebase (a commit hash squashed away by the merge, an outdated file path, internal tracking IDs replaced with plain-language rationale).

Testing

Run live against Dash testnet earlier in development (~104s, all 4 assertions passed). This PR's rebased version compiles clean (cargo test --test backend-e2e --all-features --no-run, exit 0). The test is #[ignore]-gated and network-dependent per this repo's backend-e2e conventions, so it's not part of CI — see tests/backend-e2e/README.md for how to run it live before merge if a reviewer wants to re-confirm.

Breaking changes

None (test-only addition).

Checklist

  • Compiles (--no-run check)
  • Follows tests/backend-e2e/README.md conventions
  • cargo fmt clean

Prior work

Fixed by #954 — this PR only adds the test coverage that PR's squash merge dropped.

Attribution

🤖 Co-authored by Claudius the Magnificent AI Agent

Covers the behaviour fixed by #954 (`resolve_top_up_route` in
`src/backend_task/identity/top_up_identity.rs`) end-to-end against Dash
testnet. Offline tests in `src/context/wallet_lifecycle/tests.rs` already
cover routing and the corruption regression at the unit level; this closes
the live-network gap — a real asset lock, broadcast, IS proof, `TopUpIdentity`
acceptance on Platform, and the paying wallet's persister state afterward.

Four assertions:

1. A foreign top-up lands on Platform, confirmed independently via
   `RefreshIdentity` rather than the task's own return value.
2. The payer wallet is left uncorrupted — no orphaned `identity_keys` rows in
   the live persister, and both wallets survive a real `ensure_wallets_registered`
   reload (the "Saved wallet data appears damaged" failure mode).
3. Resuming the now-spent unbound asset lock via `UseAssetLock` is refused,
   so the lock lingering in a non-`Consumed` state cannot become a double-credit.
4. Same-wallet (owned-identity) top-up still works.

The test file was written and live-verified during #954's development (104s
testnet run, all four assertions passed) but was dropped by that PR's squash
merge; this restores it. Marked `#[ignore]` per `tests/backend-e2e/README.md`
— it needs network access and a funded testnet wallet, and is not run by CI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcX9SNDB26o5TVoUhUQkEN
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 28101404-2c72-4285-acd8-b11d9c52c3d2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants