Skip to content

Commit

Permalink
Fix tests, spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Rader <[email protected]>
  • Loading branch information
kimbor committed Feb 19, 2025
1 parent 423e31f commit 9b55be1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static com.hedera.node.app.spi.workflows.PreCheckException.validateTruePreCheck;
import static java.util.Objects.requireNonNull;

import com.hedera.hapi.node.base.AccountID;
import com.hedera.hapi.node.base.AccountAmount;
import com.hedera.hapi.node.base.AccountID;
import com.hedera.hapi.node.base.HederaFunctionality;
Expand All @@ -49,11 +48,10 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Collections;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.function.BiConsumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import com.hedera.node.app.spi.workflows.PreCheckException;
import com.hedera.node.app.spi.workflows.PreHandleContext;
import com.hedera.node.app.spi.workflows.PureChecksContext;
import com.hedera.node.app.spi.workflows.record.StreamBuilder;
import com.hedera.node.config.testfixtures.HederaTestConfigBuilder;
import com.hedera.pbj.runtime.io.buffer.Bytes;
import java.time.Instant;
Expand Down Expand Up @@ -304,7 +303,7 @@ void handleDispatched() {
.willReturn(recordBuilder);
given(bodyParser.apply(any())).willReturn(innerTxnBody);
given(recordBuilder.status()).willReturn(SUCCESS);
subject.handle(handleContext);
assertDoesNotThrow( () -> subject.handle(handleContext));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public Stream<DynamicTest> multiBatchSuccess() {
cryptoCreate(innerTnxPayer).balance(ONE_HUNDRED_HBARS),
usableTxnIdNamed(innerTxnId1).payerId(innerTnxPayer),
usableTxnIdNamed(innerTxnId2).payerId(innerTnxPayer),
atomicBatch(innerTxn1, innerTxn2).via(atomicTxn),
atomicBatch(innerTxn1, innerTxn2).payingWith(batchOperator).via(atomicTxn),
getTxnRecord(atomicTxn).logged(),
getTxnRecord(innerTxnId1).assertingNothingAboutHashes().logged(),
getTxnRecord(innerTxnId2).assertingNothingAboutHashes().logged(),
Expand Down Expand Up @@ -216,7 +216,10 @@ public Stream<DynamicTest> multiBatchFail() {
cryptoCreate(innerTnxPayer).balance(ONE_HUNDRED_HBARS),
usableTxnIdNamed(innerTxnId1).payerId(innerTnxPayer),
usableTxnIdNamed(innerTxnId2).payerId(innerTnxPayer),
atomicBatch(innerTxn1, innerTxn2).via(atomicTxn).hasKnownStatus(INNER_TRANSACTION_FAILED),
atomicBatch(innerTxn1, innerTxn2)
.via(atomicTxn)
.payingWith(batchOperator)
.hasKnownStatus(INNER_TRANSACTION_FAILED),
getTxnRecord(atomicTxn).logged(),
getTxnRecord(innerTxnId1).assertingNothingAboutHashes().logged(),
getTxnRecord(innerTxnId2).assertingNothingAboutHashes().logged());
Expand Down Expand Up @@ -250,9 +253,9 @@ public Stream<DynamicTest> duplicatedInnerTransactionsFail() {
.txnId(innerTxnId1)
.payingWith(innerTnxPayer)
.balance(ONE_HBAR),
atomicBatch(innerTxn1, innerTxn2).hasKnownStatus(INNER_TRANSACTION_FAILED),
atomicBatch(innerTxn2),
atomicBatch(innerTxn2).hasKnownStatus(INNER_TRANSACTION_FAILED));
atomicBatch(innerTxn1, innerTxn2).payingWith(batchOperator).hasKnownStatus(INNER_TRANSACTION_FAILED),
atomicBatch(innerTxn2).payingWith(batchOperator),
atomicBatch(innerTxn2).payingWith(batchOperator).hasKnownStatus(INNER_TRANSACTION_FAILED));
}

@HapiTest
Expand All @@ -276,7 +279,7 @@ public Stream<DynamicTest> invalidTransactionStartFailed() {
cryptoCreate(innerTnxPayer).balance(ONE_HUNDRED_HBARS),
usableTxnIdNamed(innerTxnId1).payerId(innerTnxPayer).validStart(validStart),
cryptoCreate(batchOperator).balance(ONE_HBAR),
atomicBatch(innerTxn1).hasKnownStatus(INNER_TRANSACTION_FAILED));
atomicBatch(innerTxn1).payingWith(batchOperator).hasKnownStatus(INNER_TRANSACTION_FAILED));
}

@HapiTest
Expand All @@ -297,7 +300,7 @@ public Stream<DynamicTest> invalidTransactionDurationFailed() {
cryptoCreate(innerTnxPayer).balance(ONE_HUNDRED_HBARS),
usableTxnIdNamed(innerTxnId1).payerId(innerTnxPayer),
cryptoCreate(batchOperator).balance(ONE_HBAR),
atomicBatch(innerTxn1).hasKnownStatus(INNER_TRANSACTION_FAILED));
atomicBatch(innerTxn1).payingWith(batchOperator).hasKnownStatus(INNER_TRANSACTION_FAILED));
}

@Nested
Expand All @@ -306,7 +309,7 @@ class BatchConstraintsPositive {

@LeakyHapiTest
@Disabled // TODO: enable this test when we have the maxInnerTxn property
@DisplayName("Bach with max number of inner transaction")
@DisplayName("Batch with max number of inner transaction")
// BATCH_01
public Stream<DynamicTest> maxInnerTxn() {
final var payer = "payer";
Expand Down Expand Up @@ -340,13 +343,13 @@ public Stream<DynamicTest> maxInnerTxn() {
}

@LeakyHapiTest(requirement = {THROTTLE_OVERRIDES})
@DisplayName("Bach contract call with the TPS limit")
@DisplayName("Batch contract call with the TPS limit")
// BATCH_02
public Stream<DynamicTest> contractCallTPSLimit() {
final var batchOperator = "batchOperator";
final var contract = "CalldataSize";
final var function = "callme";
final var payload = new byte[100];
final byte[] payload = new byte[100];
final var payer = "payer";
return hapiTest(
cryptoCreate(batchOperator),
Expand Down Expand Up @@ -379,7 +382,7 @@ public Stream<DynamicTest> contractCallTPSLimit() {
}

@LeakyHapiTest
@DisplayName("Bach contract call with the gas limit")
@DisplayName("Batch contract call with the gas limit")
// BATCH_03
public Stream<DynamicTest> contractCallGasLimit() {
final var contract = "CalldataSize";
Expand All @@ -399,7 +402,7 @@ public Stream<DynamicTest> contractCallGasLimit() {
}

@HapiTest
@DisplayName("Bach contract call with 6kb payload")
@DisplayName("Batch contract call with 6kb payload")
// BATCH_04
public Stream<DynamicTest> contractCallTxnSizeLimit() {
final var contract = "CalldataSize";
Expand Down Expand Up @@ -445,9 +448,10 @@ public Stream<DynamicTest> followingBatchWithSameButNonExecutedTxn() {
.hasKnownStatus(INNER_TRANSACTION_FAILED),
// create a successful batch, containing the second (non-executed) transaction
atomicBatch(cryptoCreate("bar")
.txnId(secondTxnId)
.payingWith(payer)
.batchKey(batchOperator)));
.txnId(secondTxnId)
.payingWith(payer)
.batchKey(batchOperator))
.signedByPayerAnd(batchOperator));
}

@HapiTest
Expand Down Expand Up @@ -921,7 +925,7 @@ final Stream<DynamicTest> validateInnerTxnValidStart() {
}

@HapiTest
@DisplayName("Submit batch containng Hapi and Ethereum txns")
@DisplayName("Submit batch containing Hapi and Ethereum txns")
// BATCH_17
final Stream<DynamicTest> submitBatchWithEthereumTxn() {
final var receiver = "receiver";
Expand Down

0 comments on commit 9b55be1

Please sign in to comment.