-
Notifications
You must be signed in to change notification settings - Fork 59
fix(sdk): honor explicit regtest addresses in dapi-client; tolerate empty discovery in wasm-sdk trusted context #4538
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
base: v4.2-dev
Are you sure you want to change the base?
Changes from all commits
1af31af
d77050c
b03993d
c3003da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,7 +257,27 @@ impl WasmTrustedContext { | |
| .await | ||
| .map_err(|e| WasmSdkError::generic(format!("Failed to prefetch quorums: {}", e)))?; | ||
|
|
||
| let discovered_addresses = Self::fetch_addresses_from(&inner).await?; | ||
| // Masternode discovery is an optional convenience: it only feeds the | ||
| // no-explicit-addresses path in `withTrustedContext`, while the quorum | ||
| // data prefetched above is what proof verification actually needs. On | ||
| // a local network the sidecar's per-masternode version checks reject | ||
| // the gateway's self-signed TLS, so discovery failing there is the | ||
| // NORMAL case and must not make the whole trusted context unusable | ||
| // for an SDK constructed with explicit addresses. On public networks | ||
| // the failure stays fatal: it signals a genuine outage of the trusted | ||
| // endpoint, and degrading silently would hide it. | ||
| let discovered_addresses = match Self::fetch_addresses_from(&inner).await { | ||
| Ok(addresses) => addresses, | ||
| Err(e) if network == dash_sdk::dpp::dashcore::Network::Regtest => { | ||
| tracing::warn!( | ||
| error = %e, | ||
| "trusted context: masternode discovery unavailable, continuing without \ | ||
| discovered addresses (explicitly configured addresses are unaffected)" | ||
| ); | ||
| Vec::new() | ||
| } | ||
| Err(e) => return Err(e), | ||
| }; | ||
|
Comment on lines
+269
to
+280
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: Add deterministic tests for the network-scoped discovery fallback No committed test executes the new branches in source: ['claude'] |
||
|
|
||
| Ok(WasmTrustedContext { | ||
| inner, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Suggestion: Only suppress the expected empty-discovery error on regtest
The PR describes tolerating the normal
No eligible masternode addresses discoveredresult, but this match suppresses every discovery error on regtest.fetch_masternode_addressescan also fail because of transport errors, non-success HTTP responses, malformed JSON, or a sidecar-declared failure, andfetch_addresses_fromcan reject malformed URIs or addresses. Those failures currently become an empty discovered list, so a builder without explicit addresses silently retains its preset addresses and can contact an unintended endpoint. Preserve the provider error through this layer, represent the expected no-eligible-addresses result as a dedicated typed variant, and downgrade only that variant on regtest.source: ['claude']