Select a state rule
Alice proposes lunch. Bob and Carol vote for Sushi. Bob changes his vote to Pizza. The history now contains three vote acts from two voters. Each option has one current vote.
| Reader’s question | Rule or combination | Result for this history |
|---|---|---|
| What did Alice ask? | initial on the proposal’s question | The opener’s question |
| Has anyone voted? | exists on vote | True |
| How many eligible vote acts occurred? | count on vote | Three |
| Which choices appeared? | set-union over the choice field | Sushi and Pizza |
| What is each voter’s current choice? | lww-per-signer on choice and clock | Bob → Pizza, Carol → Sushi |
| How many voters selected each option in their current ballots? | histogram of those ballots | One for each option |
Keep the inputs for replay
A tally alone cannot tell which voter changed their mind. Record the authenticated acts. Calculate the current ballot for each signer. Count those ballots. When a client connects again, a duplicate address adds no act. A new vote by the same signer can move one count from Sushi to Pizza.
Select a conflict policy
Use a last-writer-wins register if the application must select one value in the order that the dialect specifies. Use a multi-value register if the reader must see competing edits. A subsequent act can supersede the edits. For a collection with removals, an observed set lets a removal cite the additions it saw. A concurrent addition can survive if the remover did not see it.
The poll definition also declares a domain. Its domain limits each vote contribution to a choice offered in the opener. The same act can be correctly shaped and causally admissible yet contribute to none of the vote-derived fields.
Decide when a read is final
Two receivers can have the same tally now. A subsequent vote can change that tally. An exists field becomes true when a qualifying act arrives. A tally can increase or decrease when voters change their ballots.
If a result must refer to a closing act, add a closing step to the protocol. Check the freeze rule for the effect of concurrent closing acts.
For rule signatures, thresholds, freezes and bounded resources, consult the state language reference.