Skip to content

Commit ee96be1

Browse files
committed
wip: update readme
1 parent 05391fc commit ee96be1

File tree

2 files changed

+72
-15
lines changed

2 files changed

+72
-15
lines changed

README.md

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,71 @@
11
# The Signet Block Builder
22

3-
The Builder is responsible for transactions through the Signet rollup, from ingestion and simulation to block construction and submission to Ethereum L1.
3+
The Builder simulates bundles and transactions against the latest chain state to create valid Signet rollup blocks and submits them to the configured host chain as an [EIP-4844 transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md).
4+
5+
Bundles are treated as Flashbots-style bundles, meaning that the Builder should respect transaction ordering, bundle atomicity, and the specified revertability.
46

57
---
68

79
## 🚀 System Design
810

9-
The Builder orchestrates a series of asynchronous actors that work together to:
11+
The Builder orchestrates a series of asynchronous actors that work together to build blocks for every assigned slot.
1012

1113
1. **Env** - watches the latest host and rollup blocks to monitor gas rates and block updates.
1214
2. **Cache** - polls bundle and transaction caches and adds them to the cache.
13-
3. **Simulator** - simulates transactions against rollup state and block environment to build them into a cohesive block.
14-
5. **Submit** - builds a blob transaction of the built block and sends it to Ethereum L1.
15-
6. **Metrics** - records block and tx data.
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 Ethereum L1.
17+
6. **Metrics** - records block and tx data over time.
1618

1719
```mermaid
20+
%%{ init : { "theme" : "dark" } }%%
1821
flowchart TD
1922
%% ────────────── INITIALIZATION ──────────────
2023
A0(["Start main"]) --> A1[Init tracing & logging]
2124
A1 --> A2_BuilderConfig[Load BuilderConfig from env]
2225
2326
%% ────────────── CORE TASK SPAWNS ──────────────
2427
subgraph Tasks_Spawned["Spawned Actors"]
25-
EnvTaskActor["Env Task"] ==block_env==> CacheSystem
26-
CacheSystem["Cache System"]
27-
MetricsTaskActor["Metrics Task"]
28-
SubmitTaskActor["Submit Task"]
29-
SimulatorTaskActor["Simulator Task"]
28+
EnvTaskActor["🔢 Env Task"] ==block_env==> CacheSystem
29+
CacheSystem["🪏 Cache System"]
30+
MetricsTaskActor["📏 Metrics Task"]
31+
SubmitTaskActor["📡 Submit Task "]
32+
SimulatorTaskActor["💾 Simulator Task"]
33+
Quincey["🖊️ Quincey"]
34+
35+
SubmitTaskActor -.block hash.-> Quincey
36+
Quincey -.block signature.-> SubmitTaskActor
3037
end
3138
3239
%% ────────────── CONNECTIONS & DATA FLOW ──────────────
33-
A2_BuilderConfig --> A4_Providers["Connect Providers"]
40+
A2_BuilderConfig -.host_provider.-> MetricsTaskActor
41+
A2_BuilderConfig -.host_provider.->SubmitTaskActor
42+
A2_BuilderConfig -.ru_provider.-> SimulatorTaskActor
43+
A2_BuilderConfig -.host_provider.-> EnvTaskActor
44+
A2_BuilderConfig -.ru_provider.-> EnvTaskActor
3445
35-
A4_Providers -.host_provider.-> MetricsTaskActor
36-
A4_Providers -.host_provider.->SubmitTaskActor
37-
A4_Providers -.ru_provider.-> SimulatorTaskActor
46+
A3["📥 Transactions &
47+
📦 Bundles"] --> CacheSystem
3848
3949
EnvTaskActor ==block_env==> SimulatorTaskActor
4050
CacheSystem ==sim_cache ==> SimulatorTaskActor
4151
SubmitTaskActor ==tx receipt==> MetricsTaskActor
4252
SimulatorTaskActor ==built block==> SubmitTaskActor
4353
44-
SubmitTaskActor ==>|"signet block (blob tx)"| C1["Ethereum L1"]
54+
SubmitTaskActor ==>|"signet block (blob tx)"| C1["⛓️ Ethereum L1"]
4555
```
4656

57+
The block building loop waits until a new block has been received, and then kicks off the next attempt.
58+
59+
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.
60+
61+
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.
62+
63+
When the deadline is reached, the simulator is stopped, and all open simulation threads and cancelled. The block is then bundled with the block environment and the previous host header that it was simulated against, and passes all three along to the submit task.
64+
65+
If no transactions in the cache are valid and the resulting block is empty, the submit task will ignore it.
66+
67+
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.
68+
4769
---
4870

4971
## ⚙️ Configuration
@@ -73,6 +95,36 @@ The Builder is configured via environment variables. The following values are su
7395

7496
---
7597

98+
## 💾 EVM Behavior
99+
100+
### 🗿 Inherited Header Values
101+
102+
`PREVRANDAO` is set to a random byte string for each block.
103+
104+
```rust
105+
// `src/tasks/env.rs`
106+
prevrandao: Some(B256::random()),
107+
```
108+
109+
`TIMESTAMP` - Block timestamps are set to the same value as the current Ethereum block.
110+
111+
Blob gas values `excess_blob_gas` and `blob_gasprice` are also set to 0 for all Signet blocks.
112+
113+
### 🔢 Disabled Opcodes
114+
115+
`BLOBHASH` - EIP-4844 is not supported on Signet.
116+
`BLOBBASEFEE` - EIP4844 is not supported.
117+
118+
## ⛽ Transaction Submission
119+
120+
When a completed, non-empty Signet block is received by the Submit task, it prepares the block data into a blob transaction and submits it to the network.
121+
122+
If it fails, it will retry up to 3 times with a 12.5% bump on each retry.
123+
124+
The previous header's basefee is tracked through the build loop and used for gas estimation purposes in the Submit Task.
125+
126+
---
127+
76128
## 📤 Transaction Sender
77129

78130
A binary (`bin/submit-transaction.rs`) for continously sending very small transactions for testing block construction.
@@ -87,6 +139,10 @@ The following values are available for configuring the transaction sender:
87139
| `SIGNER_CHAIN_ID` | Yes | Chain ID used for signing |
88140
| `SIGNER_KEY` | Yes | Signing key used to sign the transaction |
89141

142+
The transaction submitter is located at `bin/submit_transaction.rs`.
143+
144+
Run the transaction submitter with `cargo run --bin transaction-submitter`
145+
90146
---
91147

92148
## 🛠️ Development

src/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub fn setup_test_config() -> Result<BuilderConfig> {
4545
1740681556, // pecorino start timestamp as sane default
4646
0, 1,
4747
),
48+
block_confirmation_buffer: todo!(),
4849
};
4950
Ok(config)
5051
}

0 commit comments

Comments
 (0)