Commit 8571a4d
authored
perf: Move request inspection outside of the executor (#3356)
In the current implementation, every RPC request requires a least 3
messages to be sent to manage outbound request/response tracking. This
PR proposes to move that tracking to the client side where we can simply
monitor the RPC stream for requests and responses. This should alleviate
some pressure on the communication layer for Snaps.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Shift outbound request/response tracking to AbstractExecutionService
by inspecting the JSON-RPC stream, removing executor-side notifications
and updating tests accordingly.
>
> - **Controllers (`packages/snaps-controllers`)**:
> - Update `AbstractExecutionService` to detect outbound activity by
inspecting `rpc` stream:
> - Publish `ExecutionService:outboundRequest` on inbound RPC chunks
with an `id`.
> - Intercept `rpcStream.write` to publish
`ExecutionService:outboundResponse` when writing responses; ignore
`metamask_chainChanged`.
> - **Execution Environment (`packages/snaps-execution-environments`)**:
> - Remove `OutboundRequest`/`OutboundResponse` notifications from
`BaseSnapExecutor` provider wrappers (`snap.request`,
`ethereum.request`) and simplify teardown handling.
> - Adjust `BaseSnapExecutor.test.browser.ts` to drop expectations for
command-stream outbound notifications where applicable, keeping RPC flow
assertions intact.
> - **Coverage**: Minor metric fluctuations in coverage JSON files.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8b9e40f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 222928d commit 8571a4d
File tree
5 files changed
+33
-156
lines changed- packages
- snaps-controllers
- src/services
- snaps-execution-environments
- src/common
5 files changed
+33
-156
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
310 | 311 | | |
311 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
312 | 335 | | |
313 | 336 | | |
314 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
Lines changed: 0 additions & 108 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 192 | | |
199 | 193 | | |
200 | 194 | | |
| |||
216 | 210 | | |
217 | 211 | | |
218 | 212 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 213 | | |
226 | 214 | | |
227 | 215 | | |
| |||
255 | 243 | | |
256 | 244 | | |
257 | 245 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | 246 | | |
265 | 247 | | |
266 | 248 | | |
| |||
282 | 264 | | |
283 | 265 | | |
284 | 266 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | 267 | | |
292 | 268 | | |
293 | 269 | | |
| |||
369 | 345 | | |
370 | 346 | | |
371 | 347 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | 348 | | |
379 | 349 | | |
380 | 350 | | |
| |||
396 | 366 | | |
397 | 367 | | |
398 | 368 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | 369 | | |
406 | 370 | | |
407 | 371 | | |
| |||
437 | 401 | | |
438 | 402 | | |
439 | 403 | | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | 404 | | |
447 | 405 | | |
448 | 406 | | |
| |||
471 | 429 | | |
472 | 430 | | |
473 | 431 | | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | 432 | | |
481 | 433 | | |
482 | 434 | | |
| |||
808 | 760 | | |
809 | 761 | | |
810 | 762 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | 763 | | |
818 | 764 | | |
819 | 765 | | |
| |||
841 | 787 | | |
842 | 788 | | |
843 | 789 | | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | 790 | | |
851 | 791 | | |
852 | 792 | | |
| |||
885 | 825 | | |
886 | 826 | | |
887 | 827 | | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | 828 | | |
895 | 829 | | |
896 | 830 | | |
| |||
920 | 854 | | |
921 | 855 | | |
922 | 856 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | 857 | | |
930 | 858 | | |
931 | 859 | | |
| |||
2075 | 2003 | | |
2076 | 2004 | | |
2077 | 2005 | | |
2078 | | - | |
2079 | | - | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
2084 | 2006 | | |
2085 | 2007 | | |
2086 | 2008 | | |
| |||
2120 | 2042 | | |
2121 | 2043 | | |
2122 | 2044 | | |
2123 | | - | |
2124 | | - | |
2125 | | - | |
2126 | | - | |
2127 | | - | |
2128 | | - | |
2129 | 2045 | | |
2130 | 2046 | | |
2131 | 2047 | | |
| |||
2184 | 2100 | | |
2185 | 2101 | | |
2186 | 2102 | | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
2192 | | - | |
2193 | 2103 | | |
2194 | 2104 | | |
2195 | 2105 | | |
| |||
2232 | 2142 | | |
2233 | 2143 | | |
2234 | 2144 | | |
2235 | | - | |
2236 | | - | |
2237 | | - | |
2238 | | - | |
2239 | | - | |
2240 | | - | |
2241 | 2145 | | |
2242 | 2146 | | |
2243 | 2147 | | |
| |||
2278 | 2182 | | |
2279 | 2183 | | |
2280 | 2184 | | |
2281 | | - | |
2282 | | - | |
2283 | | - | |
2284 | | - | |
2285 | | - | |
2286 | | - | |
2287 | 2185 | | |
2288 | 2186 | | |
2289 | 2187 | | |
| |||
2308 | 2206 | | |
2309 | 2207 | | |
2310 | 2208 | | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | 2209 | | |
2318 | 2210 | | |
2319 | 2211 | | |
| |||
Lines changed: 2 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
| 532 | + | |
552 | 533 | | |
553 | 534 | | |
554 | 535 | | |
| |||
574 | 555 | | |
575 | 556 | | |
576 | 557 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
| 558 | + | |
597 | 559 | | |
598 | 560 | | |
599 | 561 | | |
| |||
0 commit comments