Skip to content

feat: persist ephemeral state - #924

Merged
QuantumExplorer merged 5 commits into
feat/abci_validationfrom
feat/persist-state
Apr 18, 2023
Merged

feat: persist ephemeral state#924
QuantumExplorer merged 5 commits into
feat/abci_validationfrom
feat/persist-state

Conversation

@iammadab

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

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 made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@QuantumExplorer
QuantumExplorer marked this pull request as ready for review April 18, 2023 14:09
@QuantumExplorer
QuantumExplorer merged commit 9f3ee81 into feat/abci_validation Apr 18, 2023
@QuantumExplorer
QuantumExplorer deleted the feat/persist-state branch April 18, 2023 14:10
QuantumExplorer pushed a commit that referenced this pull request Aug 6, 2026
…o the watermark can't freeze

Root-cause follow-up to the batching + sync_fault commits on this branch.
Batching raised the burst threshold but a single `broadcast::Lagged` still
froze a wallet's durable sync watermark permanently (#4069).

The producer (dashpay/rust-dashcore#924) now offers a dedicated, unbounded
`mpsc` persistence channel alongside its lossy broadcast. This switches the
consumer onto it:

- core_bridge.rs: `spawn_/run_wallet_event_adapter` take
  `mpsc::UnboundedReceiver<WalletEvent>` instead of `broadcast::Receiver`.
  The batched `try_recv` fold is kept verbatim; the `Lagged`/`missed`/global
  `fault_all` path is removed because an unbounded channel can never lag.
  `AdapterFaultState` keeps only the per-wallet store-rejection freeze as a
  fail-closed backstop (never fires in a healthy run).
- manager/mod.rs: take the receiver via `take_persistence_receiver()` instead
  of `subscribe_events()`. Unlike a broadcast receiver, the mpsc buffers
  events emitted before the task's first poll, so there is no
  subscribe-before-publish race.
- Diagnostics via the `log` facade (android_logger forwards `log` to logcat;
  `tracing` may not — see rs-unified-sdk-jni JNI_OnLoad): one
  `log::info!("wallet-event batch: folded=.. wallets=.. synced_height_persisted=.. faulted=.. missed=0")`
  per drain, and a one-shot `log::error!("SYNC WATERMARK FROZEN ...")` if the
  per-wallet freeze ever latches — so the next tester logcat is unambiguous
  about whether the watermark is advancing.
- Cargo.toml: re-pin key-wallet-manager (and the sibling rust-dashcore crates,
  kept consistent to avoid a duplicate-crate type mismatch) to the fork rev
  carrying #924.

reaches the persister before the `SyncHeightAdvanced` watermark that implies
it — the durable watermark can never outrun its rows. The freeze guard stays
as a backstop but should now never fire.

Tests: broadcast-driven adapter tests ported to the mpsc; the `Lagged` test is
replaced by `lossless_burst_never_freezes_and_watermark_reaches_tip` (a
3000-event burst — 3× the old ring — advances the watermark to the tip with no
freeze). `cargo test -p platform-wallet` (531) and `-p platform-wallet-ffi`
(224) green.

Stacked on the batching + sync_fault commits (#4289).
Requires dashpay/rust-dashcore#924 (producer) to land.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
QuantumExplorer added a commit that referenced this pull request Aug 6, 2026
…ying the lossless persistence channel

rust-dashcore#927 (successor of #924) merged as 08bf729de819, so the
temporary bfoss765-fork pin moves to the canonical dashpay rev. The pin
range additionally carries #909 (out-of-order spend fix, additive) and
the #927 API this consumer was built for: take_persistence_receiver
(opt-in, taken once), the removed event_sender accessor (no platform
callers), and the late-install warning. Cargo.lock regenerated minimally
from the v4.2-dev lock: the 12 repinned git entries plus
platform-wallet's log dependency edge.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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