mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-03 06:13:31 +00:00
Rename MAX_UINT_64
-> UINT64_MAX
This commit is contained in:
parent
42bc6004e5
commit
e3d91d8e2a
@ -178,7 +178,7 @@ The following values are (non-configurable) constants used throughout the specif
|
||||
|
||||
| Name | Value |
|
||||
| - | - |
|
||||
| `MAX_UINT_64` | `uint64(2**64 - 1)` |
|
||||
| `UINT64_MAX` | `uint64(2**64 - 1)` |
|
||||
| `GENESIS_SLOT` | `Slot(0)` |
|
||||
| `GENESIS_EPOCH` | `Epoch(0)` |
|
||||
| `FAR_FUTURE_EPOCH` | `Epoch(2**64 - 1)` |
|
||||
@ -600,7 +600,7 @@ def integer_squareroot(n: uint64) -> uint64:
|
||||
"""
|
||||
Return the largest integer ``x`` such that ``x**2 <= n``.
|
||||
"""
|
||||
if n == MAX_UINT_64:
|
||||
if n == UINT64_MAX:
|
||||
return uint64(4294967295)
|
||||
x = n
|
||||
y = (x + 1) // 2
|
||||
|
@ -89,4 +89,4 @@ ALL_PRESETS = (MINIMAL, MAINNET)
|
||||
#
|
||||
# Number
|
||||
#
|
||||
MAX_UINT_64 = 2**64 - 1
|
||||
UINT64_MAX = 2**64 - 1
|
||||
|
@ -2,7 +2,7 @@ from eth2spec.test.context import (
|
||||
spec_state_test,
|
||||
with_all_phases,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import MAX_UINT_64
|
||||
from eth2spec.test.helpers.constants import UINT64_MAX
|
||||
from eth2spec.test.helpers.forks import (
|
||||
is_post_altair, is_post_bellatrix,
|
||||
)
|
||||
@ -16,9 +16,9 @@ def check_bound(value, lower_bound, upper_bound):
|
||||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_validators(spec, state):
|
||||
check_bound(spec.VALIDATOR_REGISTRY_LIMIT, 1, MAX_UINT_64)
|
||||
check_bound(spec.MAX_COMMITTEES_PER_SLOT, 1, MAX_UINT_64)
|
||||
check_bound(spec.TARGET_COMMITTEE_SIZE, 1, MAX_UINT_64)
|
||||
check_bound(spec.VALIDATOR_REGISTRY_LIMIT, 1, UINT64_MAX)
|
||||
check_bound(spec.MAX_COMMITTEES_PER_SLOT, 1, UINT64_MAX)
|
||||
check_bound(spec.TARGET_COMMITTEE_SIZE, 1, UINT64_MAX)
|
||||
|
||||
# Note: can be less if you assume stricters bounds on validator set based on total ETH supply
|
||||
maximum_validators_per_committee = (
|
||||
@ -30,24 +30,24 @@ def test_validators(spec, state):
|
||||
check_bound(spec.config.MIN_PER_EPOCH_CHURN_LIMIT, 1, spec.VALIDATOR_REGISTRY_LIMIT)
|
||||
check_bound(spec.config.CHURN_LIMIT_QUOTIENT, 1, spec.VALIDATOR_REGISTRY_LIMIT)
|
||||
|
||||
check_bound(spec.config.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, spec.TARGET_COMMITTEE_SIZE, MAX_UINT_64)
|
||||
check_bound(spec.config.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT, spec.TARGET_COMMITTEE_SIZE, UINT64_MAX)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_balances(spec, state):
|
||||
assert spec.MAX_EFFECTIVE_BALANCE % spec.EFFECTIVE_BALANCE_INCREMENT == 0
|
||||
check_bound(spec.MIN_DEPOSIT_AMOUNT, 1, MAX_UINT_64)
|
||||
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.MIN_DEPOSIT_AMOUNT, MAX_UINT_64)
|
||||
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.EFFECTIVE_BALANCE_INCREMENT, MAX_UINT_64)
|
||||
check_bound(spec.MIN_DEPOSIT_AMOUNT, 1, UINT64_MAX)
|
||||
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.MIN_DEPOSIT_AMOUNT, UINT64_MAX)
|
||||
check_bound(spec.MAX_EFFECTIVE_BALANCE, spec.EFFECTIVE_BALANCE_INCREMENT, UINT64_MAX)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_hysteresis_quotient(spec, state):
|
||||
check_bound(spec.HYSTERESIS_QUOTIENT, 1, MAX_UINT_64)
|
||||
check_bound(spec.HYSTERESIS_QUOTIENT, 1, UINT64_MAX)
|
||||
check_bound(spec.HYSTERESIS_DOWNWARD_MULTIPLIER, 1, spec.HYSTERESIS_QUOTIENT)
|
||||
check_bound(spec.HYSTERESIS_UPWARD_MULTIPLIER, spec.HYSTERESIS_QUOTIENT, MAX_UINT_64)
|
||||
check_bound(spec.HYSTERESIS_UPWARD_MULTIPLIER, spec.HYSTERESIS_QUOTIENT, UINT64_MAX)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@ -68,7 +68,7 @@ def test_time(spec, state):
|
||||
assert spec.SLOTS_PER_EPOCH <= spec.SLOTS_PER_HISTORICAL_ROOT
|
||||
assert spec.MIN_SEED_LOOKAHEAD < spec.MAX_SEED_LOOKAHEAD
|
||||
assert spec.SLOTS_PER_HISTORICAL_ROOT % spec.SLOTS_PER_EPOCH == 0
|
||||
check_bound(spec.SLOTS_PER_HISTORICAL_ROOT, spec.SLOTS_PER_EPOCH, MAX_UINT_64)
|
||||
check_bound(spec.SLOTS_PER_HISTORICAL_ROOT, spec.SLOTS_PER_EPOCH, UINT64_MAX)
|
||||
check_bound(spec.MIN_ATTESTATION_INCLUSION_DELAY, 1, spec.SLOTS_PER_EPOCH)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user