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

09448 Implement intake with new framework #9747

Merged
merged 30 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5a5a237
Add new config value
litt3 Oct 19, 2023
321f912
Hook everything up
litt3 Nov 7, 2023
40e1559
Fix preconsensus replay
litt3 Nov 7, 2023
25569ce
Use correct config value
litt3 Nov 7, 2023
fe7274c
Merge branch 'develop' into 09448-intake
litt3 Nov 7, 2023
7923437
Merge branch 'develop' into 09448-intake
litt3 Nov 7, 2023
d1ed9e2
Use old duplicate event metrics
litt3 Nov 7, 2023
10fc5da
Merge branch 'develop' into 09448-intake
litt3 Nov 8, 2023
1027884
Fix merge
litt3 Nov 8, 2023
43fe95e
Properly update address books
litt3 Nov 8, 2023
a8f1934
Update min gen non ancient at startup
litt3 Nov 8, 2023
c1b4621
Revert config.txt change
litt3 Nov 8, 2023
6483f1e
Reorganize wiring
litt3 Nov 13, 2023
db99849
Merge branch 'develop' into 09448-intake
litt3 Nov 13, 2023
bfe087d
Merge branch 'develop' into 09448-intake
litt3 Nov 14, 2023
555bdf1
Use the same min gen non ancient as old pathway
litt3 Nov 14, 2023
62b0cae
Rename wiring method
litt3 Nov 15, 2023
4e01027
Merge branch 'develop' into 09448-intake
litt3 Nov 15, 2023
8730bf2
Don't recalculate min gen non ancient when migrating
litt3 Nov 15, 2023
c3d7c5c
Split platform wiring into multiple methods
litt3 Nov 15, 2023
282ad70
Merge branch 'develop' into 09448-intake
litt3 Nov 16, 2023
f3e0abd
Merge branch 'develop' into 09448-intake
litt3 Nov 16, 2023
4b8c8f9
Use configuration for platform schedulers
litt3 Nov 20, 2023
58a2e43
Merge branch 'develop' into 09448-intake
litt3 Nov 20, 2023
27ebcc2
Add test that all platform input wires are bound
litt3 Nov 20, 2023
0550393
Merge branch 'develop' into 09448-intake
litt3 Nov 21, 2023
b2b2b61
Merge branch 'develop' into 09448-intake
litt3 Nov 21, 2023
211b941
Use InputWire instead of BindableInputWire in wiring objects
litt3 Nov 21, 2023
e9e5d6d
Merge branch 'develop' into 09448-intake
litt3 Nov 21, 2023
cf400a5
Merge branch 'develop' into 09448-intake
litt3 Nov 21, 2023
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 @@ -35,7 +35,7 @@
* because syncs that started before the throttle engages can grow the queue to
* very large sizes on larger networks.
* @param randomEventProbability The probability that after a sync, a node will create an event with a random
* other parent. The probability is is 1 in X, where X is the value of
* other parent. The probability is 1 in X, where X is the value of
* randomEventProbability. A value of 0 means that a node will not create any
* random events.
* <p>
Expand All @@ -57,6 +57,7 @@
* @param eventsLogDir eventStream files will be generated in this directory.
* @param enableEventStreaming enable stream event to server.
* @param prehandlePoolSize the size of the thread pool used for prehandling transactions
* @param useLegacyIntake if true then use the legacy intake monolith, if false then use the new intake pipeline
*/
@ConfigData("event")
public record EventConfig(
Expand All @@ -70,4 +71,5 @@ public record EventConfig(
@ConfigProperty(defaultValue = "5") long eventsLogPeriod,
@ConfigProperty(defaultValue = "/opt/hgcapp/eventsStreams") String eventsLogDir,
@ConfigProperty(defaultValue = "true") boolean enableEventStreaming,
@ConfigProperty(defaultValue = "8") int prehandlePoolSize) {}
@ConfigProperty(defaultValue = "8") int prehandlePoolSize,
@ConfigProperty(defaultValue = "false") boolean useLegacyIntake) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright (C) 2022-2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.swirlds.common.config;

import com.swirlds.common.wiring.schedulers.builders.TaskSchedulerType;
import com.swirlds.config.api.ConfigData;
import com.swirlds.config.api.ConfigProperty;

/**
* Contains configuration values for the platform schedulers.
*
* @param internalEventValidatorSchedulerType the internal event validator scheduler type
* @param internalEventValidatorUnhandledCapacity number of unhandled events allowed in the internal event validator scheduler
* @param eventDeduplicatorSchedulerType the event deduplicator scheduler type
* @param eventDeduplicatorUnhandledCapacity number of unhandled tasks allowed in the event deduplicator scheduler
* @param eventSignatureValidatorSchedulerType the event signature validator scheduler type
* @param eventSignatureValidatorUnhandledCapacity number of unhandled tasks allowed in the event signature validator scheduler
* @param orphanBufferSchedulerType the orphan buffer scheduler type
* @param orphanBufferUnhandledCapacity number of unhandled tasks allowed in the orphan buffer scheduler
* @param inOrderLinkerSchedulerType the in-order linker scheduler type
* @param inOrderLinkerUnhandledCapacity number of unhandled tasks allowed in the in-order linker scheduler
* @param linkedEventIntakeSchedulerType the linked event intake scheduler type
* @param linkedEventIntakeUnhandledCapacity number of unhandled tasks allowed in the linked event intake scheduler
*/
@ConfigData("platformSchedulers")
public record PlatformSchedulersConfig(
@ConfigProperty(defaultValue = "SEQUENTIAL") String internalEventValidatorSchedulerType,
@ConfigProperty(defaultValue = "500") int internalEventValidatorUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL") String eventDeduplicatorSchedulerType,
@ConfigProperty(defaultValue = "500") int eventDeduplicatorUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL") String eventSignatureValidatorSchedulerType,
@ConfigProperty(defaultValue = "500") int eventSignatureValidatorUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL") String orphanBufferSchedulerType,
@ConfigProperty(defaultValue = "500") int orphanBufferUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL") String inOrderLinkerSchedulerType,
@ConfigProperty(defaultValue = "500") int inOrderLinkerUnhandledCapacity,
@ConfigProperty(defaultValue = "SEQUENTIAL") String linkedEventIntakeSchedulerType,
@ConfigProperty(defaultValue = "500") int linkedEventIntakeUnhandledCapacity) {

/**
* Get the internal event validator scheduler type
*
* @return the internal event validator scheduler type
*/
public TaskSchedulerType getInternalEventValidatorSchedulerType() {
return TaskSchedulerType.valueOf(internalEventValidatorSchedulerType);

Check warning on line 60 in platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java#L60

Added line #L60 was not covered by tests
}

/**
* Get the event deduplicator scheduler type
*
* @return the event deduplicator scheduler type
*/
public TaskSchedulerType getEventDeduplicatorSchedulerType() {
return TaskSchedulerType.valueOf(eventDeduplicatorSchedulerType);

Check warning on line 69 in platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java#L69

Added line #L69 was not covered by tests
}

/**
* Get the event signature validator scheduler type
*
* @return the event signature validator scheduler type
*/
public TaskSchedulerType getEventSignatureValidatorSchedulerType() {
return TaskSchedulerType.valueOf(eventSignatureValidatorSchedulerType);

Check warning on line 78 in platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java#L78

Added line #L78 was not covered by tests
}

/**
* Get the orphan buffer scheduler type
*
* @return the orphan buffer scheduler type
*/
public TaskSchedulerType getOrphanBufferSchedulerType() {
return TaskSchedulerType.valueOf(orphanBufferSchedulerType);

Check warning on line 87 in platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java#L87

Added line #L87 was not covered by tests
}

/**
* Get the in-order linker scheduler type
*
* @return the in-order linker scheduler type
*/
public TaskSchedulerType getInOrderLinkerSchedulerType() {
return TaskSchedulerType.valueOf(inOrderLinkerSchedulerType);

Check warning on line 96 in platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java#L96

Added line #L96 was not covered by tests
}

/**
* Get the linked event intake scheduler type
*
* @return the linked event intake scheduler type
*/
public TaskSchedulerType getLinkedEventIntakeSchedulerType() {
return TaskSchedulerType.valueOf(linkedEventIntakeSchedulerType);

Check warning on line 105 in platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-common/src/main/java/com/swirlds/common/config/PlatformSchedulersConfig.java#L105

Added line #L105 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.swirlds.base.state.Startable;
import com.swirlds.base.time.Time;
import com.swirlds.base.utility.Pair;
import com.swirlds.common.config.BasicConfig;
import com.swirlds.common.config.ConsensusConfig;
import com.swirlds.common.config.EventConfig;
import com.swirlds.common.config.StateConfig;
Expand Down Expand Up @@ -77,6 +76,7 @@
import com.swirlds.common.threading.framework.QueueThread;
import com.swirlds.common.threading.framework.config.QueueThreadConfiguration;
import com.swirlds.common.threading.framework.config.QueueThreadMetricsConfiguration;
import com.swirlds.common.threading.interrupt.InterruptableConsumer;
import com.swirlds.common.threading.manager.ThreadManager;
import com.swirlds.common.utility.AutoCloseableWrapper;
import com.swirlds.common.utility.Clearable;
Expand All @@ -88,6 +88,7 @@
import com.swirlds.logging.legacy.LogMarker;
import com.swirlds.logging.legacy.payload.FatalErrorPayload;
import com.swirlds.platform.components.EventIntake;
import com.swirlds.platform.components.LinkedEventIntake;
import com.swirlds.platform.components.SavedStateController;
import com.swirlds.platform.components.appcomm.AppCommunicationComponent;
import com.swirlds.platform.components.state.DefaultStateManagementComponent;
Expand All @@ -106,9 +107,12 @@
import com.swirlds.platform.event.EventUtils;
import com.swirlds.platform.event.GossipEvent;
import com.swirlds.platform.event.creation.AsyncEventCreationManager;
import com.swirlds.platform.event.deduplication.EventDeduplicator;
import com.swirlds.platform.event.linking.EventLinker;
import com.swirlds.platform.event.linking.InOrderLinker;
import com.swirlds.platform.event.linking.OrphanBufferingLinker;
import com.swirlds.platform.event.linking.ParentFinder;
import com.swirlds.platform.event.orphan.OrphanBuffer;
import com.swirlds.platform.event.preconsensus.AsyncPreconsensusEventWriter;
import com.swirlds.platform.event.preconsensus.NoOpPreconsensusEventWriter;
import com.swirlds.platform.event.preconsensus.PreconsensusEventFileManager;
Expand All @@ -117,11 +121,14 @@
import com.swirlds.platform.event.preconsensus.PreconsensusEventStreamSequencer;
import com.swirlds.platform.event.preconsensus.PreconsensusEventWriter;
import com.swirlds.platform.event.preconsensus.SyncPreconsensusEventWriter;
import com.swirlds.platform.event.validation.AddressBookUpdate;
import com.swirlds.platform.event.validation.AncientValidator;
import com.swirlds.platform.event.validation.EventDeduplication;
import com.swirlds.platform.event.validation.EventSignatureValidator;
import com.swirlds.platform.event.validation.EventValidator;
import com.swirlds.platform.event.validation.GossipEventValidator;
import com.swirlds.platform.event.validation.GossipEventValidators;
import com.swirlds.platform.event.validation.InternalEventValidator;
import com.swirlds.platform.event.validation.SignatureValidator;
import com.swirlds.platform.event.validation.StaticValidators;
import com.swirlds.platform.event.validation.TransactionSizeValidator;
Expand Down Expand Up @@ -173,6 +180,7 @@
import com.swirlds.platform.system.Shutdown;
import com.swirlds.platform.threading.PauseAndLoad;
import com.swirlds.platform.util.PlatformComponents;
import com.swirlds.platform.wiring.PlatformWiring;
import com.swirlds.platform.wiring.SignedStateFileManagerWiring;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
Expand Down Expand Up @@ -232,9 +240,10 @@
private final EventLinker eventLinker;

/**
* Validates events and passes valid events further down the pipeline.
* Validates events and passes valid events further down the intake pipeline.
*/
private final EventValidator eventValidator;
private final InterruptableConsumer<GossipEvent> intakeHandler;

/** Contains all validators for events */
private final GossipEventValidators eventValidators;

Expand Down Expand Up @@ -323,6 +332,11 @@
/** Manages emergency recovery */
private final EmergencyRecoveryManager emergencyRecoveryManager;

/**
* Encapsulated wiring for the platform.
*/
private final PlatformWiring platformWiring;

/**
* the browser gives the Platform what app to run. There can be multiple Platforms on one computer.
*
Expand Down Expand Up @@ -666,8 +680,6 @@
preConsensusEventHandler::preconsensusEvent,
intakeEventCounter);

final BasicConfig basicConfig = platformContext.getConfiguration().getConfigData(BasicConfig.class);

final List<GossipEventValidator> validators = new ArrayList<>();
// it is very important to discard ancient events, otherwise the deduplication will not work, since it
// doesn't track ancient events
Expand All @@ -685,14 +697,55 @@
time));

eventValidators = new GossipEventValidators(validators);
eventValidator = new EventValidator(

final EventValidator eventValidator = new EventValidator(

Check warning on line 701 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L701

Added line #L701 was not covered by tests
eventValidators, eventIntake::addUnlinkedEvent, eventIntakePhaseTimer, intakeEventCounter);

if (eventConfig.useLegacyIntake()) {
intakeHandler = eventValidator::validateEvent;
platformWiring = null;

Check warning on line 706 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L705-L706

Added lines #L705 - L706 were not covered by tests
} else {
final InternalEventValidator internalEventValidator = new InternalEventValidator(

Check warning on line 708 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L708

Added line #L708 was not covered by tests
platformContext, time, currentAddressBook.getSize() == 1, intakeEventCounter);
final EventDeduplicator eventDeduplicator =

Check warning on line 710 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L710

Added line #L710 was not covered by tests
new EventDeduplicator(platformContext, intakeEventCounter, eventIntakeMetrics);
final EventSignatureValidator eventSignatureValidator = new EventSignatureValidator(

Check warning on line 712 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L712

Added line #L712 was not covered by tests
platformContext,
time,
CryptoStatic::verifySignature,
appVersion,
initialState.getState().getPlatformState().getPreviousAddressBook(),

Check warning on line 717 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L717

Added line #L717 was not covered by tests
currentAddressBook,
intakeEventCounter);
final OrphanBuffer orphanBuffer = new OrphanBuffer(platformContext, intakeEventCounter);
final InOrderLinker inOrderLinker = new InOrderLinker(intakeEventCounter);
final LinkedEventIntake linkedEventIntake = new LinkedEventIntake(

Check warning on line 722 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L720-L722

Added lines #L720 - L722 were not covered by tests
platformContext,
threadManager,
time,
consensusRef::get,

Check warning on line 726 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L726

Added line #L726 was not covered by tests
eventObserverDispatcher,
shadowGraph,
preConsensusEventHandler::preconsensusEvent,

Check warning on line 729 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L729

Added line #L729 was not covered by tests
intakeEventCounter);

platformWiring = new PlatformWiring(platformContext, time);
platformWiring.bind(

Check warning on line 733 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L732-L733

Added lines #L732 - L733 were not covered by tests
internalEventValidator,
eventDeduplicator,
eventSignatureValidator,
orphanBuffer,
inOrderLinker,
linkedEventIntake);

intakeHandler = platformWiring.getEventInput();

Check warning on line 741 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L741

Added line #L741 was not covered by tests
}

intakeQueue = components.add(new QueueThreadConfiguration<GossipEvent>(threadManager)
.setNodeId(selfId)
.setComponent(PLATFORM_THREAD_POOL_NAME)
.setThreadName("event-intake")
.setHandler(eventValidator::validateEvent)
.setHandler(intakeHandler)

Check warning on line 748 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L748

Added line #L748 was not covered by tests
.setCapacity(eventConfig.eventIntakeQueueSize())
.setLogAfterPauseDuration(threadConfig.logStackTracePauseDuration())
.setMetricsConfiguration(new QueueThreadMetricsConfiguration(metrics).enableMaxSizeMetric())
Expand Down Expand Up @@ -761,7 +814,12 @@

loadStateIntoConsensus(initialState);
loadStateIntoEventCreator(initialState);
eventLinker.loadFromSignedState(initialState);

if (eventConfig.useLegacyIntake()) {
eventLinker.loadFromSignedState(initialState);

Check warning on line 819 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L819

Added line #L819 was not covered by tests
} else {
platformWiring.updateMinimumGenerationNonAncient(initialMinimumGenerationNonAncient);

Check warning on line 821 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L821

Added line #L821 was not covered by tests
}

// We don't want to invoke these callbacks until after we are starting up.
final long round = initialState.getRound();
Expand All @@ -787,7 +845,8 @@
Pair.of(gossip, "gossip"),
Pair.of(preConsensusEventHandler, "preConsensusEventHandler"),
Pair.of(consensusRoundHandler, "consensusRoundHandler"),
Pair.of(transactionPool, "transactionPool")));
Pair.of(transactionPool, "transactionPool"),
Pair.of(platformWiring, "platformWiring")));

Check warning on line 849 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L848-L849

Added lines #L848 - L849 were not covered by tests

if (platformContext.getConfiguration().getConfigData(ThreadConfig.class).jvmAnchor()) {
components.add(new JvmAnchor(threadManager));
Expand Down Expand Up @@ -1001,14 +1060,26 @@
// from the ones we had before the reconnect
intakeQueue.pause();
try {
eventValidators.replaceValidator(
SignatureValidator.VALIDATOR_NAME,
new SignatureValidator(
signedState.getState().getPlatformState().getPreviousAddressBook(),
signedState.getState().getPlatformState().getAddressBook(),
appVersion,
CryptoStatic::verifySignature,
Time.getCurrent()));
if (platformContext
.getConfiguration()
.getConfigData(EventConfig.class)

Check warning on line 1065 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L1063-L1065

Added lines #L1063 - L1065 were not covered by tests
.useLegacyIntake()) {
eventValidators.replaceValidator(

Check warning on line 1067 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L1067

Added line #L1067 was not covered by tests
SignatureValidator.VALIDATOR_NAME,
new SignatureValidator(
signedState.getState().getPlatformState().getPreviousAddressBook(),
signedState.getState().getPlatformState().getAddressBook(),

Check warning on line 1071 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L1070-L1071

Added lines #L1070 - L1071 were not covered by tests
appVersion,
CryptoStatic::verifySignature,
Time.getCurrent()));

Check warning on line 1074 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L1074

Added line #L1074 was not covered by tests
} else {
platformWiring
.getAddressBookUpdateInput()
.accept(new AddressBookUpdate(
signedState.getState().getPlatformState().getPreviousAddressBook(),
signedState.getState().getPlatformState().getAddressBook()));
platformWiring.updateMinimumGenerationNonAncient(signedState.getMinRoundGeneration());

Check warning on line 1081 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/SwirldsPlatform.java#L1076-L1081

Added lines #L1076 - L1081 were not covered by tests
}
} finally {
intakeQueue.resume();
}
Expand Down Expand Up @@ -1176,7 +1247,7 @@
Time.getCurrent(),
preconsensusEventFileManager,
preconsensusEventWriter,
eventValidator,
intakeHandler,
intakeQueue,
consensusRoundHandler,
stateHashSignQueue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@
* Add an event to the hashgraph
*
* @param event an event to be added
* @return a list of rounds that came to consensus as a result of adding the event
*/
public void addEvent(@NonNull final EventImpl event) {
@NonNull
public List<ConsensusRound> addEvent(@NonNull final EventImpl event) {
Objects.requireNonNull(event);

try {
if (event.getGeneration() < consensusSupplier.get().getMinGenerationNonAncient()) {
// ancient events *may* be discarded, and stale events *must* be discarded
return;
return List.of();

Check warning on line 134 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/components/LinkedEventIntake.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/components/LinkedEventIntake.java#L134

Added line #L134 was not covered by tests
}

dispatcher.preConsensusEvent(event);
Expand All @@ -153,6 +155,8 @@
// with no consensus events, so we check the diff in generations to look for stale events
handleStale(minGenNonAncientBeforeAdding);
}

return Objects.requireNonNullElseGet(consensusRounds, List::of);

Check warning on line 159 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/components/LinkedEventIntake.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/components/LinkedEventIntake.java#L159

Added line #L159 was not covered by tests
} finally {
intakeEventCounter.eventExitedIntakePipeline(event.getBaseEvent().getSenderId());
}
Expand Down
Loading
Loading