Skip to content

Commit

Permalink
Fix inital set of ScheduleExecutionSpecs HapiTest methods.
Browse files Browse the repository at this point in the history
* Modifie the workflow to skip the correct configured number of nanoseconds before the first child transaction consensus time.
* Marked all tests in ScheduleExecutionSpecs with `@HapiTest` or `@todo('issue#')` and file issues for groups with similar failures
* Small code cleanups to move shared methods to ScheduleUtils instead of scattered across various test suites.

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>
  • Loading branch information
jsync-swirlds committed Nov 20, 2023
1 parent 9350fa9 commit 1e43f02
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,21 @@ private SingleTransactionRecordBuilderImpl doAddChild(
}

// Make sure we have not created so many that we have run out of slots.
final var childCount = childRecordBuilders.size();
final var consensusConfig = configuration.getConfigData(ConsensusConfig.class);
final int childCount = childRecordBuilders.size();
final ConsensusConfig consensusConfig = configuration.getConfigData(ConsensusConfig.class);
if (childCount >= consensusConfig.handleMaxFollowingRecords()) {
throw new HandleException(ResponseCodeEnum.MAX_CHILD_RECORDS_EXCEEDED);
}

// The consensus timestamp of the first item in the child list is T+1, where T is the time of the user tx
final var parentConsensusTimestamp = userTxnRecordBuilder.consensusNow();
final var prevConsensusNow = childRecordBuilders.isEmpty()
? userTxnRecordBuilder.consensusNow()
// The consensus timestamp of the first item in the child list is T+K (in nanoseconds),
// where T is the time of the user tx and K is the maximum number of "preceding" records
// defined for the current configuration.
final long maxPrecedingRecords = consensusConfig.handleMaxPrecedingRecords();
final Instant parentConsensusTimestamp = userTxnRecordBuilder.consensusNow();
final Instant prevConsensusNow = childRecordBuilders.isEmpty()
? userTxnRecordBuilder.consensusNow().plusNanos(maxPrecedingRecords)
: childRecordBuilders.get(childRecordBuilders.size() - 1).consensusNow();
final var consensusNow = prevConsensusNow.plusNanos(1L);
final Instant consensusNow = prevConsensusNow.plusNanos(1L);
final var recordBuilder = new SingleTransactionRecordBuilderImpl(consensusNow, reversingBehavior, customizer)
.parentConsensus(parentConsensusTimestamp)
.exchangeRate(userTxnRecordBuilder.exchangeRate());
Expand Down

0 comments on commit 1e43f02

Please sign in to comment.