eth2.0-specs/pysetup/constants.py

37 lines
848 B
Python
Raw Normal View History

# Definitions in context.py
PHASE0 = 'phase0'
ALTAIR = 'altair'
BELLATRIX = 'bellatrix'
CAPELLA = 'capella'
DENEB = 'deneb'
2024-02-16 04:29:00 +00:00
ELECTRA = 'electra'
2024-03-06 06:23:23 +00:00
EIP7594 = 'eip7594'
EIP7251 = 'eip7251'
EIP7549 = 'eip7549'
WHISK = 'whisk'
2023-06-26 10:07:48 +00:00
# The helper functions that are used when defining constants
CONSTANT_DEP_SUNDRY_CONSTANTS_FUNCTIONS = '''
def ceillog2(x: int) -> uint64:
if x < 1:
raise ValueError(f"ceillog2 accepts only positive values, x={x}")
return uint64((x - 1).bit_length())
def floorlog2(x: int) -> uint64:
if x < 1:
raise ValueError(f"floorlog2 accepts only positive values, x={x}")
return uint64(x.bit_length() - 1)
'''
OPTIMIZED_BLS_AGGREGATE_PUBKEYS = '''
def eth_aggregate_pubkeys(pubkeys: Sequence[BLSPubkey]) -> BLSPubkey:
return bls.AggregatePKs(pubkeys)
'''
ETH2_SPEC_COMMENT_PREFIX = "eth2spec:"