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

Reduce wait period to avoid flakiness #8701

Merged
merged 10 commits into from
Oct 11, 2024
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ jobs:
path: build/test-results

acceptanceTests:
parallelism: 5
parallelism: 4
executor: machine_large_executor_amd64
steps:
- install_java_21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.junit.jupiter.params.provider.MethodSource;
import tech.pegasys.teku.bls.BLSKeyPair;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.test.acceptance.dsl.TekuBeaconNode;
import tech.pegasys.teku.test.acceptance.dsl.TekuNodeConfigBuilder;
import tech.pegasys.teku.test.acceptance.dsl.TekuValidatorNode;
Expand All @@ -39,43 +38,25 @@ public class MultiPeersStandAloneVcBlocksAcceptanceTest
shouldShutDownWhenOwnedValidatorSlashed_StandAloneVC_MultiplePeers_SlashingThroughBlock_NoSlashingEventsGossip(
final SlashingEventType slashingEventType) throws Exception {

final int genesisTime = timeProvider.getTimeInSeconds().plus(10).intValue();
final UInt64 altairEpoch = UInt64.valueOf(100);
final int genesisTime = timeProvider.getTimeInSeconds().plus(30).intValue();

final TekuBeaconNode firstTekuNode =
createTekuBeaconNode(
TekuNodeConfigBuilder.createBeaconNode()
.withGenesisTime(genesisTime)
.withNetwork(network)
.withRealNetwork()
.withAltairEpoch(altairEpoch)
.withSubscribeAllSubnetsEnabled()
.withInteropValidators(0, 32)
.build());

firstTekuNode.start();

firstTekuNode.waitForEpochAtOrAbove(2);

final int slashedValidatorIndex = 34;
final BLSKeyPair slashedValidatorKeyPair = getBlsKeyPair(slashedValidatorIndex);
final int slotInThirdEpoch =
firstTekuNode.getSpec().forMilestone(SpecMilestone.ALTAIR).getSlotsPerEpoch() * 2 + 3;

postSlashing(
firstTekuNode,
UInt64.valueOf(slotInThirdEpoch),
UInt64.valueOf(slashedValidatorIndex),
slashedValidatorKeyPair.getSecretKey(),
slashingEventType);

final TekuBeaconNode secondBeaconNode =
createTekuBeaconNode(
TekuNodeConfigBuilder.createBeaconNode()
.withGenesisTime(genesisTime)
.withNetwork(network)
.withRealNetwork()
.withRealNetwork()
.withAltairEpoch(altairEpoch)
Copy link
Contributor

Choose a reason for hiding this comment

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

is removal of withAltairEpoch intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

think so, although this was added by Paul's commit, we never actually reached the epoch where Altair was set.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes it was pointless to have altair at epoch 100 when we're finishing in a few epochs...

.withSubscribeAllSubnetsEnabled()
.withPeers(firstTekuNode)
.build());

Expand All @@ -89,10 +70,23 @@ public class MultiPeersStandAloneVcBlocksAcceptanceTest
.withBeaconNodes(secondBeaconNode)
.build());

firstTekuNode.start();
secondBeaconNode.start();

secondValidatorClient.start();

firstTekuNode.waitForEpochAtOrAbove(1);

final int slashedValidatorIndex = 34;
final BLSKeyPair slashedValidatorKeyPair = getBlsKeyPair(slashedValidatorIndex);
final int slotInSecondEpoch = firstTekuNode.getSpec().getGenesisSpec().getSlotsPerEpoch() + 3;

postSlashing(
firstTekuNode,
UInt64.valueOf(slotInSecondEpoch),
UInt64.valueOf(slashedValidatorIndex),
slashedValidatorKeyPair.getSecretKey(),
slashingEventType);

secondValidatorClient.waitForLogMessageContaining(
String.format(slashingActionLog, slashedValidatorKeyPair.getPublicKey().toHexString()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ValidatorSlashingDetectionAcceptanceTest extends AcceptanceTestBase
final String slashingActionLog =
"Validator slashing detection is enabled and validator(s) with public key(s) %s detected as slashed. "
+ "Shutting down...";
final int shutdownWaitingSeconds = 60;
final int shutdownWaitingSeconds = 90;

enum SlashingEventType {
PROPOSER_SLASHING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public void postProposerSlashing(
randomSignedBeaconBlockHeader(slot, index, secretKey, signingRootUtil, forkInfo);
final SignedBeaconBlockHeader header2 =
randomSignedBeaconBlockHeader(slot, index, secretKey, signingRootUtil, forkInfo);
LOG.debug("Inserting proposer slashing for index {} at slot {}", index, slot);
final String body =
JsonUtil.serialize(
new ProposerSlashing(header1, header2),
Expand Down Expand Up @@ -256,6 +257,7 @@ public void postAttesterSlashing(
spec.getGenesisSchemaDefinitions()
.getAttesterSlashingSchema()
.create(indexedAttestation1, indexedAttestation2);
LOG.debug("Inserting attester slashing for index {} at slot {}", slashedIndex, slashingSlot);
final String body =
JsonUtil.serialize(
attesterSlashing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,12 @@ public TekuNodeConfigBuilder withDoppelgangerDetectionEnabled() {
return this;
}

public TekuNodeConfigBuilder withSubscribeAllSubnetsEnabled() {
LOG.debug("p2p-subscribe-all-subnets-enabled=true");
configMap.put("p2p-subscribe-all-subnets-enabled", true);
return this;
}

public TekuNodeConfigBuilder withDepositsFrom(final BesuNode eth1Node) {
mustBe(NodeType.BEACON_NODE);
configMap.put("Xinterop-enabled", false);
Expand Down