diff --git a/book/src/contract-keywords.md b/book/src/contract-keywords.md index 247beea63a7..907ac7bd19b 100644 --- a/book/src/contract-keywords.md +++ b/book/src/contract-keywords.md @@ -195,7 +195,7 @@ A typed array's element (`items`) takes `type` (the `identifier` and `bytes` sho | `documentType` | document type name | The referenced document type. | 14 | [documentType](contract-keywords/refers-to.md#documenttype) | | `contractId` | identifier | The contract holding `documentType`, when it is not this one. | 14 | [contractId](contract-keywords/refers-to.md#contractid) | | `contractId`, `documentType` as `"$self."` | `$self.` and a top-level property name | On a `permanentDocument` or `moderatedDocument`, or a `type` [listing both](contract-keywords/refers-to-dynamic.md#either-kind): both read from the referring document, an identifier property holding the id of the contract and a string property holding the name of the document type. Both or neither. | 15 | [A Target the Document Names](contract-keywords/refers-to-dynamic.md) | -| `documentTypeRequirements` | `{ "properties", "require"? }` | Beside a target read from the document: 1 to 4 named slots, each a property the named type must have (`name`, `type`, `maxBytes`, `distinctFrom`, and `when`, a [condition](contract-keywords/refers-to-dynamic.md#a-condition-on-the-property-when) on what the type says of the property), and which of them must be filled. | 15 | [documentTypeRequirements](contract-keywords/refers-to-dynamic.md#documenttyperequirements) | +| `documentTypeRequirements` | `{ "properties", "require"? }` | Beside a target read from the document: 1 to 4 named slots, each a property the named type must have (`name`, `type`, `maxBytes`, `distinctFrom`, and `when`, a [condition](contract-keywords/refers-to-dynamic.md#a-condition-on-the-property-when) on what the type says of the property), which of them must be filled, and a [`when` on the type as a whole](contract-keywords/refers-to-dynamic.md#a-condition-on-the-type-when). | 15 | [documentTypeRequirements](contract-keywords/refers-to-dynamic.md#documenttyperequirements) | | `findBy` | 1 to 10 entries: referenced property → `"."`, `"$ownerId"`, a path or a function | Finds the document through the unique index of `documentType` over exactly these properties, in any order; `"."` is the value itself. Without it the value is the document's `$id`. | 14 | [findBy](contract-keywords/refers-to-lookup.md) · [internals](data-model/documents.md#found-by-a-unique-index-findby) | | `findBy.` | `{ "function": "sys.hash.sha256d", "params" }` | A function entry: the referenced property holds the hash of `params` (paths, `{ "const": text }`, `"."` for a value without a path), which fills that part of the key, finding a commitment made earlier. At most one. | 14 | [Commit and reveal](contract-keywords/refers-to-lookup.md#commit-and-reveal) · [internals](data-model/documents.md#commit-and-reveal-a-findby-function) | | `where` | 1 to 10 entries `{ "": "" }` | Checked on the document found: each referenced property (or `$ownerId`, `$creatorId`, `$id`) must equal the referring property. A value of `"$ownerId"`, the writer, makes a write gate. Never finds the document. | 14 | [where](contract-keywords/refers-to.md#where) | diff --git a/book/src/contract-keywords/refers-to-dynamic.md b/book/src/contract-keywords/refers-to-dynamic.md index fb03c340bc3..bbe1bb697d5 100644 --- a/book/src/contract-keywords/refers-to-dynamic.md +++ b/book/src/contract-keywords/refers-to-dynamic.md @@ -48,7 +48,7 @@ A note is described by a document its author points at: `descriptionContractId` |---|---|---| | `contractId` | `"$self."` followed by the name of a top-level identifier property of the document type, 1 to 64 letters, digits or underscores | The property holding the id of the contract the referenced document type lives in, where a reference naming its target in the schema writes the id itself. | | `documentType` | `"$self."` followed by the name of a top-level string property | The property holding the name of the referenced document type, where a reference naming its target in the schema writes the name itself. | -| `documentTypeRequirements` | object: `properties` (required), `require` | What the named document type must look like. Absent, the type is held to its kind alone. | +| `documentTypeRequirements` | object: `properties` (required), `require`, `when` | What the named document type must look like. Absent, the type is held to its kind alone. | The two come together: a declaration names its target in the schema or through the document, never half of each, so a `$self.` `contractId` beside a literal `documentType` is refused, as is one beside none. The declaring contract is named like any other: a document pointing into its own contract writes that contract's id. Nothing a schema could write literally starts with `$self.`: a contract id is base58 and a document type name holds no `$`. @@ -140,18 +140,46 @@ When the type is a moderated one, the string filling `body` is one a moderator's | `"$property"` | The name of the property tried for the slot. | | `"$moderatorAbilities.deleteKeepsFields"` | The referenced type's [`deleteKeepsFields`](moderator-abilities.md): the property paths a removal record keeps. Empty when the type lists none. | | `"$moderatorAbilities.changeFields"` | The referenced type's [`changeFields`](moderator-abilities.md): the properties only moderators write. Empty when the type lists none. | +| `"$electedAbilities"` | The abilities the referenced type's contract gives its [elected moderation team](../data-model/contract-moderation.md) on the type, by name: `deleteDocuments`, `ban`, `suspend`, `warn`, `changeDocumentFields`. Empty when the contract elects no team, or leaves the type out of what the team moderates. | +| `"$moderatorAbilities.deleteWithin"`, `"$moderatorAbilities.deleteSettled"` | Settings of the referenced type a `present` or an `absent` tests: whether moderators delete a document only within a window after its last change, and whether the type says who of a seated team may delete one past it. | +| `"$moderatorAbilities.deleteSettled.approversPredateDocument"` | A setting a `present` or an `absent` tests: whether that rule counts a member the team's leader added only for documents created after its addition ([`approversPredateDocument`](moderator-abilities.md), as the rule reads once its default is applied: set unless one approval meets it). Absent on a type with no such rule. | | `{ "const": "" }` | The string, 1 to 256 characters. | | Condition | Holds when | |---|---| | `{ "equal": [a, b] }`, `{ "notEqual": [a, b] }` | `$kind` or `$property` is, or is not, the constant on the other side. Compared with `$kind`, the constant is `permanentDocument` or `moderatedDocument`. | | `{ "in": [a, [...]] }`, `{ "notIn": [a, [...]] }` | `$kind` or `$property` is, or is not, one of two or more distinct strings. | -| `{ "contains": [list, a] }` | One of the two lists holds `$property` or a constant, as a whole entry. | +| `{ "contains": [list, a] }` | One of the two property lists holds `$property` or a constant, as a whole entry; or `$electedAbilities` holds the ability a constant names. | +| `{ "present": setting }`, `{ "absent": setting }` | The type declares, or does not declare, `$moderatorAbilities.deleteWithin` or `$moderatorAbilities.deleteSettled`; or its settled rule sets, or does not set, `approversPredateDocument`. | | `{ "not": c }`, `{ "anyOf": [...] }`, `{ "allOf": [...] }` | As in `propertyConstraints`: `anyOf` and `allOf` take two or more conditions, none listed twice and none the same combinator; `not` holds no `not` and no `notIn`. | | `{ "ifThen": [c, then] }`, `{ "ifThenElse": [c, then, else] }` | `then` holds whenever `c` does; with an `else`, it holds when `c` does not. | One `when` is made of at most 16 conditions (`max_document_type_requirement_condition_nodes`), combinators counted and each string an `in` or a `notIn` lists counted too, and no string in it is longer than 256 characters (`max_document_type_requirement_condition_text_length`), so what it adds to a stored contract is bounded. It reads the type, never a document: no property path, no arithmetic, and no value of the referenced document. `distinctFrom`, `require` and the search for an assignment work as before, over the properties each slot's `when` leaves it. +## A condition on the type (`when`) + +`documentTypeRequirements` takes a `when` of its own, beside `properties`: the same condition, judged once for the named type as a whole, whatever fills the slots. No property is in hand, so it reads no `$property`. A type it does not hold for does not meet the requirements (40153). + +```json +"documentTypeRequirements": { + "when": { "allOf": [ + { "contains": ["$electedAbilities", { "const": "deleteDocuments" }] }, + { "anyOf": [ + { "absent": "$moderatorAbilities.deleteWithin" }, + { "allOf": [ + { "present": "$moderatorAbilities.deleteSettled" }, + { "absent": "$moderatorAbilities.deleteSettled.approversPredateDocument" } + ] } + ] } + ] }, + "properties": { "body": { "name": "$any", "type": "string" } } +} +``` + +The contract of the named type gives its elected team the deletion of the type's documents, and a document stays deletable: the type sets no window, or says who of the team deletes one past it and counts every member for every document. Without the first, a type can be a moderated one that nobody may moderate once a team is seated; without the second, a document outlasts its window for good; without the third, a rule taking more approvals than the leader and the elected members give never deletes a document older than the members the leader added. A reference that relies on a document being removable asks for both, and usually for [an elected contract](#who-vouches-for-the-target) too. + +A slot's `when` reads the same facts beside `$property`. Each `when` is held to the limits above on its own. + ## How it works Nothing about the target is known when the contract is registered, so registration checks the declaration alone. Everything about the target is checked when a document is written, in this order, the first failure refusing the write: @@ -193,6 +221,8 @@ The requirements say what the target's type looks like. They do not say who runs or compare it with the contracts the application trusts in a [`propertyConstraints`](property-constraints.md) rule (`{ "in": ["descriptionContractId", ["", ""]] }`). +The decision proposals contract does the first for the description of a multiple choice proposal: a `moderatedDocument` whose text a removal takes away, in a contract whose moderators the masternodes elect (see `docs/protocol/decision-proposals.md`). `"moderation": "elected"` says the contract declares such a team, not that one is seated: until then the contract's interim moderators, if it names any, are the ones who can remove the document. + ## Errors | Error | Code | When | diff --git a/book/src/data-model/documents.md b/book/src/data-model/documents.md index 4d503d61ee0..a488591e8f9 100644 --- a/book/src/data-model/documents.md +++ b/book/src/data-model/documents.md @@ -638,7 +638,7 @@ Version 1 of `apply_property_reference` reads the declaration (`try_from_schema/ The write-time check, `document_reference_validation` 1, builds the declaration a by-id reference would carry from the document's own values (the contract id and the type name, no `where`) and runs the flow every document reference runs: contract, document type, kind, document, removal record. Between the document type and the kind it does what registration does for a reference naming its type in the schema, refusing a private type, and judges the requirements with `DocumentTypeRequirements::met_by`. That search is over sets of slots, fullest first, and within a set fills the slot with the fewest candidates first; with at most `max_document_type_requirement_slots` slots it stays small whatever the referenced type declares. A replace checks the reference again when one of `DynamicDocumentReference::target_properties` changed. -A `type` listing both kinds parses to `DynamicDocumentReferenceKind::PermanentOrModerated`, and the write-time check takes the kind the reference is checked as from the named type (`checked_as`): moderated into a moderated type, permanent into any other. A slot's `when` is a `SlotCondition` (`property/slot_condition.rs`), judged by `met_by` for each property that could fill the slot against a `SlotConditionSubject`: the type's kind, the property's name, and the type's `moderator_deletion_kept_fields` and `moderator_changeable_fields`. The condition is stored in the compiled contract and travels in the consensus errors that carry a reference target, so the conditions it holds inside it sit behind `SlotConditions`, whose decoders refuse a nesting past `MAX_SLOT_CONDITION_DECODE_DEPTH` (16), as `ReferenceOperands` does for reference expressions. The parser holds one `when` to `max_document_type_requirement_condition_nodes` conditions (16), each string an `in` or a `notIn` lists counted, which keeps every registered condition within that depth and bounds its size with `max_document_type_requirement_condition_text_length`. `DocumentTypeRequirements::comparisons` counts what judging a type may take (each property a slot tries, times one plus the nodes of its `when`), and `document_reference_validation` 1 bills it through `bill_requirement_comparisons` before calling `met_by`, as `bill_where_list_elements` bills a `where` over lists. +A `type` listing both kinds parses to `DynamicDocumentReferenceKind::PermanentOrModerated`, and the write-time check takes the kind the reference is checked as from the named type (`checked_as`): moderated into a moderated type, permanent into any other. A slot's `when` is a `SlotCondition` (`property/slot_condition.rs`), judged by `met_by` for each property that could fill the slot against a `SlotConditionSubject`: the type's kind, the property's name, and the type's `moderator_deletion_kept_fields` and `moderator_changeable_fields`. The condition is stored in the compiled contract and travels in the consensus errors that carry a reference target, so the conditions it holds inside it sit behind `SlotConditions`, whose decoders refuse a nesting past `MAX_SLOT_CONDITION_DECODE_DEPTH` (16), as `ReferenceOperands` does for reference expressions. The parser holds one `when` to `max_document_type_requirement_condition_nodes` conditions (16), each string an `in` or a `notIn` lists counted, which keeps every registered condition within that depth and bounds its size with `max_document_type_requirement_condition_text_length`. `DocumentTypeRequirements::comparisons` counts what judging a type may take (each property a slot tries, times one plus the nodes of its `when`), and `document_reference_validation` 1 bills it through `bill_requirement_comparisons` before calling `met_by`, as `bill_where_list_elements` bills a `where` over lists. `DocumentTypeRequirements::when` is a condition of the same type judged once for the named type, which the parser holds to reading no `$property` (`SlotCondition::reads_the_property`). What it and a slot's `when` read of the type is a `SlotConditionSubject`: beside the kind and the two field lists, the abilities the type's contract gives its elected team on it (`ElectedModerators::moderated_document_types`, which `document_reference_validation` 1 hands to `met_by`) and whether the type declares `deleteWithin` and `deleteSettled`. ## Immutable Properties on Mutable Document Types diff --git a/docs/protocol/decision-proposals.md b/docs/protocol/decision-proposals.md index 4cca25cf168..fbd2d8deb85 100644 --- a/docs/protocol/decision-proposals.md +++ b/docs/protocol/decision-proposals.md @@ -134,8 +134,10 @@ is a contender of its own, so an identity may enter several. ### `multipleChoiceProposal` Undeletable (`canBeDeleted: false`), so a `choice` can refer to it as a -`permanentDocument`. The owner may edit `title`, `description` and `url` until -two hours after the proposal was created: each is an `immutable` entry whose +`permanentDocument`. The owner may edit `title` and `url`, and point the +proposal at another description (`descriptionId`, `descriptionContractId`, +`descriptionDocumentType`), until two hours after the proposal was created: +each is an `immutable` entry whose condition, `{ "greaterThan": [{ "subtract": ["$updatedAt", "$createdAt"] }, 7200000] }`, freezes it once that time has passed, and an edit after it is refused @@ -150,13 +152,137 @@ rejected. | Property | Type | Meaning | | --- | --- | --- | | `title` | string, 1 to 128 characters and at most 512 bytes, required | The question, in one line | -| `description` | string, 1 to 4096 characters and at most 4096 bytes, required | What is being decided | +| `descriptionId` | identifier, required | The document saying what is being decided: a [reference whose target the proposal names](../../book/src/contract-keywords/refers-to-dynamic.md) | +| `descriptionContractId` | identifier, required | The contract that document lives in: `refersTo` a `contract` with `contractRequirements: { "moderation": "elected", "ownerProtected": false }` | +| `descriptionDocumentType` | string, 1 to 64 characters, required | That document's document type | | `url` | string, `format: uri`, 1 to 512 characters and at most 512 bytes | Where the proposal is discussed | | `open` | boolean, required | Whether anyone may enter choices. Only the proposal's owner may when it is `false` | Indexes: `byOwner` (`$ownerId`, `$createdAt`) and `byCreatedAt` (`$createdAt`), neither unique. +#### The description + +A proposal costs its storage and nothing else, so text held in it would be +cheap to fill with anything and could never be taken down: the proposal is +undeletable. It therefore holds no description. It points at a document that +does, hosted where moderators can remove it: + +```json +"descriptionId": { + "type": "identifier", + "refersTo": { + "type": "moderatedDocument", + "contractId": "$self.descriptionContractId", + "documentType": "$self.descriptionDocumentType", + "documentTypeRequirements": { + "when": , + "properties": { + "body": { "name": "$any", "type": "string", "when": }, + "bodyBytes": { "name": "$any", "type": "array", "byteArray": true, "when": } + }, + "require": { "anyOf": ["body", "bodyBytes"] } + } + } +}, +"descriptionContractId": { + "type": "identifier", + "refersTo": { + "type": "contract", + "contractRequirements": { "moderation": "elected", "ownerProtected": false } + } +} +``` + +where `` is + +```json +{ "allOf": [ + { "contains": ["$electedAbilities", { "const": "deleteDocuments" }] }, + { "anyOf": [ + { "absent": "$moderatorAbilities.deleteWithin" }, + { "allOf": [ + { "present": "$moderatorAbilities.deleteSettled" }, + { "absent": "$moderatorAbilities.deleteSettled.approversPredateDocument" } + ] } + ] } +] } +``` + +and `` is + +```json +{ "allOf": [ + { "not": { "contains": ["$moderatorAbilities.deleteKeepsFields", "$property"] } }, + { "not": { "contains": ["$moderatorAbilities.changeFields", "$property"] } } +] } +``` + +Checked when the proposal is created, and again when an edit points it +elsewhere. The description is checked before the contract it names. The rows +are in the order checked, the first that applies refusing the write: + +| What the proposal names | Refused with | +| --- | --- | +| A contract that does not exist, or has no such document type | `ReferencedDocumentTypeNotFoundError` (40121) | +| A private document type, whose documents are encrypted entries the chain never reads | `ReferencedDocumentTypePrivateError` (40150) | +| An `indexOnly` document type, whose documents are index entries with none to find by its id | `ReferencedDocumentTypeIndexOnlyError` (40146) | +| A type its contract's elected team may not delete from (the contract elects no team, or leaves the type out of the team's `deleteDocuments`), or one moderators delete only within a window (`deleteWithin`) with no rule for later (`deleteSettled`), or with a rule that counts a member the leader added only for documents created after its addition (`approversPredateDocument`) | `ReferencedDocumentTypeRequirementNotMetError` (40153) | +| A moderated type with no string or byte array a removal takes away: every one is kept in the removal record (`deleteKeepsFields`) or is the moderators' to write (`changeFields`) | `ReferencedDocumentTypeRequirementNotMetError` (40153) | +| A document type whose documents their owner can delete, or that never leave state | `ReferencedDocumentTypeNotModeratedError` (40143) | +| A document that is not there | `ReferencedEntityNotFoundError` (40120) | +| A contract whose elected declaration protects its owner from the team. A contract that declares no elected moderation never gets this far: it gives no elected team the deletion of the type, and is refused with 40153 above | `ReferencedContractRequirementNotMetError` (40135) | + +What this does and does not give: + +- A moderator's removal of the description leaves the proposal in place, + pointing at the removal record: the question and its vote stay, the text is + gone. +- The contract declares a team the masternodes elect. It does not have to have + seated one yet: until it does, whoever the contract names for the interim + moderates, which may be its owner or nobody. How long that lasts is the + contract's to say: its `electionDelay`, counted from its creation, holds off + the first election, and has no upper bound short of some 136 years. A + reference requiring `"moderation": "electionOpen"` would admit only a + contract whose delay has passed; it would still not require a seated team. +- The team may moderate the contract's owner like anyone: a contract whose + declaration protects its owner (`ownerProtected`) is refused, since a + description the owner wrote there could not be removed. +- The team is given the deletion of the description's type, and a description + stays deletable. A contract that leaves the type out of the abilities it + gives its elected team (`deleteDocuments`) is refused, since once a team is + seated nobody could remove its documents. So is a type that lets moderators + delete only within a window after a document's last change + (`moderatorAbilities.deleteWithin`) without saying who may delete a settled + one (`deleteSettled`), since a description would outlast the window for + good. And so is a type whose rule for a settled document counts a member the + team's leader added only for documents created after its addition + (`approversPredateDocument`, the default once a rule asks for more than one + approval): under a rule taking more approvals than the leader and the + elected members give, a description older than the added members could + never be deleted. A type with a window qualifies with a rule one approval + meets, or one that sets `approversPredateDocument` to false. A settled + document is deleted by a seated team alone, so within the interim a + description past its window waits for the first election, and a rule taking + several approvals takes that many members of the team. +- All of this is what the host declares, checked when the proposal is written. + The team that is seated is the masternodes' to elect and changes afterwards, + and the reference does not read it. Two things about a seated team can keep + a description in place: + - A seated team does not moderate its own leader or active members. A + description one of them wrote, or whose author takes a seat later, cannot + be removed while the author holds the seat. + - A seated team acts only for a reason its charter lists, and a charter may + list none. Such a team removes nothing until another is elected. +- The description's own edit rules are its document type's. A type that lets + its author replace a document lets the author change the description after + the two hours, and after choices were entered. The proposal's history keeps + which document it pointed at, not what that document said. +- Which property of the document is the description is the first, in the + type's `position` order, that fills the `body` slot, then `bodyBytes` + (see [the binding rule](../../book/src/contract-keywords/refers-to-dynamic.md#documenttyperequirements)). +- `title` and `url` are still text of the proposal. + ### `choice` Immutable and undeletable. Additional properties are rejected. diff --git a/packages/decision-proposals-contract/README.md b/packages/decision-proposals-contract/README.md index 1436b3adee6..5df59368770 100644 --- a/packages/decision-proposals-contract/README.md +++ b/packages/decision-proposals-contract/README.md @@ -54,16 +54,28 @@ limits, or the create is refused: ## `multipleChoiceProposal` A question whose answers are the choices entered for it. Any identity may -create one, and nobody may delete it. Its owner may edit the `title`, -`description` and `url` for two hours after creating it; after that they -freeze. Every version is kept (`documentsKeepHistory`), so a reader can see the -text as it was when a choice was entered. Whether it is `open` never changes. -Creating it opens no vote and states no fund: the first choice does. +create one, and nobody may delete it. Its owner may edit the `title` and `url`, +and point it at another description, for two hours after creating it; after +that they freeze. Every version is kept (`documentsKeepHistory`), so a reader +can see the proposal as it was when a choice was entered. Whether it is `open` +never changes. Creating it opens no vote and states no fund: the first choice +does. + +The proposal holds no description of its own. It points at a document saying +what is being decided, in another contract, so that the description can be +taken down: the document type is a moderated one (its documents leave state +only through a moderator's recorded removal) holding a string or a byte array +that the removal takes away and that the document's author writes, the +contract is one whose moderators the masternodes elect and whose owner they +may moderate, and it gives that team the deletion of the type's documents, +at any time after they are written. | Property | Type | Meaning | | --- | --- | --- | | `title` | string, 1 to 128 characters and at most 512 bytes, required | The question, in one line | -| `description` | string, 1 to 4096 characters and at most 4096 bytes, required | What is being decided | +| `descriptionId` | identifier, required | The document saying what is being decided | +| `descriptionContractId` | identifier, required | The contract that document lives in, one declaring elected moderation that does not protect its owner from the team | +| `descriptionDocumentType` | string, 1 to 64 characters, required | That document's document type | | `url` | string, a URI of 1 to 512 characters and at most 512 bytes | Where the proposal is discussed | | `open` | boolean, required | Whether anyone may enter choices. Only the proposal's owner may when it is false | diff --git a/packages/decision-proposals-contract/schema/v1/decision-proposals-contract-documents.json b/packages/decision-proposals-contract/schema/v1/decision-proposals-contract-documents.json index 5748d32630e..0a95ad1f3b9 100644 --- a/packages/decision-proposals-contract/schema/v1/decision-proposals-contract-documents.json +++ b/packages/decision-proposals-contract/schema/v1/decision-proposals-contract-documents.json @@ -222,13 +222,130 @@ "description": "The question, in one line", "position": 0 }, - "description": { + "descriptionId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "contentMediaType": "application/x.dash.dpp.identifier", + "refersTo": { + "type": "moderatedDocument", + "contractId": "$self.descriptionContractId", + "documentType": "$self.descriptionDocumentType", + "documentTypeRequirements": { + "when": { + "allOf": [ + { + "contains": [ + "$electedAbilities", + { + "const": "deleteDocuments" + } + ] + }, + { + "anyOf": [ + { + "absent": "$moderatorAbilities.deleteWithin" + }, + { + "allOf": [ + { + "present": "$moderatorAbilities.deleteSettled" + }, + { + "absent": "$moderatorAbilities.deleteSettled.approversPredateDocument" + } + ] + } + ] + } + ] + }, + "properties": { + "body": { + "name": "$any", + "type": "string", + "when": { + "allOf": [ + { + "not": { + "contains": [ + "$moderatorAbilities.deleteKeepsFields", + "$property" + ] + } + }, + { + "not": { + "contains": [ + "$moderatorAbilities.changeFields", + "$property" + ] + } + } + ] + } + }, + "bodyBytes": { + "name": "$any", + "type": "array", + "byteArray": true, + "when": { + "allOf": [ + { + "not": { + "contains": [ + "$moderatorAbilities.deleteKeepsFields", + "$property" + ] + } + }, + { + "not": { + "contains": [ + "$moderatorAbilities.changeFields", + "$property" + ] + } + } + ] + } + } + }, + "require": { + "anyOf": [ + "body", + "bodyBytes" + ] + } + } + }, + "description": "The document saying what is being decided: a document of a moderated type its contract's elected team may delete, at any time after it is written, holding text its author wrote that the removal takes away with it", + "position": 1 + }, + "descriptionContractId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "contentMediaType": "application/x.dash.dpp.identifier", + "refersTo": { + "type": "contract", + "contractRequirements": { + "moderation": "elected", + "ownerProtected": false + } + }, + "description": "The contract the description document lives in, one whose moderators the masternodes elect and whose owner they may moderate like anyone", + "position": 2 + }, + "descriptionDocumentType": { "type": "string", "minLength": 1, - "maxLength": 4096, - "maxBytes": 4096, - "description": "What is being decided", - "position": 1 + "maxLength": 64, + "description": "The document type of the description document", + "position": 3 }, "url": { "type": "string", @@ -237,19 +354,21 @@ "maxLength": 512, "maxBytes": 512, "description": "Where the proposal is discussed", - "position": 2 + "position": 4 }, "open": { "type": "boolean", "description": "Whether anyone may enter choices; only the proposal's owner may when it is false", - "position": 3 + "position": 5 } }, "required": [ "$createdAt", "$updatedAt", "title", - "description", + "descriptionId", + "descriptionContractId", + "descriptionDocumentType", "open" ], "immutable": [ @@ -269,7 +388,35 @@ } }, { - "property": "description", + "property": "descriptionId", + "when": { + "greaterThan": [ + { + "subtract": [ + "$updatedAt", + "$createdAt" + ] + }, + 7200000 + ] + } + }, + { + "property": "descriptionContractId", + "when": { + "greaterThan": [ + { + "subtract": [ + "$updatedAt", + "$createdAt" + ] + }, + 7200000 + ] + } + }, + { + "property": "descriptionDocumentType", "when": { "greaterThan": [ { @@ -298,7 +445,7 @@ } ], "additionalProperties": false, - "description": "A question put to the masternodes whose answers are the choices entered for it. Anyone may enter choices when it is open, and only its owner when it is not. Its title, description and url may be edited for two hours after it is created; whether it is open never changes, and it is never deleted" + "description": "A question put to the masternodes whose answers are the choices entered for it. What is being decided is said by a document the proposal points at, of a moderated type of a contract whose moderators the masternodes elect, so that they can take it down. Anyone may enter choices when it is open, and only its owner when it is not. Its title, url and the description it points at may be changed for two hours after it is created; whether it is open never changes, and it is never deleted" }, "choice": { "type": "object", diff --git a/packages/decision-proposals-contract/src/lib.rs b/packages/decision-proposals-contract/src/lib.rs index 37539f1fefb..f5032f6e9a6 100644 --- a/packages/decision-proposals-contract/src/lib.rs +++ b/packages/decision-proposals-contract/src/lib.rs @@ -160,8 +160,9 @@ mod tests { let schema = load_documents_schemas(PlatformVersion::latest()).expect("schema loads"); - // The question's text may be edited for two hours, every version kept, and then - // freezes. It is never deleted, which is what lets a choice refer to it. + // The question's title and url may be edited, and the description it points at + // changed, for two hours, every version kept, and then they freeze. It is never + // deleted, which is what lets a choice refer to it. let question = &schema[multiple_choice_proposal::NAME]; assert_eq!(question["documentsMutable"], Value::Bool(true)); assert_eq!(question["documentsKeepHistory"], Value::Bool(true)); @@ -189,7 +190,15 @@ mod tests { &two_hours_after_creation ), ( - multiple_choice_proposal::properties::DESCRIPTION, + multiple_choice_proposal::properties::DESCRIPTION_ID, + &two_hours_after_creation + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID, + &two_hours_after_creation + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_DOCUMENT_TYPE, &two_hours_after_creation ), ( @@ -208,11 +217,90 @@ mod tests { declared, BTreeSet::from([ multiple_choice_proposal::properties::TITLE, - multiple_choice_proposal::properties::DESCRIPTION, + multiple_choice_proposal::properties::DESCRIPTION_ID, + multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID, + multiple_choice_proposal::properties::DESCRIPTION_DOCUMENT_TYPE, multiple_choice_proposal::properties::URL, multiple_choice_proposal::properties::OPEN, ]) ); + // The question holds no description of its own: it points at a document of a + // moderated type, of the contract and the type it names, holding a string or bytes + // that a moderator's removal takes away and that its author writes + let taken_with_the_document = serde_json::json!({ + "allOf": [ + { "not": { "contains": ["$moderatorAbilities.deleteKeepsFields", "$property"] } }, + { "not": { "contains": ["$moderatorAbilities.changeFields", "$property"] } } + ] + }); + assert_eq!( + question["properties"][multiple_choice_proposal::properties::DESCRIPTION_ID] + ["refersTo"], + serde_json::json!({ + "type": "moderatedDocument", + "contractId": format!( + "$self.{}", + multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID + ), + "documentType": format!( + "$self.{}", + multiple_choice_proposal::properties::DESCRIPTION_DOCUMENT_TYPE + ), + "documentTypeRequirements": { + // The contract's elected team may delete documents of the type, and + // at any time: no window, or a rule for deleting past it that counts + // every member of the team, whenever the document was created + "when": { "allOf": [ + { "contains": ["$electedAbilities", { "const": "deleteDocuments" }] }, + { "anyOf": [ + { "absent": "$moderatorAbilities.deleteWithin" }, + { "allOf": [ + { "present": "$moderatorAbilities.deleteSettled" }, + { "absent": + "$moderatorAbilities.deleteSettled.approversPredateDocument" } + ] } + ] } + ] }, + "properties": { + "body": { + "name": "$any", + "type": "string", + "when": taken_with_the_document + }, + "bodyBytes": { + "name": "$any", + "type": "array", + "byteArray": true, + "when": taken_with_the_document + } + }, + "require": { "anyOf": ["body", "bodyBytes"] } + } + }) + ); + // and that contract is one whose moderators the masternodes elect, with no + // protection of its owner from them: a description its owner wrote is removable too + assert_eq!( + question["properties"][multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID] + ["refersTo"], + serde_json::json!({ + "type": "contract", + "contractRequirements": { "moderation": "elected", "ownerProtected": false } + }) + ); + let required: Vec<&str> = question["required"] + .as_array() + .expect("the question lists required properties") + .iter() + .filter_map(Value::as_str) + .collect(); + for property in [ + multiple_choice_proposal::properties::DESCRIPTION_ID, + multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID, + multiple_choice_proposal::properties::DESCRIPTION_DOCUMENT_TYPE, + ] { + assert!(required.contains(&property), "{property} is required"); + } // Every question says whether it is open, for good assert_eq!( question["properties"][multiple_choice_proposal::properties::OPEN]["type"], diff --git a/packages/decision-proposals-contract/src/v1/mod.rs b/packages/decision-proposals-contract/src/v1/mod.rs index d1de1b2d5e8..ed0f96862b7 100644 --- a/packages/decision-proposals-contract/src/v1/mod.rs +++ b/packages/decision-proposals-contract/src/v1/mod.rs @@ -34,15 +34,27 @@ pub mod document_types { /// A question put to the masternodes whose answers are the choices entered for it. Any /// identity may enter [`choice`]s when it is open, and only its owner when it is not; whoever - /// may enter them may enter several. Its owner may edit the title, description and url for - /// two hours after creating it, and every version is kept; whether it is open never changes. + /// may enter them may enter several. What is being decided is not text of the proposal: + /// the proposal points at a document saying it, of a moderated document type of a contract + /// whose moderators the masternodes elect, so that a description can be taken down. Its + /// owner may edit the title and url, and point it at another description, for two hours + /// after creating it, and every version is kept; whether it is open never changes. /// Undeletable. pub mod multiple_choice_proposal { pub const NAME: &str = "multipleChoiceProposal"; pub mod properties { pub const TITLE: &str = "title"; - pub const DESCRIPTION: &str = "description"; + /// The id of the document saying what is being decided. Its document type is a + /// moderated one holding a string or a byte array that a moderator's removal + /// takes away and that its author writes, which its contract's elected team may + /// delete from at any time. + pub const DESCRIPTION_ID: &str = "descriptionId"; + /// The id of the contract the description document lives in, one declaring + /// elected moderation that does not protect its owner from the team. + pub const DESCRIPTION_CONTRACT_ID: &str = "descriptionContractId"; + /// The name of the description document's document type. + pub const DESCRIPTION_DOCUMENT_TYPE: &str = "descriptionDocumentType"; pub const URL: &str = "url"; /// Whether anyone may enter choices. Only the proposal's owner may when it is /// false. diff --git a/packages/decision-proposals-contract/test/unit/decisionProposalsContract.spec.js b/packages/decision-proposals-contract/test/unit/decisionProposalsContract.spec.js index 33ca3ad5de9..639c6172f2c 100644 --- a/packages/decision-proposals-contract/test/unit/decisionProposalsContract.spec.js +++ b/packages/decision-proposals-contract/test/unit/decisionProposalsContract.spec.js @@ -235,25 +235,29 @@ describe('Decision Proposals Contract', () => { }); describe('multipleChoiceProposal', () => { - const rawQuestion = () => ({ + // The description is a document of another contract: its id, that contract's id and + // the name of its document type + const rawQuestion = async () => ({ title: 'Which block time should Platform target?', - description: 'Enter the answer you would have the network give.', + descriptionId: await generateRandomIdentifier(), + descriptionContractId: await generateRandomIdentifier(), + descriptionDocumentType: 'post', url: 'https://www.dash.org/forum/threads/block-time.1/', open: true, }); - it('should be valid', () => { - expect(validateType('multipleChoiceProposal', rawQuestion()).isValid()).to.be.true(); + it('should be valid', async () => { + expect(validateType('multipleChoiceProposal', await rawQuestion()).isValid()).to.be.true(); }); - it('should not need a url', () => { - const raw = rawQuestion(); + it('should not need a url', async () => { + const raw = await rawQuestion(); delete raw.url; expect(validateType('multipleChoiceProposal', raw).isValid()).to.be.true(); }); - it('should keep its text editable for two hours, every version, and never be deleted', () => { + it('should keep its text and its description editable for two hours, every version, and never be deleted', () => { const { multipleChoiceProposal } = decisionProposalsContractDocumentsSchema; expect(multipleChoiceProposal.documentsMutable).to.be.true(); @@ -261,28 +265,93 @@ describe('Decision Proposals Contract', () => { expect(multipleChoiceProposal.canBeDeleted).to.be.false(); expect(multipleChoiceProposal.immutable).to.deep.equal([ 'open', - ...['title', 'description', 'url'].map((property) => ({ + ...[ + 'title', + 'descriptionId', + 'descriptionContractId', + 'descriptionDocumentType', + 'url', + ].map((property) => ({ property, when: { greaterThan: [{ subtract: ['$updatedAt', '$createdAt'] }, 7200000] }, })), ]); }); - it('should say whether it is open', () => { + it('should take its description from a moderated document of an elected contract', () => { + const { properties } = decisionProposalsContractDocumentsSchema.multipleChoiceProposal; + + expect(properties.description).to.be.undefined(); + + const takenWithTheDocument = { + allOf: [ + { not: { contains: ['$moderatorAbilities.deleteKeepsFields', '$property'] } }, + { not: { contains: ['$moderatorAbilities.changeFields', '$property'] } }, + ], + }; + + expect(properties.descriptionId.refersTo).to.deep.equal({ + type: 'moderatedDocument', + contractId: '$self.descriptionContractId', + documentType: '$self.descriptionDocumentType', + documentTypeRequirements: { + // The contract's elected team may delete documents of the type, at any time + when: { + allOf: [ + { contains: ['$electedAbilities', { const: 'deleteDocuments' }] }, + { + anyOf: [ + { absent: '$moderatorAbilities.deleteWithin' }, + { + allOf: [ + { present: '$moderatorAbilities.deleteSettled' }, + { absent: '$moderatorAbilities.deleteSettled.approversPredateDocument' }, + ], + }, + ], + }, + ], + }, + properties: { + body: { name: '$any', type: 'string', when: takenWithTheDocument }, + bodyBytes: { + name: '$any', type: 'array', byteArray: true, when: takenWithTheDocument, + }, + }, + require: { anyOf: ['body', 'bodyBytes'] }, + }, + }); + expect(properties.descriptionContractId.refersTo).to.deep.equal({ + type: 'contract', + contractRequirements: { moderation: 'elected', ownerProtected: false }, + }); + }); + + it('should refuse a description document type of 65 characters', async () => { + const raw = await rawQuestion(); + raw.descriptionDocumentType = 'a'.repeat(65); + + const error = expectJsonSchemaError(validateType('multipleChoiceProposal', raw)); + + expect(error.keyword).to.equal('maxLength'); + }); + + it('should say whether it is open', async () => { const { multipleChoiceProposal } = decisionProposalsContractDocumentsSchema; expect(multipleChoiceProposal.properties.open.type).to.equal('boolean'); + const question = await rawQuestion(); + [true, false].forEach((open) => { - const raw = rawQuestion(); - raw.open = open; + const raw = { ...question, open }; expect(validateType('multipleChoiceProposal', raw).isValid()).to.be.true(); }); }); - it('should refuse an open that is not a boolean', () => { - const raw = rawQuestion(); + it('should refuse an open that is not a boolean', async () => { + const raw = await rawQuestion(); raw.open = 'yes'; const error = expectJsonSchemaError(validateType('multipleChoiceProposal', raw)); @@ -297,9 +366,15 @@ describe('Decision Proposals Contract', () => { indices.forEach(({ unique }) => expect(unique).to.be.undefined()); }); - ['title', 'description', 'open'].forEach((property) => { - it(`should require ${property}`, () => { - const raw = rawQuestion(); + [ + 'title', + 'descriptionId', + 'descriptionContractId', + 'descriptionDocumentType', + 'open', + ].forEach((property) => { + it(`should require ${property}`, async () => { + const raw = await rawQuestion(); delete raw[property]; const error = expectJsonSchemaError(validateType('multipleChoiceProposal', raw)); @@ -309,8 +384,8 @@ describe('Decision Proposals Contract', () => { }); }); - it('should not have additional properties', () => { - const raw = rawQuestion(); + it('should not have additional properties', async () => { + const raw = await rawQuestion(); raw.choices = ['one', 'two']; const error = expectJsonSchemaError(validateType('multipleChoiceProposal', raw)); @@ -319,8 +394,8 @@ describe('Decision Proposals Contract', () => { expect(error.params.additionalProperties).to.deep.equal(['choices']); }); - it('should refuse a title of 129 characters', () => { - const raw = rawQuestion(); + it('should refuse a title of 129 characters', async () => { + const raw = await rawQuestion(); raw.title = 'a'.repeat(129); const error = expectJsonSchemaError(validateType('multipleChoiceProposal', raw)); diff --git a/packages/rs-dpp/src/data_contract/config/moderation/elected.rs b/packages/rs-dpp/src/data_contract/config/moderation/elected.rs index fc3f08ddd23..7876eae4715 100644 --- a/packages/rs-dpp/src/data_contract/config/moderation/elected.rs +++ b/packages/rs-dpp/src/data_contract/config/moderation/elected.rs @@ -99,6 +99,15 @@ pub enum ModerationAbility { } impl ModerationAbility { + /// Every ability, for what lists or names them all. A test holds it to the variants. + pub const ALL: [ModerationAbility; 5] = [ + ModerationAbility::DeleteDocuments, + ModerationAbility::Ban, + ModerationAbility::Suspend, + ModerationAbility::Warn, + ModerationAbility::ChangeDocumentFields, + ]; + /// The wire name of the ability pub fn as_str(&self) -> &'static str { match self { @@ -619,6 +628,24 @@ mod tests { ids.iter().map(|b| Identifier::from([*b; 32])).collect() } + /// `ModerationAbility::ALL` names every variant, once. The match has no wildcard arm, so + /// a new variant does not compile here until it is given its place in `ALL`. + #[test] + fn should_list_every_ability() { + let place = |ability: &ModerationAbility| match ability { + ModerationAbility::DeleteDocuments => 0, + ModerationAbility::Ban => 1, + ModerationAbility::Suspend => 2, + ModerationAbility::Warn => 3, + ModerationAbility::ChangeDocumentFields => 4, + }; + let places: Vec = ModerationAbility::ALL.iter().map(place).collect(); + assert_eq!( + places, + (0..ModerationAbility::ALL.len()).collect::>() + ); + } + /// `post`, which moderators may delete, and `like`, which they may not fn schemas() -> BTreeMap { BTreeMap::from([ diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/dynamic_reference.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/dynamic_reference.rs index 4a98bd8aebc..323b3b0c455 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/dynamic_reference.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/dynamic_reference.rs @@ -3,14 +3,17 @@ //! version 1 of `apply_property_reference` reads (protocol version 15). See //! [`DynamicDocumentReference`]. +use crate::data_contract::config::moderation::ModerationAbility; use crate::data_contract::document_type::accessors::DocumentTypeV0Getters; use crate::data_contract::document_type::property::{ DocumentPropertyType, DocumentTypeRequirements, DynamicDocumentReference, DynamicDocumentReferenceKind, PropertyReference, ReferenceHolder, RequiredPropertySlot, - SlotCondition, SlotConditionList, SlotConditionValue, SlotConditions, SlotPropertyName, - SlotRequirement, SlotRequirementTerm, SlotValue, ANY_PROPERTY_NAME, REFERRING_DOCUMENT_PREFIX, - SLOT_CONDITION_CHANGE_FIELDS, SLOT_CONDITION_DELETE_KEEPS_FIELDS, SLOT_CONDITION_KIND, - SLOT_CONDITION_PROPERTY, + SlotCondition, SlotConditionList, SlotConditionSetting, SlotConditionValue, SlotConditions, + SlotPropertyName, SlotRequirement, SlotRequirementTerm, SlotValue, ANY_PROPERTY_NAME, + REFERRING_DOCUMENT_PREFIX, SLOT_CONDITION_CHANGE_FIELDS, SLOT_CONDITION_DELETE_KEEPS_FIELDS, + SLOT_CONDITION_DELETE_SETTLED, SLOT_CONDITION_DELETE_WITHIN, SLOT_CONDITION_ELECTED_ABILITIES, + SLOT_CONDITION_KIND, SLOT_CONDITION_PROPERTY, + SLOT_CONDITION_SETTLED_APPROVERS_PREDATE_DOCUMENT, }; use crate::data_contract::document_type::{property_names, DocumentTypeRef}; use crate::data_contract::errors::DataContractError; @@ -67,6 +70,16 @@ struct SlotConditionLimits { text_length: usize, } +impl SlotConditionLimits { + fn of(platform_version: &PlatformVersion) -> Self { + let limits = &platform_version.system_limits; + Self { + nodes: usize::from(limits.max_document_type_requirement_condition_nodes), + text_length: usize::from(limits.max_document_type_requirement_condition_text_length), + } + } +} + fn refused(message: String) -> DataContractError { DataContractError::InvalidContractStructure(message) } @@ -263,10 +276,11 @@ fn parse_document_type_requirements( .map_err(|_| refused("documentTypeRequirements must be an object".to_string()))?; if let Some(key) = requirements .keys() - .find(|key| !matches!(key.as_str(), "properties" | "require")) + .find(|key| !matches!(key.as_str(), "properties" | "require" | "when")) { return Err(refused(format!( - "documentTypeRequirements does not take {key}: it holds properties and require" + "documentTypeRequirements does not take {key}: it holds properties, require and \ + when" ))); } let slot_values = requirements @@ -321,7 +335,34 @@ fn parse_document_type_requirements( .map(|value| parse_require(value, &slots)) .transpose()?; - Ok(DocumentTypeRequirements { slots, require }) + // What the type must say of itself, whatever fills the slots: the grammar of a slot's + // `when`, with no property in hand to read + let when = requirements + .get("when") + .map(|when| { + let mut nodes = 0; + let condition = parse_slot_condition( + when, + "documentTypeRequirements", + &mut nodes, + SlotConditionLimits::of(platform_version), + )?; + if condition.reads_the_property() { + return Err(refused(format!( + "documentTypeRequirements when is judged for the document type as a \ + whole and reads no \"{SLOT_CONDITION_PROPERTY}\": a condition on a property \ + belongs on the slot the property fills" + ))); + } + Ok(condition) + }) + .transpose()?; + + Ok(DocumentTypeRequirements { + slots, + require, + when, + }) } fn parse_slot( @@ -440,20 +481,13 @@ fn parse_slot( let when = slot .get("when") .map(|when| { - let limits = SlotConditionLimits { - nodes: usize::from( - platform_version - .system_limits - .max_document_type_requirement_condition_nodes, - ), - text_length: usize::from( - platform_version - .system_limits - .max_document_type_requirement_condition_text_length, - ), - }; let mut nodes = 0; - parse_slot_condition(when, &at(), &mut nodes, limits) + parse_slot_condition( + when, + &at(), + &mut nodes, + SlotConditionLimits::of(platform_version), + ) }) .transpose()?; @@ -553,7 +587,8 @@ fn parse_slot_condition( .ok_or_else(|| { refused(format!( "{at} when, and every condition inside it, is an object of one key: equal, \ - notEqual, in, notIn, contains, not, anyOf, allOf, ifThen or ifThenElse" + notEqual, in, notIn, contains, present, absent, not, anyOf, allOf, ifThen or \ + ifThenElse" )) })?; let Some((key, operand)) = condition.iter().next() else { @@ -650,15 +685,37 @@ fn parse_slot_condition( let list = match pair[0].as_text() { Some(SLOT_CONDITION_DELETE_KEEPS_FIELDS) => SlotConditionList::DeletionKeptFields, Some(SLOT_CONDITION_CHANGE_FIELDS) => SlotConditionList::ModeratorChangeableFields, + Some(SLOT_CONDITION_ELECTED_ABILITIES) => SlotConditionList::ElectedAbilities, _ => { return Err(refused(format!( - "{at} when contains looks into \"{SLOT_CONDITION_DELETE_KEEPS_FIELDS}\" \ - or \"{SLOT_CONDITION_CHANGE_FIELDS}\", got {}", + "{at} when contains looks into \"{SLOT_CONDITION_DELETE_KEEPS_FIELDS}\", \ + \"{SLOT_CONDITION_CHANGE_FIELDS}\" or \ + \"{SLOT_CONDITION_ELECTED_ABILITIES}\", got {}", pair[0] ))) } }; let needle = slot_condition_value(&pair[1], at, limits.text_length)?; + // The team's abilities are named, not properties: a constant that names one + if list == SlotConditionList::ElectedAbilities { + let names_an_ability = matches!( + &needle, + SlotConditionValue::Constant(name) + if ModerationAbility::ALL.iter().any(|ability| ability.as_str() == name) + ); + if !names_an_ability { + return Err(refused(format!( + "{at} when contains looks in \"{SLOT_CONDITION_ELECTED_ABILITIES}\" for \ + a {{ \"const\": ... }} naming an ability: {}", + ModerationAbility::ALL + .iter() + .map(ModerationAbility::as_str) + .collect::>() + .join(", ") + ))); + } + return Ok(SlotCondition::Contains(list, needle)); + } if needle == SlotConditionValue::Kind { return Err(refused(format!( "{at} when contains looks for \"{SLOT_CONDITION_PROPERTY}\" or a {{ \"const\": \ @@ -715,9 +772,30 @@ fn parse_slot_condition( .map(SlotCondition::IfThen), "ifThenElse" => parse_slot_conditions(items(3..=3, "three conditions")?, at, nodes, limits) .map(SlotCondition::IfThenElse), + "present" | "absent" => { + let setting = match operand.as_text() { + Some(SLOT_CONDITION_DELETE_WITHIN) => SlotConditionSetting::DeleteWithin, + Some(SLOT_CONDITION_DELETE_SETTLED) => SlotConditionSetting::DeleteSettled, + Some(SLOT_CONDITION_SETTLED_APPROVERS_PREDATE_DOCUMENT) => { + SlotConditionSetting::SettledApproversPredateDocument + } + _ => { + return Err(refused(format!( + "{at} when {key} tests \"{SLOT_CONDITION_DELETE_WITHIN}\", \ + \"{SLOT_CONDITION_DELETE_SETTLED}\" or \ + \"{SLOT_CONDITION_SETTLED_APPROVERS_PREDATE_DOCUMENT}\", got {operand}" + ))) + } + }; + Ok(if key == "present" { + SlotCondition::Present(setting) + } else { + SlotCondition::Absent(setting) + }) + } other => Err(refused(format!( "{at} when does not take {other}: a condition is equal, notEqual, in, notIn, \ - contains, not, anyOf, allOf, ifThen or ifThenElse" + contains, present, absent, not, anyOf, allOf, ifThen or ifThenElse" ))), } } diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/references.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/references.rs index baede1fb6bb..f2dcbeeba9a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/references.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/references.rs @@ -31,18 +31,28 @@ const DYNAMIC_TARGET_KINDS: [&str; 2] = ["permanentDocument", "moderatedDocument /// The operands a slot's `when` reads as a string, and the two lists it looks into. const SLOT_CONDITION_STRINGS: [&str; 2] = ["$kind", "$property"]; -const SLOT_CONDITION_LISTS: [&str; 2] = [ +const SLOT_CONDITION_LISTS: [&str; 3] = [ "$moderatorAbilities.deleteKeepsFields", "$moderatorAbilities.changeFields", + "$electedAbilities", +]; + +/// The settings of the referenced type a `present` or an `absent` tests. +const SLOT_CONDITION_SETTINGS: [&str; 3] = [ + "$moderatorAbilities.deleteWithin", + "$moderatorAbilities.deleteSettled", + "$moderatorAbilities.deleteSettled.approversPredateDocument", ]; /// The keys of a condition of a slot's `when`, each the one key of its object. -const SLOT_CONDITION_KEYS: [&str; 10] = [ +const SLOT_CONDITION_KEYS: [&str; 12] = [ "equal", "notEqual", "in", "notIn", "contains", + "present", + "absent", "not", "anyOf", "allOf", @@ -376,7 +386,7 @@ impl Checker<'_> { /// it uses are slots is the parser's to check. fn document_type_requirements(&self, value: &JsonValue) -> Checked { let map = self.object(value)?; - self.closed(map, &["properties", "require"])?; + self.closed(map, &["properties", "require", "when"])?; self.required(map, &["properties"])?; self.member(map, "properties", |c, properties| { let slots = c.object(properties)?; @@ -394,7 +404,10 @@ impl Checker<'_> { return c.word(require); } c.slot_combinator(require, true) - }) + })?; + // A condition on the type as a whole: that it reads no property is the parser's + // to check + self.member(map, "when", |c, when| c.slot_condition(when)) } /// One slot of `documentTypeRequirements.properties`. @@ -509,6 +522,7 @@ impl Checker<'_> { None => Ok(()), } } + "present" | "absent" => c.one_of_strings(operand, &SLOT_CONDITION_SETTINGS), "ifThen" => c.tuple(operand, 2, 2, |c, _, item| c.slot_condition(item)), "ifThenElse" => c.tuple(operand, 3, 3, |c, _, item| c.slot_condition(item)), _ => Ok(()), diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/dynamic_reference_tests.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/dynamic_reference_tests.rs index b8090fb7f6e..43cadfff01b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/dynamic_reference_tests.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/dynamic_reference_tests.rs @@ -10,7 +10,9 @@ use super::reference_test_helpers::{ use crate::consensus::basic::BasicError; use crate::consensus::ConsensusError; use crate::data_contract::accessors::v0::DataContractV0Getters; -use crate::data_contract::config::moderation::{ContractModerationConfig, ContractModerators}; +use crate::data_contract::config::moderation::{ + ContractModerationConfig, ContractModerators, ModerationAbility, +}; use crate::data_contract::config::DataContractConfig; use crate::data_contract::document_type::accessors::{ DocumentTypeV0Getters, DocumentTypeV2Getters, @@ -18,8 +20,9 @@ use crate::data_contract::document_type::accessors::{ use crate::data_contract::document_type::{ DocumentPropertyReferenceTarget, DocumentPropertyType, DocumentReferenceKind, DocumentType, DocumentTypeRequirements, DynamicDocumentReference, DynamicDocumentReferenceKind, - RequiredPropertySlot, SlotCondition, SlotConditionList, SlotConditionValue, SlotConditions, - SlotPropertyName, SlotRequirement, SlotRequirementTerm, SlotValue, + RequiredPropertySlot, SlotCondition, SlotConditionList, SlotConditionSetting, + SlotConditionValue, SlotConditions, SlotPropertyName, SlotRequirement, SlotRequirementTerm, + SlotValue, }; use crate::data_contract::DataContract; use crate::serialization::{ @@ -147,7 +150,7 @@ fn post_meets(requirements_value: serde_json::Value, body_property: Option<&str> dynamic_reference(&parsed) .requirements .expect("requirements") - .met_by(post, |referring_property| { + .met_by(post, None, |referring_property| { assert_eq!(referring_property, "bodyProperty"); body_property.map(str::to_string) }) @@ -266,6 +269,7 @@ fn should_parse_a_reference_naming_its_target_through_the_referring_document() { SlotRequirementTerm::Slot("body".to_string()), SlotRequirementTerm::Slot("bodyBytes".to_string()), ])), + when: None, }), } ); @@ -782,7 +786,7 @@ fn should_hold_a_slot_to_its_byte_bound() { dynamic_reference(&parsed) .requirements .expect("requirements") - .met_by(post, |_| None) + .met_by(post, None, |_| None) }; assert!(bounded_both_ways("code", 8)); assert!(!bounded_both_ways("code", 7)); @@ -1145,7 +1149,11 @@ fn should_refuse_a_malformed_slot_condition() { json!({ "equal": ["$property", { "const": "a" }], "not": is_body() }), "is an object of one key", ); - refused(json!({ "present": "$property" }), "does not take present"); + refused(json!({ "present": "$property" }), "when present tests"); + refused( + json!({ "startsWith": ["$property", { "const": "a" }] }), + "does not take startsWith", + ); refused( json!({ "greaterThan": ["$property", { "const": "a" }] }), "does not take greaterThan", @@ -1226,11 +1234,11 @@ fn should_refuse_a_malformed_slot_condition() { // `contains` refused( json!({ "contains": ["$property", "$property"] }), - "contains looks into \"$moderatorAbilities.deleteKeepsFields\" or", + "contains looks into \"$moderatorAbilities.deleteKeepsFields\",", ); refused( json!({ "contains": ["$moderatorAbilities.delete", "$property"] }), - "contains looks into \"$moderatorAbilities.deleteKeepsFields\" or", + "contains looks into \"$moderatorAbilities.deleteKeepsFields\",", ); refused( json!({ "contains": ["$moderatorAbilities.changeFields", "$kind"] }), @@ -1372,7 +1380,7 @@ fn should_ask_of_a_moderated_type_what_it_does_not_ask_of_a_permanent_one() { .expect("requirements") }; let met = |name: serde_json::Value, post: &DocumentType| { - slot_requirements(name).met_by(post.as_ref(), |_| None) + slot_requirements(name).met_by(post.as_ref(), None, |_| None) }; // Moderators delete posts, the removal record keeping `tags`, and they alone write @@ -1985,3 +1993,173 @@ fn should_count_the_comparisons_judging_a_type_takes() { } })); assert_eq!(comparisons, properties * (1 + 4) + (1 + 2)); } + +/// The requirements may carry a `when` of their own, judged once for the named type as a +/// whole: the grammar of a slot's `when` with no property to read, over what the type's +/// contract lets its elected team do on it (`$electedAbilities`) and the settings the type +/// declares (`present`, `absent`). +#[test] +fn should_parse_a_condition_on_the_type_as_a_whole() { + let removable = || { + json!({ "allOf": [ + { "contains": ["$electedAbilities", { "const": "deleteDocuments" }] }, + { "anyOf": [ + { "absent": "$moderatorAbilities.deleteWithin" }, + { "allOf": [ + { "present": "$moderatorAbilities.deleteSettled" }, + { "absent": "$moderatorAbilities.deleteSettled.approversPredateDocument" } + ] } + ] } + ] }) + }; + let with_when = |when: serde_json::Value| { + json!({ + "when": when, + "properties": { "body": { "name": "$any", "type": "string" } } + }) + }; + let parsed = requirements(with_when(removable())); + assert_eq!( + parsed.when, + Some(SlotCondition::AllOf(SlotConditions::new(vec![ + SlotCondition::Contains( + SlotConditionList::ElectedAbilities, + SlotConditionValue::Constant("deleteDocuments".to_string()) + ), + SlotCondition::AnyOf(SlotConditions::new(vec![ + SlotCondition::Absent(SlotConditionSetting::DeleteWithin), + SlotCondition::AllOf(SlotConditions::new(vec![ + SlotCondition::Present(SlotConditionSetting::DeleteSettled), + SlotCondition::Absent(SlotConditionSetting::SettledApproversPredateDocument), + ])), + ])), + ]))) + ); + // Written back as declared, which parses to the same requirements + let written = parsed + .to_schema_value() + .try_into_validating_json() + .expect("the schema value converts to JSON"); + assert_eq!(written, with_when(removable())); + assert_eq!(requirements(written), parsed); + // and it survives the platform serialization of its contract + let platform_version = PlatformVersion::latest(); + let original = contract(note_contract(requiring(with_when(removable())))).expect("parses"); + let bytes = original + .serialize_to_bytes_with_platform_version(platform_version) + .expect("the contract should serialize"); + let recovered = DataContract::versioned_deserialize_untrusted(&bytes, false, platform_version) + .expect("the contract should deserialize"); + assert_eq!(dynamic_reference(&original), dynamic_reference(&recovered)); + + // The same facts are a slot's to read too, beside the property + requirements(json!({ "properties": { "body": { + "name": "$any", + "type": "string", + "when": { "ifThen": [ + { "present": "$moderatorAbilities.deleteWithin" }, + { "notEqual": ["$property", { "const": "title" }] } + ] } + } } })); + + let refused = |when: serde_json::Value, fragment: &str| { + assert_refused_by_the_parser(note_contract(requiring(with_when(when))), fragment); + }; + // No property is in hand for the type as a whole + refused( + json!({ "notEqual": ["$property", { "const": "title" }] }), + "is judged for the document type as a whole and reads no \"$property\"", + ); + refused( + json!({ "anyOf": [ + removable(), + { "not": { "contains": ["$moderatorAbilities.changeFields", "$property"] } } + ] }), + "is judged for the document type as a whole and reads no \"$property\"", + ); + // An ability is one a contract can give, named by a constant + refused( + json!({ "contains": ["$electedAbilities", { "const": "delete" }] }), + "for a { \"const\": ... } naming an ability: deleteDocuments, ban, suspend, warn, \ + changeDocumentFields", + ); + refused( + json!({ "contains": ["$electedAbilities", "$kind"] }), + "naming an ability", + ); + // and a setting is one of those that say how long a document stays deletable + refused( + json!({ "absent": "$moderatorAbilities.delete" }), + "when absent tests \"$moderatorAbilities.deleteWithin\", \ + \"$moderatorAbilities.deleteSettled\" or \ + \"$moderatorAbilities.deleteSettled.approversPredateDocument\"", + ); + refused( + json!({ "absent": "$moderatorAbilities.deleteSettled.approvals" }), + "when absent tests", + ); + refused( + json!({ "present": ["$moderatorAbilities.deleteWithin"] }), + "when present tests", + ); + // It is held to the limits of a slot's + let max_nodes = usize::from( + platform_version + .system_limits + .max_document_type_requirement_condition_nodes, + ); + refused( + json!({ "anyOf": (0..max_nodes) + .map(|index| json!({ "notEqual": ["$kind", { "const": if index % 2 == 0 { "permanentDocument" } else { "moderatedDocument" } }] })) + .collect::>() }), + &format!("documentTypeRequirements when is made of more than {max_nodes} conditions"), + ); + refused( + json!({ "in": ["$kind", ["permanentDocument", "moderatedDocument"]], "extra": 1 }), + "is an object of one key", + ); +} + +/// A type meets a condition on it by what its contract and its own moderation say: the +/// elected team's abilities come from the contract, the window and the settled deletion +/// from the type. The judging counts the condition's nodes once. +#[test] +fn should_judge_the_named_type_by_its_moderation() { + let parsed = requirements(json!({ + "when": { "allOf": [ + { "contains": ["$electedAbilities", { "const": "deleteDocuments" }] }, + { "absent": "$moderatorAbilities.deleteWithin" } + ] }, + "properties": { "body": { "name": "$any", "type": "string" } } + })); + let deleting = BTreeSet::from([ModerationAbility::DeleteDocuments]); + let banning = BTreeSet::from([ModerationAbility::Ban, ModerationAbility::Suspend]); + let met = |post: &DocumentType, abilities: Option<&BTreeSet>| { + parsed.met_by(post.as_ref(), abilities, |_| None) + }; + + // Moderators delete posts, at any time + let durable = moderated_post(json!({ + "canBeDeleted": false, + "moderatorAbilities": { "delete": true } + })); + assert!(met(&durable, Some(&deleting))); + // The contract elects no team, leaves the type out, or gives the team other abilities + assert!(!met(&durable, None)); + assert!(!met(&durable, Some(&BTreeSet::new()))); + assert!(!met(&durable, Some(&banning))); + + // Moderators delete posts for an hour after their last change, and nobody after + let windowed = moderated_post(json!({ + "canBeDeleted": false, + "required": ["$createdAt", "$updatedAt"], + "moderatorAbilities": { "delete": true, "deleteWithin": 3600 } + })); + assert!(windowed + .documents_can_be_deleted_by_moderators_for() + .is_some()); + assert!(!met(&windowed, Some(&deleting))); + + // Three string properties tried for the slot, and the three nodes of the condition + assert_eq!(parsed.comparisons(durable.as_ref()), 3 + 3); +} diff --git a/packages/rs-dpp/src/data_contract/document_type/property/dynamic_document_reference.rs b/packages/rs-dpp/src/data_contract/document_type/property/dynamic_document_reference.rs index 1c94b5fae08..ce20eab3063 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/dynamic_document_reference.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/dynamic_document_reference.rs @@ -37,6 +37,7 @@ //! carry a `when` ([`SlotCondition`]) telling the two apart, so that it asks of a moderated //! type what it does not ask of a permanent one. +use crate::data_contract::config::moderation::ModerationAbility; use crate::data_contract::document_type::accessors::{ DocumentTypeV0Getters, DocumentTypeV2Getters, }; @@ -170,6 +171,10 @@ pub struct DocumentTypeRequirements { pub slots: BTreeMap, /// Which slots must be filled (`require`); `None` means every one of them. pub require: Option, + /// What the referenced type must say of itself, whatever fills the slots (`when`): a + /// [`SlotCondition`] that reads no `$property`. A type it does not hold for does not + /// meet the requirements. `None` asks nothing. + pub when: Option, } /// One slot of a [`DocumentTypeRequirements`]. @@ -419,6 +424,9 @@ impl DocumentTypeRequirements { if let Some(require) = &self.require { members.push(("require", require.to_schema_value())); } + if let Some(when) = &self.when { + members.push(("when", when.to_schema_value())); + } schema_object(members) } @@ -438,10 +446,15 @@ impl DocumentTypeRequirements { /// the slot's description, and one more for each node of the slot's `when` /// ([`SlotCondition::node_count`]), whether or not the description admits it: the /// count depends on the declaration and the size of the type alone, not on what the - /// type's properties are. The search for an assignment that follows is over at most + /// type's properties are. The requirements' own `when`, judged once for the type, adds + /// its nodes. The search for an assignment that follows is over at most /// `max_document_type_requirement_slots` slots and is not counted. pub fn comparisons(&self, document_type: DocumentTypeRef) -> u64 { let properties = document_type.properties().len() as u64; + let of_the_type = self + .when + .as_ref() + .map_or(0, |when| when.node_count() as u64); self.slots .values() .map(|slot| { @@ -456,7 +469,7 @@ impl DocumentTypeRequirements { .saturating_add(1); tried.saturating_mul(per_property) }) - .fold(0u64, u64::saturating_add) + .fold(of_the_type, u64::saturating_add) } /// Whether `document_type` meets the requirements. @@ -475,15 +488,48 @@ impl DocumentTypeRequirements { /// candidates between them than slots, so with the number of slots held to /// `max_document_type_requirement_slots` the search stays small whatever the type /// declares. + /// + /// `elected_abilities` are the abilities the type's contract gives its elected + /// moderation team on the type (`ElectedModerators::moderated_document_types`), `None` + /// when the contract elects no team or leaves the type out: what `$electedAbilities` + /// reads. The requirements' own `when` is judged first, for the type as a whole. pub fn met_by( &self, document_type: DocumentTypeRef, + elected_abilities: Option<&BTreeSet>, name_from_property: impl Fn(&str) -> Option, ) -> bool { let properties = document_type.properties(); let kind = document_type.document_reference_kind(); let deletion_kept_fields = document_type.moderator_deletion_kept_fields(); let moderator_changeable_fields = document_type.moderator_changeable_fields(); + let elected_abilities: BTreeSet = elected_abilities + .into_iter() + .flatten() + .map(|ability| ability.as_str().to_string()) + .collect(); + let settled_deletion = document_type.moderator_settled_deletion(); + // The type as a whole: no property is in hand, and its condition reads none + let of_the_type = SlotConditionSubject { + kind, + property_name: "", + deletion_kept_fields, + moderator_changeable_fields, + elected_abilities: &elected_abilities, + deletion_window: document_type + .documents_can_be_deleted_by_moderators_for() + .is_some(), + settled_deletion: settled_deletion.is_some(), + settled_approvers_predate_document: settled_deletion + .is_some_and(|rule| rule.approvers_predate_document), + }; + if self + .when + .as_ref() + .is_some_and(|when| !when.holds(&of_the_type)) + { + return false; + } let slots: Vec<(&str, &RequiredPropertySlot, Vec<&str>)> = self .slots .iter() @@ -492,10 +538,8 @@ impl DocumentTypeRequirements { slot.admits(property) && slot.when.as_ref().is_none_or(|when| { when.holds(&SlotConditionSubject { - kind, property_name: name, - deletion_kept_fields, - moderator_changeable_fields, + ..of_the_type }) }) }; diff --git a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs index fbcfb6a7b19..b876600827a 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs @@ -78,9 +78,12 @@ pub use reference_where::{ WhereOrdering, WhereOrderingBound, }; pub use slot_condition::{ - SlotCondition, SlotConditionList, SlotConditionSubject, SlotConditionValue, SlotConditions, - MAX_SLOT_CONDITION_DECODE_DEPTH, SLOT_CONDITION_CHANGE_FIELDS, - SLOT_CONDITION_DELETE_KEEPS_FIELDS, SLOT_CONDITION_KIND, SLOT_CONDITION_PROPERTY, + SlotCondition, SlotConditionList, SlotConditionSetting, SlotConditionSubject, + SlotConditionValue, SlotConditions, MAX_SLOT_CONDITION_DECODE_DEPTH, + SLOT_CONDITION_CHANGE_FIELDS, SLOT_CONDITION_DELETE_KEEPS_FIELDS, + SLOT_CONDITION_DELETE_SETTLED, SLOT_CONDITION_DELETE_WITHIN, SLOT_CONDITION_ELECTED_ABILITIES, + SLOT_CONDITION_KIND, SLOT_CONDITION_PROPERTY, + SLOT_CONDITION_SETTLED_APPROVERS_PREDATE_DOCUMENT, }; #[cfg(test)] diff --git a/packages/rs-dpp/src/data_contract/document_type/property/slot_condition.rs b/packages/rs-dpp/src/data_contract/document_type/property/slot_condition.rs index 369ac0c2910..b93e5c104b4 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/slot_condition.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/slot_condition.rs @@ -47,6 +47,19 @@ pub const SLOT_CONDITION_PROPERTY: &str = "$property"; pub const SLOT_CONDITION_DELETE_KEEPS_FIELDS: &str = "$moderatorAbilities.deleteKeepsFields"; /// The operand reading the referenced type's `moderatorAbilities.changeFields`. pub const SLOT_CONDITION_CHANGE_FIELDS: &str = "$moderatorAbilities.changeFields"; +/// The operand reading the abilities the referenced type's contract gives its elected +/// moderation team on the type. +pub const SLOT_CONDITION_ELECTED_ABILITIES: &str = "$electedAbilities"; +/// The operand a `present` or an `absent` tests for the referenced type's +/// `moderatorAbilities.deleteWithin`. +pub const SLOT_CONDITION_DELETE_WITHIN: &str = "$moderatorAbilities.deleteWithin"; +/// The operand a `present` or an `absent` tests for the referenced type's +/// `moderatorAbilities.deleteSettled`. +pub const SLOT_CONDITION_DELETE_SETTLED: &str = "$moderatorAbilities.deleteSettled"; +/// The operand a `present` or an `absent` tests for the `approversPredateDocument` of the +/// referenced type's `moderatorAbilities.deleteSettled`. +pub const SLOT_CONDITION_SETTLED_APPROVERS_PREDATE_DOCUMENT: &str = + "$moderatorAbilities.deleteSettled.approversPredateDocument"; /// The deepest a decoder accepts conditions inside one another. It only keeps crafted bytes /// from driving the decoder, and the evaluation of what it decodes, into unbounded @@ -77,6 +90,41 @@ pub enum SlotConditionList { DeletionKeptFields, /// `$moderatorAbilities.changeFields`: what only moderators write. ModeratorChangeableFields, + /// `$electedAbilities`: the abilities the type's contract gives its elected moderation + /// team on the type, by their names (`deleteDocuments`, `changeDocumentFields`, ...). + /// Empty when the contract elects no team, or leaves the type out of what the team + /// moderates. + ElectedAbilities, +} + +/// A setting of the referenced type a `present` or an `absent` tests. +#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Encode, Decode, DecodeUntrusted)] +pub enum SlotConditionSetting { + /// `$moderatorAbilities.deleteWithin`: the type gives moderators a window after a + /// document's last change to delete it in. + DeleteWithin, + /// `$moderatorAbilities.deleteSettled`: the type says who of a seated team may delete a + /// document past that window. + DeleteSettled, + /// `$moderatorAbilities.deleteSettled.approversPredateDocument`: that rule counts a member + /// the team's leader added only for documents created after its addition, as the rule + /// reads once its default is applied (set unless one approval meets it). A document + /// older than the members it would take is then never deleted once settled. Absent on a + /// type with no such rule. + SettledApproversPredateDocument, +} + +impl SlotConditionSetting { + /// The operand the setting is written as. + pub const fn wire_name(self) -> &'static str { + match self { + SlotConditionSetting::DeleteWithin => SLOT_CONDITION_DELETE_WITHIN, + SlotConditionSetting::DeleteSettled => SLOT_CONDITION_DELETE_SETTLED, + SlotConditionSetting::SettledApproversPredateDocument => { + SLOT_CONDITION_SETTLED_APPROVERS_PREDATE_DOCUMENT + } + } + } } impl SlotConditionList { @@ -85,6 +133,7 @@ impl SlotConditionList { match self { SlotConditionList::DeletionKeptFields => SLOT_CONDITION_DELETE_KEEPS_FIELDS, SlotConditionList::ModeratorChangeableFields => SLOT_CONDITION_CHANGE_FIELDS, + SlotConditionList::ElectedAbilities => SLOT_CONDITION_ELECTED_ABILITIES, } } } @@ -113,6 +162,10 @@ pub enum SlotCondition { /// `ifThenElse`: three conditions; the second holds when the first does, the third /// when it does not. IfThenElse(SlotConditions), + /// `present`: the type declares the setting. + Present(SlotConditionSetting), + /// `absent`: the type does not declare the setting. + Absent(SlotConditionSetting), } /// What a slot condition is judged against: the referenced document type, and the one of @@ -127,6 +180,28 @@ pub struct SlotConditionSubject<'a> { pub deletion_kept_fields: &'a BTreeSet, /// The referenced type's `moderatorAbilities.changeFields`. pub moderator_changeable_fields: &'a BTreeSet, + /// The abilities the referenced type's contract gives its elected team on the type, by + /// name; empty when it elects none or leaves the type out. + pub elected_abilities: &'a BTreeSet, + /// Whether the referenced type declares `moderatorAbilities.deleteWithin`. + pub deletion_window: bool, + /// Whether the referenced type declares `moderatorAbilities.deleteSettled`. + pub settled_deletion: bool, + /// Whether that rule counts a member the leader added only for documents created after + /// its addition (`approversPredateDocument`, its default applied). + pub settled_approvers_predate_document: bool, +} + +impl SlotConditionSubject<'_> { + fn declares(&self, setting: SlotConditionSetting) -> bool { + match setting { + SlotConditionSetting::DeleteWithin => self.deletion_window, + SlotConditionSetting::DeleteSettled => self.settled_deletion, + SlotConditionSetting::SettledApproversPredateDocument => { + self.settled_approvers_predate_document + } + } + } } impl SlotConditionValue { @@ -205,6 +280,12 @@ impl SlotCondition { SlotCondition::AllOf(conditions) => ("allOf", listed(conditions)), SlotCondition::IfThen(conditions) => ("ifThen", listed(conditions)), SlotCondition::IfThenElse(conditions) => ("ifThenElse", listed(conditions)), + SlotCondition::Present(setting) => { + ("present", Value::Text(setting.wire_name().to_string())) + } + SlotCondition::Absent(setting) => { + ("absent", Value::Text(setting.wire_name().to_string())) + } }; Value::Map(vec![(Value::Text(key.to_string()), operand)]) } @@ -225,6 +306,7 @@ impl SlotCondition { SlotConditionList::ModeratorChangeableFields => { subject.moderator_changeable_fields } + SlotConditionList::ElectedAbilities => subject.elected_abilities, }; list.contains(value.read(subject)) } @@ -254,6 +336,31 @@ impl SlotCondition { } _ => false, }, + SlotCondition::Present(setting) => subject.declares(*setting), + SlotCondition::Absent(setting) => !subject.declares(*setting), + } + } + + /// Whether the condition, or one inside it, reads `$property`: a condition on the type + /// as a whole, which has no property in hand, reads none. + pub fn reads_the_property(&self) -> bool { + let reads = |value: &SlotConditionValue| *value == SlotConditionValue::PropertyName; + match self { + SlotCondition::Equal(left, right) | SlotCondition::NotEqual(left, right) => { + reads(left) || reads(right) + } + SlotCondition::In(value, _) + | SlotCondition::NotIn(value, _) + | SlotCondition::Contains(_, value) => reads(value), + SlotCondition::Not(conditions) + | SlotCondition::AnyOf(conditions) + | SlotCondition::AllOf(conditions) + | SlotCondition::IfThen(conditions) + | SlotCondition::IfThenElse(conditions) => conditions + .conditions() + .iter() + .any(SlotCondition::reads_the_property), + SlotCondition::Present(_) | SlotCondition::Absent(_) => false, } } @@ -265,7 +372,9 @@ impl SlotCondition { match self { SlotCondition::Equal(..) | SlotCondition::NotEqual(..) - | SlotCondition::Contains(..) => 1, + | SlotCondition::Contains(..) + | SlotCondition::Present(_) + | SlotCondition::Absent(_) => 1, SlotCondition::In(_, values) | SlotCondition::NotIn(_, values) => { values.len().saturating_add(1) } @@ -431,6 +540,10 @@ mod tests { property_name, deletion_kept_fields: kept, moderator_changeable_fields: changeable, + elected_abilities: &none, + deletion_window: false, + settled_deletion: false, + settled_approvers_predate_document: false, }) }; @@ -464,6 +577,10 @@ mod tests { property_name: "body", deletion_kept_fields: &empty, moderator_changeable_fields: &empty, + elected_abilities: &empty, + deletion_window: false, + settled_deletion: false, + settled_approvers_predate_document: false, }; let name_is = |name: &str| { SlotCondition::Equal( @@ -525,6 +642,78 @@ mod tests { ); } + /// A condition on the type as a whole: what its contract lets the elected team do on + /// it, and which settings it declares. "The team may delete its documents, and a + /// document stays deletable": no window, or a rule for deleting past it that counts + /// every member of the team for every document. + #[test] + fn should_judge_a_type_by_what_its_moderation_says_of_it() { + let condition = SlotCondition::AllOf(SlotConditions::new(vec![ + SlotCondition::Contains( + SlotConditionList::ElectedAbilities, + SlotConditionValue::Constant("deleteDocuments".to_string()), + ), + SlotCondition::AnyOf(SlotConditions::new(vec![ + SlotCondition::Absent(SlotConditionSetting::DeleteWithin), + SlotCondition::AllOf(SlotConditions::new(vec![ + SlotCondition::Present(SlotConditionSetting::DeleteSettled), + SlotCondition::Absent(SlotConditionSetting::SettledApproversPredateDocument), + ])), + ])), + ])); + assert_eq!(condition.node_count(), 7); + assert!(!condition.reads_the_property()); + assert!(removed_with_the_document().reads_the_property()); + + let empty = BTreeSet::new(); + let holds = |abilities: &[&str], deletion_window, settled_deletion, approvers_predate| { + condition.holds(&SlotConditionSubject { + kind: DocumentReferenceKind::Moderated, + property_name: "", + deletion_kept_fields: &empty, + moderator_changeable_fields: &empty, + elected_abilities: &kept(abilities), + deletion_window, + settled_deletion, + settled_approvers_predate_document: approvers_predate, + }) + }; + assert!(holds(&["deleteDocuments"], false, false, false)); + assert!(holds(&["ban", "deleteDocuments"], true, true, false)); + // The team does not delete documents of the type + assert!(!holds(&[], false, false, false)); + assert!(!holds(&["changeDocumentFields"], false, false, false)); + // A window with nobody to delete past it + assert!(!holds(&["deleteDocuments"], true, false, false)); + // A window, and a rule past it under which members added after a document do not + // count for it: a document older than the members it would take stays for good + assert!(!holds(&["deleteDocuments"], true, true, true)); + + // Written back as declared, and decoded as encoded + assert_eq!( + condition + .to_schema_value() + .try_into_validating_json() + .expect("converts"), + serde_json::json!({ "allOf": [ + { "contains": ["$electedAbilities", { "const": "deleteDocuments" }] }, + { "anyOf": [ + { "absent": "$moderatorAbilities.deleteWithin" }, + { "allOf": [ + { "present": "$moderatorAbilities.deleteSettled" }, + { "absent": + "$moderatorAbilities.deleteSettled.approversPredateDocument" } + ] } + ] } + ] }) + ); + let bytes = + bincode::encode_to_vec(&condition, bincode::config::standard()).expect("encodes"); + for decoded in decode_every_way(&bytes) { + assert_eq!(decoded.expect("decodes"), condition); + } + } + #[test] fn should_round_trip_through_every_decoder() { let condition = removed_with_the_document(); diff --git a/packages/rs-dpp/src/errors/consensus/state/document/referenced_entity_not_found_error.rs b/packages/rs-dpp/src/errors/consensus/state/document/referenced_entity_not_found_error.rs index 3e7a4860c97..d121cef7aa1 100644 --- a/packages/rs-dpp/src/errors/consensus/state/document/referenced_entity_not_found_error.rs +++ b/packages/rs-dpp/src/errors/consensus/state/document/referenced_entity_not_found_error.rs @@ -125,6 +125,7 @@ mod tests { }) .collect(), )), + when: None, }), } } diff --git a/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl b/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl index 791fc5c583e..bca76fdb3f4 100644 --- a/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl +++ b/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl @@ -8,7 +8,7 @@ {"contract":"system DocumentHistory","sha256":"60a6904648adf2f98aa4a806e6279112fc5460f47bf529c916b0ef2dbf083cfd","indexStructures":"9f16f37fbeb19d500ad6b3ec489e45d2d3fcea730b99baf57b3e397b96fd2dd3","bytes":"AlgSjNCz5/I54csE0vVfiFygp3B2re5TPurm3hDnHmNiAgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwtwcmljZVVwZGF0ZRYKEgR0eXBlEgZvYmplY3QSCCRjb21tZW50EshUaW1lLXJhbmdlIGFnZ3JlZ2F0ZXMgb3ZlciB0aGVzZSByZWNvcmRzIGFyZSB3ZWlnaHRlZCBieSBsaXN0aW5nIGV2ZW50czogYSBkb2N1bWVudCByZWxpc3RlZCBOIHRpbWVzIGluIHRoZSB3aW5kb3cgY29udHJpYnV0ZXMgTiByZWNvcmRzLiBUaGV5IGFyZSBhY3Rpdml0eS13ZWlnaHRlZCBhdm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AAAAAAAAAAAAAAAAAAAAAAAAIAzwABAAIAAAEBBA5kYXRhQ29udHJhY3RJZAABAAMAAAABAAABIAEgAAEAAAAQZG9jdW1lbnRUeXBlTmFtZQABAAUAAAAAAQABQAAAAAAKZG9jdW1lbnRJZAABAAMAAAABAAABIAEgAAEAAAAMdG9JZGVudGl0eUlkAAEAAwAAAAEAAAEgASAAAQAAAAEAAQQOZGF0YUNvbnRyYWN0SWQQZG9jdW1lbnRUeXBlTmFtZQpkb2N1bWVudElkDHRvSWRlbnRpdHlJZAAAAAAAAAAAAA=="} {"contract":"system AppConnect","sha256":"4d6dd642c6f74fe2fcfd04696bd8d58b8ca418586619301b235fe7729f73c09a","indexStructures":"05f449543911990d081569c8124f9fbb312a5d3dcbbe045d6f7dfb0a14dd8da4","bytes":"Au+WDqVpcuutvviifvfaXIH/S7OKApaXRX4k2kK3m1S3AgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARBsb2dpbktleVJlc3BvbnNlFgsSBHR5cGUSBm9iamVjdBIQZG9jdW1lbnRzTXV0YWJsZRMAEgxjYW5CZURlbGV0ZWQTARIXY3JlYXRpb25SZXN0cmljdGlvbk1vZGUCABIHaW5kaWNlcxUBFgISBG5hbWUSCWJ5UmVxdWVzdBIIdGVybWluYWwVAhIWYXBwRXBoZW1lcmFsUHViS2V5SGFzaBIIJG93bmVySWQSCnByb3BlcnRpZXMWAxIWYXBwRXBoZW1lcmFsUHViS2V5SGFzaBYGEgR0eXBlEgVhcnJheRIJYnl0ZUFycmF5EwESCG1pbkl0ZW1zAhQSCG1heEl0ZW1zAhQSC2Rlc2NyaXB0aW9uEl5oYXNoMTYwIG9mIHRoZSBlcGhlbWVyYWwgcHVibGljIGtleSB0aGUgYXBwIHB1dCBpbiBpdHMgY29ubmVjdCByZXF1ZXN0OyBpZGVudGlmaWVzIHRoZSByZXF1ZXN0Eghwb3NpdGlvbgIAEhV3YWxsZXRFcGhlbWVyYWx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hlbWVyYWxQdWJLZXlIYXNoFXdhbGxldEVwaGVtZXJhbFB1YktleRBlbmNyeXB0ZWRQYXlsb2FkAAAAAAAAAAAA"} {"contract":"system ModerationCharters","sha256":"08e879d58b351ca5dbb3beb72f0c2905679a24233c4aef7682a5cf4d7bae24cb","indexStructures":"959daf512c8055ab2f16c63e84b5ca8cbf1fba87c461bbc30279be340c74ad35","bytes":"AsUG5khqxlKB/YcrVrm2EXCkf2AFa7mcLg4Kbe1N5PiBAgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABw5hZGRlZE1vZGVyYXRvchYIEgR0eXBlEgZvYmplY3QSEGRvY3VtZW50c011dGFibGUTABIMY2FuQmVEZWxldGVkEwESB2luZGljZXMVARYDEgRuYW1lEhZieUVsZWN0ZWRDaGFydGVyTWVtYmVyEgpwcm9wZXJ0aWVzFQIWARIQZWxlY3RlZENoYXJ0ZXJJZBIDYXNjFgESCG1lbWJlcklkEgNhc2MSBnVuaXF1ZRMBEgpwcm9wZXJ0aWVzFgMSEGVsZWN0ZWRDaGFydGVySWQWCBIEdHlwZRIFYXJyYXkSCWJ5dGVBcnJheRMBEghtaW5JdGVtcwIgEghtYXhJdGVtcwIgEhBjb250ZW50TWVkaWFUeXBlEiFhcHBsaWNhdGlvbi94LmRhc2guZHBwLmlkZW50aWZpZXISCHJlZmVyc1RvFgMSBHR5cGUSEXBlcm1hbmVudERvY3VtZW50Egxkb2N1bWVudFR5cGUSDmVsZWN0ZWRDaGFydGVyEgV3aGVyZRYCEggkb3duZXJJZBIIJG93bmVySWQSEnN1Ym1pdHRlZENoYXJ0ZXJJZBISc3VibWl0dGVkQ2hhcnRlcklkEgtkZXNjcmlwdGlvbhIrVGhlIHNlYXRlZCBjaGFydGVyOyBvbmx5IGl0cyBsZWFkZXIgbWF5IGFkZBIIcG9zaXRpb24CABISc3VibWl0dGVkQ2hhcnRlcklkFgYSBHR5cGUSBWFycmF5EglieXRlQXJyYX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lvbgdyZWFzb25zC3Jld2FyZFNwbGl0E3Jld2FyZFNwbGl0LmFjdGlvbnMRcmV3YXJkU3BsaXQuZXF1YWwScmV3YXJkU3BsaXQubGVhZGVyEHRhcmdldENvbnRyYWN0SWQAAAAAAAAAAAAAAAAAAAAAAQECAAAAAAAAAAAAAAAAAAAAAAAAAAAAARJyZXdhcmRTcGxpdElzV2hvbGUAAAYDARJyZXdhcmRTcGxpdC5sZWFkZXIAARFyZXdhcmRTcGxpdC5lcXVhbAABE3Jld2FyZFNwbGl0LmFjdGlvbnMAAMgAAAACAPsBZgABAAIAAAEBBRB0YXJnZXRDb250cmFjdElkAAEAAwAAAAEAAAEgASAAAQAAAAtkZXNjcmlwdGlvbgABAAUAAAAAAQEBAfsQAAH7EAAAAAAHcmVhc29ucwABAAMAAAABAQABAAMAAAABAAABIAEgAAEAAAAAAQABQAEBAAAAAA9tb2RlcmF0b3JzU2hhcmUAAQAGAAAAAAABAQIAAQJkAAAAAAtyZXdhcmRTcGxpdAABAAIAAAEBAwZsZWFkZXIAAQAGAAAAAAABAQIAAQJkAAAAAAVlcXVhbAABAAYAAAAAAAEBAgABAmQAAAAAB2FjdGlvbnMAAQAGAAAAAAABAQIAAQJkAAAAAAEAAQMGbGVhZGVyBWVxdWFsB2FjdGlvbnMAAAAAAAAAAQABBBB0YXJnZXRDb250cmFjdElkC2Rlc2NyaXB0aW9uB3JlYXNvbnMLcmV3YXJkU3BsaXQAAAAAAAAAAAA="} -{"contract":"system DecisionProposals","sha256":"f3004fbae4af50ccbb0ab93ac213ec22c6b807fcb85da9c0fd71106d2075bee7","indexStructures":"0b3ce0e20cde7b45a89351adea5ee84da634ab0b36268c00891c7917a5969bc8","bytes":"AihRCgKmaz7aBrhvyubaqp21d2bTw3JcyFpYzR6uMcvIAgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZjaG9pY2UWCRIEdHlwZRIGb2JqZWN0EhBkb2N1bWVudHN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CiRjcmVhdGVkQXQBAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAdieU93bmVyB2J5T3duZXICCCRvd25lcklkAQokY3JlYXRlZEF0AQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHCiRjcmVhdGVkQXQKJHVwZGF0ZWRBdAtkZXNjcmlwdGlvbgdlbmREYXRlFW1pbmltdW1UdXJub3V0UGVyY2VudAtwYXNzUGVyY2VudAV0aXRsZQADB2VuZERhdGUVbWluaW11bVR1cm5vdXRQZXJjZW50C3Bhc3NQZXJjZW50AwtkZXNjcmlwdGlvbgAECAUAAQAFAAAADAIA/ApMuAAJCAEHZW5kRGF0ZQAFAAAAAAoFdGl0bGUABAgFAAEABQAAAAwCAPwKTLgACQgBB2VuZERhdGUABQAAAAAKA3VybAAECAUAAQAFAAAADAIA/ApMuAAJCAEHZW5kRGF0ZQAFAAAAAAoAAAEAAAABAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgD7AQ8AAQACAAABAQYFdGl0bGUAAQAFAAAAAAEBAQGAAfsCAAAAAAtkZXNjcmlwdGlvbgABAAUAAAAAAQEBAfsQAAH7EAAAAAADdXJsAAEABQAAAAABAQEB+wIAAfsCAAAAAQEJAAtwYXNzUGVyY2VudAABAAYAAAAAAAEBAjIBAlAAAAAAFW1pbmltdW1UdXJub3V0UGVyY2VudAABAAYAAAAAAAEBAgABAjIAAAAAB2VuZERhdGUAAQAGAAAAAAABAQIAAAAAAAABAAEFBXRpdGxlC2Rlc2NyaXB0aW9uC3Bhc3NQZXJjZW50FW1pbmltdW1UdXJub3V0UGVyY2VudAdlbmREYXRlAAAAAAAAAAAA"} +{"contract":"system DecisionProposals","sha256":"a12c600de9a6a2b249c967c408207f82ae95df41e1900a1fd40a9a8ffbda03fd","indexStructures":"0b3ce0e20cde7b45a89351adea5ee84da634ab0b36268c00891c7917a5969bc8","bytes":"AihRCgKmaz7aBrhvyubaqp21d2bTw3JcyFpYzR6uMcvIAgAAA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4AAkIAQdlbmREYXRlAAUAAAAACgN1cmwABAgFAAEABQAAAAwCAPwKTLgACQgBB2VuZERhdGUABQAAAAAKAAABAAAAAQAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA+wEPAAEAAgAAAQEGBXRpdGxlAAEABQAAAAABAQEBgAH7AgAAAAALZGVzY3JpcHRpb24AAQAFAAAAAAEBAQH7EAAB+xAAAAAAA3VybAABAAUAAAAAAQEBAfsCAAH7AgAAAAEBCQALcGFzc1BlcmNlbnQAAQAGAAAAAAABAQIyAQJQAAAAABVtaW5pbXVtVHVybm91dFBlcmNlbnQAAQAGAAAAAAABAQIAAQIyAAAAAAdlbmREYXRlAAEABgAAAAAAAQECAAAAAAAAAQABBQV0aXRsZQtkZXNjcmlwdGlvbgtwYXNzUGVyY2VudBVtaW5pbXVtVHVybm91dFBlcmNlbnQHZW5kRGF0ZQAAAAAAAAAAAA=="} {"contract":"system TokenMarket","sha256":"a76774b65159a4ff93874a556e72cd29a7d7d3aa35fcd972e76e3b2e85cf2d0e","indexStructures":"8ff1e8772d7b8e32e036dc6ef3324be80c0bd02177c35fac5f18419a6926d279","bytes":"AokUfSEJcaCMnscCt0vmRybVw0ENgSAKW+J05qRNZQCTAgAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgNhc2sWBxIEdHlwZRIGb2JqZWN0EgtkZXNjcmlwdGlvbhK5VG9rZW5zIGEgaG9sZGVyIG9mZmVycyBmb3Igc2FsZSBhdCBhIHByaWNlLiBXcml0dGVuIG9ubHkgYnkgdGhlIHRva2VuIG1hcmtldHBsYWNlIHRyYW5zaXRpb25zOiB0aGUgbGlzdGVkIHRva2VucyBhcmUgaGVsZCBpbiBlc2Nyb3cgdW5kZXIgdGhlIG9yZGVyJ3MgaWQgdW50aWwgaXQgaXMgZmlsbGVkIG9yIGNhbmNlbGxlZC4SF2NyZWF0aW9uUmVzdHJpY3Rpb25Nb2RlAgIS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AQAAAAAAAAhkZWNpbWFscwMBAAAAAAECAAEHdG9rZW5JZAAGB3Rva2VuSWQNAQAAAAAAAAVwcmljZQMBAAAAAAAABmFtb3VudAMBAAAAAAAACXJlbWFpbmluZwMBAAAAAAAABmVzY3JvdwMBAAAAAAAACGRlY2ltYWxzAwEAAAAAAQIAAQd0b2tlbklkAAMEYm9vawRib29rBAd0b2tlbklkAQhkZWNpbWFscwEFcHJpY2UBCiRjcmVhdGVkQXQBAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAdieU93bmVyB2J5T3duZXIDCCRvd25lcklkAQd0b2tlbklkAQokY3JlYXRlZEF0AQABAAAAAAAAAAAAAAAAAAAAAAAAAAAFZGVwdGgFZGVwdGgDB3Rva2VuSWQBCGRlY2ltYWxzAQVwcmljZQEAAQAAAAEGZXNjcm93AQAAAAAAAAAAAAAAAAAAAAABB3Rva2VuSWQACAokY3JlYXRlZEF0CiR1cGRhdGVkQXQGYW1vdW50CGRlY2ltYWxzBmVzY3JvdwVwcmljZQlyZW1haW5pbmcHdG9rZW5JZAAAAAAAAAAAAAEBAAAAAgAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAOUAAQACAAABAQYHdG9rZW5JZAABAAMAAAABAAABIAEgAAEAAAAFcHJpY2UAAQAGAAAAAAABAQIBAAAAAAAGYW1vdW50AAEABgAAAAAAAQECAQAAAAAACXJlbWFpbmluZwABAAYAAAAAAAEBAgEAAAAAAAZlc2Nyb3cAAQAGAAAAAAABAQIAAAAAAAAIZGVjaW1hbHMAAQAGAAAAAAABAQIAAQL7AP8AAAAAAQABBgd0b2tlbklkBXByaWNlBmFtb3VudAlyZW1haW5pbmcIZGVjaW1hbHMGZXNjcm93AAAAAAAAAAAA"} {"contract":"mainnet 2NZwXdb3wGQzbWQeQZHFAaL4GuQzuzF2v8iQfcKuUC5q","sha256":"f88948650030b46642a88f5bbe753b611fea8bc426736536ed92fcc34f046775","indexStructures":"4fe79ced8e35b61d7ebb7b90bd5e022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jdGl2ZQZleFJhdGULaW5zdHJ1Y3Rpb24GbWF4QW10Bm1pbkFtdAdteVN0b3JlBHRvTWUKdG9NZUhhbmRsZQd0b01lVmlhA3RvVQZ0b1VWaWEAAAAAAAAAAAABAQAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgD7AY4AAQACAAABAQsEdG9NZQABAAUAAAAAAQEAASIAAAAAB3RvTWVWaWEAAQAFAAAAAAEBAAEiAAAAAAp0b01lSGFuZGxlAAEABQAAAAABAQABIgAAAAADdG9VAAEABQAAAAABAQABIgAAAAAGdG9VVmlhAAEABQAAAAABAQABIgAAAAAGZXhSYXRlAAEABgAAAAAAAQECAAEC/QAACRhOcqAAAAAAAAtpbnN0cnVjdGlvbgABAAUAAAAAAQEAAfsCWAAAAAAGbWluQW10AAEABgAAAAAAAQECAAEC/QAAAOjUpRAAAAAAAAZtYXhBbXQAAQAGAAAAAAABAQIAAQL9AAAA6NSlEAAAAAAABmFjdGl2ZQABAAEAAAAAAAAAB215U3RvcmUAAQABAAAAAAAAAAEAAQsEdG9NZQd0b01lVmlhCnRvTWVIYW5kbGUDdG9VBnRvVVZpYQZleFJhdGULaW5zdHJ1Y3Rpb24GbWluQW10Bm1heEFtdAZhY3RpdmUHbXlTdG9yZQAAAAAAAAAAAA=="} {"contract":"mainnet 2UDyunHraJLbg1TqjYBHhVoaCetPKcy5aAVdGYxmWZga","sha256":"a3353b8902cb43493e3f2748ee49e9d30b41039ca87e7ef65c82b5b9cf7bcada","indexStructures":"74eaa293ce4381e8af811c0b929a7993cbe2ef218f2f7f9452e0f3dbf0d4ed03","bytes":"AhXVC/KBoXOMVjfhmUg5RJO8HV2kSxbGS8a+p1IpXs9fAAAAAAABAQAAASj+fLksRsQidDbOM1gGlYam9hkWlYmgY835HLI6FUqTAAEEbm90ZRYEEgR0eXBlEgZvYmplY3QSCnByb3BlcnRpZXMWARIHbWVzc2FnZRYDEgR0eXBlEgZzdHJpbmcSCW1heExlbmd0aAN+Eghwb3NpdGlvbgMAEgdpbmRpY2VzFQEWAxIEbmFtZRIHbWVzc2FnZRIKcHJvcGVydGllcxUBFgESB21lc3NhZ2USA2FzYxIGdW5pcXVlEwASFGFkZGl0aW9uYWxQcm9wZXJ0aWVzEwAAAAAAAAAAAAAAAQRub3RlAAEHbWVzc2FnZQsAAT8AAAAAAAAAAAEHbWVzc2FnZQsAAT8AAAAAAAAAAAEHbWVzc2FnZQdtZXNzYWdlAQdtZXNzYWdlAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIALQABAAIAAAEBAQdtZXNzYWdlAAEABQAAAAABAAE/AAAAAAEAAAAAAAAAAAAAAA=="} diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs index 0dd7040f56d..2817fb11f69 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs @@ -256,7 +256,7 @@ mod tests { .unwrap(); assert_eq!( hex::encode(root), - "25476fa4798355d300068734d17845c135522d835be3b4314f3a48d727f91086", + "4d8f2a9f55e6fdeb24307bea0c7faadcfa91baa93e0b5e72bd03865ed1803c69", "activation includes the current system contracts and retained-history migration", ); roots.push(root); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v1/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v1/mod.rs index 61d9fae6da3..f479ff3e9a4 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v1/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v1/mod.rs @@ -21,6 +21,7 @@ use dpp::data_contract::document_type::{ ReferenceCombinator, ReferenceHolder, ReferringWrite, }; use dpp::data_contract::config::moderation::{kept_value_at, ContractDocumentRemoval}; +use dpp::data_contract::config::v2::DataContractConfigGettersV2; use dpp::data_contract::document_type::property_constraints::{ referenced_document_value, referenced_document_values, referenced_fields, DocumentSystemValues, }; @@ -1302,13 +1303,25 @@ fn validate_reference_target_v1( platform_version, )?; } + // What the named contract lets its elected team do on the type, which a + // requirement may ask for (`$electedAbilities`): nothing where the contract + // elects no team or leaves the type out of what the team moderates + let elected_abilities = referenced_contract + .config() + .moderation() + .and_then(|moderation| moderation.moderators.elected()) + .and_then(|elected| elected.moderated_document_types.get(document_type_name)); let meets_requirements = dynamic.requirements.as_ref().is_none_or(|requirements| { - requirements.met_by(referenced_document_type, |referring_property| { - document_data - .get(referring_property) - .and_then(|name| name.as_text()) - .map(str::to_string) - }) + requirements.met_by( + referenced_document_type, + elected_abilities, + |referring_property| { + document_data + .get(referring_property) + .and_then(|name| name.as_text()) + .map(str::to_string) + }, + ) }); if !meets_requirements { return Ok(SimpleConsensusValidationResult::new_with_error( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs index 9dd30ec3cc2..6916e42eb49 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs @@ -731,7 +731,7 @@ async fn should_preserve_single_entry_full_processor_fees_and_result() { .value .unwrap() ), - "03d298d40e3b91aef74fb132d65795e4e71d2e610d8141a91409ab2dc4e919c4" + "3af8b4d7945db95a0a5acbc5777278dc9d54b92247b2fa5381ce17525bf63ec2" ); assert_eq!( pool.platform @@ -2182,39 +2182,39 @@ async fn should_preserve_single_entry_actions_errors_operations_and_settled_stat let (expected_validation, expected_settled) = match case { "shield" => ( "6a823c2db94612652926e6b9c1ae7feec9c2547dfd4cfc4e474318da1c16d59c", - "1692151d109b9dfdb9f97d959017077591abceef316672a4e5cc39e2d6e21313", + "2e364d1f94204d0e69a5deb1c151aae69bd8e8b0c6bfa2887aa3590eb778f9a3", ), "valid-payment" => ( "9388d5cf63c4a571b9fb009679e2e34d0b681acc88f0f5195e7287c7efbd92f7", - "ee8d9654c58fbb130f020ed5a8d5927d724f77832768fa43f1e916baf9257795", + "44dfbad3721901f165edbce5ea92c91a22d9b1e125cc801a52d4938bd01d3454", ), "failed-payment" => ( "d9b5fe191841bea952494f2a45e3833f925f4d367a1937b2ef1235a1aa01f51e", - "44b4ccd20284c51bbafe24ad65775fadc13594d27da2fe5428e764fd638a6258", + "afa7559900bbecf9840d19cd4e9af013d887ab642fdfa37db7d7d4f75618aaed", ), "within-bundle-repeat" => ( "8023e03a697a20f6a78396a05503a4bc583ca8f69e19bd7ee07a6ae0ce7be478", - "e1d51ae0c261bfad94cdd2c4aa10ea77fee84674304d58b10bc7c70fa15a5ed3", + "045f516d45879d472b62a23eb1d8675d5d79777ac1f07af0712328292b9ae5aa", ), "stored-repeat" => ( "05652ac85c972902e8c09d20a7d8586e17e9434a478b335da136ad85f73def01", - "3bdcc1e2d4462769cb6ea6b61420b20d128db2091397d10cd50c3f57150de4d6", + "b2d0b86d502164041844eb4ecfff816b4970dc1d0725df15a2117384541404a8", ), "open-mint-group" => ( "5c68381297c9bf68c5e85ebe6bb9e0f1289e2c07718eecfb5e6773d6009455bb", - "f0ec26c64030fe122b4483fc5e0a39b1f44bc989f690113e5e4f341e735e65fc", + "c9629605b64e1ee61ce490738253f604fea7794ad99a76f362ab9360cd4bbaf5", ), "closing-mint-group" => ( "2cedc16732c76e0605b5f46085db3d69c12936a5af55a2a82f52ec9e9ca67e38", - "e74efdeb572a716ff465dab55c2dd09c36226c9b374342e9de85a9ef4f7d7ce5", + "39a37c39aef7699d72c2ac669c3bb177500fe7667f3bc13d61e010c6de52578b", ), "open-burn-group" => ( "e664a045f020ff84de1ca98f364fbabccfc141ad46aa82c79491a340bb0db5f8", - "fa4794264c8d960a284104ebb4cf1fc92237b2736725a71ccb2887719f954316", + "3e6f0e1f5e8eec10b71dda07ca3c72b8dae61aa898fda7dbad9053319cbfbd32", ), "closing-burn-group" => ( "93e1732286f168c4a91d2765931e181c5721bfca1bfd5f93b8baacca03e00b2b", - "7a1a6c8d6b066550aa25485ca33bbc186233dfd5f2873b62a52877a1baaf4b66", + "94ac1e01e41b10927a1fc6e3e9e3334ec41b89dd32fd3a37cbdae14fa5a78590", ), _ => unreachable!("enumerated characterization case"), }; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/multiple_choice_proposal_tests.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/multiple_choice_proposal_tests.rs index a8af2e39aba..6f9aa110f34 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/multiple_choice_proposal_tests.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/multiple_choice_proposal_tests.rs @@ -5,6 +5,10 @@ //! as it wants. The choice with the most votes is kept, and a lock means none of them. Anyone //! enters choices for an `open` proposal, and only its owner for one that is not. The owner //! may edit the question's text for two hours after creating it. +//! +//! A proposal holds no description of its own. It points at a document saying what is being +//! decided, of the contract and the document type it names: a moderated type of a contract +//! whose moderators the masternodes elect, holding text a moderator's removal takes away. use crate::execution::validation::state_transition::state_transitions::tests::{ setup_identity, setup_masternode_voting_identity, @@ -28,7 +32,14 @@ use dpp::consensus::basic::BasicError; use dpp::consensus::state::state_error::StateError; use dpp::consensus::ConsensusError; use dpp::dash_to_credits; -use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; +use dpp::data_contract::config::moderation::{ + ContractModerationConfig, ContractModerators, ElectedModerators, InterimModerators, + ModerationAbility, DEFAULT_ELECTION_WINDOW_SECONDS, +}; +use dpp::data_contract::document_type::accessors::DocumentTypeV2Getters; +use dpp::data_contract::document_type::DocumentReferenceKind; +use dpp::data_contract::schema::DataContractSchemaMethodsV0; use dpp::data_contract::DataContract; use dpp::decision_proposal::DECISION_PROPOSALS_CONTRACT_ID; use dpp::document::document_methods::DocumentMethodsV0; @@ -38,7 +49,7 @@ use dpp::fee::Credits; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::{Identity, IdentityPublicKey, TimestampMillis}; use dpp::platform_serialization::PLATFORM_BINCODE_CONFIG; -use dpp::platform_value::{Bytes32, Identifier, Value}; +use dpp::platform_value::{platform_value, Bytes32, Identifier, Value}; use dpp::prelude::IdentityNonce; use dpp::serialization::PlatformSerializable; use dpp::state_transition::batch_transition::methods::v0::DocumentsBatchTransitionMethodsV0; @@ -48,6 +59,7 @@ use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition; use dpp::system_data_contracts::decision_proposals_contract::v1::document_types::{ choice, multiple_choice_proposal, }; +use dpp::tests::fixtures::get_data_contract_fixture; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use dpp::voting::vote_info_storage::contested_document_vote_poll_stored_info::{ ContestedDocumentVotePollStatus, ContestedDocumentVotePollStoredInfoV0Getters, @@ -68,11 +80,12 @@ use drive::query::vote_poll_vote_state_query::{ }; use drive::query::DriveDocumentQuery; use drive::util::object_size_info::DataContractResolvedInfo; +use drive::util::storage_flags::StorageFlags; use platform_version::version::PlatformVersion; use rand::prelude::StdRng; use rand::{Rng, SeedableRng}; use simple_signer::signer::SimpleSigner; -use std::collections::BTreeMap; +use std::collections::{BTreeMap, BTreeSet}; use std::sync::Arc; type IdentityInfo = (Identity, SimpleSigner, IdentityPublicKey); @@ -99,6 +112,199 @@ fn block(time_ms: TimestampMillis, height: u64) -> BlockInfo { } } +/// A document type of the description hosts whose documents moderators delete, a removal +/// taking their `text` with it. +const TEXT: &str = "text"; +/// One whose removal record keeps the `text`. +const KEPT_TEXT: &str = "keptText"; +/// One whose documents their owner deletes. +const PLAIN_TEXT: &str = "plainText"; +/// One whose documents their owner deletes, and the elected team too. +const DELETABLE_TEXT: &str = "deletableText"; +/// One moderators delete, which the contract leaves out of what its elected team may do. +const UNGRANTED_TEXT: &str = "ungrantedText"; +/// One moderators delete for an hour after a document's last change, and nobody after. +const WINDOWED_TEXT: &str = "windowedText"; +/// The same, with a rule for deleting a document past the hour. +const SETTLED_TEXT: &str = "settledText"; +/// The same, under a rule two members meet, which counts a member the leader added only +/// for documents created after its addition (the default once a rule asks for more than +/// one approval). +const PREDATED_TEXT: &str = "predatedText"; + +/// A document type holding a `text`, with `extra` merged into its schema. +fn text_schema(extra: Value) -> Value { + let mut schema = platform_value!({ + "type": "object", + "properties": { + "text": { "type": "string", "minLength": 1, "maxLength": 4096, "position": 0 }, + }, + "required": ["text"], + "additionalProperties": false, + }); + if let (Value::Map(schema_map), Value::Map(extra_map)) = (&mut schema, extra) { + for (key, value) in extra_map { + // A keyword given again replaces the one the base schema has + schema_map.retain(|(existing, _)| existing != &key); + schema_map.push((key, value)); + } + } + schema +} + +/// Who moderates a contract hosting descriptions. +#[derive(Clone, Copy, PartialEq)] +enum HostModerators { + /// A team the masternodes elect, the contract's owner until one is seated. + Elected, + /// The same, with the contract's owner protected from the team. + ElectedProtectingItsOwner, + /// The contract's owner alone. + Owner, +} + +/// A contract hosting the texts proposals describe themselves with. Its moderators are a +/// team the masternodes elect, its owner until one is seated, when `elected`; its owner +/// alone otherwise. The same contract every time it is built. +fn description_host(elected: bool, platform_version: &PlatformVersion) -> DataContract { + description_host_moderated_by( + if elected { + HostModerators::Elected + } else { + HostModerators::Owner + }, + platform_version, + ) +} + +/// A contract hosting descriptions, moderated by `moderators`. The same contract every time +/// it is built. +fn description_host_moderated_by( + moderators: HostModerators, + platform_version: &PlatformVersion, +) -> DataContract { + let owner_id = Identifier::new( + [match moderators { + HostModerators::Elected => 0xD5, + HostModerators::Owner => 0xD6, + HostModerators::ElectedProtectingItsOwner => 0xD7, + }; 32], + ); + let mut contract = + get_data_contract_fixture(Some(owner_id), 1, platform_version.protocol_version) + .data_contract_owned(); + let owner_protected = moderators == HostModerators::ElectedProtectingItsOwner; + let elects_a_team = moderators != HostModerators::Owner; + let moderators = if elects_a_team { + ContractModerators::Elected(Box::new(ElectedModerators { + join_window: DEFAULT_ELECTION_WINDOW_SECONDS, + vote_window: DEFAULT_ELECTION_WINDOW_SECONDS, + challenge_cool_down: Some(1_209_600), + moderated_document_types: [ + TEXT, + KEPT_TEXT, + DELETABLE_TEXT, + WINDOWED_TEXT, + SETTLED_TEXT, + PREDATED_TEXT, + ] + .into_iter() + .map(|name| { + ( + name.to_string(), + BTreeSet::from([ModerationAbility::DeleteDocuments]), + ) + }) + .collect(), + interim: InterimModerators::ContractOwner, + election_delay: None, + max_added_moderators: 0, + owner_protected, + })) + } else { + ContractModerators::ContractOwner + }; + contract.set_config(contract.config().clone().with_moderation(Some( + ContractModerationConfig { + banlist: false, + suspensions: false, + warnings: false, + moderators, + }, + ))); + // After the config: a type moderators delete from needs the contract to be moderated + let mut document_types = vec![ + ( + TEXT, + text_schema(platform_value!({ + "canBeDeleted": false, + "moderatorAbilities": { "delete": true }, + })), + ), + ( + KEPT_TEXT, + text_schema(platform_value!({ + "canBeDeleted": false, + "moderatorAbilities": { "delete": true, "deleteKeepsFields": ["text"] }, + })), + ), + (PLAIN_TEXT, text_schema(platform_value!({}))), + ( + DELETABLE_TEXT, + text_schema(platform_value!({ "moderatorAbilities": { "delete": true } })), + ), + ( + UNGRANTED_TEXT, + text_schema(platform_value!({ + "canBeDeleted": false, + "moderatorAbilities": { "delete": true }, + })), + ), + ( + WINDOWED_TEXT, + text_schema(platform_value!({ + "canBeDeleted": false, + "required": ["text", "$createdAt", "$updatedAt"], + "moderatorAbilities": { "delete": true, "deleteWithin": 3600 }, + })), + ), + ]; + // Who of a team approves the deletion of a settled document is an elected contract's + // to say + if elects_a_team { + document_types.push(( + SETTLED_TEXT, + text_schema(platform_value!({ + "canBeDeleted": false, + "required": ["text", "$createdAt", "$updatedAt"], + "moderatorAbilities": { + "delete": true, + "deleteWithin": 3600, + "deleteSettled": { "approvals": 1 }, + }, + })), + )); + document_types.push(( + PREDATED_TEXT, + text_schema(platform_value!({ + "canBeDeleted": false, + "required": ["text", "$createdAt", "$updatedAt"], + "moderatorAbilities": { + "delete": true, + "deleteWithin": 3600, + "deleteSettled": { "approvals": 2 }, + }, + })), + )); + } + for (name, schema) in document_types { + contract + .set_document_schema(name, schema, true, &mut vec![], platform_version) + .expect("expected to add the document type"); + } + contract +} + fn setup() -> ( TempPlatform, &'static PlatformVersion, @@ -110,6 +316,23 @@ fn setup() -> ( .with_latest_protocol_version() .build_with_mock_rpc() .set_genesis_state(); + for moderators in [ + HostModerators::Elected, + HostModerators::ElectedProtectingItsOwner, + HostModerators::Owner, + ] { + platform + .drive + .apply_contract( + &description_host_moderated_by(moderators, platform_version), + BlockInfo::default(), + true, + StorageFlags::optional_default_as_cow(), + None, + platform_version, + ) + .expect("expected to apply the description host"); + } let contract = platform .drive .cache @@ -282,25 +505,23 @@ async fn ask_stating( rng: &mut StdRng, platform_version: &PlatformVersion, ) -> Identifier { - let properties = BTreeMap::from([ - ( - multiple_choice_proposal::properties::TITLE.to_string(), - Value::Text(question.to_string()), - ), - ( - multiple_choice_proposal::properties::DESCRIPTION.to_string(), - Value::Text("Enter the answer you would have the network give.".to_string()), - ), - ( - multiple_choice_proposal::properties::OPEN.to_string(), - Value::Bool(open), - ), - ]); + // The proposer first writes what is being decided where moderators can take it down + let host = description_host(true, platform_version); + let description_id = describe( + platform, + &host, + proposer, + TEXT, + time_ms, + rng, + platform_version, + ) + .await; let (transition, id) = create_transition( contract, proposer, multiple_choice_proposal::NAME, - properties, + question_properties(question, open, host.id(), TEXT, description_id), rng, platform_version, ) @@ -309,6 +530,65 @@ async fn ask_stating( id } +/// `writer` writes a text of `document_type_name` in `host` at `time_ms`; returns its id. +async fn describe( + platform: &TempPlatform, + host: &DataContract, + writer: &mut Writer, + document_type_name: &str, + time_ms: TimestampMillis, + rng: &mut StdRng, + platform_version: &PlatformVersion, +) -> Identifier { + let (transition, id) = create_transition( + host, + writer, + document_type_name, + BTreeMap::from([( + "text".to_string(), + Value::Text("Enter the answer you would have the network give.".to_string()), + )]), + rng, + platform_version, + ) + .await; + process_valid(platform, transition, time_ms, platform_version); + id +} + +/// The properties of a multiple choice proposal asking `question`, described by the document +/// `description_id` of `description_document_type` in the contract `description_contract_id`. +fn question_properties( + question: &str, + open: bool, + description_contract_id: Identifier, + description_document_type: &str, + description_id: Identifier, +) -> BTreeMap { + BTreeMap::from([ + ( + multiple_choice_proposal::properties::TITLE.to_string(), + Value::Text(question.to_string()), + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_ID.to_string(), + Value::Identifier(description_id.to_buffer()), + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID.to_string(), + Value::Identifier(description_contract_id.to_buffer()), + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_DOCUMENT_TYPE.to_string(), + Value::Text(description_document_type.to_string()), + ), + ( + multiple_choice_proposal::properties::OPEN.to_string(), + Value::Bool(open), + ), + ]) +} + /// A serialized create of `writer`'s choice `answer` for `proposal_id`, and the choice's id. async fn choice_transition( contract: &DataContract, @@ -1371,6 +1651,29 @@ async fn should_let_the_proposer_edit_the_question_for_two_hours() { ) .await; + // Another text the proposer wrote, to describe the question with instead + let host = description_host(true, platform_version); + let rewritten = describe( + &platform, + &host, + &mut proposer, + TEXT, + created_at + 30_000, + &mut rng, + platform_version, + ) + .await; + let later_text = describe( + &platform, + &host, + &mut proposer, + TEXT, + created_at + 30_000, + &mut rng, + platform_version, + ) + .await; + // The title, the description and the url may change until two hours after the creation let edit = edit_transition( &contract, @@ -1382,8 +1685,8 @@ async fn should_let_the_proposer_edit_the_question_for_two_hours() { Value::Text("Which mascot for Platform?".to_string()), ), ( - multiple_choice_proposal::properties::DESCRIPTION, - Value::Text("One animal, in one word.".to_string()), + multiple_choice_proposal::properties::DESCRIPTION_ID, + Value::Identifier(rewritten.to_buffer()), ), ( multiple_choice_proposal::properties::URL, @@ -1403,6 +1706,10 @@ async fn should_let_the_proposer_edit_the_question_for_two_hours() { edited.get(multiple_choice_proposal::properties::URL), Some(&Value::Text("https://example.org/mascot".to_string())) ); + assert_eq!( + edited.get(multiple_choice_proposal::properties::DESCRIPTION_ID), + Some(&Value::Identifier(rewritten.to_buffer())) + ); // to the millisecond let edit = edit_transition( @@ -1420,21 +1727,32 @@ async fn should_let_the_proposer_edit_the_question_for_two_hours() { // and no longer after that, whichever of them the edit changes for (property, value) in [ - (multiple_choice_proposal::properties::TITLE, "Which bird?"), ( - multiple_choice_proposal::properties::DESCRIPTION, - "One bird, in one word.", + multiple_choice_proposal::properties::TITLE, + Value::Text("Which bird?".to_string()), + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_ID, + Value::Identifier(later_text.to_buffer()), + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_CONTRACT_ID, + Value::Identifier(description_host(false, platform_version).id().to_buffer()), + ), + ( + multiple_choice_proposal::properties::DESCRIPTION_DOCUMENT_TYPE, + Value::Text(KEPT_TEXT.to_string()), ), ( multiple_choice_proposal::properties::URL, - "https://example.org/bird", + Value::Text("https://example.org/bird".to_string()), ), ] { let edit = edit_transition( &contract, &mut proposer, question(&platform), - &[(property, Value::Text(value.to_string()))], + &[(property, value)], platform_version, ) .await; @@ -1620,3 +1938,256 @@ async fn should_never_let_a_proposal_change_whether_it_is_open() { ); } } + +/// What is being decided is said by a document the proposal points at. The contract it names +/// is one whose moderators the masternodes elect, the document type a moderated one whose +/// text a removal takes away, and the document is there. +#[tokio::test] +async fn should_take_the_description_from_a_moderated_text_of_an_elected_contract() { + let (mut platform, platform_version, contract, mut rng) = setup(); + let mut proposer = writer(&mut platform, &mut rng); + let elected = description_host(true, platform_version); + let owner_moderated = description_host(false, platform_version); + let owner_protecting = + description_host_moderated_by(HostModerators::ElectedProtectingItsOwner, platform_version); + for (document_type_name, kind) in [ + (TEXT, DocumentReferenceKind::Moderated), + (KEPT_TEXT, DocumentReferenceKind::Moderated), + (UNGRANTED_TEXT, DocumentReferenceKind::Moderated), + (WINDOWED_TEXT, DocumentReferenceKind::Moderated), + (PLAIN_TEXT, DocumentReferenceKind::Deletable), + (DELETABLE_TEXT, DocumentReferenceKind::Deletable), + ] { + assert_eq!( + elected + .document_type_for_name(document_type_name) + .expect("expected the type") + .document_reference_kind(), + kind, + "{document_type_name}" + ); + } + + // A text in each place a proposal could point + let mut texts = BTreeMap::new(); + for (host, document_type_name) in [ + (&elected, TEXT), + (&elected, KEPT_TEXT), + (&elected, PLAIN_TEXT), + (&elected, DELETABLE_TEXT), + (&elected, UNGRANTED_TEXT), + (&elected, WINDOWED_TEXT), + (&elected, SETTLED_TEXT), + (&owner_moderated, TEXT), + (&owner_protecting, TEXT), + (&elected, PREDATED_TEXT), + ] { + let id = describe( + &platform, + host, + &mut proposer, + document_type_name, + 10_000, + &mut rng, + platform_version, + ) + .await; + texts.insert((host.id(), document_type_name), id); + } + let asking = |host: &DataContract, document_type_name: &'static str, id: Identifier| { + question_properties("Which mascot?", true, host.id(), document_type_name, id) + }; + let text_of = |host: &DataContract, document_type_name: &'static str| { + texts[&(host.id(), document_type_name)] + }; + + // A moderated text of the elected contract + let (accepted, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, TEXT, text_of(&elected, TEXT)), + &mut rng, + platform_version, + ) + .await; + process_valid(&platform, accepted, 20_000, platform_version); + + // A type whose removal record keeps the text: taking the document down would leave it + let (kept, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, KEPT_TEXT, text_of(&elected, KEPT_TEXT)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, kept, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedDocumentTypeRequirementNotMetError(_)) + ), + "{error:?}" + ); + + // A type whose documents their owner deletes is not a moderated one, though the team + // may delete them too + let (deletable, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, DELETABLE_TEXT, text_of(&elected, DELETABLE_TEXT)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, deletable, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedDocumentTypeNotModeratedError(_)) + ), + "{error:?}" + ); + // and one the team does not moderate at all fails what is asked of the type first + let (plain, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, PLAIN_TEXT, text_of(&elected, PLAIN_TEXT)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, plain, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedDocumentTypeRequirementNotMetError(_)) + ), + "{error:?}" + ); + + // A moderated text of a contract its owner moderates: the masternodes elect nobody + // there, so no elected team is given deletion on the type. The description, checked + // before the contract it names, refuses it for that; the contract's own requirement + // would refuse it too + let (unelected, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&owner_moderated, TEXT, text_of(&owner_moderated, TEXT)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, unelected, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedDocumentTypeRequirementNotMetError(_)) + ), + "{error:?}" + ); + + // and of a contract whose elected team may not moderate its owner: a description the + // owner wrote there could never be taken down + let (protected, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&owner_protecting, TEXT, text_of(&owner_protecting, TEXT)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, protected, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedContractRequirementNotMetError(_)) + ), + "{error:?}" + ); + + // A moderated type the contract's elected team is given no deletion on: once a team is + // seated, nobody could remove the text. One moderators delete only for an hour after + // its last change, with no rule for later: the text would outlast the hour for good. And + // one whose rule for later counts a member the leader added only for documents created + // after its addition: a text older than the members the rule takes would stay for good + assert!(elected + .document_type_for_name(PREDATED_TEXT) + .expect("expected the type") + .moderator_settled_deletion() + .is_some_and(|rule| rule.approvers_predate_document)); + for unremovable in [UNGRANTED_TEXT, WINDOWED_TEXT, PREDATED_TEXT] { + let (transition, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, unremovable, text_of(&elected, unremovable)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, transition, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError( + StateError::ReferencedDocumentTypeRequirementNotMetError(_) + ) + ), + "{unremovable}: {error:?}" + ); + } + // while a window with a rule for deleting past it that counts every member qualifies + let (settled, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, SETTLED_TEXT, text_of(&elected, SETTLED_TEXT)), + &mut rng, + platform_version, + ) + .await; + process_valid(&platform, settled, 20_000, platform_version); + + // A text that is not there, and a type the contract does not have + let (missing, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, TEXT, Identifier::new([7; 32])), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, missing, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedEntityNotFoundError(_)) + ), + "{error:?}" + ); + let (no_type, _) = create_transition( + &contract, + &mut proposer, + multiple_choice_proposal::NAME, + asking(&elected, "essay", text_of(&elected, TEXT)), + &mut rng, + platform_version, + ) + .await; + let error = process_refused(&platform, no_type, 20_000, platform_version); + assert!( + matches!( + error, + ConsensusError::StateError(StateError::ReferencedDocumentTypeNotFoundError(_)) + ), + "{error:?}" + ); +} diff --git a/packages/rs-platform-version/src/version/v15.rs b/packages/rs-platform-version/src/version/v15.rs index 02441d4fab7..fdcd1878e36 100644 --- a/packages/rs-platform-version/src/version/v15.rs +++ b/packages/rs-platform-version/src/version/v15.rs @@ -732,8 +732,14 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// backfilled); a property it does not hold for does not fill the slot. Judging the /// named type is billed before it is judged, `requirement_credits_per_comparison` /// (100, added in place to `FEE_DOCUMENT_REFERENCE_VERSION1`, which nothing read for -/// it before) for each property a slot tries and each node of its `when` for it. The native schema check of note 7 admits the keys and meta-schema v3 refuses -/// them. It parses to `DocumentPropertyReferenceTarget::DynamicDocument`, +/// it before) for each property a slot tries and each node of its `when` for it. +/// `documentTypeRequirements` takes a `when` of its own, the same condition judged +/// once for the named type as a whole, reading no `$property`; a `when` may also look +/// into `$electedAbilities` (the abilities the type's contract gives its elected +/// moderation team on the type) and test with `present` or `absent` whether the type +/// declares `moderatorAbilities.deleteWithin` or `moderatorAbilities.deleteSettled`, +/// or whether that rule sets `approversPredateDocument`. The native schema check of +/// note 7 admits the keys and meta-schema v3 refuses them. It parses to `DocumentPropertyReferenceTarget::DynamicDocument`, /// appended. Such a declaration carries nothing else (no `contractId`, `documentType`, /// `findBy`, `where`, `inList`, `consume` or `constraints`), is no operand of a reference /// expression, sits on no typed array's elements and in no `ownerRefersTo` or @@ -750,8 +756,11 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// the declared kind (40122, 40143, 40144), and the document exists (40120) or, for a /// moderated one a replace keeps, was removed on the record. A replace checks the /// reference again when its value or a property it reads the target from changed. -/// Protocol v14 and earlier keep `apply_property_reference` 0, which does not read the -/// keys, and `document_reference_validation` 0, which no dynamic reference reaches. +/// The decision proposals contract's `multipleChoiceProposal` type uses it for its +/// description: a moderated document, of a contract declaring elected moderation, whose +/// text a moderator's removal takes away. Protocol v14 and earlier keep +/// `apply_property_reference` 0, which does not read the keys, and +/// `document_reference_validation` 0, which no dynamic reference reaches. /// Version 1 takes this reading only for a declaration version 0 cannot read at all (a /// reference to a document whose `contractId` is written `"$self."`, or a `type` listing /// kinds), so a contract stored before 15 with `"$self."` keys on any other declaration diff --git a/packages/wasm-dpp2/src/data_contract/document_type_reference.rs b/packages/wasm-dpp2/src/data_contract/document_type_reference.rs index 5ee682ca947..2b37baeecc1 100644 --- a/packages/wasm-dpp2/src/data_contract/document_type_reference.rs +++ b/packages/wasm-dpp2/src/data_contract/document_type_reference.rs @@ -321,6 +321,12 @@ export type DocumentTypeRequirements = { * when every slot must be filled. */ require?: string | DocumentTypeSlotRequirement; + /** + * What the named type must say of itself, whatever fills the slots: a + * condition that reads no `'$property'`. A type it does not hold for does + * not meet the requirements. + */ + when?: DocumentTypeSlotCondition; }; export type DocumentTypeRequirementSlot = { @@ -354,12 +360,28 @@ export type DocumentTypeSlotConditionString = | '$property' | { const: string }; +/** + * A setting of the referenced document type a `present` or an `absent` + * tests: whether the type declares `moderatorAbilities.deleteWithin` or + * `moderatorAbilities.deleteSettled`, or whether that rule counts a member + * the team's leader added only for documents created after its addition + * (`approversPredateDocument`, its default applied). + */ +export type DocumentTypeSlotConditionSetting = + | '$moderatorAbilities.deleteWithin' + | '$moderatorAbilities.deleteSettled' + | '$moderatorAbilities.deleteSettled.approversPredateDocument'; + /** * A condition of a slot's `when`, in the forms of a `propertyConstraints` * condition, read against the referenced document type instead of a * document. `contains` looks into the type's * `moderatorAbilities.deleteKeepsFields` or `moderatorAbilities.changeFields`, - * empty where the type declares none. + * empty where the type declares none, or into `'$electedAbilities'`, the + * abilities the type's contract gives its elected moderation team on the + * type (`'deleteDocuments'`, `'changeDocumentFields'`, ...), empty where it + * elects none or leaves the type out. `present` and `absent` test a setting + * of the type (`DocumentTypeSlotConditionSetting`). */ export type DocumentTypeSlotCondition = | { equal: [DocumentTypeSlotConditionString, DocumentTypeSlotConditionString] } @@ -371,10 +393,13 @@ export type DocumentTypeSlotCondition = ( | '$moderatorAbilities.deleteKeepsFields' | '$moderatorAbilities.changeFields' + | '$electedAbilities' ), '$property' | { const: string }, ]; } + | { present: DocumentTypeSlotConditionSetting } + | { absent: DocumentTypeSlotConditionSetting } | { not: DocumentTypeSlotCondition } | { anyOf: Array } | { allOf: Array } @@ -1190,6 +1215,14 @@ fn document_type_requirements_to_js( path, )?; } + if let Some(when) = &requirements.when { + set_field( + &object, + "when", + &platform_value_to_object(&when.to_schema_value())?, + path, + )?; + } Ok(object) } diff --git a/packages/wasm-dpp2/tests/unit/DocumentPropertyReference.spec.ts b/packages/wasm-dpp2/tests/unit/DocumentPropertyReference.spec.ts index 7513e26a7f9..8615bb3f7f8 100644 --- a/packages/wasm-dpp2/tests/unit/DocumentPropertyReference.spec.ts +++ b/packages/wasm-dpp2/tests/unit/DocumentPropertyReference.spec.ts @@ -1064,6 +1064,7 @@ describe('DataContract — refersTo declarations (v14)', () => { documentTypeRequirements?: { properties: Record>; require?: unknown; + when?: unknown; }; }; @@ -1204,6 +1205,23 @@ describe('DataContract — refersTo declarations (v14)', () => { }, ], }; + // A condition on the type as a whole, beside the slots + const ofTheType = { + allOf: [ + { contains: ['$electedAbilities', { const: 'deleteDocuments' }] }, + { + anyOf: [ + { absent: '$moderatorAbilities.deleteWithin' }, + { + allOf: [ + { present: '$moderatorAbilities.deleteSettled' }, + { absent: '$moderatorAbilities.deleteSettled.approversPredateDocument' }, + ], + }, + ], + }, + ], + }; const eitherKind = structuredClone(namedSchemas); (eitherKind.note.properties.descriptionId as { refersTo: object }).refersTo = { // Given the other way round: reported permanent first @@ -1211,6 +1229,7 @@ describe('DataContract — refersTo declarations (v14)', () => { contractId: '$self.descriptionContractId', documentType: '$self.descriptionDocumentType', documentTypeRequirements: { + when: ofTheType, properties: { body: { name: '$any', type: 'string', when }, code: { @@ -1228,6 +1247,7 @@ describe('DataContract — refersTo declarations (v14)', () => { expect(descriptionId.type).to.deep.equal(['permanentDocument', 'moderatedDocument']); expect(descriptionId.documentTypeRequirements).to.deep.equal({ + when: ofTheType, properties: { body: { name: '$any', type: 'string', when }, code: {