Repository navigation
fix(sdk): return errors for unsupported proof modes - #5387
Conversation
Replace 40 proof-disabled encoder panics and the inverse quorum proof-mode panic with existing non-retryable Config errors before transport. Keep all supported request branches byte-identical and document the limited flag. Test would have caught this in CI: ✖ before fix, ✔ after. Public Rust Query/Fetch tests: 47 runtime panic failures and 45 passing controls before, all 92 passing after. Real WASM/Node identity entry points trap before and reject with Config afterward; the instance remains usable and no fetch calls occur. SDK library and raw parser controls also pass. Three existing offline vector tests remain ignored for their prior reasons. The neighboring pass-through Fetch missing-proof retry/ban behavior remains out of scope; no raw decoding policy or trust-model change is introduced.
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The proof-mode change is mergeable after normal checks. The remaining suggestion is optional cleanup, not a demonstrated behavior problem. Pre-merge checks ·
|
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-10-12T17:16:34.706Z |
There was a problem hiding this comment.
🔇 Additional comments (8)
book/src/sdk/fetch-traits.md (1)
191-213: LGTM!packages/rs-sdk/src/sdk.rs (1)
271-272: LGTM!Also applies to: 1026-1027
packages/rs-sdk/src/platform/types/identity.rs (1)
58-60: LGTM!packages/rs-sdk/src/platform/tokens/token_pre_programmed_distributions.rs (1)
41-43: LGTM!packages/rs-sdk/src/platform/types/finalized_epoch.rs (1)
16-18: LGTM!packages/rs-sdk/tests/proof_options.rs (1)
1-995: LGTM!packages/wasm-sdk/tests/unit/proof-options.spec.ts (1)
1-48: LGTM!packages/rs-sdk/src/platform/query.rs (1)
246-248: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Extract the repeated proof-required error into one helper.
This change repeats the same
Error::Configliteral about 35 times in this file. The same literal also appears inidentity.rs,finalized_epoch.rs, andtoken_pre_programmed_distributions.rs. The tests compare the exact string throughUNPROVED_MESSAGE. A future wording edit at one site can therefore drift from the other sites without notice. Add a helper such aspub(crate) fn require_proofs(prove: bool) -> Result<(), Error>and call it at each site.The shielded queries at Lines 1374-1377 and the following lines still return
Error::Generic. Callers therefore get different error kinds for the same refusal. Consider whether those queries should use the same helper.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: dashpay/platform/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
58027921-54a4-4d25-b938-7a3da0bf95cf
📒 Files selected for processing (8)
book/src/sdk/fetch-traits.mdpackages/rs-sdk/src/platform/query.rspackages/rs-sdk/src/platform/tokens/token_pre_programmed_distributions.rspackages/rs-sdk/src/platform/types/finalized_epoch.rspackages/rs-sdk/src/platform/types/identity.rspackages/rs-sdk/src/sdk.rspackages/rs-sdk/tests/proof_options.rspackages/wasm-sdk/tests/unit/proof-options.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
|
✅ Final review complete — no blockers (commit 3db4cf1) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The proof-mode changes correctly replace unsupported-query panics with non-retryable configuration errors before transport while preserving supported proved, raw, and forced-proof paths. The added Rust and WASM regression coverage is consistent with the implementation, and no in-scope defects were identified.
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: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a substantial SDK and Rust/WASM behavior change with broad regression coverage, but it does not modify consensus, cryptography, funds movement, network deserialization, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Align shielded proof-mode refusals with Error::Config — The pre-existing shielded query encoders in packages/rs-sdk/src/platform/query.rs still return Error::Generic when proofs are disabled, while the encoders changed by this PR return Error::Config. Both are non-retryable, but they expose different WasmSdkErrorKind values to JavaScript callers. The PR explicitly leaves shielded refusals unchanged, so this should be handled separately.
- Follow-up: Create a separate SDK cleanup change to standardize shielded proof-only refusals on Error::Config, or document why their Generic classification is intentional.
|
Bots are done — your move: post |
Basic explanation
What this does: Unsupported SDK proof modes return a recoverable configuration error before sending a request.
Value: Rust callers receive an error and JavaScript callers receive a rejected promise; the SDK remains usable after the refusal.
Risks: Low: client-side error handling only, with no consensus or proof-verification changes. Currently supported proved, raw and forced-proof paths keep their behavior.
Issue being fixed or feature implemented
Audit provenance: L1 in the user-provided audit. The regression inputs were reconstructed from public APIs; private campaign scripts were not available.
Proof-disabled identity, contract, nonce and other unsupported queries panic in their encoders. The inverse unsupported proof-enabled quorum query also panics. In wasm32 these panics escape the async promise as an uncaught runtime trap.
What was done?
Error::Configbefore transport.The neighboring pass-through
Fetchbehavior remains: some requests sendprove=falsewhile the normal fetch parser still requires a proof, which can produce retryable missing-proof errors and node bans. This patch does not add universal raw support or change retry/ban policy. Existing shieldedGenericrefusals also remain unchanged.How Has This Been Tested?
cargo test -p dash-sdk --test proof_options -j 2: baseline 47 real panic failures / 45 passing controls, fixed 92 passing, none ignored.RuntimeError: unreachable; fixed 2 passing, checking Config/code/isRetriable, repeated refusals, usable instance and zero fetch calls.Local validation used baseline
8ebfc8089d. Tests CI passed on final PR head3db4cf1fmerged with target371a3b39(synthetic merge40eecb15): release WASM build, 92 Rust proof-option tests, and both new public WASM cases in Node and ChromeHeadless (481 passing per runtime). Rust workspace CI reported 19,319 passed / 1,395 skipped; native platform integration reported 95 passed / 17 pending. Executed build, lint, integration and functional jobs passed. Three configured jobs were skipped: Evo SDK lint, Rust wallet tests and ARM64 runner image validation. Skipped jobs and skipped/pending cases are not counted as executed. Local WASM validation used Node; browser/Karma and release-profile coverage comes from CI.Breaking Changes
None. Existing Result signatures and error types are retained; unsupported modes return an error in place of a panic.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
Summary by CodeRabbit
PR Hygiene ·
3db4cf1/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.