|
1 | | -# RFC-00xx: Referenda Confirmation by Candle Auction |
| 1 | +# RFC-00xx: Referenda Confirmation by Candle Mechanism |
2 | 2 |
|
3 | 3 | | | | |
4 | 4 | | --------------- | ---------------------------------------------------------------- | |
@@ -75,19 +75,26 @@ stateDiagram-v2 |
75 | 75 | rj --> [*] |
76 | 76 | ``` |
77 | 77 |
|
78 | | -This specification proposes two changes to implement this candle mechanism: |
| 78 | +This specification proposes three changes to implement this candle mechanism: |
79 | 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. |
| 80 | +1. This mechanism MUST be enabled via a configuration parameter. Once enabled, the referenda system |
| 81 | + MAY record the next poll ID from which to start enabling this mechanism. This is to preserve |
| 82 | + backwards compatibility with currently ongoing polls. |
| 83 | +1. A record of the poll status (whether it is passing or not) is stored once the decision period is |
| 84 | + finished. |
| 85 | +1. Including a **Finalization** period as part of the ongoing state. From this point, the poll MUST |
| 86 | + be immutable at this point. |
86 | 87 |
|
87 | | - After that happens, a random block within the confirm period is chosen, and the decision of |
| 88 | + This period begins the moment after confirm period ends, and extends the decision for a couple |
| 89 | + of blocks, until the [VRF][wiki:vrf] seed used to determine the candle block can be considered |
| 90 | + _"good enough"_. This is, not known before the ongoing period (decision/confirmation) was over. |
| 91 | + |
| 92 | + Once that happens, a random block within the confirm period is chosen, and the decision of |
88 | 93 | approving or rejecting the poll is based on the status immediately before the block where the |
89 | 94 | candle was _"lit-off"_. |
90 | 95 |
|
| 96 | +When enabled, the state diagram for the referenda system is the following: |
| 97 | + |
91 | 98 | ```mermaid |
92 | 99 | stateDiagram-v2 |
93 | 100 | sb: Submission |
@@ -119,28 +126,62 @@ stateDiagram-v2 |
119 | 126 | rj --> [*] |
120 | 127 | ``` |
121 | 128 |
|
122 | | -This change implies ensuring the poll cannot be mutated after . |
123 | | - |
124 | 129 | ## Drawbacks |
125 | 130 |
|
126 | | -<!-- TODO: Add if any --> |
| 131 | +This approach doesn't include a mechanism to determine whether a change of the poll status in the |
| 132 | +confirming period is due to a legitimate change of mind of the voters, or an exploitation of its |
| 133 | +aforementioned vulnerabilities (like a sniping attack), instead treating all of them as potential |
| 134 | +attacks. |
127 | 135 |
|
128 | | -## Prior Art and References |
| 136 | +This is an issue that can be addressed by additional mechanisms, and heuristics that can help |
| 137 | +determine the probability of a change of poll status to happen as a result of a legitimate behaviour. |
129 | 138 |
|
130 | | -> TODO: Mention Prior Art |
| 139 | +## Testing, Security, and Privacy |
131 | 140 |
|
132 | | -- `pallet-auction` |
| 141 | +The implementation of this RFC will be tested on testnets (Paseo and Westend) first. Furthermore, it |
| 142 | +should be enabled in a canary network (like Kusama) to ensure the behaviours it is trying to address |
| 143 | +is indeed avoided. |
133 | 144 |
|
134 | | -## Testing, Security, and Privacy |
| 145 | +An audit will be required to ensure the implementation doesn't introduce unwanted side effects. |
| 146 | + |
| 147 | +There are no privacy related concerns. |
| 148 | + |
| 149 | +## Performance, Ergonomics, and Compatibility |
| 150 | + |
| 151 | +### Performance |
| 152 | + |
| 153 | +The added steps imply pessimization, necessary to meet the expected changes. An implementation MUST |
| 154 | +exit from the **Finalization** period as early as possible to minimize this impact. |
| 155 | + |
| 156 | +### Ergonomics |
| 157 | + |
| 158 | +This proposal does not alter the already exposed interfaces or developers or end users. However, they |
| 159 | +must be aware of the changes in the additional overhead the new period might incur (these depend on the |
| 160 | +implemented VRF). |
| 161 | + |
| 162 | +### Compatibility |
| 163 | + |
| 164 | +This proposal does not break compatibility with existing interfaces, older versions, but it alters the |
| 165 | +previous implementation of the referendum processing algorithm. |
| 166 | + |
| 167 | +An acceptable upgrade strategy that can be applied is defining a point in time (block number, poll index) |
| 168 | +from which to start applying the new mechanism, thus, not affecting the already ongoing referenda. |
| 169 | + |
| 170 | +## Prior Art and References |
135 | 171 |
|
136 | | -> TODO: Mention which testing is done (and will be added on the `polkadot-sdk` PR. |
| 172 | +- [Auctions pallet][docs:polkadot-runtime-common::auctions] in [`polkadot-runtime-commont`][crates:polkadot-runtime-common]: Defines the mechanism of candle auctions. |
| 173 | +- **PBA Book**: A good place to read about [VRFs][pba:exotic-primitives]. |
137 | 174 |
|
138 | 175 | ## Unresolved Questions |
139 | 176 |
|
140 | | -<!-- TODO: Add if any --> |
| 177 | +- How to determine in a statistically meaningful way that a change in the poll status corresponds to an |
| 178 | + organic behaviour, and not an unwanted, malicious behaviour? |
141 | 179 |
|
142 | 180 | ## Future Directions and Related Material |
143 | 181 |
|
144 | | -<!-- TODO: Add if any --> |
| 182 | +A proposed implementation of this change can be seen on this [Pull Request](https://github.com/virto-network/polkadot-sdk/pull/4). |
145 | 183 |
|
| 184 | +[crates:polkadot-runtime-common]: https://crates.io/crates/polkadot-runtime-common |
| 185 | +[docs:polkadot-runtime-common::auctions]: https://docs.rs/polkadot-runtime-common/16.0.0/polkadot_runtime_common/auctions/index.html |
| 186 | +[pba:exotic-primitives]: https://polkadot-blockchain-academy.github.io/pba-book/cryptography/exotic-primitives/page.html?highlight=vrf#verifiable-random-functionsvrfs |
146 | 187 | [wiki:vrf]: https://en.wikipedia.org/wiki/Verifiable_random_function |
0 commit comments