-
Notifications
You must be signed in to change notification settings - Fork 55
feat(platform-wallet)!: shared ThreadRegistry for coordinator lifecycle + shutdown UAF/data-loss fixes #3954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Claudius-Maginificent
wants to merge
318
commits into
v3.1-dev
Choose a base branch
from
feat/platform-wallet-shutdown-join
base: v3.1-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
318 commits
Select commit
Hold shift + click to select a range
0066a5a
feat(platform-wallet-storage)!: public SecretStore API exposing Secre…
lklimek c636ac0
refactor(platform-wallet-storage): string-only keyring_core From; typ…
lklimek a5c5bf0
fix(platform-wallet-storage): box typed FileStoreError into keyring_c…
lklimek e1c7fa9
refactor(platform-wallet-storage): remove MemoryCredentialStore; reti…
lklimek 671ce69
fix(platform-wallet-storage): enforce lowercase-hex service, widen ex…
lklimek dc492cc
docs(platform-wallet-storage): strip historical comments + license he…
lklimek c58a2b5
feat(platform-wallet-storage): log swallowed mlock + corruption/write…
lklimek 316c4ee
fix(platform-wallet): serde derives on shielded changeset types
lklimek 6aa2942
docs(platform-wallet-storage): drop deleted MemoryCredentialStore / _…
lklimek f78f2e6
fix(platform-wallet-storage): gate test-only contacts reader off-state
lklimek b5a8439
refactor(platform-wallet-storage)!: native FK schema, drop barrel, co…
lklimek eb2b6b0
fix(platform-wallet-storage): resolve real account_index for multi-ac…
lklimek ce8ca25
fix(platform-wallet-storage): fast-fail mixed-wallet and divergent id…
lklimek 36577d2
refactor(platform-wallet-storage): drop delete-wallet CLI, propagate …
lklimek a996b93
test(platform-wallet-storage): cover #3625 hardening (native FK, mult…
lklimek df202ea
test(platform-wallet-storage): assert UTXO row survival in TC-048; sc…
lklimek 4c9664d
chore(platform-wallet-storage): drop unused key-wallet-manager depend…
lklimek b4ffcbc
fix(platform-wallet-storage): canonicalize TC-031 expected dir for ma…
lklimek df1e59c
Merge branch 'v3.1-dev' into feat/platform-wallet-sqlite-persistor
lklimek 9c1bec9
fix(platform-wallet-storage): atomic restore + 0o600 backup file + WA…
lklimek 36728e5
feat(platform-wallet-storage): cheap pre-staging schema sniff in rest…
lklimek 8f1d0c4
fix(platform-wallet-storage): restore drained buffer on delete_wallet…
lklimek ad3810a
feat(platform-wallet-storage): forward-version gate on open() symmetr…
lklimek 9b2664e
fix(platform-wallet-storage): serialize delete-wallet against concurr…
lklimek ad6c25e
fix(platform-wallet-storage): bounded blob decode + typed BlobTooLarg…
lklimek 7dd8ef0
fix(platform-wallet-storage): strict consumed-count on identity_keys …
lklimek dcf1655
refactor(platform-wallet-storage): collapse list_active into load_sta…
lklimek 49d429e
test(platform-wallet-storage): assert clap usage exit code Some(2) (C…
lklimek 614c43d
chore(platform-wallet-storage): clippy cleanups for new test files
lklimek cfb93a2
refactor(platform-wallet): seedless watch-only load via Wallet::new_w…
lklimek 21215d3
refactor(platform-wallet-ffi): drop resolver arg from load_from_persi…
lklimek 92f849b
fix(swift-sdk): align PlatformWalletManager.loadFromPersistor with se…
lklimek 3cd4264
style: cargo fmt across seedless-load touch points
lklimek f57b117
docs(platform-wallet): adjust rehydration_load test header to reflect…
lklimek 81ed297
Merge branch 'feat/platform-wallet-storage-secrets' into feat/platfor…
lklimek b117ff2
fix(platform-wallet-storage): backup::run_to atomic via NamedTempFile…
lklimek 9b39783
fix(platform-wallet-storage): restore_from holds exclusive lock + chm…
lklimek ae9e629
feat(platform-wallet-storage): commit_writes returns CommitReport on …
lklimek fb3362e
feat(platform-wallet-storage): Drop logs uncommitted dirty buffer in …
lklimek a23afd9
fix(platform-wallet-storage): expand is_transient to cover I/O-class …
lklimek df54420
feat(platform-wallet-storage): backup::prune accumulates per-file err…
lklimek df76e1a
feat(platform-wallet-storage): integrity_check before migrations on o…
lklimek c0b45c0
refactor(platform-wallet-storage): remove unreachable MigrationDirty …
lklimek 1840b35
chore(platform-wallet-storage): document ensure_dir TOCTOU probe as b…
lklimek 722de93
docs(platform-wallet-storage): atomicity contract rustdoc (N-3/N-4/N-…
lklimek fe01634
docs(platform-wallet-storage): Drop side-effect comment + restore loc…
lklimek 34c8ecb
Merge remote-tracking branch 'origin/feat/platform-wallet-sqlite-pers…
lklimek 54621bc
Merge remote-tracking branch 'origin/v3.1-dev' into feat/platform-wal…
lklimek db7b6b5
Merge branch 'feat/platform-wallet-sqlite-persistor' into feat/platfo…
lklimek 543d0da
Merge branch 'feat/platform-wallet-storage-secrets' into feat/platfor…
lklimek cf5f87a
Merge remote-tracking branch 'origin/v3.1-dev' into feat/platform-wal…
lklimek e7e1de8
Merge remote-tracking branch 'origin/feat/platform-wallet-sqlite-pers…
lklimek 4d21651
Merge remote-tracking branch 'origin/feat/platform-wallet-storage-sec…
lklimek e014555
feat(platform-wallet)!: rs-platform-wallet-storage crate (SQLite pers…
Claudius-Maginificent 64a85a8
Merge branch 'v3.1-dev' into feat/platform-wallet-sqlite-persistor
lklimek 016987c
Merge branch 'v3.1-dev' into feat/platform-wallet-sqlite-persistor
lklimek 187a026
Merge remote-tracking branch 'origin/v3.1-dev' into feat/platform-wal…
lklimek eadae31
chore(Cargo.lock): sync platform-wallet-storage to workspace version …
lklimek 436c196
fix(platform-wallet-ffi): drop From<String> usage in shielded FFI loa…
lklimek 03fd3dd
docs(platform-wallet-storage): add SQLite SCHEMA.md with Mermaid ER d…
lklimek 97713ee
docs(platform-wallet-storage): split SCHEMA.md into domain-grouped di…
lklimek aa95add
feat(platform-wallet-storage): enforce enum-domain CHECK constraints …
lklimek 8c4a88a
feat(platform-wallet-storage): add generic key/value store
lklimek 9bc1fc2
feat(platform-wallet-storage): gate KV store behind `kv` feature
lklimek cd76fcd
ci: bump dorny/paths-filter from v3 (Node 20, deprecated) to v4
lklimek 22e496d
feat(platform-wallet): keyring_core secret backends — encrypted-file …
Claudius-Maginificent aeb1f04
Merge branch 'v3.1-dev' into feat/platform-wallet-sqlite-persistor
lklimek d04685e
chore(Cargo.lock): bump platform-wallet-storage to workspace 3.1.0-dev.8
lklimek 9ba47e1
refactor(platform-wallet-storage): drop footprint mechanism + tighten…
lklimek 8a6fe8a
feat(platform-wallet-storage): cap KV get value size at 16 MiB (CMT-006)
lklimek f9b3438
fix(platform-wallet-storage): drop dest lock conn before WAL/SHM unli…
lklimek c35be7a
fix(platform-wallet-storage): tighten CLI gates (CMT-010, CMT-014)
lklimek 5c37004
chore(platform-wallet-storage): apply CMT-007/012/013/016/018/020-022…
lklimek 9698927
feat(platform-wallet-storage): swap kv_store for six meta_* tables in…
lklimek 1b1c6a4
feat(platform-wallet-storage): reshape KvStore to per-ObjectId scope
lklimek 27188a6
test(platform-wallet-storage): cover per-object metadata (TC-MD-001..…
lklimek 3b4a038
docs(platform-wallet-storage): document meta_* tables in SCHEMA.md
lklimek 08b0ed9
test(platform-wallet-storage): tighten metadata QA assertions + doc f…
lklimek 0556928
fix(platform-wallet-storage): allow metadata writes before parent exi…
lklimek 05d54d2
test(platform-wallet-storage): cover recursive_triggers enforcement +…
lklimek 35e4a2f
refactor(platform-wallet-storage): drop inert recursive_triggers; met…
lklimek 1053caa
fix(platform-wallet-storage): single-read KV get to close size-cap TO…
lklimek f1f0717
docs(platform-wallet-storage): surface cross-process rollback caveat …
lklimek d638c4f
refactor(platform-wallet-storage): encode outpoints via bincode (CMT-…
lklimek 3f69c31
test(platform-wallet-storage): tighten malformed-outpoint assertion +…
lklimek 269e578
Merge remote-tracking branch 'origin/v3.1-dev' into feat/platform-wal…
lklimek ffdc28b
fix(platform-wallet): gate shielded-only event_manager field to fix d…
lklimek 9e2d2b0
feat(platform-wallet): add contacts and identity-key rehydration (ite…
Claudius-Maginificent 7c2b2f9
Merge remote-tracking branch 'origin/feat/platform-wallet-sqlite-pers…
lklimek d99d7a5
chore(platform-wallet): untrack .review-3625 review scratch + gitignore
lklimek 14d868e
refactor(platform-wallet): remove dead wrong-seed-gate scaffolding (#…
lklimek 0a9c972
Merge remote-tracking branch 'origin/feat/platform-wallet-rehydration…
lklimek c3cf8b0
fix(platform-wallet-storage): reconcile identity_keys schema with #36…
lklimek ddfa66e
test(platform-wallet-storage): pin identity_keys dual-FK cascade + no…
lklimek e78eb55
fix(platform-wallet-storage): enforce identity-wallet precondition at…
lklimek 4e38975
fix(platform-wallet-storage): drop keyutils backend + dependency (CMT…
lklimek 3fc28b9
refactor(platform-wallet-storage): rename SecretStoreError + IO path …
lklimek 932b923
refactor(platform-wallet-storage): unify contact tables into one life…
lklimek 052db80
Merge commit '932b923b2b277dc80c7c0dd59a332e0ab7dc76b1' into feat/pla…
lklimek 3166090
Merge branch 'v3.1-dev' into feat/platform-wallet-sqlite-persistor
lklimek 2f35190
Merge #3625 (feat/platform-wallet-sqlite-persistor) into rehydration
lklimek 0466241
chore: update Cargo.lock
lklimek 3f2e7d2
Merge #3625 (feat/platform-wallet-sqlite-persistor @ 04662411cf) into…
lklimek 89a433a
build(wallet-storage): exact-pin bincode and getrandom; strip transie…
lklimek d241f61
fix(platform-wallet-storage): make meta_* soft-cascade state-agnostic…
lklimek 57f0f72
fix(platform-wallet-storage): promote contact to established when bot…
lklimek 0f7b7ae
fix(platform-wallet-storage): reject unbucketable unspent UTXOs and m…
lklimek 569a19a
refactor(platform-wallet-storage): drop per-table row counting from d…
lklimek 0435f3e
refactor(platform-wallet): slim persistence trait and relocate report…
lklimek 19e8980
docs(platform-wallet): record deferred persistence contract and FFI f…
lklimek 4bc8d2a
fix(wallet-storage): drop SQLITE_OPEN_URI from the read-only open path
lklimek bab3c63
refactor(wallet-storage): fix secrets error taxonomy and unify wallet…
lklimek 0bba1f7
docs(wallet-storage): strip transient review IDs from backup comments
lklimek 1b89b4b
docs(wallet-storage): align README/SCHEMA/SECRETS with shipped behaviour
lklimek f4aa2df
feat(platform-wallet-storage): reconstruct platform per_account state…
lklimek 17ea61f
feat(platform-wallet-storage): cap KV value size on put and document …
lklimek 30955c6
refactor(platform-wallet-storage): narrow the public module surface t…
lklimek 0abdb12
fix(platform-wallet-storage): pre-create the SQLite DB owner-only to …
lklimek c6dbc11
test(platform-wallet-storage): add cascade-completeness test and prun…
lklimek 30147e0
docs(platform-wallet-storage): strip transient review IDs from core s…
lklimek 97be1e9
docs(platform-wallet-storage): strip transient review IDs from edited…
lklimek 522d4ce
chore(platform-wallet-storage): finish review-ID strip, fix secret-sc…
lklimek 3eac940
merge: integrate deps/docs/secrets/conn tail into #3625 fix batch
lklimek a90c84d
docs(platform-wallet-storage): document zero-pad diagnostic risk + st…
lklimek 1d7c94d
docs(platform-wallet-storage): fix secrets-guard test ref + honest me…
lklimek bfc34cc
test(platform-wallet-storage): assert reconstructed per-account state
lklimek c92e9f9
test(platform-wallet-storage): catch over-broad wallet-delete cascade
lklimek b262e1b
chore(platform-wallet-storage): strip transient review IDs from comments
lklimek 6f1e3e4
docs(platform-wallet-storage): document orphan metadata as accepted l…
lklimek c9d1c81
docs(platform-wallet-storage): lead crate docs with why/value before …
lklimek 7de6678
refactor(platform-wallet-storage): rename wallet_metadata table to wa…
lklimek f69746d
merge: propagate #3625 (platform-wallet-storage incl. wallets rename)…
lklimek 8ba49c3
test(platform-wallet-storage): reconcile #3692 tests with #3625's str…
lklimek 9e1248c
fix(platform-wallet-storage): un-gate schema readers used by producti…
lklimek 5a9cc73
test(platform-wallet-storage): cover garbage/truncated/unknown-versio…
lklimek 6dba193
chore(platform-wallet-storage): harden secrets dependency closure
lklimek 62e9c96
refactor(platform-wallet-storage): granular AEAD errors + typed salt …
lklimek f2f54a9
fix(platform-wallet-storage): harden the encrypted-file vault seams
lklimek a7e5d85
fix(platform-wallet-storage): authenticate the KDF header via verify-…
lklimek 77ec94b
test(platform-wallet-storage): sound zeroize coverage + SPI seam doc
lklimek bdf2c27
chore(platform-wallet-storage): record argon2 zeroize edge in Cargo.lock
lklimek 6e6a78d
refactor(platform-wallet-storage): graceful put rollback + write-bit …
lklimek 86c5e63
feat(platform-wallet-storage): seal the no-key-material-in-DB invariant
lklimek f07f3c5
docs(platform-wallet-storage): keyring metadata + SPI error-format ha…
lklimek f36b719
test(platform-wallet-storage): fuzz the vault parser + tamper coverage
lklimek ff296df
docs(platform-wallet-storage): annotate accepted risks + narrow unsaf…
lklimek 409dd5a
test(platform-wallet-storage): secure integration tempdir for parent-…
lklimek 6502171
test(platform-wallet-storage): honest header-tamper tests + verify-to…
lklimek 975cd47
test(platform-wallet-storage): pin delete_wallet pre-flush BEGIN-EXCL…
lklimek 0bacb45
test(platform-wallet-storage): cover IdentityChangeSet.removed tombst…
lklimek 88cee36
test(platform-wallet-storage): cover money-column read overflow + com…
lklimek 5949439
test(platform-wallet-storage): pin prune embedded-timestamp parse + s…
lklimek f543e31
test(platform-wallet-storage): cover FK parent-before-child ordering …
lklimek af32973
fix(platform-wallet-storage): restore buffer when pre-flush BEGIN EXC…
lklimek cc33189
feat(platform-wallet-storage): wallet-DB identity gates + journal-mod…
lklimek d4523c0
feat(platform-wallet-storage): refuse a second in-process open on the…
lklimek e42f64b
fix(platform-wallet-storage): wallet-scope identity tombstone; correc…
lklimek 08239c1
refactor(platform-wallet-storage): centralize i64->u32 boundary casts…
lklimek 8e50d48
fix(platform-wallet-storage): fail-hard watermark, deterministic utxo…
lklimek 40f9997
docs(platform-wallet-storage): reconcile README/SCHEMA/SECRETS with s…
lklimek 475e3ae
docs(platform-wallet-storage): scope vault cross-process lock to loca…
lklimek e79e6cf
fix(platform-wallet-storage): drop SQLITE_OPEN_URI from CLI schema peek
lklimek 039596d
chore(platform-wallet-storage): acknowledge RUSTSEC-2025-0141 (bincod…
lklimek 9d40bdb
style(platform-wallet-storage): collapse single-line match arm per ru…
lklimek b4a3aa9
test(platform-wallet-storage): rename cascade test to reflect actual …
lklimek 66c2142
docs(platform-wallet-storage): compact verbose comments in sqlite core
lklimek d73071f
docs(platform-wallet-storage): compact verbose comments in secrets mo…
lklimek 197949d
docs(platform-wallet-storage): compact verbose comments in schema mod…
lklimek 0ceb56e
docs(platform-wallet-storage): compact verbose comments in tests
lklimek 60f2bd7
fix(platform-wallet-storage): repair comment-edit fallout (clippy doc…
lklimek 855471e
Merge remote-tracking branch 'origin/v3.1-dev' into feat/platform-wal…
lklimek 2d22cf3
merge: propagate v3.1-dev (shielded spend detection #3819, IdentityCr…
lklimek 20b20e7
fix(platform-wallet-storage): rehydrate core_derived_addresses from p…
lklimek 4f432c9
fix(platform-wallet-storage): repair partial-state derived-address re…
lklimek 67d0eba
fix(platform-wallet-storage): harden core_derived_addresses with BIP3…
lklimek ff1208a
test(platform-wallet-storage): close core_derived_addresses coverage …
lklimek d8d2239
fix(platform-wallet-storage): fail loud when a pool-declared address …
lklimek cccd217
test(platform-wallet-storage): assert resolved account_index of the s…
lklimek 63fea7a
fix(platform-wallet): emit in-band pool snapshot on derivation so acc…
lklimek f7b6136
test(platform-wallet-storage): prove in-band pool-snapshot resolution…
lklimek ebb4b30
refactor(platform-wallet-storage): replace pool mirror/reconcile with…
lklimek 50a4a0a
Merge remote-tracking branch 'origin/v3.1-dev' into merge/wallet-rehy…
lklimek 925dfcb
Merge branch 'merge/wallet-rehydration' into merge/wallet-core-derived
lklimek 156bd98
fix(platform-wallet-storage): add account_index to core_derived_addre…
lklimek 925b109
fix(platform-wallet-storage): repair label-split fallout in pool_type…
lklimek b450649
fix(platform-wallet): add background_generation guard to PlatformAddr…
lklimek 1f3ea29
fix(platform-wallet): close shielded_sync generation-guard TOCTOU (lo…
lklimek fa4584d
docs(platform-wallet-storage): update stale doc comment on ACCOUNT_IN…
lklimek aed5652
docs(platform-wallet): correct CHECK-column count and port generation…
lklimek ca68690
test(platform-wallet): cover generation-guard restart and contacts.st…
lklimek 8d8724e
refactor(platform-wallet)!: hardcode core UTXO account_index=0; retir…
lklimek e8308ed
fix(platform-wallet): persist non-default-account UTXOs under index 0…
lklimek ea0082e
docs(platform-wallet-storage): drop deleted-table refs from accounts.…
lklimek a4ed0b5
feat(platform-wallet-storage): SecretString serde/schemars/is_blank (…
lklimek 1827a39
feat(platform-wallet-storage): error taxonomy for Tier-2 secret prote…
lklimek f68f00e
feat(platform-wallet-storage): Tier-2 secret envelope (wrap/unwrap)
lklimek 491229b
feat(platform-wallet-storage)!: strict fail-closed Tier-2 read (L-1 k…
lklimek c19c23b
feat(platform-wallet-storage): SecretStore Tier-2 write API + reprotect
lklimek d4d311c
feat(platform-wallet-storage)!: Tier-1 blank-passphrase guard + open_…
lklimek 351d1e6
refactor(platform-wallet-storage): use keyring_core::mock::Store; ann…
lklimek d3df41e
docs(platform-wallet-storage): QA fixes — rustdoc clarity + ephemeral…
lklimek b5ede7d
test(platform-wallet-storage): QA fixes — Os read bound, Os crash tes…
lklimek fb7953e
test(platform-wallet-storage): cover Os read-size guard; pin new() so…
lklimek f3354f6
feat(platform-wallet)!: shutdown() joins coordinator threads and retu…
lklimek 261178e
fix(platform-wallet): RAII-guard is_syncing so a coordinator panic ca…
lklimek 42d734d
refactor(rs-dash-async): add AtomicFlagGuard RAII helper
lklimek 6e78b77
fix(platform-wallet): refine CoordinatorThreadStatus variants + tight…
lklimek 5f80450
test(rs-dash-async): assert AtomicFlagGuard contract + add #[must_use]
lklimek 6b2cd39
fix(platform-wallet): make coordinator passes cancellable + converge …
lklimek 13a22dd
fix(platform-wallet): bound clear_shielded + tidy shutdown docs/logging
lklimek 93b8954
fix(platform-wallet-ffi): timeout-bound the shielded sync stop bridge
lklimek 747f5f0
Merge branch 'v3.1-dev' into feat/platform-wallet-shutdown-join
lklimek 2bd9501
fix(platform-wallet)!: close residual coordinator-thread UAF on shutdown
lklimek 7c975ed
fix(platform-wallet)!: surface non-clean shielded drain on clear/stop
lklimek 5f63c95
fix(platform-wallet): reap prior coordinator thread outside backgroun…
lklimek 2b068ba
fix(platform-wallet): close shielded epilogue TOCTOU + pin restart reap
lklimek 5017ba1
fix(swift-sdk): retain wallet callback context on incomplete shutdown
lklimek b491773
test(platform-wallet): bound cleanup quiesce in restart-reap regressi…
lklimek 76c8bee
fix(platform-wallet): track detached coordinator threads so shutdown(…
lklimek 3cca1cf
perf(platform-wallet): drain coordinators concurrently in shutdown() …
lklimek 8c52811
feat(dash-async): add shared ThreadRegistry worker-lifecycle engine
lklimek ac9a51a
feat(dash-async): key-scope parked orphans for any_alive_for()
lklimek d20aed0
refactor(platform-wallet): migrate sync coordinators onto shared Thre…
lklimek d190f29
test(dash-async): anchor DrainHook compile_fail doctest to E0277 + no…
lklimek 3e81fc1
fix(dash-async,platform-wallet): harden ThreadRegistry lifecycle + do…
lklimek 911f99f
refactor(platform-wallet): extract CoordinatorLifecycle to dedup the …
lklimek 22647a7
fix(platform-wallet): raise quiescing gate in CoordinatorLifecycle::q…
lklimek 7f3aeb5
fix(dash-async): park a restarted worker's prior under the slot lock …
lklimek 41791c0
fix(platform-wallet-ffi): gate shielded_sync_stop success on orphan l…
lklimek 4b099a9
fix(platform-wallet): bound clear_shielded's drain and hold its quies…
lklimek 7be68c5
refactor(dash-async): full spawn-failure rollback + drop stale doc hi…
lklimek 3821389
docs(swift-sdk): broaden deinit comment for shielded_sync_stop's orph…
lklimek 748c4f8
fix(platform-wallet): make the quiescing<->is_syncing handshake self-…
lklimek 0e73de7
fix(rs-dash-async): surface reaped-orphan terminal status in Shutdown…
lklimek e762bb5
docs(platform-wallet): correct coordinator stop() docs — pass cancell…
lklimek f94fed9
fix(platform-wallet-ffi): make shielded_sync_stop cancel-only — elimi…
lklimek 97d3a21
fix(platform-wallet): drain buffered wallet events on cancel in event…
lklimek 43cbfce
docs(pr3954): apply QA findings from Marvin/Adams — trim, drop tombst…
lklimek bc16d9f
Merge remote-tracking branch 'origin/v3.1-dev' into feat/platform-wal…
lklimek 6ed5200
fix(pr3954): apply grumpy-review findings — SEC-001, RUST-001/004-007…
lklimek f11a9e0
refactor(platform-wallet): hoist coordinator poll-loop into Coordinat…
lklimek 3acfbcb
refactor(platform-wallet): collapse CoordinatorThreadStatus/Coordinat…
lklimek b43a348
refactor(platform-wallet): collapse CoordinatorThreadStatus / Coordin…
lklimek 801f35b
feat(rs-dash-async): per-key clearing latch closes the T11 RESIDUAL (…
lklimek 284752a
docs(rs-dash-async,platform-wallet): comment-hygiene sweep on the Thr…
lklimek 97e373b
fix(swift-sdk): mark deinit-accessed handler properties nonisolated(u…
lklimek 432309b
fix(platform-wallet): spawn_periodic_loop must not lower the quiescin…
lklimek 9b3d6f8
merge: PR #3692 + #3828 + #3953 stack into feat/platform-wallet-shutd…
lklimek bcf9388
merge: pull the PR #3692 + #3828 + #3953 stack onto feat/platform-wal…
lklimek 6b655aa
fix(rs-dash-async,platform-wallet): refcount ClearingGuard + gate pub…
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| use std::sync::atomic::{AtomicBool, Ordering}; | ||
|
|
||
| /// RAII guard that clears an [`AtomicBool`] flag to `false` on drop. | ||
| /// | ||
| /// Callers set the flag to `true` before constructing the guard (typically | ||
| /// via a `compare_exchange`); the guard resets it on every exit path, | ||
| /// including panics, so a panicked holder can never leave the flag wedged. | ||
| /// | ||
| /// **Panic-strategy caveat:** the clear-on-panic guarantee relies on | ||
| /// destructors running while the stack unwinds, so it holds under | ||
| /// `panic = "unwind"` (the default). Under `panic = "abort"` — e.g. the | ||
| /// iOS release profiles — a panic aborts the process immediately and no | ||
| /// `Drop` runs; there is simply no "after" left for the flag to gate. | ||
| #[must_use = "AtomicFlagGuard clears the flag on drop; binding to `_` or using as a statement drops it immediately"] | ||
| pub struct AtomicFlagGuard<'a>(&'a AtomicBool); | ||
|
|
||
| impl<'a> AtomicFlagGuard<'a> { | ||
| /// Wrap `flag`. Does **not** set it to `true` — the caller is | ||
| /// responsible for doing that before constructing the guard. | ||
| pub fn new(flag: &'a AtomicBool) -> Self { | ||
|
Claudius-Maginificent marked this conversation as resolved.
|
||
| Self(flag) | ||
| } | ||
| } | ||
|
|
||
| impl Drop for AtomicFlagGuard<'_> { | ||
| fn drop(&mut self) { | ||
| self.0.store(false, Ordering::Release); | ||
|
Claudius-Maginificent marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use std::panic::{catch_unwind, AssertUnwindSafe}; | ||
|
|
||
| /// A guard constructed over a `true` flag holds it while in scope and | ||
| /// clears it to `false` on a normal scope exit. | ||
| #[test] | ||
| fn clears_flag_on_normal_drop() { | ||
| let flag = AtomicBool::new(true); | ||
| { | ||
| let _guard = AtomicFlagGuard::new(&flag); | ||
| assert!(flag.load(Ordering::Acquire), "flag stays set while held"); | ||
| } | ||
| assert!(!flag.load(Ordering::Acquire), "flag cleared on drop"); | ||
| } | ||
|
|
||
| /// The clear also runs while unwinding a panic — the load-bearing | ||
| /// property the sync coordinators lean on so a panicked pass can't | ||
| /// leave `is_syncing` latched and wedge `quiesce()`'s drain. | ||
| #[test] | ||
| fn clears_flag_while_unwinding_panic() { | ||
| let flag = AtomicBool::new(true); | ||
| let result = catch_unwind(AssertUnwindSafe(|| { | ||
| let _guard = AtomicFlagGuard::new(&flag); | ||
| panic!("boom while holding the guard"); | ||
| })); | ||
| assert!(result.is_err(), "the panic propagated out of catch_unwind"); | ||
| assert!( | ||
| !flag.load(Ordering::Acquire), | ||
| "Drop ran during unwinding and cleared the flag" | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.