Commit 4fc63db
authored
fix: Stop relying on account metadata for
Stop relying on `account.metadata.snap.enabled` for
`MultichainRoutingService` as it is going away. Instead we can
cross-check `getRunnableSnaps`.
While doing this fix I also managed to re-use
`getSupportedAccountsMetadata` in more cases.
https://consensyssoftware.atlassian.net/browse/WPC-988
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes routing eligibility checks for account Snaps by
cross-referencing `SnapController:getRunnableSnaps`, which could impact
which accounts/methods are considered routable if Snap/account metadata
is inconsistent. Touches request routing and scope support detection, so
regressions would affect multichain RPC handling.
>
> **Overview**
> Stops relying on `account.metadata.snap.enabled` (and other snap
metadata fields) to decide whether an account Snap can service a
request, and instead gates supported accounts by whether their
`metadata.snap.id` appears in `SnapController:getRunnableSnaps`.
>
> Refactors `MultichainRoutingService` to reuse
`#getSupportedAccountsMetadata` for both request routing
(`#getSnapAccountId`) and `isSupportedScope`, and extends it with an
optional `method` filter.
>
> Updates multichain test fixtures and `InternalAccount` typing to
remove the deprecated `metadata.snap.enabled`/`name` fields, and adjusts
tests to mock `SnapController:getRunnableSnaps` (including updated call
ordering expectations).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a5425d0. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->MultichainRoutingService (#3974)1 parent 581474c commit 4fc63db
4 files changed
Lines changed: 77 additions & 23 deletions
File tree
- packages
- snaps-controllers/src
- multichain
- test-utils
- snaps-utils/src
Lines changed: 50 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| |||
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
93 | 107 | | |
94 | 108 | | |
95 | 109 | | |
| |||
142 | 156 | | |
143 | 157 | | |
144 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
145 | 166 | | |
146 | 167 | | |
147 | 168 | | |
| |||
231 | 252 | | |
232 | 253 | | |
233 | 254 | | |
234 | | - | |
| 255 | + | |
235 | 256 | | |
236 | 257 | | |
237 | 258 | | |
| |||
302 | 323 | | |
303 | 324 | | |
304 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
305 | 333 | | |
306 | 334 | | |
307 | 335 | | |
| |||
352 | 380 | | |
353 | 381 | | |
354 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
355 | 390 | | |
356 | 391 | | |
357 | 392 | | |
| |||
405 | 440 | | |
406 | 441 | | |
407 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
408 | 450 | | |
409 | 451 | | |
410 | 452 | | |
| |||
577 | 619 | | |
578 | 620 | | |
579 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
580 | 629 | | |
581 | 630 | | |
582 | 631 | | |
| |||
Lines changed: 26 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 169 | + | |
180 | 170 | | |
181 | 171 | | |
182 | 172 | | |
| |||
349 | 339 | | |
350 | 340 | | |
351 | 341 | | |
| 342 | + | |
352 | 343 | | |
353 | 344 | | |
354 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
358 | 367 | | |
359 | 368 | | |
360 | 369 | | |
| |||
395 | 404 | | |
396 | 405 | | |
397 | 406 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | 407 | | |
402 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
403 | 412 | | |
404 | 413 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | | - | |
54 | 51 | | |
55 | | - | |
56 | 52 | | |
57 | 53 | | |
58 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments