Skip to content

Commit 56ef1a4

Browse files
run process ethspecify
1 parent 841f30d commit 56ef1a4

File tree

3 files changed

+239
-0
lines changed

3 files changed

+239
-0
lines changed

specrefs/constants.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
- name: ATTESTATION_TIMELINESS_INDEX#gloas
2+
sources: []
3+
spec: |
4+
<spec constant_var="ATTESTATION_TIMELINESS_INDEX" fork="gloas" hash="7d373fc8">
5+
ATTESTATION_TIMELINESS_INDEX = 0
6+
</spec>
7+
18
- name: BASE_REWARDS_PER_EPOCH#phase0
29
sources:
310
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigPhase0.java
@@ -208,6 +215,13 @@
208215
DOMAIN_DEPOSIT: DomainType = '0x03000000'
209216
</spec>
210217
218+
- name: DOMAIN_PROPOSER_PREFERENCES#gloas
219+
sources: []
220+
spec: |
221+
<spec constant_var="DOMAIN_PROPOSER_PREFERENCES" fork="gloas" hash="9377ecfb">
222+
DOMAIN_PROPOSER_PREFERENCES: DomainType = '0x0D000000'
223+
</spec>
224+
211225
- name: DOMAIN_PTC_ATTESTER#gloas
212226
sources:
213227
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/constants/Domain.java
@@ -399,6 +413,13 @@
399413
NODE_ID_BITS = 256
400414
</spec>
401415
416+
- name: NUM_BLOCK_TIMELINESS_DEADLINES#gloas
417+
sources: []
418+
spec: |
419+
<spec constant_var="NUM_BLOCK_TIMELINESS_DEADLINES" fork="gloas" hash="c4e721d9">
420+
NUM_BLOCK_TIMELINESS_DEADLINES = 2
421+
</spec>
422+
402423
- name: PARTICIPATION_FLAG_WEIGHTS#altair
403424
sources:
404425
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/MiscHelpersAltair.java
@@ -445,6 +466,13 @@
445466
PROPOSER_WEIGHT: uint64 = 8
446467
</spec>
447468
469+
- name: PTC_TIMELINESS_INDEX#gloas
470+
sources: []
471+
spec: |
472+
<spec constant_var="PTC_TIMELINESS_INDEX" fork="gloas" hash="ffca13bd">
473+
PTC_TIMELINESS_INDEX = 1
474+
</spec>
475+
448476
- name: RANDOM_CHALLENGE_KZG_BATCH_DOMAIN#deneb
449477
sources: []
450478
spec: |

specrefs/containers.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,17 @@
14081408
total_difficulty: uint256
14091409
</spec>
14101410
1411+
- name: ProposerPreferences#gloas
1412+
sources: []
1413+
spec: |
1414+
<spec container="ProposerPreferences" fork="gloas" hash="2a38b149">
1415+
class ProposerPreferences(Container):
1416+
proposal_slot: Slot
1417+
validator_index: ValidatorIndex
1418+
fee_recipient: ExecutionAddress
1419+
gas_limit: uint64
1420+
</spec>
1421+
14111422
- name: ProposerSlashing#phase0
14121423
sources:
14131424
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/ProposerSlashing.java
@@ -1505,6 +1516,15 @@
15051516
signature: BLSSignature
15061517
</spec>
15071518
1519+
- name: SignedProposerPreferences#gloas
1520+
sources: []
1521+
spec: |
1522+
<spec container="SignedProposerPreferences" fork="gloas" hash="2142774c">
1523+
class SignedProposerPreferences(Container):
1524+
message: ProposerPreferences
1525+
signature: BLSSignature
1526+
</spec>
1527+
15081528
- name: SignedVoluntaryExit#phase0
15091529
sources:
15101530
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/operations/SignedVoluntaryExit.java

specrefs/functions.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,15 @@
13111311
]
13121312
</spec>
13131313

1314+
- name: compute_proposer_score#phase0
1315+
sources: []
1316+
spec: |
1317+
<spec fn="compute_proposer_score" fork="phase0" hash="43ff8b01">
1318+
def compute_proposer_score(state: BeaconState) -> Gwei:
1319+
committee_weight = get_total_active_balance(state) // SLOTS_PER_EPOCH
1320+
return (committee_weight * PROPOSER_SCORE_BOOST) // 100
1321+
</spec>
1322+
13141323
- name: compute_pulled_up_tip#phase0
13151324
sources: []
13161325
spec: |
@@ -2587,6 +2596,61 @@
25872596
return participation_flag_indices
25882597
</spec>
25892598

2599+
- name: get_attestation_score#phase0
2600+
sources: []
2601+
spec: |
2602+
<spec fn="get_attestation_score" fork="phase0" hash="da969f50">
2603+
def get_attestation_score(store: Store, root: Root, state: BeaconState) -> Gwei:
2604+
unslashed_and_active_indices = [
2605+
i
2606+
for i in get_active_validator_indices(state, get_current_epoch(state))
2607+
if not state.validators[i].slashed
2608+
]
2609+
return Gwei(
2610+
sum(
2611+
state.validators[i].effective_balance
2612+
for i in unslashed_and_active_indices
2613+
if (
2614+
i in store.latest_messages
2615+
and i not in store.equivocating_indices
2616+
and get_ancestor(store, store.latest_messages[i].root, store.blocks[root].slot)
2617+
== root
2618+
)
2619+
)
2620+
)
2621+
</spec>
2622+
2623+
- name: get_attestation_score#gloas
2624+
sources: []
2625+
spec: |
2626+
<spec fn="get_attestation_score" fork="gloas" hash="8a2e4701">
2627+
def get_attestation_score(
2628+
store: Store,
2629+
# [Modified in Gloas:EIP7732]
2630+
# Removed `root`
2631+
# [New in Gloas:EIP7732]
2632+
node: ForkChoiceNode,
2633+
state: BeaconState,
2634+
) -> Gwei:
2635+
unslashed_and_active_indices = [
2636+
i
2637+
for i in get_active_validator_indices(state, get_current_epoch(state))
2638+
if not state.validators[i].slashed
2639+
]
2640+
return Gwei(
2641+
sum(
2642+
state.validators[i].effective_balance
2643+
for i in unslashed_and_active_indices
2644+
if (
2645+
i in store.latest_messages
2646+
and i not in store.equivocating_indices
2647+
# [Modified in Gloas:EIP7732]
2648+
and is_supporting_vote(store, node, store.latest_messages[i])
2649+
)
2650+
)
2651+
)
2652+
</spec>
2653+
25902654
- name: get_attestation_signature#phase0
25912655
sources:
25922656
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/signatures/SigningRootUtil.java
@@ -4595,6 +4659,20 @@
45954659
return head_root
45964660
</spec>
45974661

4662+
- name: get_proposer_preferences_signature#gloas
4663+
sources: []
4664+
spec: |
4665+
<spec fn="get_proposer_preferences_signature" fork="gloas" hash="6a34cb73">
4666+
def get_proposer_preferences_signature(
4667+
state: BeaconState, preferences: ProposerPreferences, privkey: int
4668+
) -> BLSSignature:
4669+
domain = get_domain(
4670+
state, DOMAIN_PROPOSER_PREFERENCES, compute_epoch_at_slot(preferences.proposal_slot)
4671+
)
4672+
signing_root = compute_signing_root(preferences, domain)
4673+
return bls.Sign(privkey, signing_root)
4674+
</spec>
4675+
45984676
- name: get_proposer_reorg_cutoff_ms#phase0
45994677
sources:
46004678
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/Spec.java
@@ -4959,6 +5037,23 @@
49595037
return set(filter(lambda index: not state.validators[index].slashed, participating_indices))
49605038
</spec>
49615039

5040+
- name: get_upcoming_proposal_slots#gloas
5041+
sources: []
5042+
spec: |
5043+
<spec fn="get_upcoming_proposal_slots" fork="gloas" hash="802ba480">
5044+
def get_upcoming_proposal_slots(
5045+
state: BeaconState, validator_index: ValidatorIndex
5046+
) -> Sequence[Slot]:
5047+
"""
5048+
Get the slots in the next epoch for which ``validator_index`` is proposing.
5049+
"""
5050+
return [
5051+
Slot(compute_start_slot_at_epoch(get_current_epoch(state) + Epoch(1)) + offset)
5052+
for offset, proposer_index in enumerate(state.proposer_lookahead[SLOTS_PER_EPOCH:])
5053+
if validator_index == proposer_index
5054+
]
5055+
</spec>
5056+
49625057
- name: get_validator_activation_churn_limit#deneb
49635058
sources:
49645059
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/helpers/BeaconStateAccessors.java
@@ -5804,6 +5899,23 @@
58045899
)
58055900
</spec>
58065901

5902+
- name: is_eligible_for_partial_withdrawals#electra
5903+
sources: []
5904+
spec: |
5905+
<spec fn="is_eligible_for_partial_withdrawals" fork="electra" hash="c8d29720">
5906+
def is_eligible_for_partial_withdrawals(validator: Validator, balance: Gwei) -> bool:
5907+
"""
5908+
Check if ``validator`` can process a pending partial withdrawal.
5909+
"""
5910+
has_sufficient_effective_balance = validator.effective_balance >= MIN_ACTIVATION_BALANCE
5911+
has_excess_balance = balance > MIN_ACTIVATION_BALANCE
5912+
return (
5913+
validator.exit_epoch == FAR_FUTURE_EPOCH
5914+
and has_sufficient_effective_balance
5915+
and has_excess_balance
5916+
)
5917+
</spec>
5918+
58075919
- name: is_execution_block#bellatrix
58085920
sources: []
58095921
spec: |
@@ -5896,6 +6008,14 @@
58966008
return not store.block_timeliness[head_root]
58976009
</spec>
58986010

6011+
- name: is_head_late#gloas
6012+
sources: []
6013+
spec: |
6014+
<spec fn="is_head_late" fork="gloas" hash="dd4c9308">
6015+
def is_head_late(store: Store, head_root: Root) -> bool:
6016+
return not store.block_timeliness[head_root][ATTESTATION_TIMELINESS_INDEX]
6017+
</spec>
6018+
58996019
- name: is_head_weak#phase0
59006020
sources:
59016021
- file: storage/src/main/java/tech/pegasys/teku/storage/store/Store.java
@@ -5909,6 +6029,34 @@
59096029
return head_weight < reorg_threshold
59106030
</spec>
59116031

6032+
- name: is_head_weak#gloas
6033+
sources: []
6034+
spec: |
6035+
<spec fn="is_head_weak" fork="gloas" hash="a763a3db">
6036+
def is_head_weak(store: Store, head_root: Root) -> bool:
6037+
# Calculate weight threshold for weak head
6038+
justified_state = store.checkpoint_states[store.justified_checkpoint]
6039+
reorg_threshold = calculate_committee_fraction(justified_state, REORG_HEAD_WEIGHT_THRESHOLD)
6040+
6041+
# Compute head weight including equivocations
6042+
head_state = store.block_states[head_root]
6043+
head_block = store.blocks[head_root]
6044+
epoch = compute_epoch_at_slot(head_block.slot)
6045+
head_node = ForkChoiceNode(root=head_root, payload_status=PAYLOAD_STATUS_PENDING)
6046+
head_weight = get_attestation_score(store, head_node, justified_state)
6047+
for index in range(get_committee_count_per_slot(head_state, epoch)):
6048+
committee = get_beacon_committee(head_state, head_block.slot, CommitteeIndex(index))
6049+
head_weight += Gwei(
6050+
sum(
6051+
justified_state.validators[i].effective_balance
6052+
for i in committee
6053+
if i in store.equivocating_indices
6054+
)
6055+
)
6056+
6057+
return head_weight < reorg_threshold
6058+
</spec>
6059+
59126060
- name: is_in_inactivity_leak#phase0
59136061
sources:
59146062
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/helpers/BeaconStateAccessors.java
@@ -6013,6 +6161,20 @@
60136161
return parent_weight > parent_threshold
60146162
</spec>
60156163

6164+
- name: is_parent_strong#gloas
6165+
sources: []
6166+
spec: |
6167+
<spec fn="is_parent_strong" fork="gloas" hash="37089462">
6168+
def is_parent_strong(store: Store, root: Root) -> bool:
6169+
justified_state = store.checkpoint_states[store.justified_checkpoint]
6170+
parent_threshold = calculate_committee_fraction(justified_state, REORG_PARENT_WEIGHT_THRESHOLD)
6171+
block = store.blocks[root]
6172+
parent_payload_status = get_parent_payload_status(store, block)
6173+
parent_node = ForkChoiceNode(root=block.parent_root, payload_status=parent_payload_status)
6174+
parent_weight = get_attestation_score(store, parent_node, justified_state)
6175+
return parent_weight > parent_threshold
6176+
</spec>
6177+
60166178
- name: is_partially_withdrawable_validator#capella
60176179
sources:
60186180
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/helpers/PredicatesElectra.java
@@ -6094,6 +6256,23 @@
60946256
return get_beacon_proposer_index(state) == validator_index
60956257
</spec>
60966258

6259+
- name: is_proposer_equivocation#phase0
6260+
sources: []
6261+
spec: |
6262+
<spec fn="is_proposer_equivocation" fork="phase0" hash="8e90bb33">
6263+
def is_proposer_equivocation(store: Store, root: Root) -> bool:
6264+
block = store.blocks[root]
6265+
proposer_index = block.proposer_index
6266+
slot = block.slot
6267+
# roots from the same slot and proposer
6268+
matching_roots = [
6269+
root
6270+
for root, block in store.blocks.items()
6271+
if (block.proposer_index == proposer_index and block.slot == slot)
6272+
]
6273+
return len(matching_roots) > 1
6274+
</spec>
6275+
60976276
- name: is_proposing_on_time#phase0
60986277
sources:
60996278
- file: storage/src/main/java/tech/pegasys/teku/storage/client/LateBlockReorgLogic.java
@@ -6378,6 +6557,18 @@
63786557
return is_valid_merkle_branch(leaf, branch[num_extra:], depth, index, root)
63796558
</spec>
63806559

6560+
- name: is_valid_proposal_slot#gloas
6561+
sources: []
6562+
spec: |
6563+
<spec fn="is_valid_proposal_slot" fork="gloas" hash="55b8762f">
6564+
def is_valid_proposal_slot(state: BeaconState, preferences: ProposerPreferences) -> bool:
6565+
"""
6566+
Check if the validator is the proposer for the given slot in the next epoch.
6567+
"""
6568+
index = SLOTS_PER_EPOCH + preferences.proposal_slot % SLOTS_PER_EPOCH
6569+
return state.proposer_lookahead[index] == preferences.validator_index
6570+
</spec>
6571+
63816572
- name: is_valid_switch_to_compounding_request#electra
63826573
sources:
63836574
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/helpers/BeaconStateMutatorsElectra.java

0 commit comments

Comments
 (0)