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

add missing electra attestation processing committee check #8901

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
import java.util.List;
import java.util.Optional;
import tech.pegasys.teku.ethtests.finder.TestDefinition;
import tech.pegasys.teku.infrastructure.ssz.SszData;
Expand Down Expand Up @@ -68,9 +67,6 @@ public class OperationsTestExecutor<T extends SszData> implements TestExecutor {

public static final String EXPECTED_STATE_FILE = "post.ssz_snappy";

// TODO remove https://github.com/Consensys/teku/issues/8892
private static final List<String> IGNORED_TEST = List.of("invalid_nonset_bits_for_one_committee");

private enum Operation {
ATTESTER_SLASHING,
PROPOSER_SLASHING,
Expand Down Expand Up @@ -148,11 +144,6 @@ public OperationsTestExecutor(final String dataFileName, final Operation operati

@Override
public void runTest(final TestDefinition testDefinition) throws Exception {
// TODO remove https://github.com/Consensys/teku/issues/8892
if (IGNORED_TEST.contains(testDefinition.getTestName())) {
return;
}

final BeaconState preState = loadStateFromSsz(testDefinition, "pre.ssz_snappy");

final DefaultOperationProcessor standardProcessor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes32;
Expand Down Expand Up @@ -732,6 +733,16 @@ private Optional<OperationInvalidReason> checkCommittees(
}
final IntList committee =
beaconStateAccessorsElectra.getBeaconCommittee(state, slot, committeeIndex);
final int committeeOffset = participantsCount;
final long committeeAttesterCount =
IntStream.range(0, committee.size())
.filter(
committeeParticipantIndex ->
aggregationBits.isSet(committeeOffset + committeeParticipantIndex))
.count();
if (committeeAttesterCount == 0) {
return Optional.of(AttestationInvalidReason.PARTICIPANTS_COUNT_MISMATCH);
}
mehdi-aouadi marked this conversation as resolved.
Show resolved Hide resolved
participantsCount += committee.size();
}
if (participantsCount != aggregationBits.size()) {
Expand Down
Loading