@@ -43,38 +43,84 @@ earlier, on deciding state.
4343
4444## Explanation
4545
46- Currently, the process of a referendum/poll
46+ Currently, the process of a referendum/poll is defined as an sequence between an ongoing state
47+ (where accounts can vote), comprised by a with a preparation period, a decision period, and a
48+ confirm period. If the poll is passing before the decision period ends, it's possible to push
49+ forward to confirm period, and still, go back in case the poll fails. Once the decision period
50+ ends, a failure of the poll in the confirm period will lead to the poll to ultimately be rejected.
4751
4852``` mermaid
49- flowchart LR
50- S[Submit] --> P[Preparing]
51- P --> D[Deciding]
52- D --> |Passing| C[Confirmation]
53- C --> |Failing — while on decision period| D
54- D --> |Failing| R[Rejected]
55- C --> |Failing — after decision period| R
56- C --> A[Approved]
53+ stateDiagram-v2
54+ sb: Submission
55+ pp: Preparation Period
56+ dp: Decision Period
57+ cp: Confirmation Period
58+ state dpd <<choice>>
59+ state ps <<choice>>
60+ cf: Approved
61+ rj: Rejected
62+
63+ [*] --> sb
64+ sb --> pp
65+ pp --> dp: decision period starts
66+ dp --> cp: poll is passing
67+ dp --> ps: decision period ends
68+ ps --> cp: poll is passing
69+ cp --> dpd: poll fails
70+ dpd --> dp: decision period not deadlined
71+ ps --> rj: poll is failing
72+ dpd --> rj: decision period deadlined
73+ cp --> cf
74+ cf --> [*]
75+ rj --> [*]
5776```
5877
59- This specification proposes including a Finalization state for a poll. This state is described as
60- the moment after and extends the decision for a couple of blocks, until is safe to consider the VRF
61- used to determine the candle block is not known before the ongoing period (decision/confirmation)
62- was over.
78+ This specification proposes two changes to implement this candle mechanism:
79+
80+ 1 . Storing every change of the poll status (whether it is passing or not) once the decision period
81+ is over.
82+ 1 . Including a ** Finalization** period in the ongoing state. This period begins the moment after
83+ confirm period ends, and extends the decision for a couple of blocks, until the [ VRF] [ wiki:vrf ]
84+ seed used to determine the candle block can be considered _ "good enough"_ , this is, not known
85+ before the ongoing period (decision/confirmation) was over.
86+
87+ After that happens, a random block within the confirm period is chosen, and the decision of
88+ approving or rejecting the poll is based on the status immediately before the block where the
89+ candle was _ "lit-off"_ .
6390
6491``` mermaid
65- flowchart LR
66- S[Submit] --> P[Preparing]
67- P --> D[Deciding]
68- D --> |Passing| C[Confirmation]
69- C --> |Failing — while on decision period| D
70- D --> |Failing| R[Rejected]
71- C --> FF[Finalization]
72- FF --> |Candle on/after passing| A[Approved]
73- FF --> |Candle on/after failing| R
74-
75- style FF fill: #0a0, color: #fff
92+ stateDiagram-v2
93+ sb: Submission
94+ pp: Preparation Period
95+ dp: Decision Period
96+ cp: Confirmation Period
97+ cds: Finalization
98+ state dpd <<choice>>
99+ state ps <<choice>>
100+ state cd <<choice>>
101+ cf: Approved
102+ rj: Rejected
103+
104+ [*] --> sb
105+ sb --> pp
106+ pp --> dp: decision period starts
107+ dp --> cp: poll is passing
108+ ps --> cp: poll is passing
109+ dp --> ps: decision period ends
110+ ps --> rj: poll is failing
111+ cp --> dpd: poll fails
112+ dpd --> cp: decision period over
113+ dpd --> dp: decision period not over
114+ cp --> cds: confirmation period ends
115+ cds --> cd: define moment when candle lit-off
116+ cd --> cf: poll passed
117+ cd --> rj: poll failed
118+ cf --> [*]
119+ rj --> [*]
76120```
77121
122+ This change implies ensuring the poll cannot be mutated after .
123+
78124## Drawbacks
79125
80126<!-- TODO: Add if any -->
@@ -96,3 +142,5 @@ flowchart LR
96142## Future Directions and Related Material
97143
98144<!-- TODO: Add if any -->
145+
146+ [ wiki:vrf ] : https://en.wikipedia.org/wiki/Verifiable_random_function
0 commit comments