most_recent_confirmed_commitments -> grantparent_epoch_confirmed_commitments

This commit is contained in:
Dankrad Feist 2020-12-28 16:53:50 +00:00 committed by protolambda
parent f44b7ffe48
commit 41f97162d6
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
2 changed files with 4 additions and 4 deletions

View File

@ -150,7 +150,7 @@ class BeaconState(phase0.BeaconState):
# New fields
current_epoch_pending_shard_headers: List[PendingShardHeader, MAX_SHARD_HEADERS * SLOTS_PER_EPOCH]
previous_epoch_pending_shard_headers: List[PendingShardHeader, MAX_SHARD_HEADERS * SLOTS_PER_EPOCH]
most_recent_confirmed_commitments: Vector[Vector[DataCommitment, SLOTS_PER_EPOCH], MAX_SHARDS]
grandparent_epoch_confirmed_commitments: Vector[Vector[DataCommitment, SLOTS_PER_EPOCH], MAX_SHARDS]
shard_gasprice: uint64
current_epoch_start_shard: Shard
```
@ -591,10 +591,10 @@ def process_pending_headers(state: BeaconState):
candidates[winning_index].confirmed = True
for slot in range(SLOTS_PER_EPOCH):
for shard in range(SHARD_COUNT):
state.most_recent_confirmed_commitments[shard][slot] = DataCommitment()
state.grandparent_epoch_confirmed_commitments[shard][slot] = DataCommitment()
for c in state.previous_epoch_pending_shard_headers:
if c.confirmed:
state.most_recent_confirmed_commitments[c.shard][c.slot % SLOTS_PER_EPOCH] = c.commitment
state.grandparent_epoch_confirmed_commitments[c.shard][c.slot % SLOTS_PER_EPOCH] = c.commitment
```
```python

View File

@ -27,7 +27,7 @@ def get_new_dependencies(state: BeaconState) -> Set[DataCommitment]:
# Already confirmed during previous epoch
[c.commitment for c in state.previous_epoch_pending_headers if c.confirmed] +
# Confirmed in the epoch before the previous
[c for c in shard for shard in state.most_recent_confirmed_commitments if c != DataCommitment()]
[c for c in shard for shard in state.grandparent_epoch_confirmed_commitments if c != DataCommitment()]
)
```