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: README.md
+71-15Lines changed: 71 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,49 +1,71 @@
1
1
# The Signet Block Builder
2
2
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.
4
6
5
7
---
6
8
7
9
## 🚀 System Design
8
10
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.
10
12
11
13
1.**Env** - watches the latest host and rollup blocks to monitor gas rates and block updates.
12
14
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.
16
18
17
19
```mermaid
20
+
%%{ init : { "theme" : "dark" } }%%
18
21
flowchart TD
19
22
%% ────────────── INITIALIZATION ──────────────
20
23
A0(["Start main"]) --> A1[Init tracing & logging]
21
24
A1 --> A2_BuilderConfig[Load BuilderConfig from env]
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
+
47
69
---
48
70
49
71
## ⚙️ Configuration
@@ -73,6 +95,36 @@ The Builder is configured via environment variables. The following values are su
73
95
74
96
---
75
97
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
+
76
128
## 📤 Transaction Sender
77
129
78
130
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:
87
139
|`SIGNER_CHAIN_ID`| Yes | Chain ID used for signing |
88
140
|`SIGNER_KEY`| Yes | Signing key used to sign the transaction |
89
141
142
+
The transaction submitter is located at `bin/submit_transaction.rs`.
143
+
144
+
Run the transaction submitter with `cargo run --bin transaction-submitter`
0 commit comments