Skip to content

Commit a16e685

Browse files
authored
Add mocked superblock for gigasim (#4423)
Gigasim can execute and commit a superblock. Fifty lane blocks of 2,000 transactions (100,000) run and commit together. The block store still writes every lane block and gives each one its own QC. The state DB and the receipt store advance once per superblock. Receipt generation is faster because a full-node superblock was spending its generate time marshaling 100,000 receipts, and the store marshaled them again on write. Each receipt is now encoded once, from its own block, gas, index, and hash, into a buffer allocated for the superblock, and the store writes those bytes. An ERC20 receipt carries a Transfer log for that transaction's contract, sender, and recipient. A native transfer carries no log. The default storage cache is 8 GiB and the account cache is 2 GiB. The hot ERC20 contract probability is 0.9, and the block store flushes every 50 lane blocks, once per superblock.
1 parent 67a2214 commit a16e685

19 files changed

Lines changed: 870 additions & 475 deletions

‎docker/monitornode/dashboards/gigasim-dashboard.json‎

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27338,6 +27338,198 @@
2733827338
"version": "13.2.1"
2733927339
}
2734027340
}
27341+
},
27342+
"panel-280": {
27343+
"kind": "Panel",
27344+
"spec": {
27345+
"data": {
27346+
"kind": "QueryGroup",
27347+
"spec": {
27348+
"queries": [
27349+
{
27350+
"kind": "PanelQuery",
27351+
"spec": {
27352+
"hidden": false,
27353+
"query": {
27354+
"datasource": {
27355+
"name": "PBFA97CFB590B2093"
27356+
},
27357+
"group": "prometheus",
27358+
"kind": "DataQuery",
27359+
"spec": {
27360+
"editorMode": "code",
27361+
"expr": "gigasim_execution_batch_transactions",
27362+
"legendFormat": "transactions",
27363+
"range": true
27364+
},
27365+
"version": "v0"
27366+
},
27367+
"refId": "A"
27368+
}
27369+
}
27370+
],
27371+
"queryOptions": {},
27372+
"transformations": []
27373+
}
27374+
},
27375+
"description": "Transactions the executor pool ran together in the last superblock, before the next state commit. The default is TransactionsPerBlock times LaneBlocksPerSuperblock.",
27376+
"id": 280,
27377+
"links": [],
27378+
"title": "Execution batch (transactions)",
27379+
"transparent": true,
27380+
"vizConfig": {
27381+
"group": "gauge",
27382+
"kind": "VizConfig",
27383+
"spec": {
27384+
"fieldConfig": {
27385+
"defaults": {
27386+
"color": {
27387+
"mode": "thresholds"
27388+
},
27389+
"decimals": 0,
27390+
"fieldMinMax": false,
27391+
"min": 0,
27392+
"thresholds": {
27393+
"mode": "absolute",
27394+
"steps": [
27395+
{
27396+
"color": "green",
27397+
"value": 0
27398+
}
27399+
]
27400+
},
27401+
"unit": "short"
27402+
},
27403+
"overrides": []
27404+
},
27405+
"options": {
27406+
"barShape": "flat",
27407+
"barWidthFactor": 0.3,
27408+
"effects": {
27409+
"barGlow": false,
27410+
"centerGlow": false,
27411+
"gradient": true
27412+
},
27413+
"endpointMarker": "point",
27414+
"minVizHeight": 75,
27415+
"minVizWidth": 75,
27416+
"orientation": "horizontal",
27417+
"reduceOptions": {
27418+
"calcs": [
27419+
"lastNotNull"
27420+
],
27421+
"fields": "",
27422+
"values": false
27423+
},
27424+
"segmentCount": 1,
27425+
"segmentSpacing": 0.3,
27426+
"shape": "gauge",
27427+
"showThresholdLabels": false,
27428+
"showThresholdMarkers": false,
27429+
"sizing": "auto",
27430+
"sparkline": true,
27431+
"textMode": "auto"
27432+
}
27433+
},
27434+
"version": "13.2.1"
27435+
}
27436+
}
27437+
},
27438+
"panel-281": {
27439+
"kind": "Panel",
27440+
"spec": {
27441+
"data": {
27442+
"kind": "QueryGroup",
27443+
"spec": {
27444+
"queries": [
27445+
{
27446+
"kind": "PanelQuery",
27447+
"spec": {
27448+
"hidden": false,
27449+
"query": {
27450+
"datasource": {
27451+
"name": "PBFA97CFB590B2093"
27452+
},
27453+
"group": "prometheus",
27454+
"kind": "DataQuery",
27455+
"spec": {
27456+
"editorMode": "code",
27457+
"expr": "gigasim_commit_changeset_entries",
27458+
"legendFormat": "entries",
27459+
"range": true
27460+
},
27461+
"version": "v0"
27462+
},
27463+
"refId": "A"
27464+
}
27465+
}
27466+
],
27467+
"queryOptions": {},
27468+
"transformations": []
27469+
}
27470+
},
27471+
"description": "Key-value entries in the one changeset applied by the last state commit. A key written by several transactions in the batch counts once.",
27472+
"id": 281,
27473+
"links": [],
27474+
"title": "Changeset entries / commit",
27475+
"transparent": true,
27476+
"vizConfig": {
27477+
"group": "gauge",
27478+
"kind": "VizConfig",
27479+
"spec": {
27480+
"fieldConfig": {
27481+
"defaults": {
27482+
"color": {
27483+
"mode": "thresholds"
27484+
},
27485+
"decimals": 0,
27486+
"fieldMinMax": false,
27487+
"min": 0,
27488+
"thresholds": {
27489+
"mode": "absolute",
27490+
"steps": [
27491+
{
27492+
"color": "green",
27493+
"value": 0
27494+
}
27495+
]
27496+
},
27497+
"unit": "short"
27498+
},
27499+
"overrides": []
27500+
},
27501+
"options": {
27502+
"barShape": "flat",
27503+
"barWidthFactor": 0.3,
27504+
"effects": {
27505+
"barGlow": false,
27506+
"centerGlow": false,
27507+
"gradient": true
27508+
},
27509+
"endpointMarker": "point",
27510+
"minVizHeight": 75,
27511+
"minVizWidth": 75,
27512+
"orientation": "horizontal",
27513+
"reduceOptions": {
27514+
"calcs": [
27515+
"lastNotNull"
27516+
],
27517+
"fields": "",
27518+
"values": false
27519+
},
27520+
"segmentCount": 1,
27521+
"segmentSpacing": 0.3,
27522+
"shape": "gauge",
27523+
"showThresholdLabels": false,
27524+
"showThresholdMarkers": false,
27525+
"sizing": "auto",
27526+
"sparkline": true,
27527+
"textMode": "auto"
27528+
}
27529+
},
27530+
"version": "13.2.1"
27531+
}
27532+
}
2734127533
}
2734227534
},
2734327535
"layout": {
@@ -27416,6 +27608,32 @@
2741627608
"x": 12,
2741727609
"y": 8
2741827610
}
27611+
},
27612+
{
27613+
"kind": "GridLayoutItem",
27614+
"spec": {
27615+
"element": {
27616+
"kind": "ElementReference",
27617+
"name": "panel-280"
27618+
},
27619+
"height": 8,
27620+
"width": 12,
27621+
"x": 0,
27622+
"y": 16
27623+
}
27624+
},
27625+
{
27626+
"kind": "GridLayoutItem",
27627+
"spec": {
27628+
"element": {
27629+
"kind": "ElementReference",
27630+
"name": "panel-281"
27631+
},
27632+
"height": 8,
27633+
"width": 12,
27634+
"x": 12,
27635+
"y": 16
27636+
}
2741927637
}
2742027638
]
2742127639
}

‎sei-db/bench/gigasim/README.md‎

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ generation may run ahead.
6868
generator ──build txs──> write to BlockDB ──> [channel] ──> executor pool ──> receipts + state DB
6969
```
7070

71-
Every block commits at the same height in every store. A block's transactions are executed in
72-
parallel across the pool, so a block's transaction count is also its degree of parallelism, and the
73-
pool is drained before the block is committed — a block's writes reach state as one version.
71+
A superblock's transactions are executed in parallel across the pool, so its transaction count is
72+
also its degree of parallelism, and the pool is drained before the superblock is committed — its
73+
writes reach state as one version. The default superblock is 50 lane blocks of 2,000 transactions.
74+
The block store's height counts lane blocks, and the state DB and receipt store count superblocks.
7475

7576
## Transaction Model
7677

@@ -83,7 +84,7 @@ doing the arithmetic, because what is under measurement is storage traffic rathe
8384
| `erc20` (default) | token code, sender's account, sender's and recipient's balance slots, fee account | sender's account, both balance slots | `Erc20GasPerTransaction` (50,000) |
8485
| `transfer` | sender's and recipient's accounts, fee account | both accounts | 21,000 |
8586

86-
The fee account is written once per block, not once per transaction. Accounts are read and written
87+
The fee account is written once per superblock, not once per transaction. Accounts are read and written
8788
through their native balance, which every transaction changes for the sender paying gas. An ERC20
8889
transfer never touches the recipient's account, as on chain: it names the recipient only as an argument
8990
to the token contract. A native transfer touches no contract code or storage.
@@ -127,27 +128,33 @@ run reconstructs the same population from its config and the persisted identifie
127128
Every option, its default and what it means live in the [gigasim config struct](./gigasim_config.go),
128129
which is the reference for them rather than this document. Fields in the JSON file mirror the struct
129130
field names exactly, and an unrecognised field is an error rather than a silent no-op. Anything left
130-
out takes its default, so the shipped configs in [`config/`](./config) set only what they change and
131-
read as worked examples.
131+
out takes its default. The shipped configs in [`config/`](./config) set `TransactionsPerBlock` and
132+
`LaneBlocksPerSuperblock` explicitly, and otherwise only what they change.
132133

133-
Two relationships between the options are worth knowing before changing any of them, because neither is
134+
A few relationships between the options are worth knowing before changing any of them, because none is
134135
visible from a single field.
135136

136-
The default block carries 10,000 transactions of 200 bytes, which is about the size of an ERC20
137-
transfer: some 180 bytes of RLP before Sei's envelope. A ledger block holds at most autobahn's
138-
`MaxTxsPerBlock` (2,000) payload entries, so a block with more transactions than that packs several into
139-
each entry. Every transaction is still executed and committed, one state commit per block. Packing
140-
leaves the bytes stored unchanged, and those are held to the ledger's byte budget, `MaxTxsBytesPerBlock`
141-
(2 MiB). The default block is 2 MB, just inside it, so `TransactionsPerBlock` and `BytesPerTransaction`
142-
trade off against each other: configuration validation rejects a product over the budget rather than
143-
generating a block the ledger would refuse.
137+
The default lane block carries 2,000 transactions of 200 bytes, one per ledger entry, which is
138+
autobahn's `MaxTxsPerBlock`. A transaction of 200 bytes is about the size of an ERC20 transfer: some
139+
180 bytes of RLP before Sei's envelope. A lane block may carry more transactions than it has entries
140+
by packing several into each entry. Packing leaves the bytes stored unchanged, and those are held to
141+
the ledger's byte budget, `MaxTxsBytesPerBlock` (2 MiB). `TransactionsPerBlock` and
142+
`BytesPerTransaction` trade off against each other: configuration validation rejects a product over
143+
the budget rather than generating a block the ledger would refuse.
144+
145+
`LaneBlocksPerSuperblock` bundles that many lane blocks into one superblock, which is what gets
146+
executed and committed. The default is 50, so a superblock is 100,000 transactions. The block store
147+
advances once per lane block; the state DB and the receipt store advance once per superblock.
148+
`RollbackWindow` and `LookbackWindow` count each store's own versions, so the block store's window is
149+
lane blocks and the state DB's is superblocks. The debug config sets `LaneBlocksPerSuperblock` to 1,
150+
which commits each of its lane blocks on its own.
144151

145152
Generation is unthrottled by default, so a measured run reports what the stack sustains rather than a
146153
rate chosen in advance. `MaxTps` exists for the runs that are not measurements — the debug config
147154
throttles itself well below what a machine can do, because a smoke test should confirm the pipeline
148155
works rather than saturate the laptop it runs on — and for holding two builds at the same offered load,
149-
which is what makes their latencies comparable. Blocks are released a whole block at a time, so the
150-
block rate it produces is `MaxTps / TransactionsPerBlock`.
156+
which is what makes their latencies comparable. Blocks are released a whole superblock at a time, so the
157+
block rate it produces is `MaxTps / (TransactionsPerBlock * LaneBlocksPerSuperblock)`.
151158

152159
## Optional Stores
153160

0 commit comments

Comments
 (0)