Skip to content

Commit ff45f03

Browse files
committed
Remove more unnecessary casts
1 parent d3f095b commit ff45f03

15 files changed

Lines changed: 26 additions & 28 deletions

File tree

specs/_features/eip8148/beacon-chain.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def get_validators_sweep_withdrawals(
422422
amount=balance,
423423
)
424424
)
425-
withdrawal_index += WithdrawalIndex(1)
425+
withdrawal_index += 1
426426
# [Modified in EIP8148]
427427
elif is_partially_withdrawable_validator(validator, balance, sweep_threshold):
428428
withdrawals.append(
@@ -434,7 +434,7 @@ def get_validators_sweep_withdrawals(
434434
amount=balance - get_effective_sweep_threshold(validator, sweep_threshold),
435435
)
436436
)
437-
withdrawal_index += WithdrawalIndex(1)
437+
withdrawal_index += 1
438438

439439
validator_index = (validator_index + 1) % len(state.validators)
440440
processed_count += 1

specs/altair/beacon-chain.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def process_sync_aggregate(state: BeaconState, sync_aggregate: SyncAggregate) ->
661661
)
662662
if bit
663663
]
664-
previous_slot = max(state.slot, Slot(1)) - Slot(1)
664+
previous_slot = max(state.slot, Slot(1)) - 1
665665
domain = get_domain(state, DOMAIN_SYNC_COMMITTEE, compute_epoch_at_slot(previous_slot))
666666
signing_root = compute_signing_root(get_block_root_at_slot(state, previous_slot), domain)
667667
# Note: eth_fast_aggregate_verify works with a singleton list containing an aggregated key
@@ -834,7 +834,7 @@ def process_participation_flag_updates(state: BeaconState) -> None:
834834

835835
```python
836836
def process_sync_committee_updates(state: BeaconState) -> None:
837-
next_epoch = get_current_epoch(state) + Epoch(1)
837+
next_epoch = get_current_epoch(state) + 1
838838
if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0:
839839
state.current_sync_committee = state.next_sync_committee
840840
state.next_sync_committee = get_next_sync_committee(state)

specs/altair/light-client/sync-protocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def validate_light_client_update(
479479
)
480480
if bit
481481
]
482-
fork_version_slot = max(update.signature_slot, Slot(1)) - Slot(1)
482+
fork_version_slot = max(update.signature_slot, Slot(1)) - 1
483483
fork_version = compute_fork_version(compute_epoch_at_slot(fork_version_slot))
484484
domain = compute_domain(DOMAIN_SYNC_COMMITTEE, fork_version, genesis_validators_root)
485485
signing_root = compute_signing_root(update.attested_header.beacon, domain)

specs/capella/beacon-chain.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def get_validators_sweep_withdrawals(
455455
amount=balance,
456456
)
457457
)
458-
withdrawal_index += WithdrawalIndex(1)
458+
withdrawal_index += 1
459459
elif is_partially_withdrawable_validator(validator, balance):
460460
withdrawals.append(
461461
Withdrawal(
@@ -465,7 +465,7 @@ def get_validators_sweep_withdrawals(
465465
amount=balance - MAX_EFFECTIVE_BALANCE,
466466
)
467467
)
468-
withdrawal_index += WithdrawalIndex(1)
468+
withdrawal_index += 1
469469

470470
validator_index = (validator_index + 1) % len(state.validators)
471471
processed_count += 1

specs/deneb/light-client/sync-protocol.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def is_valid_light_client_header(header: LightClientHeader) -> bool:
6666

6767
# [New in Deneb:EIP4844]
6868
if epoch < DENEB_FORK_EPOCH:
69-
if header.execution.blob_gas_used != Uint64(0):
69+
if header.execution.blob_gas_used != 0:
7070
return False
71-
if header.execution.excess_blob_gas != Uint64(0):
71+
if header.execution.excess_blob_gas != 0:
7272
return False
7373

7474
if epoch < CAPELLA_FORK_EPOCH:

specs/electra/beacon-chain.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ def get_pending_partial_withdrawals(
13911391
amount=withdrawal_amount,
13921392
)
13931393
)
1394-
withdrawal_index += WithdrawalIndex(1)
1394+
withdrawal_index += 1
13951395

13961396
processed_count += 1
13971397

@@ -1435,7 +1435,7 @@ def get_validators_sweep_withdrawals(
14351435
amount=balance,
14361436
)
14371437
)
1438-
withdrawal_index += WithdrawalIndex(1)
1438+
withdrawal_index += 1
14391439
elif is_partially_withdrawable_validator(validator, balance):
14401440
withdrawals.append(
14411441
Withdrawal(
@@ -1446,7 +1446,7 @@ def get_validators_sweep_withdrawals(
14461446
amount=balance - get_max_effective_balance(validator),
14471447
)
14481448
)
1449-
withdrawal_index += WithdrawalIndex(1)
1449+
withdrawal_index += 1
14501450

14511451
validator_index = (validator_index + 1) % len(state.validators)
14521452
processed_count += 1

specs/electra/fork.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
4646
for validator in pre.validators:
4747
if validator.exit_epoch != FAR_FUTURE_EPOCH:
4848
earliest_exit_epoch = max(earliest_exit_epoch, validator.exit_epoch)
49-
earliest_exit_epoch += Epoch(1)
49+
earliest_exit_epoch += 1
5050

5151
post = BeaconState(
5252
genesis_time=pre.genesis_time,

specs/gloas/beacon-chain.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ def get_builder_withdrawals(
18271827
amount=withdrawal.amount,
18281828
)
18291829
)
1830-
withdrawal_index += WithdrawalIndex(1)
1830+
withdrawal_index += 1
18311831
processed_count += 1
18321832

18331833
return withdrawals, withdrawal_index, processed_count
@@ -1865,7 +1865,7 @@ def get_builders_sweep_withdrawals(
18651865
amount=builder.balance,
18661866
)
18671867
)
1868-
withdrawal_index += WithdrawalIndex(1)
1868+
withdrawal_index += 1
18691869

18701870
builder_index = (builder_index + 1) % len(state.builders)
18711871
processed_count += 1
@@ -2365,7 +2365,7 @@ def process_attestation(
23652365
proposer_reward_numerator = 0
23662366
for index in get_attesting_indices(state, attestation):
23672367
# [New in Gloas:EIP7732]
2368-
had_no_participation = epoch_participation[index] == ParticipationFlags(0b0000_0000)
2368+
had_no_participation = epoch_participation[index] == 0b0000_0000
23692369
will_set_new_flag = False
23702370

23712371
for flag_index, weight in enumerate(PARTICIPATION_FLAG_WEIGHTS):

specs/heze/builder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ comprises all valid and non-equivocating inclusion lists they have observed.
2626
1. Set `bid.inclusion_list_bits` to
2727
`get_inclusion_list_bits(get_inclusion_list_store(), inclusion_list_committee, slot, dependent_root, only_timely=False)`,
2828
where `inclusion_list_committee` is
29-
`get_inclusion_list_committee(state, slot)`, `slot` is `bid.slot - Slot(1)`,
29+
`get_inclusion_list_committee(state, slot)`, `slot` is `bid.slot - 1`,
3030
`dependent_root` is
3131
`get_shuffling_dependent_root(store, bid.parent_block_root, compute_epoch_at_slot(slot))`,
3232
and `store` is the fork choice store.

specs/heze/fork-choice.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def record_payload_inclusion_list_satisfaction(
190190
payload: ExecutionPayload,
191191
execution_engine: ExecutionEngine,
192192
) -> None:
193-
slot = store.blocks[root].slot - Slot(1)
193+
slot = store.blocks[root].slot - 1
194194
dependent_root = get_shuffling_dependent_root(store, root, compute_epoch_at_slot(slot))
195195
inclusion_list_transactions = get_inclusion_list_transactions(
196196
get_inclusion_list_store(), slot, dependent_root, only_timely=True

0 commit comments

Comments
 (0)