From 64ee543c31fa4e4aa02e870a8ba2f6c0350c513d Mon Sep 17 00:00:00 2001 From: Hellblazer Date: Sat, 30 Dec 2023 10:14:14 -0800 Subject: [PATCH] Cleanup and extend SwarmTest timeout --- .../apollo/fireflies/Bootstrapper.java | 15 --------------- .../salesforce/apollo/fireflies/SwarmTest.java | 8 ++++---- .../apollo/stereotomy/EventValidation.java | 17 ----------------- .../java/com/salesforce/apollo/thoth/Ani.java | 15 ++++----------- 4 files changed, 8 insertions(+), 47 deletions(-) diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/Bootstrapper.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/Bootstrapper.java index e820eecc0..660663d35 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/Bootstrapper.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/Bootstrapper.java @@ -6,8 +6,6 @@ import com.github.benmanes.caffeine.cache.RemovalCause; import com.google.common.collect.HashMultiset; import com.salesforce.apollo.archipelago.RouterImpl; -import com.salesforce.apollo.cryptography.JohnHancock; -import com.salesforce.apollo.cryptography.SigningThreshold; import com.salesforce.apollo.cryptography.Verifier; import com.salesforce.apollo.fireflies.comm.entrance.Entrance; import com.salesforce.apollo.fireflies.proto.Validation; @@ -25,7 +23,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.InputStream; import java.time.Duration; import java.util.ArrayList; import java.util.List; @@ -96,18 +93,6 @@ public Bootstrapper(S member, Durati public EventValidation getValidator() { return new EventValidation() { - @Override - public Verifier.Filtered filtered(EventCoordinates coordinates, SigningThreshold threshold, - JohnHancock signature, InputStream message) { - log.trace("Filtering for: {} on: {}", coordinates, member.getId()); - var keyState = getKeyState(coordinates); - if (keyState.isEmpty()) { - return new Verifier.Filtered(false, 0, null); - } - KeyState ks = keyState.get(); - var v = new Verifier.DefaultVerifier(ks.getKeys()); - return v.filtered(threshold, signature, message); - } @Override public Optional getKeyState(EventCoordinates coordinates) { diff --git a/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java b/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java index 316ee25d8..d18e8dad0 100644 --- a/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java +++ b/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java @@ -116,7 +116,7 @@ public void swarm() throws Exception { .start(() -> countdown.get().countDown(), gossipDuration, Collections.emptyList(), Executors.newScheduledThreadPool(2, Thread.ofVirtual().factory())); - assertTrue(countdown.get().await(30, TimeUnit.SECONDS), "Kernel did not bootstrap"); + assertTrue(countdown.get().await(60, TimeUnit.SECONDS), "Kernel did not bootstrap"); var bootstrappers = views.subList(0, seeds.size()); countdown.set(new CountDownLatch(seeds.size() - 1)); @@ -125,7 +125,7 @@ public void swarm() throws Exception { Executors.newScheduledThreadPool(2, Thread.ofVirtual().factory()))); // Test that all bootstrappers up - var success = countdown.get().await(largeTests ? 2400 : 30, TimeUnit.SECONDS); + var success = countdown.get().await(largeTests ? 2400 : 60, TimeUnit.SECONDS); var failed = bootstrappers.stream() .filter(e -> e.getContext().activeCount() != bootstrappers.size()) .map( @@ -138,7 +138,7 @@ public void swarm() throws Exception { views.forEach(v -> v.start(() -> countdown.get().countDown(), gossipDuration, seeds, Executors.newScheduledThreadPool(2, Thread.ofVirtual().factory()))); - success = countdown.get().await(largeTests ? 2400 : 60, TimeUnit.SECONDS); + success = countdown.get().await(largeTests ? 2400 : 120, TimeUnit.SECONDS); // Test that all views are up failed = views.stream() @@ -149,7 +149,7 @@ public void swarm() throws Exception { assertTrue(success, "Views did not start, expected: " + views.size() + " failed: " + failed.size() + " views: " + failed); - success = Utils.waitForCondition(largeTests ? 2400_000 : 30_000, 1_000, () -> { + success = Utils.waitForCondition(largeTests ? 2400_000 : 120_000, 1_000, () -> { return views.stream().filter(view -> view.getContext().activeCount() != CARDINALITY).count() == 0; }); diff --git a/stereotomy/src/main/java/com/salesforce/apollo/stereotomy/EventValidation.java b/stereotomy/src/main/java/com/salesforce/apollo/stereotomy/EventValidation.java index 38c1c43a8..c4d6a96f9 100644 --- a/stereotomy/src/main/java/com/salesforce/apollo/stereotomy/EventValidation.java +++ b/stereotomy/src/main/java/com/salesforce/apollo/stereotomy/EventValidation.java @@ -6,14 +6,10 @@ */ package com.salesforce.apollo.stereotomy; -import com.salesforce.apollo.cryptography.JohnHancock; -import com.salesforce.apollo.cryptography.SigningThreshold; -import com.salesforce.apollo.cryptography.Verifier.Filtered; import com.salesforce.apollo.stereotomy.event.EstablishmentEvent; import com.salesforce.apollo.stereotomy.identifier.Identifier; import org.joou.ULong; -import java.io.InputStream; import java.util.Optional; /** @@ -24,11 +20,6 @@ public interface EventValidation { EventValidation NONE = new EventValidation() { - @Override - public Filtered filtered(EventCoordinates coordinates, SigningThreshold threshold, JohnHancock signature, - InputStream message) { - return null; - } @Override public Optional getKeyState(EventCoordinates coordinates) { @@ -52,11 +43,6 @@ public boolean validate(EventCoordinates coordinates) { }; EventValidation NO_VALIDATION = new EventValidation() { - @Override - public Filtered filtered(EventCoordinates coordinates, SigningThreshold threshold, JohnHancock signature, - InputStream message) { - return null; - } @Override public Optional getKeyState(EventCoordinates coordinates) { @@ -79,9 +65,6 @@ public boolean validate(EventCoordinates coordinates) { } }; - Filtered filtered(EventCoordinates coordinates, SigningThreshold threshold, JohnHancock signature, - InputStream message); - Optional getKeyState(EventCoordinates coordinates); Optional getKeyState(Identifier identifier, ULong seqNum); diff --git a/thoth/src/main/java/com/salesforce/apollo/thoth/Ani.java b/thoth/src/main/java/com/salesforce/apollo/thoth/Ani.java index 2401d1664..b03546764 100644 --- a/thoth/src/main/java/com/salesforce/apollo/thoth/Ani.java +++ b/thoth/src/main/java/com/salesforce/apollo/thoth/Ani.java @@ -7,8 +7,10 @@ package com.salesforce.apollo.thoth; -import com.salesforce.apollo.cryptography.*; -import com.salesforce.apollo.cryptography.Verifier.Filtered; +import com.salesforce.apollo.cryptography.Digest; +import com.salesforce.apollo.cryptography.JohnHancock; +import com.salesforce.apollo.cryptography.SignatureAlgorithm; +import com.salesforce.apollo.cryptography.Verifier; import com.salesforce.apollo.cryptography.ssl.CertificateValidator; import com.salesforce.apollo.stereotomy.*; import com.salesforce.apollo.stereotomy.KEL.KeyStateWithAttachments; @@ -20,7 +22,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.InputStream; import java.security.PublicKey; import java.time.Duration; import java.util.HashMap; @@ -49,14 +50,6 @@ public CertificateValidator certificateValidator(Duration timeout) { public EventValidation eventValidation(Duration timeout) { return new EventValidation() { - @Override - public Filtered filtered(EventCoordinates coordinates, SigningThreshold threshold, JohnHancock signature, - InputStream message) { - log.trace("Filtering for: {} on: {}", coordinates, member); - KeyState ks = kerl.getKeyState(coordinates); - var v = new Verifier.DefaultVerifier(ks.getKeys()); - return v.filtered(threshold, signature, message); - } @Override public Optional getKeyState(EventCoordinates coordinates) {