Skip to content

Commit caecb96

Browse files
committed
cleanup
1 parent 5f8d0ef commit caecb96

File tree

2 files changed

+67
-66
lines changed

2 files changed

+67
-66
lines changed

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,82 +8,88 @@ Bundles are treated as Flashbots-style bundles, meaning that the Builder should
88

99
## 🚀 System Design
1010

11-
The Builder orchestrates a set of asynchronous actors that collaborate to build and submit Signet rollup blocks for every assigned slot. The core components are:
11+
The Builder orchestrates a series of asynchronous actors that work together to build blocks for every assigned slot.
1212

13-
1. **Env** watches host and rollup chain headers and maintains the block environment used for simulation.
14-
2. **Cache** — ingests transactions and bundles from configured sources and exposes a simulation view.
15-
3. **Simulator** — applies transactions and bundles against the rollup state and block environment to assemble a candidate Signet block.
16-
4. **Submit** — takes a successfully built block and routes it to the configured submission path (either a private MEV bundle relay or direct L1 broadcast via the builder helper).
17-
5. **Metrics** — records runtime metrics, submit receipts, and block statistics.
18-
19-
Below is a high-level architecture diagram that shows both submission options: direct L1 submission (Builder Helper) and private MEV bundle submission (Flashbots relay).
13+
1. **Env** - watches the latest host and rollup blocks to monitor gas rates and block updates.
14+
2. **Cache** - polls bundle and transaction caches and adds them to the cache.
15+
3. **Simulator** - simulates transactions and bundles against rollup state and block environment to build them into a cohesive block.
16+
5. **Submit** - creates a blob transaction from the built block and sends it to the configured submit task.
17+
1. Flashbots - builds a Flashbots bundle out of the Signet block which contains Signet transactions, host transactions, and host fills, and submits it to the configured Flashbots endpoint.
18+
2. Builder Helper - builds a transaction call with the builder helper contract and submits that as a transaction.
19+
6. **Metrics** - records block and tx data over time.
2020

2121
```mermaid
22-
%%{ init : { "theme" : "dark", "flowchart": {"curve":"basis"} } }%%
22+
%%{ init : { "theme" : "dark" } }%%
2323
flowchart TD
24-
%% Initialization
25-
start(["Start main"]) --> init["Init tracing & logging"]
26-
init --> cfg["Load BuilderConfig from env"]
27-
28-
%% Spawned actors
29-
subgraph Actors["Spawned Actors"]
30-
Env["🔢 Env Task"]
31-
Cache["🪏 Cache System"]
32-
Simulator["� Simulator Task"]
33-
SubmitBH["📡 Submit Task (BuilderHelper)"]
34-
SubmitFB["�️ Submit Task (Flashbots)"]
35-
Metrics["📏 Metrics Task"]
36-
Quincey["🖊️ Quincey (Signer)"]
37-
end
38-
39-
%% Config wiring
40-
cfg -.-> Metrics
41-
cfg -.-> SubmitBH
42-
cfg -.-> Simulator
43-
cfg -.-> Env
44-
cfg -. "flashbots_endpoint" -> SubmitFB
45-
46-
%% Data flow
47-
inbound["📥 Transactions & Bundles"] --> Cache
48-
Env ==block_env==> Simulator
49-
Cache ==sim_cache==> Simulator
50-
Simulator["💾 Simulator Task"]
51-
Simulator ==built_block==> SubmitFB
52-
SubmitFB["🛡️ Submit Task (Flashbots)"]
53-
SubmitBH ==tx_receipt==> Metrics
54-
SubmitFB ==bundle_receipt==> Metrics
55-
56-
%% Signing interactions
57-
SubmitBH -.block_hash.-> Quincey
58-
Quincey -.block_signature.-> SubmitBH
59-
SubmitFB -.bundle_hash.-> Quincey
60-
Quincey -.bundle_signature.-> SubmitFB
61-
62-
%% External targets
63-
cfg -."flashbots_endpoint".-> SubmitFB
64-
SubmitFB -->|"MEV bundle"| Relay["🛡️ Flashbots Relay"]
65-
66-
classDef ext fill:#111,stroke:#bbb,color:#fff;
67-
class L1,Relay ext
24+
%% ────────────── INITIALIZATION ──────────────
25+
A0(["Start main"]) --> A1[Init tracing & logging]
26+
A1 --> A2_BuilderConfig[Load BuilderConfig from env]
27+
28+
A4_Quincey["🖊️ Quincey"]
29+
30+
A3["📥 Transactions &
31+
📦 Bundles"] --> CacheTask
32+
33+
%% ────────────── CORE TASK SPAWNS ──────────────
34+
subgraph Tasks_Spawned["Spawned Actors"]
35+
EnvTaskActor["🔢 Env Task"] ==block env==>CacheTask
36+
CacheTask["🪏 Cache Task"]
37+
MetricsTaskActor["📏 Metrics Task"]
38+
SubmitTaskActor["📡 Submit Task "]
39+
SimulatorTaskActor["💾 Simulator Task"]
40+
41+
%% ────────────── Transaction Preparation ──────────────
42+
subgraph TxPrep["Transaction Prep"]
43+
Bumpable["⛽ Bumpable Tx"]
44+
end
45+
end
46+
47+
%% ────────────── CONNECTIONS & DATA FLOW ──────────────
48+
A2_BuilderConfig -.host rpc.-> MetricsTaskActor
49+
A2_BuilderConfig -.host rpc.->SubmitTaskActor
50+
A2_BuilderConfig -.host rpc.-> SimulatorTaskActor
51+
A2_BuilderConfig -.host rpc.-> TxPrep
52+
A2_BuilderConfig -.rollup rpc.-> SimulatorTaskActor
53+
A2_BuilderConfig -.rollup rpc.-> EnvTaskActor
54+
55+
56+
SubmitTaskActor ==tx receipt==> MetricsTaskActor
57+
SubmitTaskActor ==> TxPrep
58+
59+
C2 == "tx bundle" ==> C1
60+
61+
TxPrep -.block hash.-> A4_Quincey
62+
A4_Quincey -.block signature.-> TxPrep
63+
64+
65+
EnvTaskActor ==block env==> SimulatorTaskActor
66+
CacheTask ==sim cache ==> SimulatorTaskActor
67+
SimulatorTaskActor ==built block==> SubmitTaskActor
68+
69+
TxPrep ==>|"signet block"| C1["⛓️ Ethereum L1"]
70+
TxPrep ==>|"signet block"| C2["⚡🤖 Flashbots"]
71+
6872
```
6973

7074
### Simulation Task
7175

72-
The simulation loop waits for a new block environment from the host chain, then starts a simulation window for the current slot. The Builder takes a reference to the transaction cache and computes a deadline (default: slot end minus 1.5s buffer) to stop simulating and finalize the block.
76+
The block building loop waits until a new block environment has been received, and then kicks off the next attempt.
7377

74-
Transactions flow from the cache into the simulator. Applied transactions are kept and assembled into the candidate block; failing transactions are ignored. When the simulation deadline arrives, the simulator cancels remaining work, captures the built block and the block environment it was simulated against, and forwards them to the Submit task.
78+
When the Builder receives a new block, it takes a reference to the transaction cache, calculates a simulation deadline for the current slot with a buffer of 1.5 seconds, and begins constructing a block for the current slot.
7579

76-
### Submit Task
80+
Transactions enter through the cache, and then they're sent to the simulator, where they're run against the latest chain state and block environment. If they're successfully applied, they're added to the block. If a transaction fails to be applied, it is simply ignored.
7781

78-
The Submit task will route the built block to one of two paths, depending on configuration:
82+
When the deadline is reached, the simulator is stopped, and all open simulation threads are cancelled. The built block is then bundled with the block environment and the previous host header that it was simulated against, and all three are passed along to the submit task.
83+
84+
### Submit Task
7985

80-
- Flashbots (private MEV relay): when `FLASHBOTS_ENDPOINT` is configured, the Submit task prepares an MEV-style bundle containing the Signet block (plus any host transactions/fills as needed) and submits it to the configured relay. The builder expects a bundle hash in the response and records it in metrics.
86+
If Flashbots endpoint has been configured the Flashbots submit task will prepare a Flashbots bundle out of that Signet block, and then submits that bundle to the Flashbots endpoint.
8187

82-
- Builder Helper (direct L1 broadcast): when no Flashbots endpoint is configured, the Submit task composes a builder-helper contract call and broadcasts it to the mempool as a normal transaction. This path is intended for testing and private deployments; broadcasting raw Signet block data publicly may leak sensitive information.
88+
If a Flashbots endpoint has _not_ been configured, the Builder will create a raw contract call and submits the transaction to the default mempool. This is only for testing on private networks and should not be used in production, since it can leak sensitive transaction data from the Signet block.
8389

84-
If the simulated block is empty, the Submit task will drop it and continue.
90+
If the block received from simulation is empty, the submit task will ignore it.
8591

86-
If the submit path requires a signature (Quincey), the submit task requests one; on an authorization failure (e.g. 403) the submit task will skip the slot and resume on the next.
92+
Finally, if it's non-empty, the submit task attempts to get a signature for the block, and if it fails due to a 403 error, it will skip the current slot and begin waiting for the next block.
8793

8894
---
8995

0 commit comments

Comments
 (0)