Skip to content

Commit f8e8d27

Browse files
authored
fix justifications size and use DEVNET_CONFIG (leanEthereum#66)
1 parent f57fca8 commit f8e8d27

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • src/lean_spec/subspecs/containers/state
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
"""State-specific SSZ types for the Lean Ethereum consensus specification."""
22

3+
from lean_spec.subspecs.chain.config import DEVNET_CONFIG
34
from lean_spec.types import Bytes32, SSZList
45
from lean_spec.types.bitfields import BaseBitlist
56

6-
# Maximum number of historical roots to keep
7-
HISTORICAL_ROOTS_LIMIT = 262144
8-
97

108
class HistoricalBlockHashes(SSZList):
119
"""List of historical block root hashes up to historical_roots_limit."""
1210

1311
ELEMENT_TYPE = Bytes32
14-
LIMIT = HISTORICAL_ROOTS_LIMIT
12+
LIMIT = DEVNET_CONFIG.historical_roots_limit.as_int()
1513

1614

1715
class JustificationRoots(SSZList):
1816
"""List of justified block roots up to historical_roots_limit."""
1917

2018
ELEMENT_TYPE = Bytes32
21-
LIMIT = HISTORICAL_ROOTS_LIMIT
19+
LIMIT = DEVNET_CONFIG.historical_roots_limit.as_int()
2220

2321

2422
class JustifiedSlots(BaseBitlist):
2523
"""Bitlist tracking justified slots up to historical roots limit."""
2624

27-
LIMIT = HISTORICAL_ROOTS_LIMIT
25+
LIMIT = DEVNET_CONFIG.historical_roots_limit.as_int()
2826

2927

3028
class JustificationValidators(BaseBitlist):
31-
"""Bitlist for tracking validator justifications (262144^2 limit)."""
29+
"""Bitlist for tracking validator justifications per historical root."""
3230

33-
LIMIT = HISTORICAL_ROOTS_LIMIT * HISTORICAL_ROOTS_LIMIT
31+
LIMIT = (
32+
DEVNET_CONFIG.historical_roots_limit.as_int()
33+
* DEVNET_CONFIG.validator_registry_limit.as_int()
34+
)

0 commit comments

Comments
 (0)