Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sharding] Fix unspecified SHARD_COUNT and DOMAIN_SHARD_HEADER constants #2367

Merged
merged 4 commits into from
May 4, 2021

Conversation

Nashatyrev
Copy link
Member

  • Replace unspecified DOMAIN_SHARD_HEADER const with DOMAIN_SHARD_PROPOSER
  • Replace unspecified SHARD_COUNT const with get_active_shard_count(previous_epoch) in charge_confirmed_header_fees
  • Replace unspecified SHARD_COUNT with MAX_SHARDS when clearing grandparent_epoch_confirmed_commitments with default values

Fix #2357

@hwwhww hwwhww added the scope:sharding Sharding label May 4, 2021
@@ -718,9 +718,10 @@ def charge_confirmed_header_fees(state: BeaconState) -> None:
get_active_shard_count(state, get_current_epoch(state))
* SLOTS_PER_EPOCH * GASPRICE_ADJUSTMENT_COEFFICIENT
)
previous_epoch_start_slot = compute_start_slot_at_epoch(get_previous_epoch(state))
previous_epoch = get_previous_epoch(state)
previous_epoch_start_slot = compute_start_slot_at_epoch(previous_epoch)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix, but this reminds me we should limit some of these methods to epoch 1+, epoch 0 doesn't work quite as expected. The previous epoch var would be clipped to 0, and then it tries to confirm current-epoch shard headers.

Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll review the function usage for the epoch 0 edge case and put that in a separate PR.

@protolambda protolambda merged commit 8558bd7 into ethereum:dev May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOMAIN_SHARD_HEADER is missing in sharding phase spec
3 participants