Skip to content

feat(rs-platform-wallet/e2e): identity-credit sweep + ID-001/002/003/005 tests#3578

Closed
lklimek wants to merge 2 commits intotest/platform-wallet-e2efrom
feat/rs-platform-wallet-identity-tests-and-sweep
Closed

feat(rs-platform-wallet/e2e): identity-credit sweep + ID-001/002/003/005 tests#3578
lklimek wants to merge 2 commits intotest/platform-wallet-e2efrom
feat/rs-platform-wallet-identity-tests-and-sweep

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented May 4, 2026

Issue being fixed or feature implemented

The platform-wallet e2e harness had no real identity-credit sweep — sweep_identities was a no-op stub that would silently leak identity credits across CI runs until the bank starved. Identity-feature tests (ID-NNN) were also entirely unimplemented; the spec defined them but no test code existed.

This PR delivers both: a real sweep_identities implementation with a persistent bank identity, plus four ID-NNN test cases (ID-001/002/003/005) covering the identity-credit money-flow loop end-to-end.

Stacks on top of #3563 (e2e harness extensions). Targets feat/rs-platform-wallet-e2e-cases so it merges in the same trunk-down sequence.

What was done?

Bank identity persistence (framework/bank_identity.rs — new):

  • Hybrid load strategy: PLATFORM_WALLET_E2E_BANK_IDENTITY_* env-vars primary, workdir-persisted JSON fallback.
  • Auto-bootstraps from the bank wallet's primary address at DIP-9 index 0xBA77 (high index = no collision with test indices 0..n).
  • Cross-checks wallet_id on load to surface bank-mnemonic mismatches loudly.

Identity-credit sweep (framework/cleanup.rs::sweep_identities_with_seed):

  • Iterates registered identities at DIP-9 indices 0..IDENTITY_DISCOVERY_GAP (=8).
  • Builds a deterministic SweepPlan (covered by build_sweep_plan_* unit tests).
  • Broadcasts CreditTransfer to the bank identity via the harness signer.
  • Replaces the previous no-op; Harness-ID-1 regression pin asserts the contract.

ID-NNN test cases (tests/e2e/cases/):

  • id_001_register_identity_from_addresses.rsIdentityWallet::register_from_addresses happy path.
  • id_002_top_up_identity.rstop_up_from_addresses happy path.
  • id_003_identity_to_identity_transfer.rstransfer_credits_with_external_signer between two harness-owned identities.
  • id_005_identity_to_addresses_transfer.rstransfer_credits_to_addresses_with_external_signer round-trip back into wallet.
  • id_sweep_recovers_identity_credits.rs — sweep self-test (registers identity, teardown, asserts bank receives the credits).

STUB pinning for deferred cases (TEST_SPEC.md):

  • ID-004 (identity update — needs signer cache-injection helper for freshly-issued keys).
  • ID-006 (load by index — needs TestWallet::from_seed_bytes rebuild helper).
  • ID-001c, ID-005b, ID-006b (P2 deferred behind P0/P1).

How Has This Been Tested?

cargo fmt --check                      # green
cargo check --tests                    # green
cargo clippy --tests -- -D warnings    # green
cargo test --lib                       # 131 passed
cargo test --test e2e -- build_sweep_plan default_spec
                                       # 5 passed (harness unit cohort)

E2E identity tests are gated behind PLATFORM_WALLET_E2E_BANK_MNEMONIC and PLATFORM_WALLET_E2E_BANK_IDENTITY_* env-vars (not run in CI by default; operator runs against testnet).

Breaking Changes

None. Additive: new framework module, new test cases, no API changes to the wallet crate itself.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

🤖 Co-authored by Claudius the Magnificent AI Agent

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23066b27-e747-473b-8c13-3b05d540bb5c

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rs-platform-wallet-identity-tests-and-sweep

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 and usage tips.

Base automatically changed from feat/rs-platform-wallet-e2e-cases to feat/rs-platform-wallet-e2e May 4, 2026 13:05
@lklimek lklimek force-pushed the feat/rs-platform-wallet-identity-tests-and-sweep branch from 5e0e077 to 98cbfd9 Compare May 4, 2026 14:24
@lklimek lklimek changed the base branch from feat/rs-platform-wallet-e2e to fix/rs-platform-wallet-arithmetic-and-sync-hardening May 4, 2026 14:26
First DPNS-tier test on the e2e harness. Sets up an identity via Wave
A signer + register_identity_from_addresses, registers a uniquely
labelled .dash name, asserts resolver visibility within STEP_TIMEOUT.

Standard #[ignore]-gated; relies on PLATFORM_WALLET_E2E_BANK_MNEMONIC
+ live testnet. Per TEST_SPEC.md DPNS-001 (P0).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lklimek lklimek changed the base branch from fix/rs-platform-wallet-arithmetic-and-sync-hardening to test/platform-wallet-e2e May 5, 2026 12:35
@lklimek
Copy link
Copy Markdown
Contributor Author

lklimek commented May 5, 2026

merged into feature branch test/platform-wallet-e2e

@lklimek lklimek closed this May 5, 2026
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