Commit 7565626
refactor(evm-wallet-experiment): split coordinator-vat into home/away (#939)
Splits the monolithic 3,275-line `coordinator-vat` into four focused
components — home coordinator, away coordinator, delegator vat, and
redeemer vat — and replaces raw caveat bytes with a discriminated union
of decoded semantic grant types.
**Architecture before:**
```
coordinator-vat (3,275 lines) — home and away concerns mixed together
delegation-vat (211 lines) — limited grant handling
delegation-grant.ts — builds grants from raw CaveatSpec arrays
```
**Architecture after:**
```
home-coordinator (2,388 lines) — keyring, signing, delegation building, peer-relay relay
delegator-vat (245 lines) — caveat encoding, unsigned grant construction
away-coordinator (1,999 lines) — grant reception, typed delegation routing
redeemer-vat (57 lines) — away-side grant storage
delegation-twin — semantic execution wrapper per grant
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **High Risk**
> Large refactor touching core wallet execution/routing and delegation
redemption paths (UserOps, direct tx submission, spend limits), with
significant behavioral surface area and risk of regressions across
home/away flows.
>
> **Overview**
> Splits the wallet subcluster’s coordinator responsibilities by
introducing role-based clustering: `makeWalletClusterConfig` now selects
`home-coordinator` vs `away-coordinator` bundles and swaps the auxiliary
vat to `delegator` (home) or `redeemer` (away), with updated tests and
build bundling.
>
> Replaces the prior raw `DelegationGrant`/`CaveatSpec`-driven twin flow
with **semantic, discriminated grant types** (`TransferNativeGrant`,
`TransferFungibleGrant`) and a simplified `METHOD_CATALOG`; removes the
`delegation-grant` builder module and rewrites `makeDelegationTwin` to
enforce per-grant interface guards plus local spend/limit tracking.
>
> Adds an `away-coordinator` vat implementing away-side routing, grant
receipt/storage integration, and redemption execution paths (incl.
ERC-4337/UserOp vs direct 7702 submission) plus new shared `tx-utils`
helpers for gas/result validation.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
088e26c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent d54aa5c commit 7565626
37 files changed
Lines changed: 4561 additions & 9096 deletions
File tree
- packages/evm-wallet-experiment
- src
- lib
- vats
- test
- e2e
- docker
- helpers
- integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
Lines changed: 42 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
21 | 47 | | |
22 | 48 | | |
23 | 49 | | |
| |||
40 | 66 | | |
41 | 67 | | |
42 | 68 | | |
43 | | - | |
44 | | - | |
| 69 | + | |
45 | 70 | | |
46 | 71 | | |
47 | | - | |
| 72 | + | |
48 | 73 | | |
| 74 | + | |
49 | 75 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
55 | 82 | | |
56 | 83 | | |
57 | | - | |
| 84 | + | |
58 | 85 | | |
59 | 86 | | |
| 87 | + | |
60 | 88 | | |
61 | 89 | | |
62 | 90 | | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
66 | 94 | | |
67 | | - | |
| 95 | + | |
68 | 96 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
| |||
82 | 102 | | |
83 | 103 | | |
84 | 104 | | |
85 | | - | |
| 105 | + | |
86 | 106 | | |
87 | 107 | | |
88 | 108 | | |
89 | 109 | | |
90 | | - | |
91 | 110 | | |
92 | 111 | | |
93 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | | - | |
11 | | - | |
| 8 | + | |
12 | 9 | | |
13 | 10 | | |
14 | 11 | | |
| |||
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | | - | |
| 25 | + | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
37 | 54 | | |
38 | 55 | | |
39 | | - | |
| 56 | + | |
40 | 57 | | |
41 | 58 | | |
42 | 59 | | |
| |||
50 | 67 | | |
51 | 68 | | |
52 | 69 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 70 | + | |
60 | 71 | | |
61 | 72 | | |
62 | 73 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | 187 | | |
192 | 188 | | |
0 commit comments