You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+28-33Lines changed: 28 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,6 @@ Build and evolve a **sequencer prototype** for a future DeFi stack.
8
8
9
9
Current scope is intentionally small: a **dummy wallet app** that supports:
10
10
-`Transfer`
11
-
-`Deposit`
12
11
-`Withdrawal`
13
12
14
13
Primary objective in this phase: make sequencer behavior, safety checks, and persistence reliable before adding "real world" execution logic.
@@ -26,36 +25,42 @@ Primary objective in this phase: make sequencer behavior, safety checks, and per
26
25
## Glossary
27
26
28
27
-`chunk`: small bounded list of user ops processed/executed and persisted together to amortize SQLite cost and keep low-latency ack behavior.
29
-
-`frame`: canonical ordering boundary that contains user ops plus a `drain_n` decision for direct-input execution.
28
+
-`frame`: canonical ordering boundary that commits a `safe_block` plus a list of user ops; canonical execution drains all direct inputs safe at that block before executing the frame’s user ops.
30
29
-`batch`: list of frames that will be posted on-chain as one unit.
31
30
-`inclusion lane`: the hot-path single-lane loop that dequeues user ops, executes app logic, persists ordering, and rotates frame/batch boundaries.
32
31
33
32
## Architecture Map
34
33
35
-
-`sequencer/src/main.rs`: process bootstrap, env config, queue wiring, HTTP server.
-`benchmarks/src/`: benchmark harnesses and self-contained benchmark runtime.
48
51
49
52
## Domain Truths (Important)
50
53
51
54
- This is a **sequencer prototype**, not a full DeFi stack yet.
52
55
- API validates signature and enqueues signed `UserOp`; method decoding happens during application execution.
56
+
- Deposits are direct-input-only (L1 -> L2) and must not be represented as user ops.
53
57
- Rejections (`InvalidNonce`, fee cap too low, insufficient gas balance) produce no state mutation and are not persisted.
54
58
- Included txs are persisted as frame/batch data in `batches`, `frames`, `user_ops`, `direct_inputs`, and `sequenced_l2_txs`.
55
59
- Frame fee is persisted in `frames.fee` and is fixed for the lifetime of that frame.
56
60
- The next frame fee is sampled from `recommended_fees` when rotating to a new frame (default bootstrap value is `0`).
57
-
-`/ws/subscribe` has soft operational guardrails: subscriber cap (`SEQ_WS_MAX_SUBSCRIBERS`, default `64`) and catch-up cap (`SEQ_WS_MAX_CATCHUP_EVENTS`, default `50000`).
61
+
-`/ws/subscribe`currently has internal guardrails: subscriber cap `64`, catch-up cap `50000`.
58
62
- Wallet state (balances/nonces) is in-memory right now (not persisted).
63
+
- EIP-712 domain name/version are fixed in code; chain ID and verifying contract are deployment-specific inputs.
59
64
60
65
## Hot-Path Invariants
61
66
@@ -69,7 +74,7 @@ Primary objective in this phase: make sequencer behavior, safety checks, and per
69
74
70
75
- Storage model is append-oriented; avoid mutable status flags for open/closed entities.
71
76
- Open batch/frame are derived by “latest row” convention.
72
-
-`drain_n`is derivable from `sequenced_l2_txs`by counting direct-input rows per frame.
77
+
-A frame’s leading direct-input prefix is derivable from `sequenced_l2_txs`plus `frames.safe_block`.
73
78
- Safe cursor/head values should be derived from persisted facts when possible, not duplicated as mutable fields.
74
79
- Replay/catch-up must use persisted ordering plus persisted frame fee (`frames.fee`) to mirror inclusion semantics.
75
80
- Included user-op identity is constrained by `UNIQUE(sender, nonce)`.
0 commit comments