Skip to content

Commit

Permalink
Update the code according to the latest update to ethereum/consensus-…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashatyrev committed May 5, 2021
1 parent 39e1c85 commit 862de4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ private void updatePendingVotes(MutableBeaconStateRayonism state, Attestation at
} else {
pendingHeaders = state.getPrevious_epoch_pending_shard_headers();
}
UInt64 shard =
committeeUtilRayonism.computeShardFromCommitteeIndex(
state, attestation.getData().getSlot(), attestation.getData().getIndex());
// pending_header = None
// for header in pending_headers:
// if header.root == attestation.data.shard_header_root:
Expand All @@ -216,7 +219,9 @@ private void updatePendingVotes(MutableBeaconStateRayonism state, Attestation at
Optional<PendingShardHeader> maybePendingHeader = Optional.empty();
for (int i = 0; i < pendingHeaders.size(); i++) {
PendingShardHeader pendingHeader = pendingHeaders.get(i);
if (pendingHeader.getRoot().equals(attestation.getData().getShard_header_root())) {
if (pendingHeader.getRoot().equals(attestation.getData().getShard_header_root())
&& pendingHeader.getSlot().equals(attestation.getData().getSlot())
&& pendingHeader.getShard().equals(shard)) {
maybePendingHeader = Optional.of(pendingHeader);
pendingHeaderIndex = i;
break;
Expand All @@ -237,9 +242,6 @@ private void updatePendingVotes(MutableBeaconStateRayonism state, Attestation at
// attestation.data.slot,
// attestation.data.index,
// )
UInt64 shard =
committeeUtilRayonism.computeShardFromCommitteeIndex(
state, attestation.getData().getSlot(), attestation.getData().getIndex());
checkArgument(
pendingHeader.getShard().equals(shard),
"updatePendingVotes: attestation index should match header shard");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,12 @@ private void resetPendingHeaders(MutableBeaconStateRayonism state) {
// votes=Bitlist[MAX_VALIDATORS_PER_COMMITTEE]([0] * committee_length),
// confirmed=False,
// ))
ShardBlobHeader shardHeader = new ShardBlobHeader(slot, shard);
PendingShardHeader emptyPendingShardHeader =
new PendingShardHeader(
slot,
shard,
new DataCommitment(),
shardHeader.hashTreeRoot(),
Bytes32.ZERO,
PendingShardHeader.SSZ_SCHEMA.getVotesSchema().ofBits(committeeLength),
false);
state.getCurrent_epoch_pending_shard_headers().append(emptyPendingShardHeader);
Expand Down

0 comments on commit 862de4c

Please sign in to comment.