Skip to content

feat(dpp)!: moderator removal records keep the fields a type lists (PV14) - #5219

Merged
QuantumExplorer merged 4 commits into
v4.2-devfrom
claude/moderated-docs-public-fields-f90570
Sep 30, 2026
Merged

QuantumExplorer merged 4 commits into
v4.2-devfrom
claude/moderated-docs-public-fields-f90570

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

When a moderator deletes a document, the platform keeps a small removal record: whose document it was, who removed it, why, when, and a hash of it. Everything the document said is gone.

Sometimes part of a removed document should stay visible. On a social app, a moderator removes a spam post, but the post's hashtag should still say "a post here was removed", and the time it was written still places it in the timeline. This PR lets a document type list those fields. When a moderator deletes a document, the record keeps a copy of their values; everything else leaves with the document.

Issue being fixed or feature implemented

A contract could choose whether a moderator's deletion leaves a record (deleteKeepsRecord), but not what the record says about the document. Clients showing a removed post (a hashtag page, a thread, a quote) had nothing to show beyond "removed".

What was done?

A new key of moderatorAbilities (protocol version 14, in place): deleteKeepsFields, a list of property paths.

Before:

"moderatorAbilities": { "delete": true }
{
  "documentOwnerId": "…", "moderatorId": "…", "reason": { "text": "spam" },
  "removedAt": 1759200000000, "documentHash": "…"
}

After:

"moderatorAbilities": {
  "delete": true,
  "deleteKeepsFields": ["hashtag", "meta.tags", "$createdAt"]
}
{
  "documentOwnerId": "…", "moderatorId": "…", "reason": { "text": "spam" },
  "removedAt": 1759200000000, "documentHash": "…",
  "keptFields": { "$createdAt": 1759100000000, "hashtag": "dash", "meta.tags": ["privacy", "payments"] }
}

The keyword (dpp). Each entry is a declared property at any depth (hashtag, meta.tags, or meta kept whole), or one of the timestamps and block heights ($createdAt, $updatedAt, $transferredAt and their BlockHeight / CoreBlockHeight forms, the SystemProperty set) that the type lists in required. Refused (10231) on both parse paths: without delete: true; beside deleteKeepsRecord: false (nowhere to keep them); an undeclared path or one stepping through a non-object; a transient property (judged by is_transient on the declared transient paths); $id / $ownerId (every record has them); any other system property; a path inside another listed path. Fixed with the type in both directions (40212): which fields stay public is what an author was told when writing. Meta-schema v3 gains the key.

The record: kept fields stored the way documents store their properties. ContractDocumentRemoval.kept_fields is the raw bytes encode_kept_fields writes from the stored document at deletion: for each path the type lists, in the list's order, 0 when the document holds no value there, or 1 and the value as an optional property of its type is written (DocumentPropertyType::encode_value_ref_with_size, an object length-prefixed with its members in order), a time or block height as eight big-endian bytes, a core block height as four. The paths are not stored: the type lists them and never changes the list. The record is read, as a document is, under its document type (ContractDocumentRemoval::kept_values(document_type)), and each value comes back typed exactly as reading the document gives it; an object kept whole reads members an update added after the removal as absent, as an older document does. The record keeps Eq. In the Drive item, bit 1 of the tag byte says kept fields follow the restoration and come before the reason (length u32, then the bytes); a record keeping nothing is byte-for-byte what it was before. A restore keeps what the record kept; a second deletion writes fresh values. The moderator pays for the record, kept values included.

Fees. Records a write walks past are estimated from the type's kept paths (presence byte and middle size, as documents are estimated), not from the record being written. A replacement (restore, or re-deletion of a restored document) is estimated by what it adds to the record it replaces, never less. A re-deletion's forfeiture (ForfeitStorageRefunds { spared }) now spares the moderator holding the replaced record, who is refunded the bytes a shorter fresh record frees; the document's owner still forfeits.

moderatedDocument references (#5214). A where pair on a property the removed document's record keeps is checked against the kept value (same absence rule as against a document in state) instead of refused with 40145; writer gates stay limited to $ownerId / $id, the only values sure to be in every record, and the parser, error and book texts now say so. A record marked restored no longer verifies as proof of a deletion.

The wire. GetContractDocumentRemovalsResponse.ContractDocumentRemoval gains bytes kept_fields = 8, the bytes as the record stores them; the removals query and joins through a moderatedDocument reference return them as stored. Clients regenerated.

SDKs. rs-sdk returns the record; kept_values(document_type) reads it. wasm-sdk reads kept fields under the contract's document type for keptFields on getContractDocumentRemovals entries, joined removals, and the results of contractDeleteDocument / contractRestoreDocument: an object keyed by path, values as a document's properties show them, every key at any depth an own property (a __proto__ property is data). wasm-dpp2 VerifiedContractDocumentRemoval has keptFieldsBytes and keptFields(dataContract). The JSON normalizer defines rather than sets keys, and writes 64-bit integers as strings.

Docs. Book: a deleteKeepsFields section in the Deletion chapter with the example, the abilities and keyword tables, the record layout, fees and query in Contract Moderation, the moderatedDocument text in refers-to. v14 changelog: folded into item 57, beside deleteKeepsRecord.

Out of scope, by design: kept values are not indexed, so no query finds records by a kept value.

How Has This Been Tested?

  • dpp: parser accepts nested paths, whole objects and required timestamps on both parse paths; refuses each case above, including a nested path wrongly flagged transient by a prefix-named top-level property; validate_update refuses changing the list; the kept-field codec round-trips values typed as the document reads them (integers, identifiers, a whole object, a nested member, system times and core heights) and refuses bytes cut short, trailing, or with an unknown marker.
  • drive: record round trips (restored + kept), byte layout pinned, malformed kept sections and a missing reason refused; estimate ≥ apply for storage and processing on fresh records and restores keeping a full-length text and a whole object in an already filled tree; a replacement estimated by what it adds; the restoring moderator refunded on a re-deletion, the author not.
  • drive-abci: a moderator deletes a post keeping hashtag, meta.tags and $createdAt: the record reads back exactly those, the proof returns the record, a restore keeps them and the restored record no longer proves the deletion; a missing value is left out; a contract update changing the list is refused; a moderatedDocument pair on a kept text holds against the kept value, a different text mismatches, and on a type keeping nothing the same edit is refused (40145).
  • drive-proof-verifier, rs-sdk mock and fetch tests; wasm-bindgen tests on the JS shape (type-read kept fields, bigint, base58 identifier inside an object, __proto__ own at every depth and inside arrays, JSON of large integers, empty object when nothing is kept); wasm-dpp2 (1377) and wasm-sdk (455) mocha; js-evo-sdk facade.

Breaking Changes

Consensus: the removal record's stored encoding gains the kept-fields section (records that keep nothing are unchanged), moderatorAbilities accepts a new key, moderatedDocument pair checks read kept values, fee estimates of removal records change, and a re-deletion refunds the holder of the replaced record. All protocol version 14, which has not been released.

Rust API: ContractDocumentRemoval has a new public field kept_fields: Vec<u8>; ContractModerationOperationType::AddDocumentRemoval carries replaced_record_size / estimated_kept_fields_size and a boxed record; ForfeitStorageRefunds carries spared.

In-place changes to shipped generations

None: everything changed is protocol version 14, unreleased.

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 (no structure change: only the record item's contents)

🤖 Generated with Claude Code

PR Hygiene · fdb18ec

  • Bots — coderabbitai not yet · thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed once the bots are done
  • Within your 5 open PRs — this one is beyond the limit; it waits until one merges
  • Build running
  • Approvals
    • files with no dedicated owner — you own it
    • js-wasm-sdk (packages/js-evo-sdk/README.md, packages/js-evo-sdk/tests/unit/facades/contracts.spec.ts, packages/wasm-sdk/src/queries/chained_document.rs and 3 more) — shumkov
    • dpp — you own it
    • rs-drive-abci — you own it
    • rs-drive — you own it
    • rust-sdk (packages/rs-sdk/src/mock/requests.rs, packages/rs-sdk/tests/fetch/document_query_v0_v1.rs) — lklimek or shumkov

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

Summary by CodeRabbit

  • New Features
    • Moderators can configure document properties to remain public in removal records after deletion. Removal queries and verified results now include those retained values.
    • References to deleted documents can still be checked against retained properties, including nested fields.
  • Bug Fixes
    • Storage estimates and refunds account for retained fields and replaced removal records. Restored records no longer qualify as proof of an unrestored deletion.
  • Documentation
    • Added guidance on configuring retained fields, their visibility and restrictions, and how they affect removal records and references.

…V14)

A moderator's deletion leaves a removal record saying whose document it
was, who removed it, why, when and a hash of it, and nothing of what it
said. `moderatorAbilities.deleteKeepsFields` lists the fields that stay
public: the record keeps a copy of their values, copied from the stored
document at the deletion (the hashtag of a removed post, the time it was
written). Paths reach into objects; the timestamps and block heights the
type requires may be kept too. The list needs a record, and is fixed with
the type.

The record's tag byte gains bit 1: kept fields follow the restoration,
each path with its value as a bincode platform value. A record keeping
nothing is written as before. The removals response, and a join through
a `moderatedDocument` reference, carry them as `kept_fields` (field 8);
wasm-dpp2 and wasm-sdk show them as `keptFields`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: 285b765d-d494-49e2-9039-d4faf99b9426

📥 Commits

Reviewing files that changed from the base of the PR and between 7e32f78 and fdb18ec.

📒 Files selected for processing (67)
  • book/src/contract-keywords.md
  • book/src/contract-keywords/deletion.md
  • book/src/contract-keywords/moderator-abilities.md
  • book/src/contract-keywords/refers-to.md
  • book/src/data-model/contract-moderation.md
  • packages/dapi-grpc/clients/drive/v0/nodejs/drive_pbjs.js
  • packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js
  • packages/dapi-grpc/clients/platform/v0/nodejs/platform_protoc.js
  • packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.h
  • packages/dapi-grpc/clients/platform/v0/objective-c/Platform.pbobjc.m
  • packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py
  • packages/dapi-grpc/clients/platform/v0/web/platform_pb.d.ts
  • packages/dapi-grpc/clients/platform/v0/web/platform_pb.js
  • packages/dapi-grpc/protos/platform/v0/platform.proto
  • packages/js-evo-sdk/README.md
  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.ts
  • packages/rs-dpp/schema/meta_schemas/document/v3/document-meta.json
  • packages/rs-dpp/src/data_contract/config/moderation/document_removal.rs
  • packages/rs-dpp/src/data_contract/config/moderation/mod.rs
  • 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/moderator_abilities_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/property/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-dpp/src/errors/consensus/state/document/referenced_document_removed_error.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v0/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/state/v0/mod.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/deletion_options.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/moderated_document_reference.rs
  • packages/rs-drive-abci/src/query/contract_moderation_queries/contract_document_removals/v0/mod.rs
  • packages/rs-drive-abci/src/query/contract_moderation_queries/mod.rs
  • packages/rs-drive-abci/src/query/mod.rs
  • packages/rs-drive-proof-verifier/src/types/contract_moderation.rs
  • packages/rs-drive-proof-verifier/src/unproved.rs
  • packages/rs-drive/src/drive/contract/insert/insert_contract/v0/tests/chained_query_e2e_tests.rs
  • packages/rs-drive/src/drive/contract/moderation/add_contract_document_removal/mod.rs
  • packages/rs-drive/src/drive/contract/moderation/add_contract_document_removal/v0/mod.rs
  • packages/rs-drive/src/drive/contract/moderation/document_removal_tests.rs
  • packages/rs-drive/src/drive/contract/moderation/estimated_costs/mod.rs
  • packages/rs-drive/src/drive/contract/moderation/estimated_costs/v0/mod.rs
  • packages/rs-drive/src/drive/contract/moderation/mod.rs
  • packages/rs-drive/src/drive/contract/moderation/types.rs
  • packages/rs-drive/src/drive/document/derived_index_values.rs
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/contract/contract_user_moderation_transition.rs
  • packages/rs-drive/src/state_transition_action/contract/contract_user_moderation/v0/mod.rs
  • packages/rs-drive/src/structure/tests.rs
  • packages/rs-drive/src/util/batch/drive_op_batch/contract_moderation.rs
  • packages/rs-drive/src/util/batch/drive_op_batch/drive_methods/apply_drive_operations/v1/mod.rs
  • packages/rs-drive/src/util/batch/drive_op_batch/mod.rs
  • packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs
  • packages/rs-platform-version/src/version/v14.rs
  • packages/rs-sdk/src/mock/requests.rs
  • packages/rs-sdk/tests/fetch/document_query_v0_v1.rs
  • packages/wasm-dpp2/src/consensus_error.rs
  • packages/wasm-dpp2/src/serialization/conversions.rs
  • packages/wasm-dpp2/src/state_transitions/proof_result/convert.rs
  • packages/wasm-dpp2/src/state_transitions/proof_result/data_contract.rs
  • packages/wasm-sdk/src/queries/chained_document.rs
  • packages/wasm-sdk/src/queries/composite_document.rs
  • packages/wasm-sdk/src/queries/contract_moderation.rs
  • packages/wasm-sdk/src/state_transitions/contract.rs
 ________________________________________________
< Doubling as a space heater during code review. >
 ------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

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

github-actions Bot commented Sep 30, 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-09-30T09:38:04.688Z

@thepastaclaw

thepastaclaw commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit fdb18ec) · triage: critical

@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

Verified the findings against head 595f095. Independent protobuf and WASM reproductions confirmed three newly exposed client-conversion defects; inspection also confirmed the kept-field fee-test coverage gap. The client defects are suggestions under the supplied consensus-focused severity policy: none establishes consensus divergence or skipped proof verification.

🟡 4 suggestion(s)

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: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: ffi-engineer); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: platform-versioning); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 11: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 12: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 13: gpt-6-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 14: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 15: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This intricate cross-layer change modifies consensus-relevant contract validation in packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs and persistent removal-record encoding in packages/rs-drive/src/drive/contract/moderation/types.rs, alongside deletion execution and fee estimation.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — architecture-layering (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — ffi-engineer (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — platform-versioning (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 below 15% reserve: weekly 13% left, 5h 100% left), 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 xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (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-astra — general (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — ffi-engineer (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
  • 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/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js`:
- [SUGGESTION] packages/dapi-grpc/clients/platform/v0/nodejs/platform_pbjs.js:28855-28857: Preserve __proto__ kept fields throughout JavaScript protobuf conversion
  The admitted property path `__proto__` is lost because the generated decoder initializes `keptFields` with `{}` and assigns through its inherited prototype setter. Using the checked-in platform codec and pinned protobufjs runtime, a message containing own `__proto__` and `hashtag` entries decoded with only `hashtag` as an own key, changed the map's prototype to the received Buffer, and shrank from 31 bytes to 14 when re-encoded. Independently exercising `fromObject`, `toObject`, the Drive codec, and the google-protobuf binding confirmed the same loss. These are separate transport paths that the WASM own-property helper cannot protect. Preserve arbitrary map keys throughout decoding, conversion, enumeration, and serialization through a reproducible generator/runtime repair, regenerate the affected clients, and add reserved-name round-trip tests. Updating only this generated assignment would leave the other conversion paths broken.

In `packages/wasm-dpp2/src/serialization/conversions.rs`:
- [SUGGESTION] packages/wasm-dpp2/src/serialization/conversions.rs:426-434: Preserve own properties recursively inside retained objects
  The own-property helper protects only the outer property-path map, after each retained value has already been serialized. A valid `deleteKeepsFields: ["meta"]` declaration can keep an object containing a declared `__proto__` property. Both conversion branches delegate nested maps to the pinned serde-wasm-bindgen serializer, which constructs ordinary objects and uses an indexing setter. A WASM test importing this exact conversion implementation confirmed that an object-valued nested `__proto__` entry disappears from own keys and makes its contents inherited properties in both object and JSON modes. Thus the new retained-value surfaces do not faithfully expose the stored or proof-verified value. Construct nested maps recursively with own-property writes, or repair the shared serializer and update its pin. Cover scalar and object-valued `__proto__` entries, including objects inside arrays.

In `packages/wasm-dpp2/src/state_transitions/proof_result/data_contract.rs`:
- [SUGGESTION] packages/wasm-dpp2/src/state_transitions/proof_result/data_contract.rs:481: Make retained large integers JSON-compatible
  Adding kept fields to `toJSON()` makes this existing wrapper fail for valid retained 64-bit integers outside JavaScript's safe integer range. `kept_fields_to_js(..., true)` passes them through `platform_value_to_json` to serde-wasm-bindgen's JSON-compatible serializer, which disables BigInt output and rejects these integers. A WASM reproduction against the actual helper confirmed that retained values of 9007199254740992 and -9007199254740992 succeed in object mode but return errors in JSON mode. Consequently, `toJSON()` and JSON serialization of an otherwise valid removal record throw. Convert out-of-range integers recursively to a lossless JSON representation, such as decimal strings, while leaving safe integers numeric, and add boundary-value tests.

In `packages/rs-drive/src/drive/contract/moderation/estimated_costs/v0/mod.rs`:
- [SUGGESTION] packages/rs-drive/src/drive/contract/moderation/estimated_costs/v0/mod.rs:164-167: Exercise nonempty kept fields in fee-estimation regressions
  The estimated removal-tree item size now includes the encoded kept-field size, but the estimate-versus-apply tests still use records with empty `kept_fields`. `should_estimate_a_record_at_no_less_than_it_costs` exercises reason sizes only, and the restore/redelete regression also starts with an empty kept-field map. The new ABCI tests assert retained contents and proofs without checking fees. Extend the fee regressions with nonempty retained values, including a large nested value and an already populated removal tree, and compare estimated and applied fees for insertion and restoration/replacement. Include processing-fee assertions appropriate to the estimator's guarantees as well as storage fees, since this size also describes records traversed by the write.

@github-actions

github-actions Bot commented Sep 30, 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 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 Sep 30, 2026
QuantumExplorer and others added 3 commits September 30, 2026 16:09
…nd review fixes

A removal record now keeps its fields encoded the way the document
encodes its properties: for each path its type lists, in the list's
order, a presence byte and the value as an optional property of its
type is written, the paths themselves not stored. The record is read
under the document's type, as the document is, so each value comes
back typed exactly as reading the document gives it. The record holds
the raw bytes, so it keeps Eq, and a node returns them as stored
(proto `kept_fields` becomes bytes); wasm-sdk reads them under the
contract's type for `keptFields`, wasm-dpp2 exposes the bytes and a
`keptFields(dataContract)` reader.

Review fixes:
- a moderatedDocument `where` pair on a kept property is checked
  against the record's kept value instead of refused (40145); writer
  gates stay on $ownerId/$id, their texts corrected
- transience is judged by `is_transient` on the declared paths
- system fields go through `SystemProperty`
- a record replacement is estimated by what it adds, walked-past
  records from the type's kept paths
- a re-deletion spares the refund of the moderator holding the
  replaced record (ForfeitStorageRefunds { spared })
- a record marked restored no longer proves a deletion
- JS: own properties at every depth and through the JSON normalizer
- docs, v14 note, tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…docs-public-fields-f90570

# Conflicts:
#	packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs
#	packages/wasm-dpp2/src/data_contract/transitions/user_moderation.rs
…arrays

Estimate against apply, storage and processing, for fresh records and
restores that keep a full-length text and a whole object, in a removals
tree other records already fill. The kept values' JS conversion keeps a
`__proto__` member its own inside arrays too, object-valued or scalar.

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 bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Sep 30, 2026

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

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