Skip to content

test(platform-wallet): fix stale balance assertion in paloma shielded sync example#3831

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
claude/heuristic-chandrasekhar-841749
Jun 10, 2026
Merged

test(platform-wallet): fix stale balance assertion in paloma shielded sync example#3831
QuantumExplorer merged 1 commit into
v3.1-devfrom
claude/heuristic-chandrasekhar-841749

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jun 10, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

The shielded_sync_paloma example asserted wallet A (seed [0x73; 32]) recovers a 400000-credit balance (4 × 100000) from paloma's genesis-seeded shielded notes. That expectation is stale: the genesis test-wallet note seeding was removed (see ShieldedSeedConfig::sdk_test_data in packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/shielded.rs — wallet-balance UX no longer comes from seeded notes), so the devnet's 1M notes are filler-only and the example always panicked with balance 0 even when sync worked perfectly.

What was done?

  • Replaced the balance assertion in packages/rs-platform-wallet/examples/shielded_sync_paloma.rs with what current SDK_TEST_DATA=true deployments actually guarantee:
    • the sync pass reports no per-wallet errors (ShieldedSyncPassSummary::error_count() == 0),
    • wallet A's outcome is WalletShieldedOutcome::Ok and not a cooldown skip (the example forces the pass),
    • notes_result.total_scanned > 0, proving the pass walked the seeded pool.
  • Balances are now printed informationally instead of asserted (0 is the correct value).
  • Updated the "What this proves" doc section to explain that no balance is expected and that decryptable-balance flows need real shielded-fund transitions post-genesis.
  • Removed the now-unused COUNT_A / OWNED_VALUE / EXPECTED_BALANCE_A constants and the stale SEED_A cross-reference to the deleted shielded_test_wallets.rs.
  • Still an opt-in network example: compiled but never run by cargo test.

How Has This Been Tested?

  • cargo check -p platform-wallet --example shielded_sync_paloma --features shielded — compiles clean.
  • cargo fmt --all — no formatting drift.
  • The example itself requires a live paloma devnet, so it remains opt-in (cargo run -p platform-wallet --example shielded_sync_paloma --features shielded).

Breaking Changes

None.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated example documentation and comments to accurately reflect Paloma's shielded note pool behavior and improve clarity.
  • Tests

    • Enhanced validation assertions to verify zero sync errors, successful wallet outcomes, and non-zero note scanning, removing incorrect balance expectations.

…mple

The shielded_sync_paloma example asserted wallet A recovers a 400000-credit
balance from genesis-seeded notes, but the genesis test-wallet note seeding
was removed (paloma's 1M notes are filler-only), so the example always
panicked with balance 0 even when sync worked perfectly.

Assert what current SDK_TEST_DATA deployments actually guarantee instead: a
clean sync pass (no per-wallet errors, not a cooldown skip) with
total_scanned > 0, printing balances informationally. Also update the
"What this proves" doc section and drop the stale shielded_test_wallets.rs
cross-reference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 578442c8-5482-4576-9f66-aca43590021d

📥 Commits

Reviewing files that changed from the base of the PR and between 2a0e53f and c6ac144.

📒 Files selected for processing (1)
  • packages/rs-platform-wallet/examples/shielded_sync_paloma.rs

📝 Walkthrough

Walkthrough

The Paloma shielded sync example was updated to remove assertions on specific decoded balances and replace them with outcome-based criteria. The example now validates that sync completed with zero errors, produced an enabled/successful wallet state, and scanned a non-zero number of notes. Documentation and imports were adjusted accordingly, and logging was simplified.

Changes

Paloma shielded sync example assertion updates

Layer / File(s) Summary
Example setup and documentation updates
packages/rs-platform-wallet/examples/shielded_sync_paloma.rs
Top-level comment updated to describe new assertion target; imports extended to include WalletShieldedOutcome; fixed-balance expectation constants removed; green/red commentary rewritten to explain balance as informational and clarify what missing notes indicate.
Assertion and logging refactoring
packages/rs-platform-wallet/examples/shielded_sync_paloma.rs
Startup config log line removes expected_balance field; sync-result verification refactored to assert error_count()==0, validate outcome is Ok, check cooldown skip is false despite force=true, and require notes_result.total_scanned > 0. Balance computation remains but prior equality check is replaced with informational logging.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • thepastaclaw

Poem

🐰 A balance was fixed, now it's free,
Filler notes flow, assertions decree,
Zero errors, outcome sure,
Scanning works—the example's pure! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing a stale balance assertion in the paloma shielded sync example test.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/heuristic-chandrasekhar-841749

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.

@QuantumExplorer
QuantumExplorer merged commit e7acc1f into v3.1-dev Jun 10, 2026
21 of 22 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/heuristic-chandrasekhar-841749 branch June 10, 2026 04:47
@QuantumExplorer QuantumExplorer added this to the v4.0.0 milestone Jun 10, 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.

2 participants