Skip to content

Commit e3d91d8

Browse files
committed
Rename MAX_UINT_64 -> UINT64_MAX
1 parent 42bc600 commit e3d91d8

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

specs/phase0/beacon-chain.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ The following values are (non-configurable) constants used throughout the specif
178178

179179
| Name | Value |
180180
| - | - |
181-
| `MAX_UINT_64` | `uint64(2**64 - 1)` |
181+
| `UINT64_MAX` | `uint64(2**64 - 1)` |
182182
| `GENESIS_SLOT` | `Slot(0)` |
183183
| `GENESIS_EPOCH` | `Epoch(0)` |
184184
| `FAR_FUTURE_EPOCH` | `Epoch(2**64 - 1)` |
@@ -600,7 +600,7 @@ def integer_squareroot(n: uint64) -> uint64:
600600
"""
601601
Return the largest integer ``x`` such that ``x**2 <= n``.
602602
"""
603-
if n == MAX_UINT_64:
603+
if n == UINT64_MAX:
604604
return uint64(4294967295)
605605
x = n
606606
y = (x + 1) // 2

tests/core/pyspec/eth2spec/test/helpers/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@
8989
#
9090
# Number
9191
#
92-
MAX_UINT_64 = 2**64 - 1
92+
UINT64_MAX = 2**64 - 1

tests/core/pyspec/eth2spec/test/phase0/unittests/test_config_invariants.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
spec_state_test,
33
with_all_phases,
44
)
5-
from eth2spec.test.helpers.constants import MAX_UINT_64
5+
from eth2spec.test.helpers.constants import UINT64_MAX
66
from eth2spec.test.helpers.forks import (
77
is_post_altair, is_post_bellatrix,
88
)
@@ -16,9 +16,9 @@ def check_bound(value, lower_bound, upper_bound):
1616
@with_all_phases
1717
@spec_state_test
1818
def test_validators(spec, state):
19-
check_bound(spec.VALIDATOR_REGISTRY_LIMIT, 1, MAX_UINT_64)
20-
check_bound(spec.MAX_COMMITTEES_PER_SLOT, 1, MAX_UINT_64)
21-
check_bound(spec.TARGET_COMMITTEE_SIZE, 1, MAX_UINT_64)
19+
check_bound(spec.VALIDATOR_REGISTRY_LIMIT, 1, UINT64_MAX)
20+
check_bound(spec.MAX_COMMITTEES_PER_SLOT, 1, UINT64_MAX)
21+
check_bound(spec.TARGET_COMMITTEE_SIZE, 1, UINT64_MAX)
2222

2323
# Note: can be less if you assume stricters bounds on validator set based on total ETH supply
2424
maximum_validators_per_committee = (
@@ -30,24 +30,24 @@ def test_validators(spec, state):
3030
check_bound(spec.config.MIN_PER_EPOCH_CHURN_LIMIT, 1, spec.VALIDATOR_REGISTRY_LIMIT)
3131
check_bound(spec.config.CHURN_LIMIT_QUOTIENT, 1, spec.VALIDATOR_REGISTRY_LIMIT)
3232

33-
check_bound(spec.config.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, spec.TARGET_COMMITTEE_SIZE, MAX_UINT_64)
33+
check_bound(spec.config.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, spec.TARGET_COMMITTEE_SIZE, UINT64_MAX)
3434

3535

3636
@with_all_phases
3737
@spec_state_test
3838
def test_balances(spec, state):
3939
assert spec.MAX_EFFECTIVE_BALANCE % spec.EFFECTIVE_BALANCE_INCREMENT == 0
40-
check_bound(spec.MIN_DEPOSIT_AMOUNT, 1, MAX_UINT_64)
41-
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.MIN_DEPOSIT_AMOUNT, MAX_UINT_64)
42-
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.EFFECTIVE_BALANCE_INCREMENT, MAX_UINT_64)
40+
check_bound(spec.MIN_DEPOSIT_AMOUNT, 1, UINT64_MAX)
41+
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.MIN_DEPOSIT_AMOUNT, UINT64_MAX)
42+
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.EFFECTIVE_BALANCE_INCREMENT, UINT64_MAX)
4343

4444

4545
@with_all_phases
4646
@spec_state_test
4747
def test_hysteresis_quotient(spec, state):
48-
check_bound(spec.HYSTERESIS_QUOTIENT, 1, MAX_UINT_64)
48+
check_bound(spec.HYSTERESIS_QUOTIENT, 1, UINT64_MAX)
4949
check_bound(spec.HYSTERESIS_DOWNWARD_MULTIPLIER, 1, spec.HYSTERESIS_QUOTIENT)
50-
check_bound(spec.HYSTERESIS_UPWARD_MULTIPLIER, spec.HYSTERESIS_QUOTIENT, MAX_UINT_64)
50+
check_bound(spec.HYSTERESIS_UPWARD_MULTIPLIER, spec.HYSTERESIS_QUOTIENT, UINT64_MAX)
5151

5252

5353
@with_all_phases
@@ -68,7 +68,7 @@ def test_time(spec, state):
6868
assert spec.SLOTS_PER_EPOCH <= spec.SLOTS_PER_HISTORICAL_ROOT
6969
assert spec.MIN_SEED_LOOKAHEAD < spec.MAX_SEED_LOOKAHEAD
7070
assert spec.SLOTS_PER_HISTORICAL_ROOT % spec.SLOTS_PER_EPOCH == 0
71-
check_bound(spec.SLOTS_PER_HISTORICAL_ROOT, spec.SLOTS_PER_EPOCH, MAX_UINT_64)
71+
check_bound(spec.SLOTS_PER_HISTORICAL_ROOT, spec.SLOTS_PER_EPOCH, UINT64_MAX)
7272
check_bound(spec.MIN_ATTESTATION_INCLUSION_DELAY, 1, spec.SLOTS_PER_EPOCH)
7373

7474

0 commit comments

Comments
 (0)