Skip to content

Commit

Permalink
Reduce wait period to avoid flakiness (Consensys#8701)
Browse files Browse the repository at this point in the history
* reduce wait period to avoid flakiness

Signed-off-by: Gabriel Fukushima <[email protected]>

* Reduce parallelism for ATs

Signed-off-by: Gabriel Fukushima <[email protected]>

---------

Signed-off-by: Gabriel Fukushima <[email protected]>
  • Loading branch information
gfukushima authored and tbenr committed Oct 14, 2024
1 parent 60baf7f commit b2a46b8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
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)
.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

0 comments on commit b2a46b8

Please sign in to comment.