Skip to content

fix(sdk): bump tokio to 1.54.1 workspace-wide and fix the futurelocks it exposes - #5949

Merged
lklimek merged 12 commits into
v5.2-devfrom
fix/tokio-deadlock-v5.2
Nov 25, 2026
Merged

lklimek merged 12 commits into
v5.2-devfrom
fix/tokio-deadlock-v5.2

Conversation

@lklimek

@lklimek lklimek commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: Move every crate to tokio 1.54.1, declared once for the whole workspace, and fix two places where an SDK call could wait forever for another call that nobody was running any more.

User story

As a wallet or SDK developer, I want concurrent SDK calls never to hang each other, so that wallet syncs and gated requests always finish, on any tokio version.

Scenario

Base flow

A wallet syncs its private contact requests while other SDK calls run in the same task, or two SDK calls need the network's protocol version at the same time.

Actual behavior

  • With tokio 1.54, a private contact request sync can hang forever. One platform-wallet test hangs until CI times out after 90 minutes.
  • The SDK's protocol version check can hang the same way on any tokio version. This happens when the call that started the check stops being driven while another call waits for its answer.

Expected behavior

Both finish. Every crate uses tokio 1.54.1 from one workspace declaration.

Detailed discussion

Root cause

tokio 1.54.0 (tokio-rs/tokio#8371) keeps the FIFO lock order when a task runs out of its coop budget. Mutex::lock() can now take the permit and then return Pending while it holds it. tokio closed the resulting report (tokio-rs/tokio#8772) as intended behaviour. Any future that starts a lock and is then left unpolled ("snoozed" inside ready_chunks, buffered, FuturesUnordered or select!) keeps the lock. If the task then awaits something that needs that lock, it deadlocks: a "futurelock".

Changes

  • dash-sdk mock (Sdk::execute and proof parsing, Mock arms). platform-wallet's sync_private_contact_requests reads pages through ready_chunks, and its loop body makes its own SDK calls while further page fetches sit unpolled. Under tokio 1.54 a snoozed fetch kept the mock SDK's tokio Mutex permit, and the body's next SDK call waited forever. The mock now takes that lock through tokio::task::coop::unconstrained, so it never yields for budget while holding the permit; the critical sections under it are synchronous. On wasm32, which has no runtime budget, it is a plain lock(). The production DAPI path takes no such lock, and platform-wallet code is unchanged. task::coop needs tokio 1.44 or later; the workspace requirement below covers it.
  • dash-async: new single_flight::SingleFlight<Fut> (also re-exported at the crate root). It shares one in-flight future among concurrent callers, so a request goes out once and no caller depends on another caller being polled. join_or_start returns Flight::Joined or Flight::Started. A joined flight ends with StarterDropped, a crate-owned error type, when the starter is dropped first. The module docs say when to use it, and when not to: keyed requests, or work that must outlive its starter.
    • Every caller polls the shared future itself, so nobody depends on the starting call being polled.
    • Dropping Started aborts the future and clears the slot, but only if the slot still holds that same future.
    • A finished future is never joined.
    • The internal std::sync::Mutex is never held across an await.
    • It is generic over the future type, so !Send futures work too. It needs no runtime and no spawn, and works on wasm32. futures becomes a dependency on all targets.
  • Why not an existing crate. mea (singleflight::Group), asyncband, async_singleflight and singleflight-async are keyed and leader-driven: waiters only wait for the leader's result. A leader that stops being polled therefore still blocks them, which is the futurelock this PR fixes. SingleFlight is a thin layer over futures::future::Shared + Abortable, which provide the "every waiter drives it" property.
  • dash-sdk (protocol_gate::probe_once_while and probe_for_newer_network). The probe was serialised by a tokio::sync::Mutex held across the network round trip, so a waiter depended on the starting call being polled. The running probe, the gate's or the newer-network question asked before a ban, now lives in a SingleFlight<BoxFuture<..>>, which waiting calls poll themselves. The documented contract is unchanged:
    • one probe at a time, run under the settings of the call that started it;
    • if that probe failed, or its starting call was dropped (the probe is aborted then), a waiting call asks at once under its own settings;
    • the answered counter counts only successful probes.
  • One tokio declaration for the workspace. The root Cargo.toml declares tokio = { version = "1.54.1", default-features = false }, and all 29 tokio entries in 20 crates use workspace = true with their own features, optional flag and target/dev placement. Their requirements used to range over "1", 1.40, 1.41, 1.44, 1.45 and 1.47.0. default-features = false lets the wasm32 entry of rs-dapi-client keep disabling defaults; tokio's default feature set is empty, so no crate gains or loses a feature (cargo metadata shows identical feature sets before and after).
  • Cargo.lock: tokio 1.52.3 → 1.54.1; the only other change is cargo re-sorting two entries in tokio-util's dependency list. tokio 1.52.3 is also flagged unsound by RUSTSEC-2026-0386.

Testing

  • should_not_take_the_store_as_read_by_a_pass_a_sender_was_unignored_under (platform-wallet) now bounds both reads with a 10 s timeout. Without the mock fix it fails on tokio 1.54.1 after 10 s instead of hanging; with the fix it passes in 0.75 s. All platform-wallet (--all-features, 2042) and dash-sdk (1075) tests pass.
  • New should_answer_a_waiting_call_while_the_asking_call_is_not_polled (dash-sdk) starts a probe with one gated call, never polls that call again, and awaits a second gated call under a 5 s timeout. It times out on the old code and passes with the fix, with exactly one probe sent. All dash-sdk tests (1075) pass.
  • dash-async unit tests for SingleFlight:
    • a joiner drives an unpolled starter;
    • dropping the starter aborts the future and clears the slot;
    • a finished future is not joined;
    • a newer future survives an older starter's drop;
    • concurrent callers run the future once;
    • a !Send future works.
    • formatting a SingleFlight while start runs does not block;
    • Debug works for flights of futures that are not Debug;
    • plus a doctest on join_or_start.
  • cargo clippy --all-targets -- -D warnings for dash-async, dash-sdk, rs-dapi-client and platform-wallet --all-features: clean. wasm32 clippy for wasm-sdk, with and without mocks: clean. cargo fmt: clean.

Not changed here

  • The other mock-SDK lock acquires (expect, remove, request_count) are test-setup calls that are awaited directly, so none of them can be left unpolled.
  • On a multi-thread runtime, a waiter for the mock lock can still be handed the permit while nobody polls it. That window is microseconds. Switching the mock to std::sync::Mutex would close it, but it would break tests that hold mock_dapi().lock() across awaits.

Possible follow-ups

Each in its own PR, in order of value.

  1. A per-test timeout in CI nextest. A hung test today runs until the 90-minute job timeout and holds back dependent jobs; that is how this deadlock surfaced. Recommended: add .config/nextest.toml with a ci profile, slow-timeout = { period = "60s", terminate-after = 5 }, and use it in the Rust workspace tests job.

  2. Move the other shared in-flight futures onto SingleFlight.

    • rs-sdk-trusted-context-provider/src/quorum_refresh.rs has a single slot.
    • rs-sdk-trusted-context-provider/src/proof_fetches.rs is keyed, holds a WeakShared and caches.
    • wasm-sdk/src/sdk.rs (SharedContractFetch) is keyed and !Send.

    None of them aborts when its starter is dropped. Recommended: add an opt-in non-aborting mode and a keyed SingleFlightMap<K, Fut> wrapper to dash-async, then migrate one site per PR, starting with quorum_refresh. Keep each site's current semantics and tests.

  3. Mock SDK locks. On a multi-thread runtime, a waiter for the mock's tokio::sync::Mutex can still be handed the permit while nobody polls it. That blocks other mock calls, but only for microseconds. Recommended: guard the purely synchronous mock sections with a std::sync::Mutex, and keep the tokio lock only for the test-setup API (expect, remove, request_count). Changing the public Sdk::mock()/mock_dapi() guard type needs a breaking release.

  4. Futurelock-prone loops in platform-wallet. sync_private_contact_requests still awaits SDK calls while page fetches from ready_chunks sit unpolled. Recommended: either finish or cancel the in-flight fetches before the loop body awaits, or document as an invariant that the body must not await anything that shares a lock with the fetches. Also audit other buffered/ready_chunks/select! loops whose bodies await.

  5. Pre-existing dead-code warnings. These exist the same way on v5.2-dev:

    • Sdk::verify_response_metadata_as_of when dash-sdk is built without mocks;
    • asset_lock/operation.rs:161 and sync/tracking.rs:126 in platform-wallet without --all-features.

    Recommended: #[cfg_attr(not(feature = ...), expect(dead_code, reason = "..."))] or cfg-gate the items, in one small PR.

Breaking changes

No API changes. Crates published from this workspace now require tokio 1.54.1 or later instead of 1.40 (or 1), so a downstream project pinned to an older tokio must upgrade.

Checklist

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have added or updated relevant unit/integration/functional/e2e tests

Attribution

🤖 Generated with Claude Code

https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC

PR Hygiene · 5ea38b4

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Build running
  • Approvals
    • files with no dedicated owner (Cargo.lock, Cargo.toml, packages/dapi-grpc/Cargo.toml and 11 more) — QuantumExplorer or shumkov
    • rust-dapi — you own it
    • dpp (packages/rs-dpp/Cargo.toml) — QuantumExplorer or shumkov
    • rs-drive-abci (packages/rs-drive-abci/Cargo.toml) — QuantumExplorer or shumkov
    • rs-platform-wallet-ffi (packages/rs-platform-wallet-ffi/Cargo.toml) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • wallet-storage — you own it
    • rs-platform-wallet (packages/rs-platform-wallet/Cargo.toml, packages/rs-platform-wallet/src/wallet/identity/network/private_contact_requests.rs) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • rust-sdk-ffi — you own it
    • rust-sdk — you own it
    • js-wasm-sdk (packages/wasm-sdk/Cargo.toml) — shumkov

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

lklimek and others added 5 commits November 16, 2026 20:09
…dget

sync_private_contact_requests keeps page fetches in flight in its
ready_chunks stream while it processes a batch, so they go unpolled during
the batch's own SDK calls. From tokio 1.54 (tokio-rs/tokio#8371) a tokio
lock() that takes its permit and then yields for coop budget keeps the
permit; a fetch stopped there blocks every later caller of that lock
forever (a futurelock, tokio-rs/tokio#8772). With the mock SDK's tokio
mutexes this hung the pass of
should_not_take_the_store_as_read_by_a_pass_a_sender_was_unignored_under.

Poll the stream under tokio::task::unconstrained so no fetch stops holding
a lock, and bound that test's reads with a timeout so a deadlock fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC
The tokio-only update re-resolved socket2 and windows-sys for unrelated
crates; restore their v5.2-dev resolution so only tokio changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC
The protocol gate held a tokio Mutex across the probe's network round
trip, and concurrent gated calls waited on lock().await. When the call
that started the probe sat unpolled in the same task (select!, buffered
streams, ready_chunks) while that task awaited another gated call, the
task deadlocked; tokio >= 1.54 coop yields while holding a permit widen
the window.

The running probe is now a futures Shared future kept in a std Mutex
slot that is never held across an await. Waiting calls poll it too, so
it completes without its starter being polled. The starter aborts it on
drop, so waiting calls still ask under their own settings then, as the
gate's contract states. Runtime-agnostic, so wasm32 is unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC
From tokio 1.54 (tokio-rs/tokio#8371) a Mutex::lock() that takes its
permit can still return Pending for coop budget, keeping the permit; a
future left unpolled there blocks every later caller (tokio#8772). The
mock SDK's DAPI and proof-parsing mutexes are the only tokio locks on
the fetch path, so they are now acquired under
tokio::task::coop::unconstrained (plain lock() on wasm32, which has no
tokio runtime). Both critical sections are synchronous, so the guards
are never held across a Pending.

This moves the futurelock fix to its owning layer: platform-wallet's
private contact request scan polls its page stream plainly again, and
its regression test, bounded by timeouts, stays green. tokio::task::coop
needs tokio 1.44, so dash-sdk's native requirement is raised to it.

Also imports abortable, Duration and timeout instead of qualifying them
at call sites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions github-actions Bot added this to the v5.2.0 milestone Nov 16, 2026
@thepastaclaw

thepastaclaw commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because the new head is waiting for the 30-minute push debounce.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 5ea38b4. Normal review starts when eligible; priority review starts as soon as a slot is available.

lklimek and others added 3 commits November 16, 2026 22:19
Move the protocol gate's single-flight mechanics into dash-async as
SingleFlight: one in-flight future shared by every concurrent caller,
polled by each of them so none depends on the starter being polled,
aborted and cleared when the starter is dropped, never joined once
finished. It needs no runtime or spawn, is generic over the future type
(so !Send futures work), and dash-async now depends on futures on every
target for it.

The gate keeps its probe-specific logic and behaves as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC
Say when to use SingleFlight (one request for concurrent callers of the
same result, instead of an async mutex held across another caller's
request) and when not to (keyed requests, work that must outlive its
starter). Document that `start` runs with the slot locked and must not
re-enter it, and when a joined future ends without an output.

Debug never blocks on the slot, so formatting from inside `start` no
longer deadlocks; Flight and Joined get Debug without a `Fut: Debug`
bound, and join_or_start and Flight are must_use. The types live in
`dash_async::single_flight` and end with a crate-owned StarterDropped
error instead of exposing futures' Aborted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WunYYijwZNbw3EjHtdMAHC

@lklimek lklimek left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/self-reviewed

@lklimek
lklimek marked this pull request as ready for review November 16, 2026 22:44
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 16, 2026

@thepastaclaw thepastaclaw left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

Updated after discussion: 3 finding(s) of this review were settled in the inline threads.

  • ✅ Withdrawn: 🟡 Keep failed-probe retries single-flight
  • ✅ Withdrawn: 🟡 Make the impossible StarterDropped case explicit
  • ✅ Withdrawn: 🟡 Use a wasm-compatible runtime flavor for the concurrency test

The change addresses the reported future-lock paths and introduces a sound caller-driven SingleFlight primitive, with no blocking correctness, security, layering, or consensus issues found. I retained three non-blocking findings: failed protocol probes bypass SingleFlight retries, the concurrency test is unnecessarily native-only, and an impossible StarterDropped result is silently discarded. Rust workspace, wasm32, and JS checks were still in progress; no failed code checks were reported.

🟡 3 0 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a substantial cross-cutting asynchronous-concurrency change affecting SDK request coordination, mock execution, wallet synchronization behavior, and a new shared-future primitive, but it does not modify a critical surface such as consensus, funds movement, cryptography, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-sdk/src/sdk/protocol_gate.rs`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-sdk/src/sdk/protocol_gate.rs:440-443: Keep failed-probe retries single-flight
  After a shared probe fails, `answered` is unchanged and the gate remains in `Gate::Probe`, so every joined caller leaves `SingleFlight` and calls `probe_unless_answered` directly. Those retries can therefore enter `probe_network_protocol_version` concurrently, whereas the previous mutex kept retrying waiters serialized. Under a failing probe this multiplies network requests and can multiply address-banning or error side effects. Re-enter a fresh SingleFlight generation for the retry, or otherwise serialize retry generations without holding an async mutex across the network await, and add a multiple-waiter failing-probe test that asserts only one retry is in flight.
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-sdk/src/sdk/protocol_gate.rs:446: Make the impossible StarterDropped case explicit
  `Started` aborts its shared future only from its own `Drop` implementation, so while `started.await` is being evaluated it cannot produce `StarterDropped`. Using `.ok()?` silently converts that impossible state into `None`, which looks like a probe with no failure cause and hides the lifecycle invariant from future maintainers. Handle the result explicitly and document or assert why the error arm is unreachable.

In `packages/rs-dash-async/src/single_flight.rs`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-dash-async/src/single_flight.rs:299: Use a wasm-compatible runtime flavor for the concurrency test
  The SingleFlight implementation and dependency are intentionally usable on wasm32, but this test requires Tokio's `multi_thread` flavor, which wasm32 cannot provide. The test does not need OS threads: each task calls `join_or_start` before its first await, so cooperative single-threaded scheduling still exercises the run-once assertion and barrier rendezvous. Removing the flavor keeps the coverage while allowing the test to compile and run wherever the crate is supported.

@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or shumkov · rs-platform-wallet: HashEngineering or ZocoLini or llbartekll or romchornyi.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. labels Nov 18, 2026

@lklimek lklimek left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/self-reviewed

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or shumkov.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 18, 2026

@llbartekll llbartekll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 95bc79e. The SingleFlight slot handling holds up (finished futures are never joined, a starter's drop only clears its own future, the std mutex is never held across an await), and probe_unless_probing keeps its contract: one probe per wave, waiters drive it themselves and re-ask under their own settings when it failed or was aborted. The mock lock via unconstrained and the wallet test timeouts look right. No blocking issues.

@lklimek

lklimek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decisions on review-summary findings that have no inline thread:

  • SingleFlight::new requires a Clone result although Default does not (review): Per maintainer decision, out of scope for this PR.

🤖 Co-authored by Claudius the Magnificent AI Agent

1 similar comment
@lklimek

lklimek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decisions on review-summary findings that have no inline thread:

  • SingleFlight::new requires a Clone result although Default does not (review): Per maintainer decision, out of scope for this PR.

🤖 Co-authored by Claudius the Magnificent AI Agent

@HashEngineering HashEngineering left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Reviewed from the dash-wallet / kotlin-sdk side: on the request path the wallet's native library uses (dapi-client, context provider, JNI), the only tokio::sync lock was the protocol gate, which this replaces with SingleFlight. The rest use std/parking_lot locks and aren't affected by the 1.54 lock-order change. Please keep follow-up 4: the ready_chunks loop in sync_private_contact_requests is safe only while page fetches share no tokio lock with the loop body, and that sync runs every ~15 s on Android. Nit: the lockfile moves tokio from 1.53.3, not 1.52.3 as the description says.

Comment thread packages/rs-dash-async/Cargo.toml Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: address shumkov left a review thread unresolved, then post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. labels Nov 25, 2026
Every member now takes tokio from `[workspace.dependencies]` at 1.54.1
instead of its own mix of "1", "1.40", "1.41", "1.44", "1.45" and
"1.47.0" requirements. Each crate keeps its own features, target and
dependency kind. The workspace entry sets `default-features = false` so
rs-dapi-client's wasm entry can keep it; tokio's default feature set is
empty, so no crate gains or loses a feature.

Cargo.lock: cargo re-sorts the tokio-util dependency list that the base
branch left unsorted; nothing else changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 25, 2026
@lklimek lklimek changed the title fix(sdk): bump tokio to 1.54.1 and fix the futurelocks it exposes fix(sdk): bump tokio to 1.54.1 workspace-wide and fix the futurelocks it exposes Nov 25, 2026

@lklimek lklimek left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/self-reviewed

@lklimek

lklimek commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

/skip-bots

@github-actions github-actions Bot added bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 25, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This head centralizes the Tokio 1.54.1 requirement across all 29 dependency declarations without changing their features, optionality, or target scopes; the lockfile already resolved 1.54.1 at the previous review. The Rust wasm32 and Kotlin checks passed, while native Rust workspace tests and some integration checks were still pending. Browser shard 2 failed before running tests because Dash Core nodes timed out syncing to height 1392 in the unchanged local-network setup, before the SDK code under review was exercised.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The shared-future cancellation logic and SDK probe changes warrant careful review, but the diff changes client-side coordination rather than consensus rules or another critical surface.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@github-actions github-actions Bot removed the bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 25, 2026
@lklimek
lklimek merged commit fddec1a into v5.2-dev Nov 25, 2026
25 of 28 checks passed
@lklimek
lklimek deleted the fix/tokio-deadlock-v5.2 branch November 25, 2026 15:16
romchornyi added a commit that referenced this pull request Nov 25, 2026
…let-payment-delivery

Brings in #5949 (tokio 1.54.1) and #5536 (invitation claim preflight).

#5536's new PlatformWalletError variants get a payment class:
- InvitationNotReady: NotSent, retryable (the preflight lookups could not
  be verified yet; nothing was broadcast).
- InvitationKeysAlreadyRegistered: NotSent when the preflight found the
  owner (no rejection), MaybeSent when it carries Platform's refusal of
  the broadcast claim; never retryable.
- InvitationAlreadyClaimed, InvitationClaimedByThisWallet: MaybeSent, not
  retryable: usually found before the broadcast, but also reported from
  Platform's refusal of a claim a lagging node let through.
AssetLockNotChainLocked keeps its class (MaybeSent) under its new code 66.

The FFI invitation export keeps the base's wait outside the registry
guard and the asset-lock handle the voucher handoff class needs. Swift's
new cases (codes 63-66) carry `payment`; Kotlin's overrides on 65 and 66
go, since `isRetryable` is the native answer. Registry rows 63-66 state
the class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants