@dashevo/moderation-charters-contract 4.2.0-beta.4 → 4.2.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,8 +12,8 @@ undeletable, so everything a charter points at, and the charter itself, is a
12
12
  fixed text; the three team changes are deletable.
13
13
 
14
14
  The schema carries almost every rule through its keywords: typed arrays with
15
- a reference per element, a reference resolved through a unique index
16
- (`lookup`), `distinctFrom`, key requirements on key references, the
15
+ a reference per element, a reference found through a unique index
16
+ (`findBy`), a reference to an element of a list (`inList`), `distinctFrom`, key requirements on key references, the
17
17
  `encryptedFor` envelope, `maxBytes` for the description's 4096-byte cap and a
18
18
  `propertyConstraints` rule holding the reward split to 100. What it cannot say,
19
19
  the cap on additions, is checked by the batch's state validation, and
@@ -62,7 +62,7 @@ to this type.
62
62
 
63
63
  | Property | Type | Meaning |
64
64
  | --- | --- | --- |
65
- | `submittedCharterId` | identifier, required, `refersTo` a `submittedCharter` | The proposal; `recipientId` must equal its owner (`propertyAgreement`) |
65
+ | `submittedCharterId` | identifier, required, `refersTo` a `submittedCharter` | The proposal; its owner must equal `recipientId` (`where`) |
66
66
  | `recipientId` | identifier, required, `refersTo` an identity public key through `recipientKeyId` | The leader and the decryption key the message is encrypted to |
67
67
  | `recipientKeyId` | integer, required | The leader's key id |
68
68
  | `senderKeyId` | integer, required | The owner's encryption key the shared secret is derived from |
@@ -72,7 +72,7 @@ to this type.
72
72
 
73
73
  A proposal put to the vote with its team: the only type that opens or joins
74
74
  the contest for a target. Only the proposal's leader may create one, for the
75
- proposal's own target (`propertyAgreement` on `$ownerId` and
75
+ proposal's own target (`where` on `$ownerId` and
76
76
  `targetContractId`). The `byTargetContract` index is a contested unique index
77
77
  keyed by the target contract with resolution `1`, the vote without a Lock
78
78
  choice by masternodes (weight 1) and evonodes (weight 4): a create on it
@@ -88,7 +88,7 @@ leader and members act with the target's full mandate; there are no powers.
88
88
  | --- | --- | --- |
89
89
  | `targetContractId` | identifier, required, `refersTo` a contract whose election is open | The contract contended for; its own `electionDelay` since its creation must have passed |
90
90
  | `submittedCharterId` | identifier, required, `refersTo` a `submittedCharter` | The proposal the team runs on |
91
- | `members` | array of at most 15 unique identity ids, required, each the owner of a `joinRequest` for this proposal (`lookup`) and none the leader (`distinctFrom`) | The team besides the leader; may be empty |
91
+ | `members` | array of at most 15 unique identity ids, required, each the owner of a `joinRequest` for this proposal (`findBy`) and none the leader (`distinctFrom`) | The team besides the leader; may be empty |
92
92
 
93
93
  ## After the election
94
94
 
@@ -96,9 +96,9 @@ Once an elected charter is seated, its team can change without a new vote:
96
96
 
97
97
  | Type | Written by | Properties | Rules |
98
98
  | --- | --- | --- | --- |
99
- | `addedModerator` | the leader | `electedCharterId`, `submittedCharterId`, `memberId` | `memberId` owns a `joinRequest` for the charter's proposal (`lookup`) and is not the leader; at most the target's `maxAddedModerators` additions per charter at a time, a consensus rule of the batch's state validation (41202); deleting it takes the member off and frees its slot |
100
- | `removedModerator` | the leader | `electedCharterId`, `memberId` | Needs no resignation; `memberId` is one of the charter's elected `members` (`listElement`); deleting it puts the member back |
101
- | `resignationRequest` | a member of the team | `electedCharterId`, `recipientId`, `recipientKeyId`, `senderKeyId`, `encryptedMessage` | The writer is in the charter's `members` or has an addition now (`ownerRefersTo` with `anyOf`, the addition a `deletableDocument` lookup); a message only the leader can read; deletable, which withdraws it; the leader acts on it by deleting the addition or removing an elected member |
99
+ | `addedModerator` | the leader | `electedCharterId`, `submittedCharterId`, `memberId` | `memberId` owns a `joinRequest` for the charter's proposal (`findBy`) and is not the leader; at most the target's `maxAddedModerators` additions per charter at a time, a consensus rule of the batch's state validation (41202); deleting it takes the member off and frees its slot |
100
+ | `removedModerator` | the leader | `electedCharterId`, `memberId` | Needs no resignation; `memberId` is one of the charter's elected `members` (`inList`); deleting it puts the member back |
101
+ | `resignationRequest` | a member of the team | `electedCharterId`, `recipientId`, `recipientKeyId`, `senderKeyId`, `encryptedMessage` | The writer is in the charter's `members` or has an addition now (`ownerRefersTo` with `anyOf`, the addition a `deletableDocument` found by `findBy`); a message only the leader can read; deletable, which withdraws it; the leader acts on it by deleting the addition or removing an elected member |
102
102
 
103
103
  Each exists at most once per member and charter (unique indexes). The team
104
104
  that acts is the leader plus the elected members less the removals, plus the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/moderation-charters-contract",
3
- "version": "4.2.0-beta.4",
3
+ "version": "4.2.0-beta.7",
4
4
  "description": "A system contract for the charters of elected moderation teams",
5
5
  "scripts": {
6
6
  "lint": "eslint .",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "license": "MIT",
18
18
  "devDependencies": {
19
- "@dashevo/wasm-dpp": "workspace:*",
19
+ "@dashevo/wasm-dpp": "4.2.0-beta.7",
20
20
  "chai": "^4.3.10",
21
21
  "dirty-chai": "^2.0.1",
22
22
  "eslint": "^9.18.0",
@@ -24,4 +24,4 @@
24
24
  "sinon": "^18.0.1",
25
25
  "sinon-chai": "^3.7.0"
26
26
  }
27
- }
27
+ }
@@ -217,8 +217,8 @@
217
217
  "refersTo": {
218
218
  "type": "permanentDocument",
219
219
  "documentType": "submittedCharter",
220
- "propertyAgreement": {
221
- "recipientId": "$ownerId"
220
+ "where": {
221
+ "$ownerId": "recipientId"
222
222
  }
223
223
  },
224
224
  "position": 0
@@ -337,7 +337,7 @@
337
337
  "refersTo": {
338
338
  "type": "permanentDocument",
339
339
  "documentType": "submittedCharter",
340
- "propertyAgreement": {
340
+ "where": {
341
341
  "$ownerId": "$ownerId",
342
342
  "targetContractId": "targetContractId"
343
343
  }
@@ -359,12 +359,9 @@
359
359
  "refersTo": {
360
360
  "type": "permanentDocument",
361
361
  "documentType": "joinRequest",
362
- "lookup": {
363
- "index": "bySubmittedCharter",
364
- "keys": {
365
- "submittedCharterId": "submittedCharterId",
366
- "$ownerId": "."
367
- }
362
+ "findBy": {
363
+ "submittedCharterId": "submittedCharterId",
364
+ "$ownerId": "."
368
365
  }
369
366
  }
370
367
  },
@@ -409,7 +406,7 @@
409
406
  "refersTo": {
410
407
  "type": "permanentDocument",
411
408
  "documentType": "electedCharter",
412
- "propertyAgreement": {
409
+ "where": {
413
410
  "$ownerId": "$ownerId",
414
411
  "submittedCharterId": "submittedCharterId"
415
412
  }
@@ -435,12 +432,9 @@
435
432
  "refersTo": {
436
433
  "type": "permanentDocument",
437
434
  "documentType": "joinRequest",
438
- "lookup": {
439
- "index": "bySubmittedCharter",
440
- "keys": {
441
- "submittedCharterId": "submittedCharterId",
442
- "$ownerId": "."
443
- }
435
+ "findBy": {
436
+ "submittedCharterId": "submittedCharterId",
437
+ "$ownerId": "."
444
438
  }
445
439
  },
446
440
  "description": "An identity that asked to join the proposal",
@@ -484,7 +478,7 @@
484
478
  "refersTo": {
485
479
  "type": "permanentDocument",
486
480
  "documentType": "electedCharter",
487
- "propertyAgreement": {
481
+ "where": {
488
482
  "$ownerId": "$ownerId"
489
483
  }
490
484
  },
@@ -499,10 +493,10 @@
499
493
  "contentMediaType": "application/x.dash.dpp.identifier",
500
494
  "distinctFrom": "$ownerId",
501
495
  "refersTo": {
502
- "type": "listElement",
496
+ "type": "permanentDocument",
503
497
  "documentType": "electedCharter",
504
- "propertyAgreement": {
505
- "electedCharterId": "$id"
498
+ "findBy": {
499
+ "$id": "electedCharterId"
506
500
  },
507
501
  "inList": "members"
508
502
  },
@@ -525,22 +519,19 @@
525
519
  "ownerRefersTo": {
526
520
  "anyOf": [
527
521
  {
528
- "type": "listElement",
522
+ "type": "permanentDocument",
529
523
  "documentType": "electedCharter",
530
- "propertyAgreement": {
531
- "electedCharterId": "$id"
524
+ "findBy": {
525
+ "$id": "electedCharterId"
532
526
  },
533
527
  "inList": "members"
534
528
  },
535
529
  {
536
530
  "type": "deletableDocument",
537
531
  "documentType": "addedModerator",
538
- "lookup": {
539
- "index": "byElectedCharterMember",
540
- "keys": {
541
- "electedCharterId": "electedCharterId",
542
- "memberId": "."
543
- }
532
+ "findBy": {
533
+ "electedCharterId": "electedCharterId",
534
+ "memberId": "."
544
535
  }
545
536
  }
546
537
  ]
@@ -569,8 +560,8 @@
569
560
  "refersTo": {
570
561
  "type": "permanentDocument",
571
562
  "documentType": "electedCharter",
572
- "propertyAgreement": {
573
- "recipientId": "$ownerId"
563
+ "where": {
564
+ "$ownerId": "recipientId"
574
565
  }
575
566
  },
576
567
  "position": 0
@@ -412,9 +412,9 @@ describe('Moderation Charters Contract', () => {
412
412
  const { refersTo } = moderationChartersContractDocumentsSchema.removedModerator.properties.memberId;
413
413
 
414
414
  expect(refersTo).to.deep.equal({
415
- type: 'listElement',
415
+ type: 'permanentDocument',
416
416
  documentType: 'electedCharter',
417
- propertyAgreement: { electedCharterId: '$id' },
417
+ findBy: { $id: 'electedCharterId' },
418
418
  inList: 'members',
419
419
  });
420
420
  });
@@ -445,7 +445,7 @@ describe('Moderation Charters Contract', () => {
445
445
  const { anyOf } = moderationChartersContractDocumentsSchema.resignationRequest.ownerRefersTo;
446
446
 
447
447
  expect(anyOf.map(({ type, documentType }) => [type, documentType])).to.deep.equal([
448
- ['listElement', 'electedCharter'],
448
+ ['permanentDocument', 'electedCharter'],
449
449
  ['deletableDocument', 'addedModerator'],
450
450
  ]);
451
451
  });