Repository navigation
feat(platform)!: a moderation reason names the documents it is about - #4884
Conversation
`ContractModerationReason` gains `documents`, the posts a warning, a ban, a suspension or a deletion is for, each by document type name and id: at most `SystemLimits::max_contract_moderation_reason_documents` (16), none twice, refused unpaid with `InvalidContractModerationReasonDocumentsError` (10904). Nothing looks a cited document up. Stored under a second tag bit of the reason, so every entry written so far still decodes; on the proto and JS reasons, left out when empty. The wasm surfaces read the reason through an input shape so a document id arrives as an `IdentifierLike`. Also: the wasm-dpp2 contract config spec expects the warning list to default off, and two review wordings. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Warning Review limit reachedNext included review available in 22 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: dashpay/platform/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (42)
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. Comment |
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-09-21T12:13:55.571Z |
PR HygieneState: waiting-bots · commit
Self-review is an author attestation that you have read the diff: This check passes when the policy is satisfied; the repository decides whether merging requires it. |
|
|
Issue being fixed or feature implemented
Follow-up to #4872 (the warning list), which merged before this landed on its branch. A moderation reason could say why in text and a code, but not which posts it was about. A warning, a ban or a suspension for "these three posts" had nowhere to name them, and the client that shows the warned user its warnings had nothing to link.
What was done?
A reason names the documents it is about, on every action.
ContractModerationReasongainsdocuments: Vec<ContractModerationDocument { document_type_name, document_id }>, so a warning, a ban, a suspension and a moderator's document deletion can all cite the posts they are for.SystemLimits::max_contract_moderation_reason_documents(16) per reason, none twice (the same id under another type is another document), and a document type name a contract could admit (1 to 64 bytes). Refused with the newInvalidContractModerationReasonDocumentsError(10904, appended toBasicError, discriminant pinned).ContractModerationDocumenton the proto,documentsonContractModerationReason, clients regenerated; the proof verifier refuses an id that is not 32 bytes and, as for the text, does not bound the count.documents?: [{ documentTypeName, documentId }]on the reason, ids as base58, present on a reason read back only when it cites any (skip_serializing_ifon the Rust side too, sotoJSON()of a transition is unchanged for a reason about no document). A document id inside the reason arrives from JavaScript through serde, which refuses a base58 string for a rawIdentifier, so wasm-dpp2 reads options through aContractModerationReasonInputbuilt on the wasm identifier wrapper, and wasm-sdk uses it for its ban, suspend, warn and delete-document options.Also carried here, since they were on the merged PR's branch after the merge:
DataContractconfig spec expected a moderation declaration withoutwarnings; it now expects the warning list defaulted off (the failingJS packages (@dashevo/wasm-dpp2) / Testscheck onv4.2-dev).How Has This Been Tested?
toJSON()and bytes, and nodocumentskey without any. wasm-sdk unit specs and the js-evo-sdk contracts spec pass.Breaking Changes
PV14 is unreleased; the reason gains a field in its bincode layout (transitions) and its storage gains a tag bit (backward-readable). The TypeScript reason type gains an optional field only.
Checklist
🤖 Generated with Claude Code