Skip to content

Commit 026b14b

Browse files
committed
Sync constants
1 parent 4bd796d commit 026b14b

File tree

4 files changed

+64
-16
lines changed

4 files changed

+64
-16
lines changed

eth/beacon/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
RAND_BYTES = 3
1111
# The highest possible result of the RNG.
1212
RAND_MAX = 2 ** (RAND_BYTES * 8) - 1
13+
14+
EMPTY_SIGNATURE = (0, 0)

eth/beacon/state_machines/configs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@
1313
# Misc
1414
('SHARD_COUNT', int),
1515
('TARGET_COMMITTEE_SIZE', int),
16-
('MAX_ATTESTATIONS_PER_BLOCK', int),
17-
('MIN_BALANCE', int),
16+
('EJECTION_BALANCE', int),
1817
('MAX_BALANCE_CHURN_QUOTIENT', int),
1918
('GWEI_PER_ETH', int),
2019
('BEACON_CHAIN_SHARD_NUMBER', int),
21-
('BLS_WITHDRAWAL_CREDENTIALS', bytes),
20+
('BLS_WITHDRAWAL_PREFIX_BYTE', bytes),
21+
('MAX_CASPER_VOTES', int),
22+
('LATEST_BLOCK_ROOTS_LENGTH', int),
23+
# EMPTY_SIGNATURE is defined in constants.py
2224
# Deposit contract
2325
('DEPOSIT_CONTRACT_ADDRESS', Address),
2426
('DEPOSIT_CONTRACT_TREE_DEPTH', int),
2527
('MIN_DEPOSIT', int),
2628
('MAX_DEPOSIT', int),
29+
# ZERO_HASH (ZERO_HASH32) is defined in constants.py
2730
# Initial values
2831
('INITIAL_FORK_VERSION', int),
2932
('INITIAL_SLOT_NUMBER', int),
@@ -41,5 +44,11 @@
4144
('WHISTLEBLOWER_REWARD_QUOTIENT', int),
4245
('INCLUDER_REWARD_QUOTIENT', int),
4346
('INACTIVITY_PENALTY_QUOTIENT', int),
47+
# Max operations per block
48+
('MAX_PROPOSER_SLASHINGS', int),
49+
('MAX_CASPER_SLASHINGS', int),
50+
('MAX_ATTESTATIONS', int),
51+
('MAX_DEPOSITS', int),
52+
('MAX_EXITS', int),
4453
)
4554
)

eth/beacon/state_machines/forks/serenity/configs.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
# Misc
99
SHARD_COUNT=2**10, # (= 1,024) shards
1010
TARGET_COMMITTEE_SIZE=2**8, # (= 256) validators
11-
MAX_ATTESTATIONS_PER_BLOCK=2**7, # (= 128) attestations
12-
MIN_BALANCE=2**4, # (= 16) ETH
11+
EJECTION_BALANCE=2**4, # (= 16) ETH
1312
MAX_BALANCE_CHURN_QUOTIENT=2**5, # (= 32)
1413
GWEI_PER_ETH=10**9, # Gwei/ETH
1514
BEACON_CHAIN_SHARD_NUMBER=2**64 - 1,
16-
BLS_WITHDRAWAL_CREDENTIALS=b'\x00',
15+
BLS_WITHDRAWAL_PREFIX_BYTE=b'\x00',
16+
MAX_CASPER_VOTES=2**10, # (= 1,024) votes
17+
LATEST_BLOCK_ROOTS_LENGTH=2**13, # (= 8,192) block roots
1718
# Deposit contract
1819
DEPOSIT_CONTRACT_ADDRESS=ZERO_ADDRESS, # TBD
1920
DEPOSIT_CONTRACT_TREE_DEPTH=2**5, # (= 32)
@@ -32,8 +33,14 @@
3233
COLLECTIVE_PENALTY_CALCULATION_PERIOD=2**20, # (= 1,048,576) slots
3334
ZERO_BALANCE_VALIDATOR_TTL=2**22, # (= 4,194,304) slots
3435
# Reward and penalty quotients
35-
BASE_REWARD_QUOTIENT=2**11, # (= 2,048)
36+
BASE_REWARD_QUOTIENT=2**10, # (= 1,024)
3637
WHISTLEBLOWER_REWARD_QUOTIENT=2**9, # (= 512)
3738
INCLUDER_REWARD_QUOTIENT=2**3, # (= 8)
3839
INACTIVITY_PENALTY_QUOTIENT=2**34, # (= 17,179,869,184)
40+
# Max operations per block
41+
MAX_PROPOSER_SLASHINGS=2**4, # (= 16)
42+
MAX_CASPER_SLASHINGS=2**4, # (= 16)
43+
MAX_ATTESTATIONS=2**7, # (= 128)
44+
MAX_DEPOSITS=2**4, # (= 16)
45+
MAX_EXITS=2**4, # (= 16)
3946
)

tests/beacon/conftest.py

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,8 @@ def target_committee_size():
330330

331331

332332
@pytest.fixture
333-
def max_attestations_per_block():
334-
return SERENITY_CONFIG.MAX_ATTESTATIONS_PER_BLOCK
335-
336-
337-
@pytest.fixture
338-
def min_balance():
339-
return SERENITY_CONFIG.MIN_BALANCE
333+
def ejection_balance():
334+
return SERENITY_CONFIG.EJECTION_BALANCE
340335

341336

342337
@pytest.fixture
@@ -355,8 +350,18 @@ def beacon_chain_shard_number():
355350

356351

357352
@pytest.fixture
358-
def bls_withdrawal_credentials():
359-
return SERENITY_CONFIG.BLS_WITHDRAWAL_CREDENTIALS
353+
def bls_withdrawal_prefix_byte():
354+
return SERENITY_CONFIG.BLS_WITHDRAWAL_PREFIX_BYTE
355+
356+
357+
@pytest.fixture
358+
def max_casper_votes():
359+
return SERENITY_CONFIG.MAX_CASPER_VOTES
360+
361+
362+
@pytest.fixture
363+
def latest_block_roots_length():
364+
return SERENITY_CONFIG.LATEST_BLOCK_ROOTS_LENGTH
360365

361366

362367
@pytest.fixture
@@ -439,6 +444,31 @@ def inactivity_penalty_quotient():
439444
return SERENITY_CONFIG.INACTIVITY_PENALTY_QUOTIENT
440445

441446

447+
@pytest.fixture
448+
def max_proposer_slashings():
449+
return SERENITY_CONFIG.MAX_PROPOSER_SLASHINGS
450+
451+
452+
@pytest.fixture
453+
def max_casper_slashings():
454+
return SERENITY_CONFIG.MAX_CASPER_SLASHINGS
455+
456+
457+
@pytest.fixture
458+
def max_attestations():
459+
return SERENITY_CONFIG.MAX_ATTESTATIONS
460+
461+
462+
@pytest.fixture
463+
def max_deposits():
464+
return SERENITY_CONFIG.MAX_DEPOSITS
465+
466+
467+
@pytest.fixture
468+
def max_exits():
469+
return SERENITY_CONFIG.MAX_EXITS
470+
471+
442472
#
443473
# genesis
444474
#

0 commit comments

Comments
 (0)