Commit 72c806d
authored
serviceability: add SubscribeFeed and UnsubscribeFeed for EdgeSeat feeds (#4113)
Resolves #4109
## Summary
- New `SubscribeFeed` (117) and `UnsubscribeFeed` (118) instructions
join or leave whole feeds on an EdgeSeat access pass, in one atomic
transaction. Seats are charged per feed, not per group.
- A feed is all-or-nothing: the caller names feeds, the processor
derives which groups change, and a group list that does not match is
rejected so a stale client cannot half-apply. Because a seat follows the
feed the caller named rather than being inferred from group membership,
two feeds carrying the same group stay unambiguous — leaving one keeps
the shared group and releases only that feed's seat.
- An unsubscribe must pass every feed the user holds. Without the
retained feeds' group sets the processor cannot tell that a departing
feed is dropping a group another held feed still covers, so it rejects
rather than stranding that feed's seat.
- `UpdateMulticastGroupRoles` now enforces the multicast-group
allowlists for every access-pass type, EdgeSeat included, which
previously bypassed both. Purchased groups go through the feed
instructions and charge a seat; individually comped groups go through
the allowlist and charge nothing.
- `CreateSubscribeUser` skips the allowlist only for the case
`create_user_core`'s feed gate actually covers, and always checks the
publisher allowlist. Two paths could previously join a group with no
check at all: an EdgeSeat pass creating a non-multicast user, and an
EdgeSeat multicast user taking a publisher role on a feed group it only
bought receive rights to.
Not breaking: no EdgeSeat pass exists on mainnet-beta, and the EdgeSeat
path through `UpdateMulticastGroupRoles` was already unreachable — no
builder emitted the device account its coverage check required, so every
such call failed with `MetroMismatch`.
Must land before #4110 (naked `CreateUser`), or naked EdgeSeat users
could reach any group through an ungated `UpdateMulticastGroupRoles`.
## Testing Verification
- Seat accounting: a feed's whole group set joins for one seat (cap set
to 1, so a per-group tick would surface as `FeedSeatFull`); a second
feed takes its own seat; two feeds join in one transaction; leaving
releases the seat.
- `test_leaving_a_feed_keeps_a_group_a_retained_feed_covers`: two feeds
both carry g0, the user leaves one, keeps g0 via the retained feed, and
only the departing feed's seat is released.
- `test_leave_omitting_a_held_feed_rejected`: a leave that omits a held
feed is refused instead of stranding its seat.
- `test_seat_cap_rejects_a_second_machine` fills a one-user feed with a
real second user on the same dynamic pass, rather than a synthetic full
seat.
- Regression suites green for the paths whose authorization moved:
`create_subscribe_user_test`, `multicastgroup_subscribe_test`,
`feed_metro_gate_test`.1 parent b7c44cc commit 72c806d
14 files changed
Lines changed: 1815 additions & 61 deletions
File tree
- crates/doublezero-serviceability-instruction/src
- smartcontract/programs/doublezero-serviceability
- src
- processors
- feed
- multicastgroup
- user
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
201 | 288 | | |
202 | 289 | | |
203 | 290 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
427 | 429 | | |
428 | 430 | | |
429 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
430 | 438 | | |
431 | 439 | | |
432 | 440 | | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
| |||
314 | 322 | | |
315 | 323 | | |
316 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
317 | 329 | | |
318 | 330 | | |
319 | 331 | | |
| |||
421 | 433 | | |
422 | 434 | | |
423 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
424 | 440 | | |
425 | 441 | | |
426 | 442 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
256 | 261 | | |
257 | 262 | | |
258 | 263 | | |
| |||
401 | 406 | | |
402 | 407 | | |
403 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
404 | 412 | | |
405 | 413 | | |
406 | 414 | | |
| |||
550 | 558 | | |
551 | 559 | | |
552 | 560 | | |
| 561 | + | |
| 562 | + | |
553 | 563 | | |
554 | 564 | | |
555 | 565 | | |
| |||
692 | 702 | | |
693 | 703 | | |
694 | 704 | | |
| 705 | + | |
| 706 | + | |
695 | 707 | | |
696 | 708 | | |
697 | 709 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments