Skip to content

feat(platform)!: let a banned or suspended author retract with a declared replace (PV14) - #5253

Merged
QuantumExplorer merged 3 commits into
v5.0-devfrom
claude/banned-author-retraction-dc7bf9
Oct 2, 2026
Merged

QuantumExplorer merged 3 commits into
v5.0-devfrom
claude/banned-author-retraction-dc7bf9

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: On a moderated contract, a banned or suspended user can't post anything new, but has always been allowed to delete their own posts. Some apps make posts undeletable, because replies and quotes point at them. On those apps the only way to take a post back is to overwrite it with a blank "this was deleted" version (a tombstone), and the ban blocked that too. This PR lets a contract name what its tombstone looks like (retractedWhen). A barred user may then still write a tombstone, and nothing else.

Value: Banned or suspended authors get back the one exit they lose on undeletable types: taking down what they wrote. Yappr posts and replies (canBeDeleted: false, tombstoned with deleted: true) and the blog contract hit exactly this. Contracts that don't declare the keyword behave as before.

Risks: Low to medium. It is a consensus change at protocol version 14 (not yet on mainnet). It touches the moderation gate and the batch transformer shared with every earlier version, but it is inert there: the gate, and so a bar, only exist from version 14. The main risk sits in contracts: the platform only checks the declared condition, so a contract that declares retractedWhen without a rule blanking the retracted document lets a barred author write into it. The book and the meta-schema say so. The keyword is fixed once a type is created, so a mistake can't be patched by an update.

Issue being fixed or feature implemented

The moderation gate let a barred identity delete documents but refused every replace (ContractUserBannedError 41107, ContractUserSuspendedError 41108). On a canBeDeleted: false type a retraction is a replace, so a barred author could retract nothing. Repro: ban Y; Y's tombstone of its own post is refused with 41107, while Y's unlike (a delete) is accepted. Same on the blog contract.

What was done?

A document type may declare retractedWhen: one condition, in the grammar of an immutable entry's when (a propertyConstraints condition, $old. reads the stored document, no countOf/sumOf). A banned or suspended owner's replace on that type passes when the document it writes meets the condition.

"post": {
  "type": "object",
  "canBeDeleted": false,
  "properties": {
    "text": { "type": "string", "maxLength": 500, "position": 0 },
    "deleted": { "type": "boolean", "position": 1 }
  },
  "additionalProperties": false,
  "retractedWhen": { "present": "deleted" },
  "propertyConstraints": {
    "retractedIsBlank": { "anyOf": [{ "absent": "deleted" }, { "absent": "text" }] }
  },
  "immutable": [{ "property": "deleted", "when": { "present": "$old.deleted" } }]
}

Banned author Y, stored post { "text": "hello" }:

Y's replace Before After
{ "deleted": true } (tombstone) 41107 accepted
{ "text": "edited" } 41107 41107
{ "text": "hello", "deleted": true } 41107 10422 (the type's own retractedIsBlank)
taking a tombstone back, { "text": "hello" } 41107 41107
a create, or a replace on a type without retractedWhen 41107 41107
a delete accepted accepted

The condition picks the replaces a barred owner may make. What a retracted document holds is the type's other rules to say (propertyConstraints, immutable), and they judge every replace as before.

dpp (parser generation 3, meta-schema v3)

  • retractedWhen in the v3 document meta-schema, property_names::RETRACTED_WHEN, DocumentTypeV2::retracted_when and the DocumentTypeV2Getters::retracted_when getter (None on V0/V1).
  • apply_retracted_when in try_from_schema::common. The condition parse is pulled out of apply_immutable_fields into parse_replace_condition, shared by both keywords; the immutable messages are unchanged.
  • Refused with InvalidContractStructure (10231), on every parse, on a type whose documents are not mutable and on a contract keeping neither a banlist nor a suspension list.
  • Fixed on contract update: validate_retracted_when_unchanged (DocumentTypeUpdateError, 40212) in validate_update v1, and the key joins the schema differ's frozen keywords.
  • The stored-read refusal of a propertyConstraints rule now names both conditions that may read $old..

drive-abci

  • contract_moderation_gate v0: under a bar, a replace on a type declaring retractedWhen passes next to the deletions. ContractModerationRefusal gains retraction_bar (the signer's bar), and refused becomes an Option, since a batch of such replaces refuses nothing.
  • Batch transformer: the bar is handed to the per-type and per-transition transforms. In the replace arm, right after the action is built from the fetched document, judge_barred_replace (new transformer/v0/retraction.rs) judges the condition as an immutable condition is judged. A replace that doesn't meet it, or whose condition faults, is refused with the bar, paid, nonce bumped. The mempool runs the same transformer.
  • The condition inputs (condition_data, condition_system_values) move from the private ImmutableConditionInputs of replace state validation v1 to ReplaceConditionInputs, visible to the batch module. Behaviour unchanged.

Docs: a retractedWhen section in the book's Deletion chapter, the keyword table, the moderation chapter's document gate, the mutability page's $old. rule, and PV14 note 72 in v14.rs.

In-place changes to shipped generations

  • transform_document_transitions_within_contract_v0, transform_document_transitions_within_document_type_v0 and transform_document_transition_v0 (the batch transformer shared with protocol versions before 14) take the new retraction_bar. It is only ever Some when contract_moderation_gate returns one, and the gate is None in every table before protocol version 14, so earlier versions run exactly as before.
  • Replace state validation v1: a trait rename and visibility change, no behaviour change.
  • Everything else edited (parser generation 3, validate_update v1, schema compatibility v1, contract_moderation_gate v0) is selected by protocol version 14 only, which is not yet released.

How Has This Been Tested?

  • dpp, 8 new tests in try_from_schema/v3/retracted_when_tests.rs: the condition parsed and judged ($old. included), the refusals on an immutable type, on an unmoderated or warning-only contract, for unparseable conditions and unknown or aggregate reads, a value that is not one condition on both parse paths, and the update rule (add, remove, change refused; unchanged passes). 341 targeted dpp tests pass (retracted_when immutable validate_update validate_schema_compatibility moderator_abilities property_constraints).
  • drive-abci, 5 new tests:
    • contract_user_moderation/tests/retraction.rs, end to end through process_raw_state_transitions. A suspended and then a banned author retracts while edits are refused with 41108/41107. A retraction keeping its text is refused by the type's own rule (10422). Taking a tombstone back is refused with the bar, and after the unban by immutable (40128). check_tx lets the retraction in and refuses the edit. A type without retractedWhen refuses a tombstone-shaped replace. A condition that faults (10 / score with score: 0) keeps the bar: refused with 41107 by check_tx and in a block, paid with the contract nonce bumped, the stored document unchanged; the same condition met passes.
    • contract_moderation_gate unit test: the passed replace carries the bar while a create on the same type and a replace on another type are refused, and a batch of the replace alone refuses nothing.
    • 137 targeted drive-abci tests pass (contract_moderation_gate contract_user_moderation immutable_conditions).
  • Mutation checks: with the gate's retraction pass disabled, 3 of the 4 original new drive-abci tests fail; with the transformer never refusing, 2 fail; with a faulting condition counted as met (unwrap_or(true)), the fault test fails.
  • cargo clippy -p dpp -p drive-abci -p platform-version --all-targets --all-features -- -D warnings and cargo fmt --all are clean.

Breaking Changes

Consensus, protocol version 14 only: a new document type keyword (meta-schema v3), and a banned or suspended owner's replace on a type declaring it is no longer refused by the moderation gate when it meets the condition. Nothing changes for contracts that don't declare it, or before protocol version 14.

Follow-ups outside this PR: Yappr's post and reply need "retractedWhen": { "present": "deleted" } to use this. wasm-dpp2 does not expose the keyword as a getter; clients read it from the schema. PV14 note 72 assumes #5239 keeps 71.

Checklist:

  • I have performed a self-review of my own code
  • 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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 9d2d014

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

When every box is checked the PR Hygiene check passes and this can merge.

Summary by CodeRabbit

  • New Features

    • Protocol version 14 adds retractedWhen, allowing a banned or suspended document owner to replace a document only when the replacement meets the document type’s specified condition.
    • The feature applies only to eligible mutable document types on moderated contracts. Other document rules still apply, and unevaluable conditions do not qualify.
  • Documentation

    • Added guidance and examples for configuring retraction conditions and their restrictions.

…ared replace (PV14)

A moderated contract's gate refused every document transition of a barred
identity except deletions. On a type whose documents the owner can not
delete (canBeDeleted: false), the only way to take a document back is a
replace that blanks it, so a barred author had no exit at all.

A document type may now declare `retractedWhen`, one condition in the
grammar of an `immutable` entry's `when`. The gate lets a barred owner's
replaces on such a type through with its bar, and once the stored document
is fetched the transformer refuses with the bar (41107, 41108), paid, each
replace whose written document does not meet the condition. Every other
rule of the type still judges the replace, so what a retracted document
holds is the contract's to say (a propertyConstraints rule that it is
blank, an immutable entry that keeps it retracted).

The keyword is refused (10231) on a type whose documents are not mutable
and on a contract keeping neither a banlist nor a suspension list, and is
fixed on contract update (40212). The condition parse is shared with the
immutable entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added this to the v5.0.0 milestone Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

📖 Book Preview built successfully.

Download the preview from the workflow artifacts.
To view locally: download the artifact, unzip, and open index.html.

Updated at 2026-10-02T15:24:00.922Z

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 2, 2026
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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 20 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

Configuration used: Repository: dashpay/platform/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 764798b4-1b0e-40e6-8177-0953a157c82f

📥 Commits

Reviewing files that changed from the base of the PR and between cb88d19 and 9d2d014.

📒 Files selected for processing (2)
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/contract_moderation_gate/v0/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/retraction.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: dashpay/platform/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 38ee08fb-c420-4e5d-9d49-fb6eef58b733

📥 Commits

Reviewing files that changed from the base of the PR and between e1efd2a and cb88d19.

📒 Files selected for processing (26)
  • book/src/contract-keywords.md
  • book/src/contract-keywords/deletion.md
  • book/src/contract-keywords/mutability.md
  • book/src/data-model/contract-moderation.md
  • packages/rs-dpp/schema/meta_schemas/document/v3/document-meta.json
  • packages/rs-dpp/src/data_contract/document_type/accessors/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/accessors/v2/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/immutable_tests.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/retracted_when_tests.rs
  • packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v1/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/schema/validate_schema_compatibility/v1/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/v2/accessors.rs
  • packages/rs-dpp/src/data_contract/document_type/v2/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_replace_transition_action/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_replace_transition_action/state_v1/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/contract_moderation_gate/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/contract_moderation_gate/v0/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/retraction.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/retraction.rs
  • packages/rs-platform-version/src/version/v14.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.


📝 Walkthrough

Walkthrough

Adds the protocol v14 retractedWhen document-type condition. The moderation gate can pass eligible replacements by barred owners to batch transformation, which checks the written document against the condition.

Changes

Barred-owner retractions

Layer / File(s) Summary
Define and parse retraction conditions
packages/rs-dpp/schema/meta_schemas/document/v3/document-meta.json, packages/rs-dpp/src/data_contract/document_type/*, book/src/contract-keywords*, book/src/data-model/contract-moderation.md, packages/rs-platform-version/src/version/v14.rs
Adds the retractedWhen schema property and document-type constraint. Parsing applies the shared replace-condition checks. Update validation rejects additions, removals, or changes to the condition. Documentation and v14 feature comments describe the condition and its restrictions.
Pass eligible replacements through moderation
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_replace_transition_action/*, packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/contract_moderation_gate/*
The gate passes barred-owner replacements for types with retractedWhen and carries the moderation bar for later evaluation. Other barred operations remain subject to refusal.
Evaluate replacements in batch transformation
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/*, packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/*, book/src/data-model/contract-moderation.md
The transformer checks passed replacements against retractedWhen and refuses those that fail. Tests cover retractions, ordinary edits, restoration, mempool checks, and document types without the condition.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Batch as Batch transformer
  participant Gate as Contract moderation gate
  participant Type as DocumentTypeV2
  participant Judge as judge_barred_replace
  Batch->>Gate: Submit barred owner's replacement
  Gate->>Type: Read retracted_when
  Type-->>Gate: Return optional condition
  Gate-->>Batch: Pass replacement with retraction_bar
  Batch->>Judge: Check replacement against condition
  Judge-->>Batch: Return condition result or bar error
Loading

Merge Risk: ⚪ Minimal · up to cb88d

No actionable issue remains from this review; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to cb88d

The new permission is opt-in and remains limited to an author's own documents. Failed conditions preserve the ban or suspension, and ordinary document rules still apply. The principal design risk is contract configuration: declaring a retraction condition does not itself require a blank or irreversible tombstone, and the condition cannot later be changed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A barred signer can exercise the new permission across its own existing documents on opted-in types in contracts where it is barred. Exposure is bounded by each contract's condition and ordinary schema rules; the traced replacement path does not grant ownership of another author's documents or exempt transfers and purchases.

Security Findings and Attack Paths

  • inferred — If a contract author declares a permissive retraction condition without constraints removing content, a barred document owner can submit content-bearing replacements that satisfy it. This is a documented consequence of delegated contract policy, not a verified deployed vulnerability or an unintended validation bypass.

Trust Boundaries and Controls

  • observed — The replacing author controls proposed properties but not the contract condition. Enforcement binds the replacement to stored-document ownership, refuses absent, false or faulted conditions, and retains ordinary property, immutable and reference validation. Declaring retraction does not grant moderator-only field authority.

Resilience and Maintainability Implications

  • observed — Freezing the declaration prevents later updates from silently changing barred-owner authority, but also prevents repairing or removing a mistaken condition through an update to the same type. Restoration safety after unbanning therefore remains dependent on the type's separate immutable policy.

Hardening Proposals

  • proposed — Consider contract-author tooling that checks representative barred replacements for retained content and restoration, and warns before registration when the retraction condition lacks companion blankness or irreversible-state rules. Such checks would reduce configuration mistakes without treating all contract-specific policies as platform vulnerabilities.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.34% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 58 functions across 21 files. (5 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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.
Title check ✅ Passed The title clearly and concisely summarizes the main change: allowing banned or suspended authors to retract documents through a declared replace condition in protocol version 14.
Full details: Docstring Coverage

Explanation

Docstring coverage is 60.34% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 58 functions across 21 files. (5 skipped: 5 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 9d2d014) · triage: critical
██████████████░░░░░░ 71% · about 15 min left · running for 33 min
✅ triage → ✅ Phase 2 → ✅ Phase 1 → ✅ verify 2 → ⏳ fresh Phase 2 (3/5 lanes) → ▫️ publish
Estimated from recent reviews of this tier · updated 15:58 UTC · live progress

@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 protocol-14 retraction implementation is correctly version-gated and preserves the moderation bar when the declaration does not match or cannot be evaluated. Two non-blocking issues remain: the new required public trait method breaks downstream trait implementations, and the fail-closed condition-error branch lacks end-to-end regression coverage.

🟡 2 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gemini-3.8-flash-high (agent: phase1-reviewer, role: general); reviewer 4: gemini-3.8-flash-high (agent: phase1-reviewer, role: rust-quality); 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: critical by gpt-6.1-sol (effort low) — This is a large, intricate consensus-rule change that modifies document-type parsing and the contract moderation gate in rs-drive-abci, directly changing state-transition validation for banned or suspended authors.
  • Phase 1 reviewers: gemini-3.8-flash-high — general (completed, effort high); agent phase1-reviewer, gemini-3.8-flash-high — rust-quality (completed, effort high); agent phase1-reviewer
  • Phase 1 model: gemini-3.8-flash-high — antigravity quota: weekly 59% left, 5h 39% left
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); 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-dpp/src/data_contract/document_type/accessors/v2/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/accessors/v2/mod.rs:146-151: Adding a required public trait method breaks downstream implementations
  `DocumentTypeV2Getters` is public and re-exported, so adding `retracted_when` as a required method causes downstream crates that implement this trait to fail compilation with a missing-method error. All in-repository implementations were updated, but the PR's breaking-change description only identifies the protocol consensus change. Give the method a default implementation returning `None`, which matches the documented behavior for pre-keyword types and still allows `DocumentTypeV2` to override it, or explicitly document this Rust API break as part of the release compatibility change.

In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/retraction.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/retraction.rs:45-50: Add integration coverage for fail-closed retraction-condition faults
  `judge_barred_replace` deliberately maps a `retractedWhen` evaluation error to `false`, so an overflow or division-by-zero fault must preserve the author's ban or suspension. Every new drive-abci retraction fixture uses a `present` condition, which cannot exercise this branch. The existing immutable-condition fault test covers the opposite policy (`unwrap_or(true)` keeps an immutable field frozen) and therefore does not protect this helper. Add an end-to-end case with a valid condition that faults at runtime, such as division by zero from a zero-valued replacement property, and assert that block processing returns the original moderation error with the paid nonce-bump behavior, leaves the stored document unchanged, and that `check_tx` rejects the transition.

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
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 2, 2026
A barred author's replace whose `retractedWhen` condition divides by zero
is refused with the bar in the mempool and in a block, paid with the
nonce bumped, and leaves the stored document as it was; the same
condition met lets the replace through. Pins the fail-closed branch of
`judge_barred_replace`, which the earlier `present` conditions could not
reach.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 2, 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 PV14 gating and fail-closed regression coverage are supported by the source, but the new retraction exception exposes a blocking mixed-result execution path that skips the replacement's remaining validation. A documentation suggestion also remains for the required public-trait method. This verification was static only: the supplied CI snapshot shows Kotlin SDK testing and PR Hygiene pending and contains no completed Rust validation results.

🔴 1 blocking | 🟡 1 suggestion(s)

1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.

Review provenance

Source: reviewer 1: gemini-3.8-flash-high (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gemini-3.8-flash-high (agent: phase1-reviewer, role: rust-quality); 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-astra (agent: phase2-reviewer, role: general); reviewer 9: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 11: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 12: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This intricate cross-cutting change alters PV14 consensus acceptance rules in contract_moderation_gate/v0/mod.rs and the batch transformer’s retraction.rs, coordinating conditional authorization of barred authors’ replaces with schema parsing, immutable contract updates, and document validation.
  • Phase 1 reviewers: gemini-3.8-flash-high — general (completed, effort high); agent phase1-reviewer, gemini-3.8-flash-high — rust-quality (completed, effort high); agent phase1-reviewer
  • Phase 1 model: gemini-3.8-flash-high — antigravity quota: weekly 37% left, 5h 95% left
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — general (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — security-auditor (completed, effort xhigh); agent phase2-reviewer
  • Model comparison: every Phase-2 reviewer also ran on gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/contract_moderation_gate/v0/mod.rs`:
- [BLOCKING] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/transformer/v0/contract_moderation_gate/v0/mod.rs:202-205: Validate admitted retractions before executing an error-bearing batch
  The new exemption can retain a live replacement in a transformer result that also contains consensus errors. The contract transformer merges passed actions with refusals at transformer/v0/mod.rs:493–516, and the outer transformer preserves both action data and errors. processor/v0/mod.rs:288–297 then converts that result directly into an ExecutionEvent, returning before advanced structure and state validation. Those skipped stages enforce propertyConstraints, immutable fields, and document references; satisfying retractedWhen does not replace those checks.

  The execution path does not make this safe: retained replacements become UpdateDocument operations, and paid execution applies the operations before reporting the consensus errors. PaidConsensusError outcomes retain their writes. Although this aggregation behavior predates the PR, barred owners' replacements previously became nonce bumps; this exemption newly admits replacement writes into that path and breaks the stated guarantee that every other document rule still applies.

  For PV14, ensure error-bearing transformer results cannot execute retained replacements until all applicable advanced structure and state checks have completed. Alternatively, replace unvalidated retained actions with nonce bumps before constructing the failed execution event. Add mixed-result regression coverage asserting that rejected batches cannot persist replacements violating blanking or immutability rules.

In `packages/rs-dpp/src/data_contract/document_type/accessors/v2/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/accessors/v2/mod.rs:146-151: Adding a required public trait method breaks downstream implementations
  (existing thread: https://github.com/dashpay/platform/pull/5253#discussion_r4163442958)
  Keeping retracted_when required follows the existing getter convention, and all four in-tree implementations are updated. However, DocumentTypeV2Getters is publicly re-exported and unsealed, so external implementations must also add this method to compile; the in-tree implementation count does not establish that external implementations cannot exist.

  The book reserves the title's ! marker for consensus-breaking changes, but that does not remove API disclosure from the PR body: .github/PULL_REQUEST_TEMPLATE.md asks for any breaking changes, and the book also directs public API removals to be described there. The current Breaking Changes section describes only consensus activation. Retain the required getter, but add a brief Rust API migration note stating that custom DocumentTypeV2Getters implementations must implement retracted_when, returning None when no condition applies. No default implementation or additional runtime version slot is required.

…one result

A transition the moderation gate passes (a deletion, a retraction, what the
interim block passes) shares a transformer result with a refusal only in a
batch of several transitions, which basic structure refuses while
`max_transitions_in_documents_batch` is 1 (10412). Such a result would be
executed without the passed transitions' state validation, so the note
says what raising the cap must do first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@QuantumExplorer
QuantumExplorer merged commit 0a5fcd4 into v5.0-dev Oct 2, 2026
39 of 40 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/banned-author-retraction-dc7bf9 branch October 2, 2026 15:57
@PastaPastaPasta PastaPastaPasta mentioned this pull request Oct 5, 2026
1 of 22 tasks
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