Skip to content

fix(dapi): check the state transition size pre-filter against the active protocol version - #5659

Open
romchornyi wants to merge 6 commits into
v5.2-devfrom
fix/dapi-state-transition-size-bound
Open

romchornyi wants to merge 6 commits into
v5.2-devfrom
fix/dapi-state-transition-size-bound

Conversation

@romchornyi

@romchornyi romchornyi commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Follow-up to #5460 (review thread #5460 (comment)): DAPI's state transition size pre-filter in broadcastStateTransition checks against PlatformVersion::latest(), not the version the network runs. If a later protocol version lowered max_state_transition_size, DAPI would refuse transitions the network still accepts until that version activates.

What was done?

  • rs-dapi broadcast_state_transition.rs: the pre-filter checks against the limit of the protocol version the network runs now, Drive's current from the cached getStatus (cleared on every block), still through validate_state_transition_size. The lookup waits at most 2 s, as getRecentStateTransitionStatus does since feat(sdk): prove a state transition's outcome, and add getRecentStateTransitionStatus #5823. When the status does not answer in time or names a version this build does not know, it checks against MOST_PERMISSIVE_SIZE_VERSION, the known version with the largest max_state_transition_size, so DAPI never refuses what the network could accept. Drive enforces the active version's limit when it decodes.
  • shielded_proof_failure_budget.rs: the proof-failure budget clamps a broadcast's Orchard action count, and caps actions in flight, at MAX_SHIELDED_ACTIONS, the largest max_shielded_transition_actions across PLATFORM_VERSIONS (a const fn, asserted non-zero at compile time), instead of latest()'s. A smaller bound would charge a bundle the active version still verifies for fewer actions than Drive checks.

The proof-failure budget keeps the largest known action limit: it only sizes a reservation and refuses nothing, and it is synchronous.

How Has This Been Tested?

  • cargo test -p rs-dapi --lib: 449 passed. should_check_the_size_against_the_given_version_limit checks max accepted and max + 1 refused for a version's limit; should_take_the_current_drive_version_from_the_status and should_have_no_active_version_without_a_known_current_version cover reading the version from the status and the fallback cases (no status, version 0, unknown version); should_pick_the_version_with_the_largest_size_limit covers the fallback's selection; the budget test checks an oversized bundle is reserved as MAX_SHIELDED_ACTIONS.
  • cargo clippy -p rs-dapi --all-targets: clean.

The limits are the same today: every known version allows 20480 bytes and 16 shielded actions. A broadcast now reads the cached status first; after each block the first one waits for a fresh status, at most 2 s.

Breaking Changes

None.

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 commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • State transition size validation now uses the largest limit across known platform versions, avoiding rejection of transactions allowed by an older supported version.
    • The in-flight shielded action limit now reflects the largest limit across known platform versions. Reservations above that bound are capped, keeping the budget consistent across supported versions.

PR Hygiene · 0fc5537

  • Bots — thepastaclaw ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals
    • rust-dapi (packages/rs-dapi/src/services/platform_service/broadcast_state_transition.rs, packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs) — QuantumExplorer or lklimek or shumkov
    • shumkov requested changes — waiting for them to re-review or dismiss

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.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

No actionable comments were generated in the recent review.

Walkthrough

State-transition size validation and the shielded-proof in-flight action budget now use the greatest corresponding limit among known platform versions, rather than the latest version’s limit. Tests cover maximum selection, tie handling, validation, and reservation clamping.

Changes: Platform-version bounds

Layer / File(s) Summary
Select the state-transition size bound
packages/rs-dapi/src/services/platform_service/broadcast_state_transition.rs
Size validation now uses the greatest state-transition size limit among known platform versions. Tests cover maximum selection, ties, and validation.
Set the shielded-action budget bound
packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs
The default in-flight action limit now uses the greatest action limit among known platform versions. A compile-time assertion rejects a zero bound. Tests cover maximum selection and clamping.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • dashpay/platform#5460: Adds the state-transition size validation whose platform-version limit selection this change updates.

Suggested reviewers: quantumexplorer

Merge Risk: Minimal · previous review ed9e6

The size pre-filter remains compatible with known network versions. No merge-blocking regression was identified.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Title check Warning The title names the rs-dapi state transition size pre-filter and says the check now uses the active protocol version. The changeset does something different. Both files now take the largest max_state_… Rewrite the title to match the change. For example: "fix(dapi): bound the state transition size pre-filter by the largest known limit". Use the same wording as the PR objectives.
Passed Passed checks: 3 passed

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the rs-dapi state transition size pre-filter and says the check now uses the active protocol version. The changeset does something different. Both files now take the largest max_state_transition_size and max_shielded_transition_actions across all known platform versions, not the active version. The PR objectives say the same thing, so the title contradicts the change. The title is also misleading in the way it describes the approach.

Resolution

Rewrite the title to match the change. For example: "fix(dapi): bound the state transition size pre-filter by the largest known limit". Use the same wording as the PR objectives.

Finishing Touches

🧪 Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 45d925b and ed9e65e.

Files selected for processing: 1

  • packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@thepastaclaw

thepastaclaw commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 0fc5537)

@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

The PR correctly changes DAPI's state-transition size pre-filter to use the largest limit across the compiled production protocol-version registry. Drive still applies the active protocol version's authoritative limit during decoding, and the helper and boundary tests are consistent with that design. The changed files are narrowly scoped, and the available CI checks completed successfully.

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: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: 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 contained DAPI validation-logic change with compile-time protocol-version selection and boundary tests, but it affects peer-facing state-transition admission behavior rather than being merely cosmetic.
  • 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)
  • 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 — platform-versioning (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

@romchornyi
romchornyi added this pull request to stack #5662 October 29, 2026 10:54
Base automatically changed from fix/asset-lock-proof-size-chain-fallback to v5.1-dev October 29, 2026 13:26
…known limit

DAPI does not track the network's protocol version, so checking against
PlatformVersion::latest() would refuse a transition the network still
accepts if a later version lowered the limit before activating. Check
against the known version with the largest max_state_transition_size
instead, still through validate_state_transition_size; Drive enforces
the active version's limit when it decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@romchornyi
romchornyi force-pushed the fix/dapi-state-transition-size-bound branch from e109823 to 45d925b Compare October 29, 2026 13:26
@github-actions github-actions Bot added this to the v5.1.0 milestone Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 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 Oct 29, 2026
@romchornyi

Copy link
Copy Markdown
Contributor Author

/skip-bots

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed 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 Oct 29, 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

The state-transition size pre-filter correctly uses the largest known size limit while Drive continues to enforce the active protocol version. However, the adjacent shielded proof-failure budget still clamps action counts using only PlatformVersion::latest(), so an older active version with a larger action limit could cause invalid proof work to be charged below its actual cost. The Rust workspace test failure is unrelated to this PR because it occurs in unchanged rs-sdk test callers.

🔴 1 blocking

1 finding(s) not shown inline (the lines are not part of this PR's diff)

🔴 Blocking: Use the largest known shielded-action limit for failure-budget accounting
packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs:173-181

The budget still initializes max_in_flight_actions from PlatformVersion::latest(), and try_reserve_at clamps every decoded action count to that value. If a newer protocol version lowers max_shielded_transition_actions while the network is still running an older version with a larger limit, a valid larger bundle can reach Drive and incur proof-verification work, but the DAPI budget records only the newer, smaller action count. Failed-action debt and drain timing are therefore understated, allowing a source to submit more invalid Orchard proof work than the intended budget permits. This is the same latest-versus-active-version boundary that the PR fixes for state-transition bytes; derive the action cap from the largest known platform-version limit and add a regression test using differing action limits.

source: gpt-6.1-sol (phase2-reviewer: general)

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: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 12: 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 focused but behavior-changing protocol-version-aware validation fix in DAPI, and while it affects a peer-facing input boundary, the diff is not large or intricate enough to meet the critical tier.
  • 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)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • 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 — platform-versioning (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 — platform-versioning (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. Verify each finding against the current code and only fix it if needed.

In `packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs`:
- [BLOCKING] packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs:173-181: Use the largest known shielded-action limit for failure-budget accounting
  The budget still initializes `max_in_flight_actions` from `PlatformVersion::latest()`, and `try_reserve_at` clamps every decoded action count to that value. If a newer protocol version lowers `max_shielded_transition_actions` while the network is still running an older version with a larger limit, a valid larger bundle can reach Drive and incur proof-verification work, but the DAPI budget records only the newer, smaller action count. Failed-action debt and drain timing are therefore understated, allowing a source to submit more invalid Orchard proof work than the intended budget permits. This is the same latest-versus-active-version boundary that the PR fixes for state-transition bytes; derive the action cap from the largest known platform-version limit and add a regression test using differing action limits.

@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 Oct 29, 2026
…wn action limit

The budget clamped a broadcast's Orchard action count, and capped actions in
flight, at `PlatformVersion::latest()`'s `max_shielded_transition_actions`.
If a newer version lowered that limit while the network still ran an older
one, a bundle Drive verifies would be charged for fewer actions than it
checks. Take the largest limit across `PLATFORM_VERSIONS` instead, as the
state transition size pre-filter now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 29, 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 Oct 29, 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

The largest-known-limit changes correctly resolve the prior version-bound issue, and the size pre-filter remains conservative while Drive enforces the active version. However, the DAPI failure budget still does not account for every shielded proof path: token, batch, and ShieldFromAssetLock V1 transitions can perform proof verification while orchard_action_count returns zero, and token transitions can contain two bundles while the reservation cap only allows one bundle's action limit. The Rust workspace check is marked failed, but its completed steps passed and the log ends while shielded tests were still running, with no changed-code failure shown.

🔴 1 blocking

1 finding(s) not shown inline (the lines are not part of this PR's diff)

🔴 Blocking: Count every transition type that performs shielded proof verification
packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs:119-145

orchard_action_count returns zero for TokenShieldedTransferWithShieldedFee, TokenUnshieldWithShieldedFee, TokenPurchaseFromShieldedPool, and Batch, and it omits ShieldFromAssetLockTransition::V1. Drive's authoritative shielded_proof_action_count counts these paths: the token transitions sum both token_actions and fee_actions, batch token/document payments contribute their shielded actions, and ShieldFromAssetLock::V1 contributes its actions. These transitions can therefore reach Drive's Orchard proof verification and return InvalidShieldedProofError (code 40902) without creating a DAPI reservation, allowing repeated invalid-proof submissions to bypass this DoS budget. Additionally, even if the token variants were added to this match, try_reserve clamps their combined action count to MAX_SHIELDED_ACTIONS, although each token transition contains two independently validated bundles and Drive counts both; the reservation must reflect the actual total proof work. Use a shared pure action-counting helper or otherwise keep this counter synchronized with Drive, and add coverage for standalone token, batch, and both ShieldFromAssetLock versions.

source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.1-sol (phase2-reviewer: general, architecture-layering, platform-versioning, rust-quality, security-auditor)

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: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: 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 contained but behavior-changing Rust fix in DAPI admission and resource-budget logic, and it does not directly modify consensus, cryptography, funds handling, or persistent storage.
  • 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)
  • 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 — platform-versioning (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. Verify each finding against the current code and only fix it if needed.

In `packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs`:
- [BLOCKING] packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs:119-145: Count every transition type that performs shielded proof verification
  `orchard_action_count` returns zero for `TokenShieldedTransferWithShieldedFee`, `TokenUnshieldWithShieldedFee`, `TokenPurchaseFromShieldedPool`, and `Batch`, and it omits `ShieldFromAssetLockTransition::V1`. Drive's authoritative `shielded_proof_action_count` counts these paths: the token transitions sum both `token_actions` and `fee_actions`, batch token/document payments contribute their shielded actions, and `ShieldFromAssetLock::V1` contributes its actions. These transitions can therefore reach Drive's Orchard proof verification and return `InvalidShieldedProofError` (code 40902) without creating a DAPI reservation, allowing repeated invalid-proof submissions to bypass this DoS budget. Additionally, even if the token variants were added to this match, `try_reserve` clamps their combined action count to `MAX_SHIELDED_ACTIONS`, although each token transition contains two independently validated bundles and Drive counts both; the reservation must reflect the actual total proof work. Use a shared pure action-counting helper or otherwise keep this counter synchronized with Drive, and add coverage for standalone token, batch, and both ShieldFromAssetLock versions.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Oct 29, 2026
@romchornyi

Copy link
Copy Markdown
Contributor Author

On the blocking finding in review 5703227769 (DAPI's orchard_action_count returns 0 for the token shielded transitions, shielded batches and ShieldFromAssetLock::V1): the gap is real, but this PR did not create it and does not touch the counter. DAPI's counter came with #5001, and #4760 later extended Drive's shielded_proof_action_count without updating DAPI's copy. The fix also changes the budget's model: the counter moves into dpp so both crates share it, and the clamp becomes per bundle, since a token transition verifies two. That is its own change and needs the maintainer's call on the approach, so it is tracked in #5676 and will land in a separate PR. This PR stays scoped to bounding the size pre-filter and the clamp by the largest known protocol limit.

…ansition-size-bound

# Conflicts:
#	packages/rs-dapi/src/services/platform_service/shielded_proof_failure_budget.rs
@github-actions

github-actions Bot commented Nov 11, 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.

@romchornyi

Copy link
Copy Markdown
Contributor Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — rust-dapi: QuantumExplorer or lklimek 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-self-review Waiting for the author to post /self-reviewed labels Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: address shumkov requested changes, 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 12, 2026
…l version

The size pre-filter now reads the network's current protocol version from
the cached getStatus, with a 2 s timeout, and checks against its
max_state_transition_size. When the status does not answer in time or names
a version this build does not know, it falls back to the most permissive
known version, so DAPI never refuses what the network could accept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@romchornyi romchornyi changed the title fix(dapi): bound the state transition size pre-filter by the largest known limit fix(dapi): check the state transition size pre-filter against the active protocol version Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 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 12, 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

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

  • ⏭️ Deferred (maintainer decision): 🟡 Coalesce concurrent active-version cache misses (tracked in #5900)

At head 0fc5537, the size pre-filter uses Drive's reported active protocol version with a bounded, permissive fallback. One non-blocking performance issue remains: concurrent cold-cache broadcasts independently refresh the same status. Validation was static only; current CI shows Rust workspace tests still pending and no failed code checks.

🟡 1 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: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: 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 but contained DAPI validation and resource-budget change involving protocol-version fallback behavior, without directly changing consensus rules, cryptography, funds movement, or storage.
  • 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)
  • 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 — platform-versioning (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-dapi/src/services/platform_service/broadcast_state_transition.rs`:
- [SUGGESTION → DEFERRED by a maintainer; not blocking, do not fix in this PR] packages/rs-dapi/src/services/platform_service/broadcast_state_transition.rs:280-283: Coalesce concurrent active-version cache misses
  Every broadcast now awaits this lookup, but get_status_impl caches only completed responses. On a cache miss, get_status.rs immediately calls build_status_response_with_health, which starts Drive getStatus and Tenderdash status/net_info RPCs without sharing an in-progress refresh. Concurrent broadcasts arriving after block-driven cache invalidation therefore each start another three-RPC refresh until a response is cached. The two-second timeout bounds each caller's wait, not the duplicate upstream work. Share the in-progress lookup across callers while retaining generation-checked cache insertion, and add a concurrent cold-cache test asserting that callers share one refresh.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: address shumkov requested changes, 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 waiting-bots Waiting for the review bots to report on this head labels Nov 12, 2026
@romchornyi

Copy link
Copy Markdown
Contributor Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — rust-dapi: QuantumExplorer or lklimek or shumkov · re-review or resolve: 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-self-review Waiting for the author to post /self-reviewed labels Nov 12, 2026
@github-actions
github-actions Bot requested a review from shumkov November 12, 2026 21:16
@romchornyi romchornyi modified the milestones: v5.1.0, v5.2.0 Nov 13, 2026
@romchornyi
romchornyi removed this pull request from stack #5662 November 13, 2026 09:21
@romchornyi
romchornyi changed the base branch from v5.1-dev to v5.2-dev November 13, 2026 09:21

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants