Repository navigation
fix(dpp): compile without default features - #5498
Conversation
`cargo check --no-default-features -p dpp` stopped compiling: the shielded sighash builders and the action-fee helpers that take a `DocumentTransitionActionType` import from `crate::state_transition`, which only exists with the `state-transitions` feature. The nightly "Check each feature (dpp)" job runs that check first under `bash -e`, so none of its per-feature checks have run since. Gate `shielded::sighash` (and its re-exports), `DocumentActionFees::action_fee` and `DocumentActionFeeAgreement::for_document_type_action` behind `state-transitions`, together with the imports only they use, and gate the two `identity.rs` imports only `new_with_input_addresses_and_keys` (already gated) uses. Every build that compiled before has `state-transitions` on and is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the no-default check passing, the per-feature loop of the nightly job reaches two more failures: - `json-conversion` without `state-transitions`: the `JsonSafeFields` markers for the batch transition wrappers import from `crate::state_transition`. Gate them behind `state-transitions`. - `serde-conversion` without `json-conversion`: serde code compiled under `serde-conversion` names the `json_safe_*` helpers, which were compiled only with `json-conversion`, and two `[u8; 64]` fields get their `serde_bytes` only from `#[json_safe_fields]`. Compile `serialization::json` under `serde-conversion` (the helpers need only serde and serde_json, both always present; `JsonSafeFields` stays under `json-conversion`) and give the two fields `serde_bytes` in a serde build without `json-conversion`. Every changed `cfg` is either true in every build that compiled before or, for the two field attributes, false in all of them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🔍 Review in progress — actively reviewing now (commit 3fe986e) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The feature-gating changes are correctly scoped and preserve behavior for previously compiling configurations. One in-scope compile gap remains: enabling serde-conversion together with state-transitions but without json-conversion still fails for numerous shielded and token-pool transition structs containing bare [u8; 64] fields. The failing Rust workspace test is unrelated and pre-existing on the base branch.
🟡 1 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Serde-only fallback is missing from sibling shielded and token-pool transitions
packages/rs-dpp/src/state_transition/state_transitions/shielded/shielded_transfer_transition/v0/mod.rs:44-45
The new serde_bytes fallback fixes [u8; 64] fields in SerializedAction and TokenShieldedPayment, but the same feature combination remains broken in this transition and its siblings. With serde-conversion enabled, json-conversion disabled, and state-transitions enabled, json_safe_fields does not add a serde adapter and serde has no Serialize/Deserialize implementation for arrays longer than 32 elements. This leaves the binding_signature fields in the shielded transitions and the seven batched token-pool transition V0 structs unusable, even though the PR explicitly extends serde-only compilation. The current CI matrix checks individual features and does not exercise this pair. Add the same conditional serde_bytes attribute to every affected [u8; 64] field, or add a matrix cut for serde-conversion,state-transitions and fix all resulting failures.
#[cfg_attr(
all(feature = "serde-conversion", not(feature = "json-conversion")),
serde(with = "crate::serialization::serde_bytes")
)]
pub binding_signature: [u8; 64],
source: glm-5.3-flash (phase1-reviewer: general, rust-quality)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (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); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — This small, contained change adjusts Rust feature gates to restore isolated-feature builds without changing runtime logic or protocol behavior. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— rust-quality (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 100% left, weekly 99% left; passed overgemini-3.8-flash-high(lane failed) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort medium); agentphase2-reviewer
🤖 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 `packages/rs-dpp/src/state_transition/state_transitions/shielded/shielded_transfer_transition/v0/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/state_transition/state_transitions/shielded/shielded_transfer_transition/v0/mod.rs:44-45: Serde-only fallback is missing from sibling shielded and token-pool transitions
The new `serde_bytes` fallback fixes `[u8; 64]` fields in `SerializedAction` and `TokenShieldedPayment`, but the same feature combination remains broken in this transition and its siblings. With `serde-conversion` enabled, `json-conversion` disabled, and `state-transitions` enabled, `json_safe_fields` does not add a serde adapter and serde has no `Serialize`/`Deserialize` implementation for arrays longer than 32 elements. This leaves the `binding_signature` fields in the shielded transitions and the seven batched token-pool transition V0 structs unusable, even though the PR explicitly extends serde-only compilation. The current CI matrix checks individual features and does not exercise this pair. Add the same conditional `serde_bytes` attribute to every affected `[u8; 64]` field, or add a matrix cut for `serde-conversion,state-transitions` and fix all resulting failures.
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.
- Rust workspace test has a stale inactive-version expectation on the base branch — The required Rust workspace test fails in
action_fees.rsbecause the test still expects anInternalErrorcontainingnot active, while commit5303dd391cechanged inactive-version transitions to returnUnpaidConsensusError(StateTransitionNotActiveError). The PR does not touch this code path, and the same failure is present onv5.0-dev; update it in a separate PR.- Follow-up: Update the test expectation in a separate change against
v5.0-dev.
- Follow-up: Update the test expectation in a separate change against
|
Bots are done — your move: post |
…builds `serde-conversion` with `state-transitions` but without `json-conversion` still failed: 22 `[u8; 64]` binding-signature fields in the shielded transitions and the batched token-pool transitions get `serde_bytes` only from `#[json_safe_fields]`, which is applied with `json-conversion` alone, and serde has no impl for arrays longer than 32. Give them the same serde-only attribute as `SerializedAction::spend_auth_sig`. It is false in every build with `json-conversion`, so those builds are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Brings 5.0.0-rc.5, rc.6 and rc.7 (v5.0-dev 79693ec) into v5.1-dev. Conflict resolutions: - Cargo.toml: GroveDB moves to 6.1.1 (2128ea18, dashpay#5499; fast-forward of fc7028d8). rust-dashcore stays on dev aca02026; v5.0-dev's v0.45.0 pin (d631aaca) is not taken. - Cargo.lock: v5.1-dev's lockfile, re-resolved for GroveDB 6.1.1, with dashpay#5499's RUSTSEC bumps replayed via cargo update --precise (h2 0.4.20, rustls 0.23.46, rustls-webpki 0.103.15, quinn-proto 0.11.19, crossbeam-epoch 0.9.21, rust_decimal 1.43.0, anyhow 1.0.104, event-listener 5.4.2, chacha20 0.10.2, spin 0.9.9). - CHANGELOG.md: [Unreleased] on top, then the rc.7, rc.6 and rc.5 entries. - rs-dpp serialization/mod.rs: keeps v5.1's dashcore module gate and takes dashpay#5498's serde-conversion gate for the json module. - rs-sdk dpns_usernames, put_document: dashpay#5409's ResponseMetadata import with v5.1's dpp::secp256k1 rand imports. - platform-wallet masternode/update_service.rs (dashpay#5408, dashpay#5497): v5.0's file ported to dpp::bls. rust-dashcore dev does not expose the coinbase of applied masternode list diffs, so the coinbase source is optional: with none, V24 is read from the list alone (any version-3 entry), as dashpay#5408 did, instead of refusing every legacy evonode update. - platform-wallet spv/runtime.rs: masternode_list_entries reads through DashSpvClient::latest_masternode_list (the engine is crate-private on dev); latest_coinbase is not carried over. - platform-wallet platform_wallet_traits.rs: both branches forwarded unrecorded_spend_heights and note_chain_lock_height; one forward each is kept, and the tests of both branches. - platform-wallet identity/network/profile.rs: v5.1's rs-sdk profile path (dashpay#5470). dashpay#5409's proven-balance persistence for profile writes follows in a separate commit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Basic explanation
Every night a CI job builds
dpponce with no optional features and then once per feature, to catch code that only compiles because some other feature happens to be on. Since 2026-04-28 the very first of those builds has failed, so the job has been red every night and the roughly 90 per-feature builds after it never ran. This PR fixes that first build and the per-feature builds that were broken behind it. It only adds or moves#[cfg(feature = ...)]gates. Every build that compiled before compiles to the same code, so nothing changes at any protocol version.Issue being fixed or feature implemented
"Nightly: Long-running Rust tests" has failed every night for 60+ days. Only its "Check each feature (dpp)" matrix job fails; the long-running tests and the other 7 crates pass. The job runs under
set -ex, and the first command iscargo check --no-default-features --package dpp --locked, which fails, so the loop over features never starts.Before (last night's run, job 118333824992, same locally at 5303dd3):
Once that passed, the per-feature loop hit two more kinds of failure:
After:
and every sampled per-feature cut (listed under testing) finishes with 0 errors and 0 warnings.
What was done?
Gated behind
state-transitions(the items that use state transition types):shielded::sighashand itspub usere-exports. Every function in it builds a sighash preimage for a shielded state transition, and its only in-crate callers areshielded::builder(needsshielded-client, which impliesstate-transitions) andstate_transition.DocumentActionFees::action_feeandDocumentActionFeeAgreement::for_document_type_action(both take aDocumentTransitionActionType), plus the imports only they use.JsonSafeFieldsmarkers forDocumentBaseTransition,TokenBaseTransition,DocumentTransition,TokenTransitionandBatchedTransition, with their imports.PlatformAddressandAddressNonceimports inidentity/identity.rs, used only by the already-gatedIdentity::new_with_input_addresses_and_keys.Serde without json (
serde-conversionon,json-conversionoff):serialization::jsonand thejson_safe_*re-exports now compile underserde-conversioninstead ofjson-conversion. Code gated onserde-conversion(theTokenEventdeserializer, theContestedIndexFieldMatchandTokenConfigurationChangeItemreprs) already names these helpers, and they need onlyserdeandserde_json, which are always dependencies.safe_fields/JsonSafeFieldsstay underjson-conversion.SerializedAction::spend_auth_sigandTokenShieldedPayment::binding_signatureget#[cfg_attr(all(feature = "serde-conversion", not(feature = "json-conversion")), serde(with = "crate::serialization::serde_bytes"))]. Withjson-conversionon,#[json_safe_fields]already adds exactly this attribute and the new one evaluates to nothing. The same attribute is on the 22[u8; 64]binding-signature fields of the shielded transitions and the batched token-pool transitions, which break the same way oncestate-transitionsis on too (serde-conversion,state-transitions).Why behaviour cannot change: before this PR
dppfailed to compile wheneverstate-transitionswas off, and wheneverserde-conversionwas on withoutjson-conversion. In every build that did compile, each new#[cfg(feature = "state-transitions")]and#[cfg(feature = "serde-conversion")]is true, and the two new field attributes are false. So those builds compile the same code as before. Every crate outsidedppthat uses a newly gated item enablesstate-transitionsitself: drive (state-transitions), drive-abci (abci), rs-sdk (dash-sdk-featuresandclient, both reaching it throughstate-transition-signing/client), wasm-dpp2 (state-transitions). No consensus code, no versioned method and no serialization format is touched.How Has This Been Tested?
Local
cargo check --no-default-features -p dpp --locked, one feature at a time, as the nightly loop runs them:state-transitions,shielded-client,client,all_features,abcivalidation,json-conversion,data-contract-json-conversionserde-conversion,value-conversion,data-contract-{serde,value,cbor}-conversion,identity-serde-conversion,state-transition-serde-conversionserde-conversion,state-transitions,value-conversion,state-transitions,json-conversion,state-transitions(combined cuts, not in the nightly loop)cargo fmt --all -- --checkis clean. "Nightly: Long-running Rust tests" was dispatched on this branch to run the full per-feature loop: https://github.com/dashpay/platform/actions/runs/39390569837Side note:
RUSTFLAGS="-D warnings"in the workflowThe check step sets
RUSTFLAGS="-D warnings"as a plain shell variable withoutexport, so cargo never sees it and warnings have not been errors in this job since #1783. This PR does not change that. To turn it on:export RUSTFLAGS="--cfg tokio_unstable -D warnings", not just-D warnings. An environmentRUSTFLAGSreplaces the[target.'cfg(all())'] rustflags = ["--cfg", "tokio_unstable"]from.cargo/config.tomlinstead of adding to it, and drive-abci checkstokio_unstable.dapi-grpc --features drivecut warnsunused import: crate::platform::*atpackages/dapi-grpc/src/lib.rs:116. The other six crates' loops were warning-free. With this PR, the sampleddppcuts are warning-free too.Breaking Changes
None. Each gated item was already unusable without
state-transitions, becausedppdid not compile without it.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
3fe986e/skip-botsproceeds without the ones not yet reported/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.Summary by CodeRabbit
Bug Fixes
Refactor