Skip to content

test: prove platform PR #3376 breaks Send inference - #777

Closed
lklimek wants to merge 3 commits into
v1.0-devfrom
test/prove-send-regression-3376
Closed

test: prove platform PR #3376 breaks Send inference#777
lklimek wants to merge 3 commits into
v1.0-devfrom
test/prove-send-regression-3376

Conversation

@lklimek

@lklimek lklimek commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bumps dash-sdk to platform rev 3286fcfc (contains dashpay/platform#3376)
  • Renames Network::DashNetwork::Mainnet per upstream rust-dashcore

This PR intentionally does NOT compile. It exists as proof that PR #3376 ("extract retry logic from trait default methods to fix HRTB Send issue") paradoxically introduces 4 Send bound errors in evo-tool's backend task dispatch:

error: implementation of `Send` is not general enough
  = note: `Send` would have to be implemented for the type `&DataContract`,
          for some specific lifetime `'0`

What changed upstream

PR #3376 extracted inline retry+closure logic from #[async_trait] trait default methods (fetch_with_metadata_and_proof, fetch_many_with_metadata_and_proof) into standalone async fn helpers. This adds an opaque future boundary that the compiler cannot see through, defeating HRTB Send inference (rust-lang/rust#100013).

Proof

  • Old rev (aa86b74f, current v1.0-dev): compiles clean, no workaround needed
  • New rev (3286fcfc, this PR): 4 Send errors, does not compile

Workaround

unsafe { transmute } to assert Send on the pinned boxed future — implemented separately in the feat/mempool-support branch.

See: dashpay/platform#3376
See: rust-lang/rust#100013

🤖 Co-authored by Claudius the Magnificent AI Agent

Summary by CodeRabbit

  • Chores
    • Updated core SDK dependency to a newer revision.
    • Consolidated network identification to treat Mainnet as the primary network across the app.
  • New Features / UI
    • Refined network display labels and core address input hints to reflect the Mainnet default.
    • Adjusted network-related defaults and connectivity behavior for a more consistent user experience.

Bump dash-sdk to platform rev 3286fcfc (which includes PR dashpay/platform#3376
"extract retry logic from trait default methods to fix HRTB Send issue")
and rename Network::Dash → Network::Mainnet per upstream rust-dashcore.

This does NOT compile — 4 Send bound errors in backend_task dispatch:

  error: implementation of `Send` is not general enough
    = note: `Send` would have to be implemented for the type
            `&DataContract`, for some specific lifetime `'0`

The old platform rev (aa86b74f, currently on v1.0-dev) compiles clean
without any workaround. PR #3376 paradoxically introduces the regression
by extracting inline closure logic into standalone `async fn` helpers,
adding opaque future boundaries that defeat HRTB Send inference
(Rust issue #100013).

See: dashpay/platform#3376
See: rust-lang/rust#100013

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 23a6d8c1-8884-41ff-912e-b7499c57dcb1

📥 Commits

Reviewing files that changed from the base of the PR and between 17acfb4 and e55f89f.

📒 Files selected for processing (1)
  • src/context/wallet_lifecycle.rs

📝 Walkthrough

Walkthrough

Replaces usages of the Network::Dash variant with Network::Mainnet across the codebase and updates the dash-sdk Git dependency revision; changes affect network routing, config/mapping, wallet derivation, UI gating, tests, SPV/P2P defaults, and related logic.

Changes

Cohort / File(s) Summary
Dependency
Cargo.toml
Updated dash-sdk Git dependency revision; features unchanged.
App init & routing
src/app.rs, src/app_dir.rs, src/config.rs
Switched primary network selection, context availability, core ZMQ routing, and config-for-network mapping from Network::Dash to Network::Mainnet.
Context & connection
src/context/...
src/context/mod.rs, src/context/connection_status.rs, src/context/wallet_lifecycle.rs
Mapped default platform version, chainlock online checks, and wallet network key mappings to Network::Mainnet.
Backend tasks & platform
src/backend_task/...
src/backend_task/core/mod.rs, src/backend_task/dashpay/hd_derivation.rs, src/backend_task/mnlist.rs, src/backend_task/platform_info.rs
Updated network matching for chainlock retrieval, DashPay xpub test, MNList heights, and epoch timing to use Mainnet.
Model & wallet logic
src/model/...
src/model/settings.rs, src/model/qualified_identity/..., src/model/wallet/mod.rs, src/model/qualified_identity/qualified_identity_public_key.rs
Changed default Settings network, identity decode default, wallet BIP44/path selection, Platform-address signing derivation, and testnet-derivation conditions to treat Mainnet as primary.
Database & tests
src/database/...
src/database/settings.rs, src/database/contested_names.rs, src/database/utxo.rs
Adjusted default stored network in tests, contest duration branch for mainnet, and UTXO test network insertion to Network::Mainnet.
P2P, SPV & core p2p handler
src/components/core_p2p_handler.rs, src/spv/manager.rs
Remapped default P2P port, QR timeout selection, and SPV data dir naming to Network::Mainnet.
UI: network gating, hints, theme
src/ui/...
src/ui/network_chooser_screen.rs, src/ui/left_panel.rs, src/ui/theme.rs, src/ui/contracts_documents/contracts_documents_screen.rs, src/ui/identities/*, src/ui/wallets/wallets_screen/dialogs.rs
Updated UI gating, labels, address hint text, feature-button visibility, and accent color selection to depend on Network::Mainnet.
UI tools & tokens tests
src/ui/tools/masternode_list_diff_screen.rs, src/ui/tokens/tokens_screen/mod.rs
Changed MNList initialization and test mock identities to use Network::Mainnet.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through code with nimble feet,

swapped Dash for Mainnet, tidy and neat,
deps updated, tests aligned,
contexts, UI, wallets all redefined,
a tiny hop — the repo feels complete. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the PR's primary objective: demonstrating that upstream platform PR #3376 breaks Send inference in evo-tool.

✏️ 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 test/prove-send-regression-3376
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@lklimek
lklimek marked this pull request as ready for review March 19, 2026 12:29
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/database/utxo.rs (1)

254-259: ⚠️ Potential issue | 🔴 Critical

Fix the inconsistent network string in the mainnet UTXO query.

The test inserts UTXOs with Network::Mainnet (line 243), which stores network as "mainnet" via the insert_utxo implementation. However, line 256 queries with the hardcoded string "dash", causing a mismatch that makes the query return zero results. The assertion at line 258 will fail because mainnet_utxos will be empty.

🔧 Suggested fix
         // Query mainnet UTXOs
         let mainnet_utxos = db
-            .get_utxos_by_address(&mainnet_address.to_string(), "dash")
+            .get_utxos_by_address(&mainnet_address.to_string(), &Network::Mainnet.to_string())
             .expect("Failed to get mainnet UTXOs");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/database/utxo.rs` around lines 254 - 259, The test queries mainnet UTXOs
with the wrong network string; update the call to get_utxos_by_address so the
network argument matches how insert_utxo stores Network::Mainnet (replace the
hardcoded "dash" with "mainnet")—modify the invocation that produces
mainnet_utxos (the get_utxos_by_address call using mainnet_address) so
assertions on mainnet_utxos succeed.
src/app.rs (1)

325-354: ⚠️ Potential issue | 🔴 Critical

App startup will crash for existing users with "Dash" stored in database—missing backward compatibility.

Old databases contain the string "Dash" (stored via Network::Dash.to_string()), but the recent Network enum rename to Network::Mainnet removed that variant. When Network::from_str("Dash") is called at line 586 in src/database/settings.rs, it will fail and return InvalidQuery, causing the error to propagate at line 221 in src/app.rs. The app crashes before reaching the match statement at lines 325–354.

No migration code exists to handle the string-to-enum conversion for old database values. Without either (1) updating Network::from_str() to map "Dash" → Mainnet, or (2) adding migration logic to rewrite "Dash" entries to "Mainnet" in existing databases, existing users cannot launch the app.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app.rs` around lines 325 - 354, Existing databases still store the string
"Dash" which causes Network::from_str(...) to fail; update Network::from_str to
accept "Dash" (case-insensitive) and return Network::Mainnet when encountered,
and additionally add a small migration step where settings loading (the code
path that calls Network::from_str) detects the "Dash" raw string and
rewrites/saves it as "Mainnet" before constructing the Network enum so old DBs
are transparently upgraded; modify the parsing function Network::from_str and
the settings load/save logic that calls it to implement these changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/database/settings.rs`:
- Around line 649-650: The inline comment above the assertion for network is
stale ("dash") and should reflect the renamed enum; update the comment near the
assertion that checks network and Network::Mainnet so it reads that the default
network is "mainnet" (or otherwise matches Network::Mainnet) to avoid
confusion—look for the comment immediately preceding the assert_eq!(network,
Network::Mainnet) and change its text accordingly.

In `@src/ui/tools/masternode_list_diff_screen.rs`:
- Line 148: The Testnet fallback currently constructs a Mainnet engine via
MasternodeListEngine::default_for_network(Network::Mainnet); change the fallback
to instantiate the correct Testnet engine by calling
MasternodeListEngine::default_for_network(Network::Testnet) when handling the
Testnet artifact-missing path so the masternode list/quorum logic uses Testnet
parameters instead of Mainnet.

---

Outside diff comments:
In `@src/app.rs`:
- Around line 325-354: Existing databases still store the string "Dash" which
causes Network::from_str(...) to fail; update Network::from_str to accept "Dash"
(case-insensitive) and return Network::Mainnet when encountered, and
additionally add a small migration step where settings loading (the code path
that calls Network::from_str) detects the "Dash" raw string and rewrites/saves
it as "Mainnet" before constructing the Network enum so old DBs are
transparently upgraded; modify the parsing function Network::from_str and the
settings load/save logic that calls it to implement these changes.

In `@src/database/utxo.rs`:
- Around line 254-259: The test queries mainnet UTXOs with the wrong network
string; update the call to get_utxos_by_address so the network argument matches
how insert_utxo stores Network::Mainnet (replace the hardcoded "dash" with
"mainnet")—modify the invocation that produces mainnet_utxos (the
get_utxos_by_address call using mainnet_address) so assertions on mainnet_utxos
succeed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 47f7b08f-62be-482f-812c-31d41cf1372e

📥 Commits

Reviewing files that changed from the base of the PR and between a46d40f and 17acfb4.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (29)
  • Cargo.toml
  • src/app.rs
  • src/app_dir.rs
  • src/backend_task/core/mod.rs
  • src/backend_task/dashpay/hd_derivation.rs
  • src/backend_task/mnlist.rs
  • src/backend_task/platform_info.rs
  • src/components/core_p2p_handler.rs
  • src/config.rs
  • src/context/connection_status.rs
  • src/context/mod.rs
  • src/context/wallet_lifecycle.rs
  • src/database/contested_names.rs
  • src/database/settings.rs
  • src/database/utxo.rs
  • src/model/qualified_identity/mod.rs
  • src/model/qualified_identity/qualified_identity_public_key.rs
  • src/model/settings.rs
  • src/model/wallet/mod.rs
  • src/spv/manager.rs
  • src/ui/components/left_panel.rs
  • src/ui/contracts_documents/contracts_documents_screen.rs
  • src/ui/identities/transfer_screen.rs
  • src/ui/identities/withdraw_screen.rs
  • src/ui/network_chooser_screen.rs
  • src/ui/theme.rs
  • src/ui/tokens/tokens_screen/mod.rs
  • src/ui/tools/masternode_list_diff_screen.rs
  • src/ui/wallets/wallets_screen/dialogs.rs

Comment thread src/database/settings.rs
Comment on lines 649 to +650
// Default network is "dash" (mainnet)
assert_eq!(network, Network::Dash);
assert_eq!(network, Network::Mainnet);

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.

⚠️ Potential issue | 🟡 Minor

Update the stale inline comment to match the renamed enum.

Line 649 still says "dash" while Line 650 asserts Network::Mainnet. Please align the comment text to avoid confusion.

Suggested patch
-        // Default network is "dash" (mainnet)
+        // Default network is Mainnet
         assert_eq!(network, Network::Mainnet);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Default network is "dash" (mainnet)
assert_eq!(network, Network::Dash);
assert_eq!(network, Network::Mainnet);
// Default network is Mainnet
assert_eq!(network, Network::Mainnet);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/database/settings.rs` around lines 649 - 650, The inline comment above
the assertion for network is stale ("dash") and should reflect the renamed enum;
update the comment near the assertion that checks network and Network::Mainnet
so it reads that the default network is "mainnet" (or otherwise matches
Network::Mainnet) to avoid confusion—look for the comment immediately preceding
the assert_eq!(network, Network::Mainnet) and change its text accordingly.

} else {
tracing::warn!("MNListDiff file not found: {}", file_path);
MasternodeListEngine::default_for_network(Network::Dash)
MasternodeListEngine::default_for_network(Network::Mainnet)

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.

⚠️ Potential issue | 🟠 Major

Use Testnet engine in the Testnet fallback path.

When the Testnet artifact file is missing, this currently initializes a Mainnet engine, which can produce incorrect MN list/quorum behavior on Testnet.

Suggested fix
-                    MasternodeListEngine::default_for_network(Network::Mainnet)
+                    MasternodeListEngine::default_for_network(Network::Testnet)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MasternodeListEngine::default_for_network(Network::Mainnet)
MasternodeListEngine::default_for_network(Network::Testnet)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/ui/tools/masternode_list_diff_screen.rs` at line 148, The Testnet
fallback currently constructs a Mainnet engine via
MasternodeListEngine::default_for_network(Network::Mainnet); change the fallback
to instantiate the correct Testnet engine by calling
MasternodeListEngine::default_for_network(Network::Testnet) when handling the
Testnet artifact-missing path so the masternode list/quorum logic uses Testnet
parameters instead of Mainnet.

@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.

Code Review

The mechanical Network::Dash → Network::Mainnet rename is thorough across .rs files and the PR achieves its stated goal of proving platform PR #3376 introduces Send bound regressions. One doc file was missed in the rename, and one pre-existing bug (Testnet fallback using Mainnet default) was carried forward unchanged. The database serialization gap (DEFAULT_NETWORK still 'dash') and hardcoded test strings are valid observations for the companion migration PR, not blocking for this intentionally non-compiling proof.

Reviewed commit: e55f89f

🟡 3 suggestion(s) | 💬 2 nitpick(s)

4 additional findings

🟡 suggestion: Hardcoded 'dash' string in test will break after rename

src/database/utxo.rs (line 256)

The test inserts a UTXO with Network::Mainnet (line 243, which now serializes to "mainnet") but queries with the hardcoded string "dash" (line 256). On v1.0-dev this worked because Network::Dash.to_string() returned "dash". Observation for the companion PR — this test will fail once the rename is real.

💡 Suggested change
            .get_utxos_by_address(&mainnet_address.to_string(), "mainnet")
🟡 suggestion: DEFAULT_NETWORK still 'dash' — needs migration in companion PR

src/database/initialization.rs (lines 7-9)

DEFAULT_NETWORK is "dash" and DEFAULT_DB_VERSION is still 28. If Network::Mainnet.to_string() returns "mainnet" in the new SDK, all 17 tables storing network as text will have stale "dash" values, and Network::from_str("dash") may fail. This is not blocking for a proof-of-concept that intentionally doesn't compile, but the real migration PR will need a version 29 migration to UPDATE all network columns from 'dash' to 'mainnet'.

💬 nitpick: Stale Network::Dash reference in documentation

docs/local-network.md (line 100)

The comparison table still reads Network::Dash in the Mainnet column. This was missed during the mechanical rename.

💡 Suggested change
| Network enum         | `Network::Regtest`       | `Network::Testnet` / `Network::Devnet` | `Network::Mainnet`  |
💬 nitpick: Removed NetworkExt import — verify upstream removed the trait

src/ui/tools/masternode_list_diff_screen.rs (line 17)

The v1.0-dev version had use dash_sdk::dpp::dashcore::network::constants::NetworkExt; at line 20 (old numbering). This import was removed with no replacement. Worth confirming the upstream dashcore rev at 3286fcfc actually removed or renamed this trait, so it doesn't silently drop functionality.

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/ui/tools/masternode_list_diff_screen.rs`:
- [SUGGESTION] line 148: Pre-existing bug: Testnet fallback creates Mainnet engine
  In the `Network::Testnet` match arm (line 125), when the MNListDiff file is not found (else branch at line 146), the fallback creates `MasternodeListEngine::default_for_network(Network::Mainnet)`. This should be `Network::Testnet`. On v1.0-dev this was `Network::Dash` (equally wrong). The mechanical rename carried the bug forward. Not introduced by this PR, but now more visible thanks to the rename making Mainnet/Testnet semantically distinct.

In `src/database/utxo.rs`:
- [SUGGESTION] line 256: Hardcoded 'dash' string in test will break after rename
  The test inserts a UTXO with `Network::Mainnet` (line 243, which now serializes to `"mainnet"`) but queries with the hardcoded string `"dash"` (line 256). On v1.0-dev this worked because `Network::Dash.to_string()` returned `"dash"`. Observation for the companion PR — this test will fail once the rename is real.

In `src/database/initialization.rs`:
- [SUGGESTION] lines 7-9: DEFAULT_NETWORK still 'dash' — needs migration in companion PR
  DEFAULT_NETWORK is `"dash"` and DEFAULT_DB_VERSION is still 28. If `Network::Mainnet.to_string()` returns `"mainnet"` in the new SDK, all 17 tables storing network as text will have stale `"dash"` values, and `Network::from_str("dash")` may fail. This is not blocking for a proof-of-concept that intentionally doesn't compile, but the real migration PR will need a version 29 migration to UPDATE all network columns from `'dash'` to `'mainnet'`.

} else {
tracing::warn!("MNListDiff file not found: {}", file_path);
MasternodeListEngine::default_for_network(Network::Dash)
MasternodeListEngine::default_for_network(Network::Mainnet)

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.

🟡 Suggestion: Pre-existing bug: Testnet fallback creates Mainnet engine

In the Network::Testnet match arm (line 125), when the MNListDiff file is not found (else branch at line 146), the fallback creates MasternodeListEngine::default_for_network(Network::Mainnet). This should be Network::Testnet. On v1.0-dev this was Network::Dash (equally wrong). The mechanical rename carried the bug forward. Not introduced by this PR, but now more visible thanks to the rename making Mainnet/Testnet semantically distinct.

💡 Suggested change
Suggested change
MasternodeListEngine::default_for_network(Network::Mainnet)
MasternodeListEngine::default_for_network(Network::Testnet)

source: ['claude']

🤖 Fix this with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/ui/tools/masternode_list_diff_screen.rs`:
- [SUGGESTION] line 148: Pre-existing bug: Testnet fallback creates Mainnet engine
  In the `Network::Testnet` match arm (line 125), when the MNListDiff file is not found (else branch at line 146), the fallback creates `MasternodeListEngine::default_for_network(Network::Mainnet)`. This should be `Network::Testnet`. On v1.0-dev this was `Network::Dash` (equally wrong). The mechanical rename carried the bug forward. Not introduced by this PR, but now more visible thanks to the rename making Mainnet/Testnet semantically distinct.

@thepastaclaw

Copy link
Copy Markdown
Collaborator

Review Gate

Commit: e55f89f5

  • Debounce: 14576m ago (need 30m)

  • CI checks: check(s) failed

  • CodeRabbit review: comment found

  • Run review now (check to override)

@lklimek lklimek closed this Apr 1, 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.

3 participants