From 59134fb0aecd9330cf07b825ede2e35bd0956f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9=20Monnot?= Date: Fri, 26 Mar 2021 12:18:51 +0800 Subject: [PATCH 1/9] Modify incentives to preserve invariant --- specs/altair/beacon-chain.md | 17 +++++++++-------- .../test_process_sync_committee.py | 5 ++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 81e7af14b..5389590b6 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -84,11 +84,12 @@ Altair is the first beacon chain hard fork. Its main features are: | Name | Value | | - | - | -| `TIMELY_HEAD_WEIGHT` | `12` | -| `TIMELY_SOURCE_WEIGHT` | `12` | -| `TIMELY_TARGET_WEIGHT` | `24` | -| `SYNC_REWARD_WEIGHT` | `8` | -| `WEIGHT_DENOMINATOR` | `64` | +| `TIMELY_HEAD_WEIGHT` | `3` | +| `TIMELY_SOURCE_WEIGHT` | `3` | +| `TIMELY_TARGET_WEIGHT` | `6` | +| `SYNC_REWARD_WEIGHT` | `2` | +| `NON_PROPOSER_TOTAL` | `14` | +| `WEIGHT_DENOMINATOR` | `16` | *Note*: The sum of the weight fractions (7/8) plus the proposer inclusion fraction (1/8) equals 1. @@ -477,7 +478,7 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None: proposer_reward_numerator += get_base_reward(state, index) * weight # Reward proposer - proposer_reward = Gwei(proposer_reward_numerator // (WEIGHT_DENOMINATOR * PROPOSER_REWARD_QUOTIENT)) + proposer_reward = Gwei(proposer_reward_numerator // (NON_PROPOSER_TOTAL * PROPOSER_REWARD_QUOTIENT)) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) ``` @@ -550,9 +551,9 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None for included_index in included_indices: effective_balance = state.validators[included_index].effective_balance inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) - proposer_reward = Gwei(inclusion_reward // PROPOSER_REWARD_QUOTIENT) + proposer_reward = Gwei((inclusion_reward * WEIGHT_DENOMINATOR) // (NON_PROPOSER_TOTAL * PROPOSER_REWARD_QUOTIENT)) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) - increase_balance(state, included_index, inclusion_reward - proposer_reward) + increase_balance(state, included_index, inclusion_reward) ``` ### Epoch processing diff --git a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py index 958953176..b644d46b8 100644 --- a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py +++ b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py @@ -126,8 +126,7 @@ def compute_sync_committee_participant_reward(spec, state, participant_index, co inclusion_reward = compute_sync_committee_inclusion_reward( spec, state, participant_index, committee, committee_bits, ) - proposer_reward = spec.Gwei(inclusion_reward // spec.PROPOSER_REWARD_QUOTIENT) - return spec.Gwei((inclusion_reward - proposer_reward) * multiplicities[participant_index]) + return spec.Gwei(inclusion_reward * multiplicities[participant_index]) def compute_sync_committee_proposer_reward(spec, state, committee, committee_bits): @@ -138,7 +137,7 @@ def compute_sync_committee_proposer_reward(spec, state, committee, committee_bit inclusion_reward = compute_sync_committee_inclusion_reward( spec, state, index, committee, committee_bits, ) - proposer_reward += spec.Gwei(inclusion_reward // spec.PROPOSER_REWARD_QUOTIENT) + proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // (spec.NON_PROPOSER_TOTAL * spec.PROPOSER_REWARD_QUOTIENT)) return proposer_reward From 71d03a411c93ab4d1fe4c36a80302e4246f7f9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9=20Monnot?= Date: Fri, 26 Mar 2021 18:36:49 +0800 Subject: [PATCH 2/9] Scale up weights; use existing constants and new PROPOSER_WEIGHT --- specs/altair/beacon-chain.md | 18 ++++++++++-------- .../test_process_sync_committee.py | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 5389590b6..d81a3a0b1 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -84,12 +84,12 @@ Altair is the first beacon chain hard fork. Its main features are: | Name | Value | | - | - | -| `TIMELY_HEAD_WEIGHT` | `3` | -| `TIMELY_SOURCE_WEIGHT` | `3` | -| `TIMELY_TARGET_WEIGHT` | `6` | -| `SYNC_REWARD_WEIGHT` | `2` | -| `NON_PROPOSER_TOTAL` | `14` | -| `WEIGHT_DENOMINATOR` | `16` | +| `TIMELY_HEAD_WEIGHT` | `12` | +| `TIMELY_SOURCE_WEIGHT` | `12` | +| `TIMELY_TARGET_WEIGHT` | `24` | +| `SYNC_REWARD_WEIGHT` | `8` | +| `PROPOSER_WEIGHT` | `8` | +| `WEIGHT_DENOMINATOR` | `64` | *Note*: The sum of the weight fractions (7/8) plus the proposer inclusion fraction (1/8) equals 1. @@ -478,7 +478,8 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None: proposer_reward_numerator += get_base_reward(state, index) * weight # Reward proposer - proposer_reward = Gwei(proposer_reward_numerator // (NON_PROPOSER_TOTAL * PROPOSER_REWARD_QUOTIENT)) + reward_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * PROPOSER_REWARD_QUOTIENT + proposer_reward = Gwei(proposer_reward_numerator // reward_denominator) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) ``` @@ -551,7 +552,8 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None for included_index in included_indices: effective_balance = state.validators[included_index].effective_balance inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) - proposer_reward = Gwei((inclusion_reward * WEIGHT_DENOMINATOR) // (NON_PROPOSER_TOTAL * PROPOSER_REWARD_QUOTIENT)) + proposer_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * PROPOSER_REWARD_QUOTIENT + proposer_reward = Gwei((inclusion_reward * WEIGHT_DENOMINATOR) // proposer_denominator) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) increase_balance(state, included_index, inclusion_reward) ``` diff --git a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py index b644d46b8..70509bea3 100644 --- a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py +++ b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py @@ -137,7 +137,8 @@ def compute_sync_committee_proposer_reward(spec, state, committee, committee_bit inclusion_reward = compute_sync_committee_inclusion_reward( spec, state, index, committee, committee_bits, ) - proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // (spec.NON_PROPOSER_TOTAL * spec.PROPOSER_REWARD_QUOTIENT)) + proposer_denominator = (spec.WEIGHT_DENOMINATOR - spec.PROPOSER_WEIGHT) * spec.PROPOSER_REWARD_QUOTIENT + proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // proposer_denominator) return proposer_reward From 0481e920f0cbc27719aa4597dc5646e3dfb5a86d Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 26 Mar 2021 10:51:29 +0000 Subject: [PATCH 3/9] Deprecate the use of PROPOSER_REWARD_QUOTIENT --- specs/altair/beacon-chain.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index d81a3a0b1..0c4284ca5 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -413,7 +413,7 @@ def slash_validator(state: BeaconState, if whistleblower_index is None: whistleblower_index = proposer_index whistleblower_reward = Gwei(validator.effective_balance // WHISTLEBLOWER_REWARD_QUOTIENT) - proposer_reward = Gwei(whistleblower_reward // PROPOSER_REWARD_QUOTIENT) + proposer_reward = Gwei(whistleblower_reward * PROPOSER_WEIGHT // WEIGHT_DENOMINATOR) increase_balance(state, proposer_index, proposer_reward) increase_balance(state, whistleblower_index, Gwei(whistleblower_reward - proposer_reward)) ``` @@ -478,8 +478,8 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None: proposer_reward_numerator += get_base_reward(state, index) * weight # Reward proposer - reward_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * PROPOSER_REWARD_QUOTIENT - proposer_reward = Gwei(proposer_reward_numerator // reward_denominator) + proposer_reward_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * WEIGHT_DENOMINATOR // PROPOSER_WEIGHT + proposer_reward = Gwei(proposer_reward_numerator // proposer_reward_denominator) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) ``` @@ -552,10 +552,10 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None for included_index in included_indices: effective_balance = state.validators[included_index].effective_balance inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) - proposer_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * PROPOSER_REWARD_QUOTIENT - proposer_reward = Gwei((inclusion_reward * WEIGHT_DENOMINATOR) // proposer_denominator) - increase_balance(state, get_beacon_proposer_index(state), proposer_reward) increase_balance(state, included_index, inclusion_reward) + proposer_reward_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * WEIGHT_DENOMINATOR // PROPOSER_WEIGHT + proposer_reward = Gwei(inclusion_reward * WEIGHT_DENOMINATOR // proposer_reward_denominator) + increase_balance(state, get_beacon_proposer_index(state), proposer_reward) ``` ### Epoch processing From 582965fd0bdc03c49af564f0c417c6ab30e7545c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9=20Monnot?= Date: Fri, 26 Mar 2021 18:57:02 +0800 Subject: [PATCH 4/9] Deprecate PROPOSER_REWARD_QUOTIENT from tests --- .../test/altair/block_processing/test_process_sync_committee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py index 70509bea3..fb6206388 100644 --- a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py +++ b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py @@ -137,7 +137,7 @@ def compute_sync_committee_proposer_reward(spec, state, committee, committee_bit inclusion_reward = compute_sync_committee_inclusion_reward( spec, state, index, committee, committee_bits, ) - proposer_denominator = (spec.WEIGHT_DENOMINATOR - spec.PROPOSER_WEIGHT) * spec.PROPOSER_REWARD_QUOTIENT + proposer_reward_denominator = (spec.WEIGHT_DENOMINATOR - spec.PROPOSER_WEIGHT) * spec.WEIGHT_DENOMINATOR // spec.PROPOSER_WEIGHT proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // proposer_denominator) return proposer_reward From d1c9b8bade7a6b65aa79e16b14409a97fbda97d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9=20Monnot?= Date: Fri, 26 Mar 2021 19:03:12 +0800 Subject: [PATCH 5/9] Fix variable name --- .../test/altair/block_processing/test_process_sync_committee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py index fb6206388..340273a8f 100644 --- a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py +++ b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py @@ -138,7 +138,7 @@ def compute_sync_committee_proposer_reward(spec, state, committee, committee_bit spec, state, index, committee, committee_bits, ) proposer_reward_denominator = (spec.WEIGHT_DENOMINATOR - spec.PROPOSER_WEIGHT) * spec.WEIGHT_DENOMINATOR // spec.PROPOSER_WEIGHT - proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // proposer_denominator) + proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // proposer_reward_denominator) return proposer_reward From d773c6ae9ea18150442ceb1dc4a451ae8b304b01 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Fri, 26 Mar 2021 08:28:34 -0600 Subject: [PATCH 6/9] lint from pr --- .../altair/block_processing/test_process_sync_committee.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py index 340273a8f..aa602e389 100644 --- a/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py +++ b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py @@ -137,7 +137,11 @@ def compute_sync_committee_proposer_reward(spec, state, committee, committee_bit inclusion_reward = compute_sync_committee_inclusion_reward( spec, state, index, committee, committee_bits, ) - proposer_reward_denominator = (spec.WEIGHT_DENOMINATOR - spec.PROPOSER_WEIGHT) * spec.WEIGHT_DENOMINATOR // spec.PROPOSER_WEIGHT + proposer_reward_denominator = ( + (spec.WEIGHT_DENOMINATOR - spec.PROPOSER_WEIGHT) + * spec.WEIGHT_DENOMINATOR + // spec.PROPOSER_WEIGHT + ) proposer_reward += spec.Gwei((inclusion_reward * spec.WEIGHT_DENOMINATOR) // proposer_reward_denominator) return proposer_reward From 88d8f80957f618d64a49d3314d0a330e6e1388d5 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 2 Apr 2021 14:52:32 +0100 Subject: [PATCH 7/9] Fix two bugs (and some cleanups) Fix two bugs: 1) The participant reward (previously known as "inclusion reward") should not be proportional to `effective_balance` because a sync committee member is already chosen with probability proportional to the effective balance. Credit to @vbuterin. 2) The participant reward (previously known as "inclusion reward") was too large by a factor of `len(participant_indices)`, not taking into account the `for` loop. Fixing these two bugs actually makes the code significantly simpler and cleaner :) @barnabemonnot: Could you check the logic? :) If confirmed happy to update the tests. --- specs/altair/beacon-chain.md | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index ac71dccf9..35122a6d1 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -91,7 +91,7 @@ Altair is the first beacon chain hard fork. Its main features are: | `PROPOSER_WEIGHT` | `uint64(8)` | | `WEIGHT_DENOMINATOR` | `uint64(64)` | -*Note*: The sum of the weight fractions (7/8) plus the proposer inclusion fraction (1/8) equals 1. +*Note*: The sum of the weights equal `WEIGHT_DENOMINATOR`. ### Misc @@ -531,30 +531,25 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None: ```python def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None: # Verify sync committee aggregate signature signing over the previous slot block root - previous_slot = Slot(max(int(state.slot), 1) - 1) - committee_indices = get_sync_committee_indices(state, get_current_epoch(state)) - included_indices = [index for index, bit in zip(committee_indices, aggregate.sync_committee_bits) if bit] committee_pubkeys = state.current_sync_committee.pubkeys - included_pubkeys = [pubkey for pubkey, bit in zip(committee_pubkeys, aggregate.sync_committee_bits) if bit] + participant_pubkeys = [pubkey for pubkey, bit in zip(committee_pubkeys, aggregate.sync_committee_bits) if bit] + previous_slot = max(state.slot, Slot(1)) - Slot(1) domain = get_domain(state, DOMAIN_SYNC_COMMITTEE, compute_epoch_at_slot(previous_slot)) signing_root = compute_signing_root(get_block_root_at_slot(state, previous_slot), domain) - assert eth2_fast_aggregate_verify(included_pubkeys, signing_root, aggregate.sync_committee_signature) + assert eth2_fast_aggregate_verify(participant_pubkeys, signing_root, aggregate.sync_committee_signature) - # Compute the maximum sync rewards for the slot + # Compute the participant reward total_active_increments = get_total_active_balance(state) // EFFECTIVE_BALANCE_INCREMENT total_base_rewards = Gwei(get_base_reward_per_increment(state) * total_active_increments) - max_epoch_rewards = Gwei(total_base_rewards * SYNC_REWARD_WEIGHT // WEIGHT_DENOMINATOR) - max_slot_rewards = Gwei(max_epoch_rewards * len(included_indices) // len(committee_indices) // SLOTS_PER_EPOCH) + max_participant_rewards = Gwei(total_base_rewards * SYNC_REWARD_WEIGHT // WEIGHT_DENOMINATOR // SLOTS_PER_EPOCH) + participant_reward = Gwei(max_participant_rewards // SYNC_COMMITTEE_SIZE) - # Compute the participant and proposer sync rewards - committee_effective_balance = sum([state.validators[index].effective_balance for index in included_indices]) - committee_effective_balance = max(EFFECTIVE_BALANCE_INCREMENT, committee_effective_balance) - for included_index in included_indices: - effective_balance = state.validators[included_index].effective_balance - inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) - increase_balance(state, included_index, inclusion_reward) - proposer_reward_denominator = (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * WEIGHT_DENOMINATOR // PROPOSER_WEIGHT - proposer_reward = Gwei(inclusion_reward * WEIGHT_DENOMINATOR // proposer_reward_denominator) + # Compute the sync sync committee participant reward and the block proposer inclusion reward + committee_indices = get_sync_committee_indices(state, get_current_epoch(state)) + participant_indices = [index for index, bit in zip(committee_indices, aggregate.sync_committee_bits) if bit] + for participant_index in participant_indices: + increase_balance(state, participant_index, participant_reward) + proposer_reward = Gwei(participant_reward * PROPOSER_WEIGHT // (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT)) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) ``` From 48fb9c39c2155950304554ec1b2d6bc5858f1f5f Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 2 Apr 2021 15:05:54 +0100 Subject: [PATCH 8/9] Update beacon-chain.md --- specs/altair/beacon-chain.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 35122a6d1..72d511b04 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -538,18 +538,18 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None signing_root = compute_signing_root(get_block_root_at_slot(state, previous_slot), domain) assert eth2_fast_aggregate_verify(participant_pubkeys, signing_root, aggregate.sync_committee_signature) - # Compute the participant reward + # Compute participant and proposer rewards total_active_increments = get_total_active_balance(state) // EFFECTIVE_BALANCE_INCREMENT total_base_rewards = Gwei(get_base_reward_per_increment(state) * total_active_increments) max_participant_rewards = Gwei(total_base_rewards * SYNC_REWARD_WEIGHT // WEIGHT_DENOMINATOR // SLOTS_PER_EPOCH) participant_reward = Gwei(max_participant_rewards // SYNC_COMMITTEE_SIZE) + proposer_reward = Gwei(participant_reward * PROPOSER_WEIGHT // (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT)) - # Compute the sync sync committee participant reward and the block proposer inclusion reward + # Apply participant and proposer rewards committee_indices = get_sync_committee_indices(state, get_current_epoch(state)) participant_indices = [index for index, bit in zip(committee_indices, aggregate.sync_committee_bits) if bit] for participant_index in participant_indices: increase_balance(state, participant_index, participant_reward) - proposer_reward = Gwei(participant_reward * PROPOSER_WEIGHT // (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT)) increase_balance(state, get_beacon_proposer_index(state), proposer_reward) ``` From 0bbef67efe5b76fb197d805fba6a06d1cf45923f Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 6 Apr 2021 00:08:30 +0800 Subject: [PATCH 9/9] Add ALTAIR_INVAIANT_CHECKS, checks the weight configurations --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 91baf978f..6d9147661 100644 --- a/setup.py +++ b/setup.py @@ -277,6 +277,12 @@ ALTAIR_HARDCODED_SSZ_DEP_CONSTANTS = { } +ALTAIR_INVAIANT_CHECKS = ''' +assert ( + TIMELY_HEAD_WEIGHT + TIMELY_SOURCE_WEIGHT + TIMELY_TARGET_WEIGHT + SYNC_REWARD_WEIGHT + PROPOSER_WEIGHT +) == WEIGHT_DENOMINATOR''' + + def is_phase0(fork): return fork == PHASE0 @@ -331,6 +337,7 @@ def objects_to_spec(spec_object: SpecObject, imports: str, fork: str, ordered_cl if is_altair(fork): altair_ssz_dep_constants_verification = '\n'.join(map(lambda x: 'assert %s == %s' % (x, spec_object.ssz_dep_constants[x]), ALTAIR_HARDCODED_SSZ_DEP_CONSTANTS)) spec += '\n\n\n' + altair_ssz_dep_constants_verification + spec += '\n' + ALTAIR_INVAIANT_CHECKS spec += '\n' return spec