require e/p tags be specified, require primary hosting relay be specified, clarify and simplify tally requirement descriptions

This commit is contained in:
toadlyBroodle 2023-03-07 11:13:37 +09:00
parent 641047525f
commit f435bc80da

29
69.md
View File

@ -17,6 +17,8 @@ A careful balancing of all poll attributes should enable pollers to conduct tail
## Poll format
A poll event:
* MUST specify an `e` tag that includes a primary hosting relay URL
* MUST specify a `p` tag that includes the same primary hosting relay specified in the `e` tag
* MUST contain a primary description string, specified in the `content` field
* MUST contain a `poll_options` tag, containing a serialized key-value array of vote options, formatted as below
* MUST include at least 2 voting options, each with its own unique description string
@ -35,8 +37,8 @@ A poll event:
"created_at": <unix timestamp in seconds>,
"kind": 6969,
"tags": [
["e", <32-bytes hex of the id of another event>, <recommended relay URL>],
["p", <32-bytes hex of the key>, <recommended relay URL>],
["e", <32-bytes hex of the id of the poll event>, <primary poll host relay URL>],
["p", <32-bytes hex of the key>, <primary poll host relay URL>],
["poll_options", "[[0, 'poll option 0 description string'], [1, 'poll option 1 description string'], [<n>, 'poll option <n> description string']]"],
["value_maximum", "maximum satoshi value for inclusion in tally"],
["value_minimum", "minimum satoshi value for inclusion in tally"],
@ -50,15 +52,20 @@ A poll event:
## Zap vote format
Poll options are voted on by sending [zap events](57.md) (referencing the original poll event) which include 1 additional `poll_option` tag in the zap request event.
Poll options are voted on by sending [zap events](57.md) (referencing the original poll event's `e` and `p` values) that indicate their chosen vote option in a `poll_option`. To ensure all eligible votes are included in the tally, `e` and `p` tags must specify a primary hosting relay.
The zap request event (kind `9734`):
* MUST specify an `e` tag that references the original poll event
* MUST include a primary hosting relay URL in the `e` tag
* MUST specify a `p` tag that references the poller's pubkey
* MUST include the same primary hosting relay URL in the `p` tag as is specified in the `e` tag
* MUST include exactly 1 `poll_option` tag
* MUST reference the vote option by its corresponding integer `n`, chosen from the original poll event's key-value array of predefined `polling_options`
```json
"tags": [
...
["e", <32-bytes hex of the id of the original poll event>, <primary poll host relay URL>],
["p", <32-bytes hex of the key>, <primary poll host relay URL>],
["poll_option", "n"],
...
]
@ -66,17 +73,17 @@ The zap request event (kind `9734`):
## Poll outcome
Polls results are tallied by summing the exact satoshi values from all eligible zaps for each `poll_option`. The total tally is the sum of all individual `poll_option` tallies, and `poll_option` results are calculated by their percentage of the total tally value.
To avoid ambiguity of results, strict adherence to the following rules is vital when tallying and rendering poll outcomes.
A tallying client:
* MUST clearly indicate the `value_maximum`, `value_minimum`, and `closed_at` attributes (when specified) to participants before they vote
* MUST ONLY include full satoshi value amounts in option tallies from all eligible zaps, according to the following criteria:
* if a `value_maximum` is specified, clients:
* MUST include zap amounts less than or equal to `value_maximum` in the tally
* MUST NOT include zap amounts greater than `value_maximum` in the tally
* if a `value_minimum` is specified, clients:
* MUST include zap amounts greater than or equal to `value_minimum` in the tally
* MUST NOT include zap amounts less than `value_minimum` in the tally
* MUST ONLY include full satoshi value amounts in option tallies from ALL eligible zaps that meet ALL following criteria:
* MUST ONLY tally zaps that reference the original poll event by its `e` tag value
* MUST ONLY tally zaps sent to the poller's `p` key
* MUST ONLY include zap amounts less than or equal to `value_maximum`, if specified
* MUST ONLY include zap amounts greater than or equal to `value_minimum`, if specified
* if a valid `closed_at` time is specified, clients:
* MUST NOT tally late votes received after `closed_at` time