|
8 | 8 | {.push raises: [], gcsafe.} |
9 | 9 |
|
10 | 10 | import |
11 | | - std/[strutils, parseutils, tables, typetraits], |
| 11 | + std/[parseutils, tables, typetraits], |
12 | 12 | chronos/timer, |
13 | 13 | stew/[byteutils], stint, eth/common/addresses as eth, |
14 | 14 | ./datatypes/constants |
15 | 15 |
|
16 | 16 | from std/algorithm import sort |
| 17 | +from std/strutils import split, splitLines, startsWith, strip, `%` |
17 | 18 |
|
18 | 19 | export constants |
19 | | - |
20 | 20 | export stint, eth |
21 | 21 |
|
22 | 22 | const |
|
40 | 40 | MAX_SUPPORTED_BLOBS_PER_BLOCK*: uint64 = 9 # revisit getShortMap(Blobs) if >9 |
41 | 41 | MAX_SUPPORTED_REQUEST_BLOB_SIDECARS*: uint64 = 1152 |
42 | 42 |
|
| 43 | + # https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/phase0/beacon-chain.md#time-parameters-1 |
| 44 | + SLOT_DURATION_MS: uint64 = 12000 |
| 45 | + |
| 46 | + # https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/phase0/validator.md#time-parameters |
| 47 | + ATTESTATION_DUE_BPS: uint64 = 3333 |
| 48 | + AGGREGATE_DUE_BPS: uint64 = 6667 |
| 49 | + |
| 50 | + # https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/altair/validator.md#time-parameters |
| 51 | + SYNC_MESSAGE_DUE_BPS: uint64 = 3333 |
| 52 | + CONTRIBUTION_DUE_BPS: uint64 = 6667 |
| 53 | + |
| 54 | + # https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/phase0/fork-choice.md#time-parameters |
| 55 | + PROPOSER_REORG_CUTOFF_BPS: uint64 = 1667 |
| 56 | + |
43 | 57 | type |
44 | 58 | TimeConfig* = object |
45 | 59 | SECONDS_PER_SLOT*: uint64 |
@@ -164,11 +178,13 @@ type |
164 | 178 | const |
165 | 179 | const_preset* {.strdefine.} = "mainnet" |
166 | 180 |
|
167 | | - # No-longer used values from legacy config files |
| 181 | + # No-longer used values from legacy config files, or quirks of BPO parsing |
168 | 182 | ignoredValues = [ |
169 | 183 | "TRANSITION_TOTAL_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets |
170 | 184 | "MIN_ANCHOR_POW_BLOCK_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets |
171 | 185 | "RANDOM_SUBNETS_PER_VALIDATOR", # Removed in consensus-specs v1.4.0 |
| 186 | + " MAX_BLOBS_PER_BLOCK", # parsed separately |
| 187 | + " - EPOCH", # parsed separately |
172 | 188 | ] |
173 | 189 |
|
174 | 190 | when const_preset == "mainnet": |
@@ -809,6 +825,7 @@ proc readRuntimeConfig*( |
809 | 825 | if lineParts[0] in ignoredValues: continue |
810 | 826 |
|
811 | 827 | values[lineParts[0]] = lineParts[1].strip |
| 828 | + |
812 | 829 | # Accumulate BLOB_SCHEDULE entries |
813 | 830 | var |
814 | 831 | blobScheduleEntries: seq[BlobParameters] |
@@ -992,6 +1009,13 @@ proc readRuntimeConfig*( |
992 | 1009 | checkCompatibility REORG_PARENT_WEIGHT_THRESHOLD |
993 | 1010 | checkCompatibility REORG_MAX_EPOCHS_SINCE_FINALIZATION |
994 | 1011 |
|
| 1012 | + checkCompatibility SLOT_DURATION_MS |
| 1013 | + checkCompatibility ATTESTATION_DUE_BPS |
| 1014 | + checkCompatibility AGGREGATE_DUE_BPS |
| 1015 | + checkCompatibility SYNC_MESSAGE_DUE_BPS |
| 1016 | + checkCompatibility CONTRIBUTION_DUE_BPS |
| 1017 | + checkCompatibility PROPOSER_REORG_CUTOFF_BPS |
| 1018 | + |
995 | 1019 | template assignValue(name: static string, field: untyped): untyped = |
996 | 1020 | if values.hasKey(name): |
997 | 1021 | when field is seq[BlobParameters]: |
|
0 commit comments