Commit 6659441
committed
markets/: fix a zero-payout burn and a loser-triggered void
Fifth review round produced two working proof-of-concepts, both mine.
Round 4 made an oracle-initiated void a proposal so holders could object
to a cancellation they can only lose on. That added a lifecycle state
with no resolvedOutcome -- and every settlement path that assumed one
then computed shares[undefined] -> NaN, which Math.max(0, Math.floor())
turns into a silent zero. Upholding a disputed void proposal, or letting
its grace expire, paid every holder nothing and burned the whole pool to
the house, while conservation balanced perfectly the entire time. A
payout that is not a finite number now throws instead of flooring, a
market with no declared outcome cannot be resolved at all, and uphold
now means whatever the oracle actually proposed.
Separately, the dead-oracle backstop computed staleness from timestamps
alone, ignoring lifecycle state. A market that had been correctly
resolved and was merely past closesAt + settlementWindow could be voided
by any authenticated agent -- a loser refunding their own losing bet
with no bond, no dispute, not the oracle, not an admin, erasing the
winner's payout. The backstop is for an oracle that never acted; one
that acted is not dead.
Also: disputeWindowMs >= settlementWindowMs is now a boot failure,
because that ordering put every resolution inside the backstop window;
disputeBondBps and the rate-limit config are validated like every other
load-bearing value; /settle and /dispute advance only the market named
in the path, which is both immediate and O(1) -- throttling /settle had
quietly turned an explicit 'settle now' into a no-op; the dispute grace
clock anchors to the latest dispute rather than the first, which was
handing late disputers a zero-length window and keeping their bond; and
the WebSocket upgrade uses the same origin resolution as HTTP.
69 plugin tests, 39 compose tests.1 parent 5db70c9 commit 6659441
4 files changed
Lines changed: 193 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
174 | 192 | | |
175 | 193 | | |
176 | 194 | | |
| |||
214 | 232 | | |
215 | 233 | | |
216 | 234 | | |
217 | | - | |
| 235 | + | |
218 | 236 | | |
219 | 237 | | |
220 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
117 | 124 | | |
118 | 125 | | |
119 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
| |||
154 | 166 | | |
155 | 167 | | |
156 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
157 | 190 | | |
158 | 191 | | |
159 | 192 | | |
160 | 193 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 194 | + | |
174 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
175 | 199 | | |
176 | 200 | | |
177 | 201 | | |
178 | 202 | | |
179 | 203 | | |
180 | | - | |
| 204 | + | |
181 | 205 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
176 | 194 | | |
177 | 195 | | |
178 | 196 | | |
| |||
190 | 208 | | |
191 | 209 | | |
192 | 210 | | |
193 | | - | |
| 211 | + | |
194 | 212 | | |
195 | 213 | | |
196 | 214 | | |
| |||
496 | 514 | | |
497 | 515 | | |
498 | 516 | | |
499 | | - | |
| 517 | + | |
500 | 518 | | |
501 | 519 | | |
502 | 520 | | |
| |||
511 | 529 | | |
512 | 530 | | |
513 | 531 | | |
514 | | - | |
| 532 | + | |
515 | 533 | | |
516 | 534 | | |
517 | 535 | | |
| |||
965 | 983 | | |
966 | 984 | | |
967 | 985 | | |
968 | | - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
969 | 990 | | |
970 | 991 | | |
971 | 992 | | |
| |||
985 | 1006 | | |
986 | 1007 | | |
987 | 1008 | | |
988 | | - | |
| 1009 | + | |
989 | 1010 | | |
990 | 1011 | | |
991 | 1012 | | |
| |||
1022 | 1043 | | |
1023 | 1044 | | |
1024 | 1045 | | |
1025 | | - | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1026 | 1050 | | |
1027 | 1051 | | |
1028 | 1052 | | |
| |||
1159 | 1183 | | |
1160 | 1184 | | |
1161 | 1185 | | |
| 1186 | + | |
1162 | 1187 | | |
1163 | | - | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1164 | 1192 | | |
1165 | 1193 | | |
1166 | 1194 | | |
1167 | 1195 | | |
1168 | 1196 | | |
1169 | 1197 | | |
1170 | 1198 | | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1171 | 1202 | | |
1172 | 1203 | | |
1173 | | - | |
| 1204 | + | |
1174 | 1205 | | |
1175 | 1206 | | |
1176 | 1207 | | |
| |||
0 commit comments