Skip to content

test(drive-abci): pin the check tx reservation split and fix its doc - #5990

Merged
shumkov merged 2 commits into
v5.1-devfrom
shumkov/v51-checktx-followup
Nov 19, 2026
Merged

shumkov merged 2 commits into
v5.1-devfrom
shumkov/v51-checktx-followup

Conversation

@shumkov

@shumkov shumkov commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Answers Sam's review of #5984, which was merged before the review arrived:

  • The lookup-reservation tests could not tell a reservation missing its key hash or consumed-document delete from a complete one.
  • A doc comment said check tx reserves the competitor hashes for a create its contest decides; it reserves only the scan budget for such a create.

Tests and a doc comment only; no behaviour change.

What was done?

  • Block test of a consuming reveal
    (should_reserve_the_lookup_and_the_consumed_commitments_delete_when_admitting_a_reveal).

    • Check tx now runs with lookup_query_credits_reserved set to what the block bills for the lookup query, measured through the block's own reference validation.
    • So the balance a signer is held to covers the block only when the consumed delete is reserved.
  • New gas test (should_report_the_gas_a_reveal_wants_with_its_billed_reservation_in, replacing the old allowance-only gas test). It rebuilds check tx's event (state_transition_to_execution_event_for_check_tx) and asserts:

    • the billed reservation is exactly the key hash and the delete, and the bounds are exactly the allowance;
    • gas_wanted is the event's fee without the bounds: exactly with no fee increase, otherwise exactly or one credit above;
    • the billed part, raised by the user fee increase, is in that fee.

    It runs at protocol versions 14 and 15, on the first check and on a recheck, with no fee increase and with 100%. Another allowance still moves the judged fee and not the gas.

  • Doc fix: document reference validation 1's chooseFirst doc now says check tx reserves only the scan budget for a create its contest decides.

  • Helpers:

    • CommitRevealFixture::check_tx_at_version checks at a given platform version;
    • creation_transition_raising_fees builds a create with a user fee increase.

How Has This Been Tested?

  • The changed and new tests pass, and the affected drive-abci tests (commit_reveal, reference_expression, check_tx, choose_first) pass. Clippy with -D warnings is clean.
  • Mutation checks:
    • dropping the consumed delete from the reservation fails the block test at 14 and 15;
    • reporting the key hash and the delete as bounds fails the gas test.

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

PR Hygiene · 7aae447

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Build running
  • Approvals — you own every area touched; none needed

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.

shumkov and others added 2 commits November 19, 2026 16:39
…e gas

The tests of the lookup reservation could not tell a reservation missing
its key hash or consumed delete from a complete one: a balance one
credit short of check tx's estimate is refused whatever the estimate
holds, the 12,000,000-credit query allowance covers a missing delete in
the block, and the gas test compared two figures both holding the billed
part.

The consuming reveal's block test now runs check tx with the query's
allowance at what the block bills for the query, so the held estimate
covers the block only with the delete reserved. A new gas test rebuilds
check tx's event at protocol versions 14 and 15, on the first check and
on a recheck, with no fee increase and with 100%: the billed reservation
is exactly the key hash and the delete, the bounds exactly the allowance,
the gas the estimate without the bounds (exactly, or one credit above),
and the billed part, raised as the estimate is, is in it.

Test-only change: it passes on the current code; removing the delete
from the reservation fails the block test, and reporting the hash and the
delete as bounds fails the gas test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he scan budget

The doc of document reference validation 1's chooseFirst check said check
tx reserves the scan's budget and the competitors' hashes for a create its
contest decides too; choose_first_reservation 1 reserves only the budget
for it, as no competitor is read. Comment-only change, no test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@shumkov shumkov added this to the v5.1.0 milestone Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 77558d0 and 7aae447.

Files selected for processing: 2

  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v1/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/commit_reveal_lookup.rs
  • 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

@github-actions

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 commented Nov 19, 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 Nov 19, 2026
@thepastaclaw

thepastaclaw commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress (commit 7aae447) · live progress

@shumkov
shumkov merged commit f3bdf54 into v5.1-dev Nov 19, 2026
24 of 26 checks passed
@shumkov
shumkov deleted the shumkov/v51-checktx-followup branch November 19, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants