Skip to content

Commit 5e50780

Browse files
authored
Linear Leios lenhancements (#459)
* Change CPU model of linear leios * Implement actual voting rules * Variant: linear leios with TX references * Update schema with new task type * Update docs
1 parent 496be2f commit 5e50780

15 files changed

+126
-30
lines changed

data/simulation/config.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ export interface Config {
168168
"eb-generation-probability": number;
169169
"eb-generation-cpu-time-ms": number;
170170
"eb-validation-cpu-time-ms": number;
171+
"eb-header-validation-cpu-time-ms": number;
172+
"eb-body-validation-cpu-time-ms-constant": number;
173+
"eb-body-validation-cpu-time-ms-per-byte": number;
171174
"eb-size-bytes-constant": bigint;
172175
"eb-size-bytes-per-ib": bigint;
173176
"eb-body-avg-size-bytes": bigint;
@@ -297,6 +300,8 @@ export enum LeiosVariant {
297300
FullWithTXReferences = "full-with-tx-references",
298301
/** Linear Leios: Leios with as little concurrency as possible. */
299302
Linear = "linear",
303+
/** Linear Leios, but blocks include transaction references instead of full TXs */
304+
LinearWithTxReferences = "linear-with-tx-references",
300305
}
301306

302307
export enum MempoolSamplingStrategy {

data/simulation/config.default.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ praos-fallback-enabled: true
3838

3939
linear-vote-stage-length-slots: 5
4040
linear-diffuse-stage-length-slots: 5
41+
store-txs-as-references: false
4142

4243
################################################################################
4344
# Transaction Configuration
@@ -144,6 +145,11 @@ eb-body-avg-size-bytes: 0
144145
eb-generation-cpu-time-ms: 75.0
145146
# Validating signature and vrf proof, as in other headers.
146147
eb-validation-cpu-time-ms: 1.0
148+
# For linear leios: "fast" incomplete validation of the EB
149+
eb-header-validation-cpu-time-ms: 50.0
150+
# For linear leios: complete validation of the EB
151+
eb-body-validation-cpu-time-ms-constant: 50.0
152+
eb-body-validation-cpu-time-ms-per-byte: 0.0005
147153

148154
eb-diffusion-strategy: "peer-order"
149155

data/simulation/config.schema.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"full",
7979
"full-without-ibs",
8080
"full-with-tx-references",
81-
"linear"
81+
"linear",
82+
"linear-with-tx-references"
8283
],
8384
"type": "string"
8485
},
@@ -154,6 +155,12 @@
154155
"properties": {},
155156
"type": "number"
156157
},
158+
"eb-body-validation-cpu-time-ms-constant": {
159+
"type": "number"
160+
},
161+
"eb-body-validation-cpu-time-ms-per-byte": {
162+
"type": "number"
163+
},
157164
"eb-diffusion-max-bodies-to-request": {
158165
"additionalProperties": false,
159166
"description": "Only supported by Haskell simulation.",
@@ -182,6 +189,9 @@
182189
"eb-generation-probability": {
183190
"type": "number"
184191
},
192+
"eb-header-validation-cpu-time-ms": {
193+
"type": "number"
194+
},
185195
"eb-max-age-for-relay-slots": {
186196
"additionalProperties": false,
187197
"description": "The maximum age of EBs to be relayed.\n\nAn EB from slot `s` will only be relayed\nup to slot `s+eb-max-age-for-relay-slots`.\n\nOnly supported by Haskell simulation.",

data/simulation/trace.haskell.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"GenRB",
4949
"GenVote",
5050
"ValEB",
51+
"ValEH",
5152
"ValIB",
5253
"ValIH",
5354
"ValRB",

data/simulation/trace.rust.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"GenRB",
7575
"GenVote",
7676
"ValEB",
77+
"ValEH",
7778
"ValIB",
7879
"ValIH",
7980
"ValRB",

data/simulation/trace.shared.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface NoBlockEvent {
3131
slot: number;
3232
}
3333

34-
type CpuTaskType = "ValIB" | "ValEB" | "ValRB" | "ValIH" | "ValRH" | "ValVote" | "GenIB" | "GenEB" | "GenVote" | "GenRB" | "ValTX";
34+
type CpuTaskType = "ValIB" | "ValEB" | "ValRB" | "ValIH" | "ValEH" | "ValRH" | "ValVote" | "GenIB" | "GenEB" | "GenVote" | "GenRB" | "ValTX";
3535
type CpuEventType = "Cpu"
3636
interface CpuEvent {
3737
type: CpuEventType;

data/simulation/trace.shared.schema.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"GenRB",
4949
"GenVote",
5050
"ValEB",
51+
"ValEH",
5152
"ValIB",
5253
"ValIH",
5354
"ValRB",
@@ -99,16 +100,16 @@
99100
},
100101
"GeneratedEndorserBlock": {
101102
"properties": {
102-
"id": {
103-
"type": "string"
104-
},
105-
"input_blocks": {
103+
"endorser_blocks": {
106104
"items": {
107105
"$ref": "#/definitions/BlockRef"
108106
},
109107
"type": "array"
110108
},
111-
"endorser_blocks": {
109+
"id": {
110+
"type": "string"
111+
},
112+
"input_blocks": {
112113
"items": {
113114
"$ref": "#/definitions/BlockRef"
114115
},
@@ -131,9 +132,9 @@
131132
}
132133
},
133134
"required": [
135+
"endorser_blocks",
134136
"id",
135137
"input_blocks",
136-
"endorser_blocks",
137138
"pipeline",
138139
"producer",
139140
"size_bytes",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leios-variant: linear-with-tx-references

sim-rs/LINEAR_LEIOS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Linear Leios (rust simulation)
22

3-
To run it, set `leios-variant` to `linear`.
3+
To run Linear Leios with entire transactions stored in EBs, set `leios-variant` to `linear`.
4+
To run Linear Leios with transaction references stored in EBs, set `leios-variant` to `linear-with-tx-references`.
45

56
The log file schema is currently identical to every other variant (though `pipeline` is always 0).
67

@@ -12,7 +13,9 @@ RB headers are diffused separately from bodies. When a node receives an RB heade
1213

1314
When a node receives an RB body, it immediately removes all referenced/conflicting transactions from its mempool. If the RB has an EB certificate, it also removes that EB’s transactions from its mempool (note that this should be redundant based on the procedure below).
1415

15-
When a node receives an EB body, it immediately runs a VRF lottery to decide how many times it can vote for that EB; if it has any votes, it will transmit them to all peers. If the EB has been certified after L_vote + L_diff slots have passed, the node removes all of its transactions from the mempool (under the assumption that the EB will make it on-chain).
16+
When a node receives an EB body, it runs lightweight validation and then propagates the body to peers. After this lightweight validation, it runs more expensive complete validation (presumably at the TX level) before voting.
17+
18+
When voting, a node runs a VRF lottery to decide how many times it can vote for that EB; if it has any votes, it will transmit them to all peers. If the EB has been certified after L_vote + L_diff slots have passed, the node removes all of its transactions from the mempool (under the assumption that the EB will make it on-chain).
1619

1720
## New parameters
1821

@@ -21,6 +24,9 @@ When a node receives an EB body, it immediately runs a VRF lottery to decide how
2124
|`linear-vote-stage-length-slots`|How many slots the EB voting stage is allowed to last. For equivocation protection, this should be at least 3 * delta_hdr (which is currently 1 second).|5|
2225
|`linear-diffuse-stage-length-slots`|How many slots are votes allowed to diffuse.|5|
2326
|`eb-body-avg-size-bytes`|If `simulate-transactions` is false, this controls the size of the EBs we generate.|0|
27+
|`eb-header-validation-cpu-time-ms`|The time taken to validate an EB _before_ we propagate it to peers|50.0|
28+
|`eb-body-validation-cpu-time-ms-constant`|The time taken to validate the transactions in an EB _after_ we propagate it to peers.|50.0|
29+
|`eb-body-validation-cpu-time-ms-per-byte`|The time taken to validate the transactions in an EB _after_ we propagate it to peers.|50.0|
2430
|`vote-generation-cpu-time-ms-per-tx`|A per-transaction CPU cost to apply when generating new vote bundles.|0|
2531

2632
## Not yet implemented
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
leios-variant: linear-with-tx-references
2+
timestamp-resolution-ms: 0.05

0 commit comments

Comments
 (0)