diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermExecutionTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermExecutionTest.java index 6af46800ae4e..7af805a42e18 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermExecutionTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermExecutionTest.java @@ -18,6 +18,8 @@ import static com.hedera.services.bdd.junit.ContextRequirement.FEE_SCHEDULE_OVERRIDES; import static com.hedera.services.bdd.junit.RepeatableReason.NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION; +import static com.hedera.services.bdd.junit.TestTags.INTEGRATION; +import static com.hedera.services.bdd.junit.hedera.embedded.EmbeddedMode.REPEATABLE; import static com.hedera.services.bdd.spec.HapiSpec.hapiTest; import static com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith; import static com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance; @@ -45,7 +47,6 @@ import static com.hedera.services.bdd.spec.utilops.UtilVerbs.freezeAbort; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.recordFeeAmount; -import static com.hedera.services.bdd.spec.utilops.UtilVerbs.sleepFor; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.uploadScheduledContractPrices; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext; import static com.hedera.services.bdd.suites.HapiSuite.DEFAULT_PAYER; @@ -97,6 +98,7 @@ import com.hedera.services.bdd.junit.HapiTestLifecycle; import com.hedera.services.bdd.junit.LeakyHapiTest; import com.hedera.services.bdd.junit.RepeatableHapiTest; +import com.hedera.services.bdd.junit.TargetEmbeddedMode; import com.hedera.services.bdd.junit.support.TestLifecycle; import edu.umd.cs.findbugs.annotations.NonNull; import java.math.BigInteger; @@ -108,12 +110,11 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DynamicTest; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.Tag; -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@Tag(INTEGRATION) @HapiTestLifecycle +@TargetEmbeddedMode(REPEATABLE) public class ScheduleLongTermExecutionTest { private static final String PAYING_ACCOUNT = "payingAccount"; private static final String RECEIVER = "receiver"; @@ -146,8 +147,7 @@ static void beforeAll(@NonNull final TestLifecycle lifecycle) { } @SuppressWarnings("java:S5960") - @HapiTest - @Order(1) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream executionWithCustomPayerWorks() { return hapiTest(flattened( cryptoCreate(PAYING_ACCOUNT), @@ -235,8 +235,7 @@ final Stream executionWithCustomPayerWorks() { }))); } - @HapiTest - @Order(2) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream executionWithCustomPayerAndAdminKeyWorks() { return hapiTest(flattened( newKeyNamed("adminKey"), @@ -325,8 +324,7 @@ final Stream executionWithCustomPayerAndAdminKeyWorks() { }))); } - @HapiTest - @Order(3) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream executionWithCustomPayerWhoSignsAtCreationAsPayerWorks() { return hapiTest(flattened( cryptoCreate(PAYING_ACCOUNT), @@ -412,8 +410,7 @@ final Stream executionWithCustomPayerWhoSignsAtCreationAsPayerWorks }))); } - @LeakyHapiTest(requirement = FEE_SCHEDULE_OVERRIDES) - @Order(5) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithContractCallWorksAtExpiry() { final var payerBalance = new AtomicLong(); return hapiTest(flattened( @@ -465,8 +462,7 @@ public Stream executionWithContractCallWorksAtExpiry() { }))); } - @HapiTest - @Order(6) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithContractCreateWorksAtExpiry() { final var payerBalance = new AtomicLong(); return hapiTest(flattened( @@ -517,8 +513,7 @@ public Stream executionWithContractCreateWorksAtExpiry() { }))); } - @HapiTest - @Order(7) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithDefaultPayerButNoFundsFails() { long balance = 10_000_000L; long noBalance = 0L; @@ -530,7 +525,7 @@ public Stream executionWithDefaultPayerButNoFundsFails() { cryptoCreate(RECEIVER).balance(noBalance), scheduleCreate(BASIC_XFER, cryptoTransfer(tinyBarsFromTo(SENDER, RECEIVER, transferAmount))) .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 4) + .withRelativeExpiry(SENDER_TXN, 10) .payingWith(PAYING_ACCOUNT) .recordingScheduledTxn() .via(CREATE_TX), @@ -546,9 +541,9 @@ public Stream executionWithDefaultPayerButNoFundsFails() { .hasWaitForExpiry() .isNotExecuted() .isNotDeleted() - .hasRelativeExpiry(SENDER_TXN, 4) + .hasRelativeExpiry(SENDER_TXN, 10) .hasRecordedScheduledTxn(), - triggerSchedule(BASIC_XFER), + triggerSchedule(BASIC_XFER, 15), getAccountBalance(SENDER).hasTinyBars(transferAmount), getAccountBalance(RECEIVER).hasTinyBars(noBalance), withOpContext((spec, opLog) -> { @@ -563,8 +558,7 @@ public Stream executionWithDefaultPayerButNoFundsFails() { }))); } - @HapiTest - @Order(8) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithCustomPayerThatNeverSignsFails() { long transferAmount = 1; return hapiTest(flattened( @@ -589,8 +583,7 @@ public Stream executionWithCustomPayerThatNeverSignsFails() { getTxnRecord(CREATE_TX).scheduled().hasPriority(recordWith().status(INVALID_PAYER_SIGNATURE)))); } - @HapiTest - @Order(9) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithCustomPayerButNoFundsFails() { long balance = 0L; long transferAmount = 1; @@ -628,8 +621,7 @@ public Stream executionWithCustomPayerButNoFundsFails() { }))); } - @HapiTest - @Order(10) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithDefaultPayerButAccountDeletedFails() { long balance = 10_000_000L; long noBalance = 0L; @@ -641,7 +633,7 @@ public Stream executionWithDefaultPayerButAccountDeletedFails() { cryptoCreate(RECEIVER).balance(noBalance), scheduleCreate(BASIC_XFER, cryptoTransfer(tinyBarsFromTo(SENDER, RECEIVER, transferAmount))) .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 4) + .withRelativeExpiry(SENDER_TXN, 10) .recordingScheduledTxn() .payingWith(PAYING_ACCOUNT) .via(CREATE_TX), @@ -655,9 +647,9 @@ public Stream executionWithDefaultPayerButAccountDeletedFails() { .hasWaitForExpiry() .isNotExecuted() .isNotDeleted() - .hasRelativeExpiry(SENDER_TXN, 4) + .hasRelativeExpiry(SENDER_TXN, 10) .hasRecordedScheduledTxn(), - triggerSchedule(BASIC_XFER), + triggerSchedule(BASIC_XFER, 15), getAccountBalance(SENDER).hasTinyBars(transferAmount), getAccountBalance(RECEIVER).hasTinyBars(noBalance), // future: a check if account was deleted will be added in DispatchValidator @@ -666,8 +658,7 @@ public Stream executionWithDefaultPayerButAccountDeletedFails() { .hasPriority(recordWith().statusFrom(PAYER_ACCOUNT_DELETED, INSUFFICIENT_PAYER_BALANCE)))); } - @HapiTest - @Order(11) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithCustomPayerButAccountDeletedFails() { long balance = 10_000_000L; long noBalance = 0L; @@ -678,7 +669,7 @@ public Stream executionWithCustomPayerButAccountDeletedFails() { cryptoCreate(RECEIVER).balance(noBalance), scheduleCreate(BASIC_XFER, cryptoTransfer(tinyBarsFromTo(SENDER, RECEIVER, transferAmount))) .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 4) + .withRelativeExpiry(SENDER_TXN, 10) .recordingScheduledTxn() .designatingPayer(PAYING_ACCOUNT) .alsoSigningWith(PAYING_ACCOUNT) @@ -692,9 +683,9 @@ public Stream executionWithCustomPayerButAccountDeletedFails() { .hasWaitForExpiry() .isNotExecuted() .isNotDeleted() - .hasRelativeExpiry(SENDER_TXN, 4) + .hasRelativeExpiry(SENDER_TXN, 10) .hasRecordedScheduledTxn(), - triggerSchedule(BASIC_XFER), + triggerSchedule(BASIC_XFER, 15), getAccountBalance(SENDER).hasTinyBars(transferAmount), getAccountBalance(RECEIVER).hasTinyBars(noBalance), // future: a check if account was deleted will be added in DispatchValidator @@ -703,29 +694,7 @@ public Stream executionWithCustomPayerButAccountDeletedFails() { .hasPriority(recordWith().statusFrom(INSUFFICIENT_PAYER_BALANCE, PAYER_ACCOUNT_DELETED)))); } - @HapiTest - @Order(12) - public Stream executionWithInvalidAccountAmountsFails() { - long transferAmount = 100; - long senderBalance = 1000L; - long payingAccountBalance = 1_000_000L; - long noBalance = 0L; - return hapiTest( - cryptoCreate(PAYING_ACCOUNT).balance(payingAccountBalance), - cryptoCreate(SENDER).balance(senderBalance).via(SENDER_TXN), - cryptoCreate(RECEIVER).balance(noBalance), - scheduleCreate( - FAILED_XFER, - cryptoTransfer(tinyBarsFromToWithInvalidAmounts(SENDER, RECEIVER, transferAmount))) - .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 4) - .designatingPayer(PAYING_ACCOUNT) - .recordingScheduledTxn() - .hasKnownStatus(INVALID_ACCOUNT_AMOUNTS)); - } - - @HapiTest - @Order(13) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionWithCryptoInsufficientAccountBalanceFails() { long noBalance = 0L; long senderBalance = 100L; @@ -808,8 +777,7 @@ public Stream executionWithCryptoSenderDeletedFails() { }))); } - @HapiTest - @Order(15) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream executionTriggersWithWeirdlyRepeatedKey() { String schedule = "dupKeyXfer"; @@ -846,8 +814,7 @@ public Stream executionTriggersWithWeirdlyRepeatedKey() { scheduleSign(schedule).alsoSigningWith(WEIRDLY_POPULAR_KEY).hasKnownStatus(INVALID_SCHEDULE_ID))); } - @HapiTest - @Order(16) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream scheduledFreezeWorksAsExpected() { return hapiTest(flattened( cryptoCreate(PAYING_ACCOUNT).via(PAYER_TXN), @@ -874,30 +841,7 @@ final Stream scheduledFreezeWorksAsExpected() { }))); } - @HapiTest - @Order(17) - final Stream scheduledFreezeWithUnauthorizedPayerFails() { - - return hapiTest(flattened( - cryptoCreate(PAYING_ACCOUNT).via(PAYER_TXN), - cryptoCreate(PAYING_ACCOUNT_2), - scheduleFakeUpgrade(PAYING_ACCOUNT, 4, "test"), - // future throttles will be exceeded because there is no throttle - // for freeze - // and the custom payer is not exempt from throttles like and admin - // user would be - // todo future throttle is not implemented yet - // .hasKnownStatus(SCHEDULE_FUTURE_THROTTLE_EXCEEDED) - - // note: the sleepFor and cryptoCreate operations are added only to clear the schedule before - // the next state. This was needed because an edge case in the BaseTranslator occur. - // When scheduleCreate trigger the schedules execution scheduleRef field is not the correct one. - sleepFor(6000), - cryptoCreate("foo"))); - } - - @HapiTest - @Order(18) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream scheduledPermissionedFileUpdateWorksAsExpected() { return hapiTest(flattened( cryptoCreate(PAYING_ACCOUNT).via(PAYER_TXN), @@ -932,8 +876,7 @@ final Stream scheduledPermissionedFileUpdateWorksAsExpected() { }))); } - @HapiTest - @Order(19) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream scheduledPermissionedFileUpdateUnauthorizedPayerFails() { return hapiTest(flattened( cryptoCreate(PAYING_ACCOUNT).via(PAYER_TXN), @@ -969,8 +912,7 @@ final Stream scheduledPermissionedFileUpdateUnauthorizedPayerFails( }))); } - @HapiTest - @Order(20) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream scheduledSystemDeleteWorksAsExpected() { return hapiTest(flattened( cryptoCreate(PAYING_ACCOUNT).via(PAYER_TXN), @@ -1007,8 +949,28 @@ final Stream scheduledSystemDeleteWorksAsExpected() { }))); } + // Tests that don't need virtual time + @HapiTest + public Stream executionWithInvalidAccountAmountsFails() { + long transferAmount = 100; + long senderBalance = 1000L; + long payingAccountBalance = 1_000_000L; + long noBalance = 0L; + return hapiTest( + cryptoCreate(PAYING_ACCOUNT).balance(payingAccountBalance), + cryptoCreate(SENDER).balance(senderBalance).via(SENDER_TXN), + cryptoCreate(RECEIVER).balance(noBalance), + scheduleCreate( + FAILED_XFER, + cryptoTransfer(tinyBarsFromToWithInvalidAmounts(SENDER, RECEIVER, transferAmount))) + .waitForExpiry() + .withRelativeExpiry(SENDER_TXN, 4) + .designatingPayer(PAYING_ACCOUNT) + .recordingScheduledTxn() + .hasKnownStatus(INVALID_ACCOUNT_AMOUNTS)); + } + @HapiTest - @Order(21) final Stream scheduledSystemDeleteUnauthorizedPayerFails() { return hapiTest( cryptoCreate(PAYING_ACCOUNT).via(PAYER_TXN), @@ -1024,7 +986,6 @@ final Stream scheduledSystemDeleteUnauthorizedPayerFails() { } @HapiTest - @Order(22) final Stream scheduleCreateWithExpiringInMoreThenTwoMonths() { return hapiTest( cryptoCreate("luckyYou").balance(0L), @@ -1034,7 +995,6 @@ final Stream scheduleCreateWithExpiringInMoreThenTwoMonths() { } @HapiTest - @Order(23) final Stream scheduleCreateWithNonWhiteListedTransaction() { return hapiTest( cryptoCreate("luckyYou").balance(0L), @@ -1045,7 +1005,6 @@ final Stream scheduleCreateWithNonWhiteListedTransaction() { } @HapiTest - @Order(24) final Stream scheduleCreateWithNonExistingPayer() { return hapiTest( cryptoCreate("luckyYou").balance(0L), @@ -1056,7 +1015,6 @@ final Stream scheduleCreateWithNonExistingPayer() { } @HapiTest - @Order(25) final Stream scheduleCreateIdenticalTransactions() { return hapiTest( cryptoCreate("luckyYou").balance(0L).via("cryptoCreate"), @@ -1069,7 +1027,6 @@ final Stream scheduleCreateIdenticalTransactions() { } @LeakyHapiTest(requirement = FEE_SCHEDULE_OVERRIDES) - @Order(26) final Stream scheduleCreateIdenticalContractCall() { final var contract = "CallOperationsChecker"; return hapiTest( diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermSignTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermSignTest.java index 7e8c8c28a196..bda48cd15c52 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermSignTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip423/ScheduleLongTermSignTest.java @@ -1,6 +1,24 @@ -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2025 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.hedera.services.bdd.suites.hip423; +import static com.hedera.services.bdd.junit.RepeatableReason.NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION; +import static com.hedera.services.bdd.junit.TestTags.INTEGRATION; +import static com.hedera.services.bdd.junit.hedera.embedded.EmbeddedMode.REPEATABLE; import static com.hedera.services.bdd.spec.HapiSpec.hapiTest; import static com.hedera.services.bdd.spec.assertions.AccountInfoAsserts.changeFromSnapshot; import static com.hedera.services.bdd.spec.keys.ControlForKey.forKey; @@ -58,6 +76,8 @@ import com.hedera.services.bdd.junit.HapiTest; import com.hedera.services.bdd.junit.HapiTestLifecycle; +import com.hedera.services.bdd.junit.RepeatableHapiTest; +import com.hedera.services.bdd.junit.TargetEmbeddedMode; import com.hedera.services.bdd.junit.support.TestLifecycle; import com.hedera.services.bdd.spec.keys.ControlForKey; import com.hedera.services.bdd.spec.keys.OverlappingKeyGenerator; @@ -69,12 +89,11 @@ import java.util.stream.Stream; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DynamicTest; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.Tag; +@Tag(INTEGRATION) @HapiTestLifecycle -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TargetEmbeddedMode(REPEATABLE) public class ScheduleLongTermSignTest { private static final long ONE_MINUTE = 60; @@ -95,8 +114,7 @@ static void beforeAll(@NonNull final TestLifecycle lifecycle) { + "Freeze,ContractCall,ContractCreate,ContractUpdate,ContractDelete")); } - @HapiTest - @Order(1) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream reductionInSigningReqsAllowsTxnToGoThrough() { var senderShape = threshOf(2, threshOf(1, 3), threshOf(1, 3), threshOf(2, 3)); var sigOne = senderShape.signedWith(sigs(sigs(OFF, OFF, ON), sigs(OFF, OFF, OFF), sigs(OFF, OFF, OFF))); @@ -142,9 +160,9 @@ final Stream reductionInSigningReqsAllowsTxnToGoThrough() { getAccountBalance(receiver).hasTinyBars(1L))); } - @HapiTest - @Order(2) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream reductionInSigningReqsAllowsTxnToGoThroughAtExpiryWithWaitForExpiry() { + long scheduleLifetime = 10; var senderShape = threshOf(2, threshOf(1, 3), threshOf(1, 3), threshOf(2, 3)); var sigOne = senderShape.signedWith(sigs(sigs(OFF, OFF, ON), sigs(OFF, OFF, OFF), sigs(OFF, OFF, OFF))); var firstSigThree = senderShape.signedWith(sigs(sigs(OFF, OFF, OFF), sigs(OFF, OFF, OFF), sigs(ON, OFF, OFF))); @@ -161,7 +179,7 @@ final Stream reductionInSigningReqsAllowsTxnToGoThroughAtExpiryWith scheduleCreate(schedule, cryptoTransfer(tinyBarsFromTo(sender, receiver, 1))) .payingWith(DEFAULT_PAYER) .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 4) + .withRelativeExpiry(SENDER_TXN, scheduleLifetime) .recordingScheduledTxn() .alsoSigningWith(sender) .sigControl(ControlForKey.forKey(senderKey, sigOne)), @@ -177,14 +195,13 @@ final Stream reductionInSigningReqsAllowsTxnToGoThroughAtExpiryWith .hasWaitForExpiry(true) .isNotExecuted() .isNotDeleted() - .hasRelativeExpiry(SENDER_TXN, 4) + .hasRelativeExpiry(SENDER_TXN, scheduleLifetime) .hasRecordedScheduledTxn(), - triggerSchedule(schedule), + triggerSchedule(schedule, scheduleLifetime), getAccountBalance(receiver).hasTinyBars(1L))); } - @HapiTest - @Order(3) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream nestedSigningReqsWorkAsExpected() { var senderShape = threshOf(2, threshOf(1, 3), threshOf(1, 3), threshOf(1, 3)); var sigOne = senderShape.signedWith(sigs(sigs(OFF, OFF, ON), sigs(OFF, OFF, OFF), sigs(OFF, OFF, OFF))); @@ -219,9 +236,9 @@ final Stream nestedSigningReqsWorkAsExpected() { getAccountBalance(receiver).hasTinyBars(1L))); } - @HapiTest - @Order(4) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream receiverSigRequiredNotConfusedByOrder() { + long scheduleLifetime = 10; var senderShape = threshOf(1, 3); var sigOne = senderShape.signedWith(sigs(ON, OFF, OFF)); String sender = "X"; @@ -235,7 +252,7 @@ final Stream receiverSigRequiredNotConfusedByOrder() { cryptoCreate(receiver).balance(0L).receiverSigRequired(true), scheduleCreate(schedule, cryptoTransfer(tinyBarsFromTo(sender, receiver, 1))) .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 4) + .withRelativeExpiry(SENDER_TXN, scheduleLifetime) .recordingScheduledTxn() .payingWith(DEFAULT_PAYER), scheduleSign(schedule).alsoSigningWith(receiver), @@ -247,15 +264,15 @@ final Stream receiverSigRequiredNotConfusedByOrder() { .hasWaitForExpiry() .isNotExecuted() .isNotDeleted() - .hasRelativeExpiry(SENDER_TXN, 4) + .hasRelativeExpiry(SENDER_TXN, scheduleLifetime) .hasRecordedScheduledTxn(), - triggerSchedule(schedule), + triggerSchedule(schedule, scheduleLifetime), getAccountBalance(receiver).hasTinyBars(1L))); } - @HapiTest - @Order(5) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream extraSigsDontMatterAtExpiry() { + long scheduleLifetime = 20; var senderShape = threshOf(1, 3); var sigOne = senderShape.signedWith(sigs(ON, OFF, OFF)); var sigTwo = senderShape.signedWith(sigs(OFF, ON, OFF)); @@ -273,7 +290,7 @@ final Stream extraSigsDontMatterAtExpiry() { cryptoCreate(receiver).balance(0L).receiverSigRequired(true), scheduleCreate(schedule, cryptoTransfer(tinyBarsFromTo(sender, receiver, 1))) .waitForExpiry() - .withRelativeExpiry(SENDER_TXN, 10) + .withRelativeExpiry(SENDER_TXN, scheduleLifetime) .recordingScheduledTxn() .payingWith(PAYER), scheduleSign(schedule).payingWith(PAYER).fee(THOUSAND_HBAR).alsoSigningWith(receiver), @@ -334,14 +351,13 @@ final Stream extraSigsDontMatterAtExpiry() { .hasWaitForExpiry() .isNotExecuted() .isNotDeleted() - .hasRelativeExpiry(SENDER_TXN, 10) + .hasRelativeExpiry(SENDER_TXN, scheduleLifetime) .hasRecordedScheduledTxn(), - triggerSchedule(schedule, 11), + triggerSchedule(schedule, scheduleLifetime), getAccountBalance(receiver).hasTinyBars(1L))); } - @HapiTest - @Order(7) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream basicSignatureCollectionWorks() { var txnBody = cryptoTransfer(tinyBarsFromTo(SENDER, RECEIVER, 1)); @@ -361,8 +377,7 @@ final Stream basicSignatureCollectionWorks() { cryptoCreate("foo")); } - @HapiTest - @Order(8) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream signalsIrrelevantSig() { var txnBody = cryptoTransfer(tinyBarsFromTo(SENDER, RECEIVER, 1)); @@ -381,8 +396,7 @@ final Stream signalsIrrelevantSig() { cryptoCreate("foo")); } - @HapiTest - @Order(9) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) final Stream signalsIrrelevantSigEvenAfterLinkedEntityUpdate() { var txnBody = mintToken(TOKEN_A, 50000000L); @@ -411,8 +425,7 @@ final Stream signalsIrrelevantSigEvenAfterLinkedEntityUpdate() { cryptoCreate("foo")); } - @HapiTest - @Order(10) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream triggersUponFinishingPayerSig() { return hapiTest(flattened( cryptoCreate(PAYER).balance(ONE_HBAR), @@ -441,8 +454,7 @@ public Stream triggersUponFinishingPayerSig() { getAccountBalance(RECEIVER).hasTinyBars(1L))); } - @HapiTest - @Order(11) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream triggersUponAdditionalNeededSig() { return hapiTest(flattened( cryptoCreate(SENDER).balance(1L).via(SENDER_TXN), @@ -469,8 +481,7 @@ public Stream triggersUponAdditionalNeededSig() { getAccountBalance(RECEIVER).hasTinyBars(1L))); } - @HapiTest - @Order(12) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream sharedKeyWorksAsExpected() { return hapiTest(flattened( newKeyNamed(SHARED_KEY), @@ -500,11 +511,10 @@ public Stream sharedKeyWorksAsExpected() { getTxnRecord(CREATION).scheduled())); } - @HapiTest - @Order(13) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream overlappingKeysTreatedAsExpected() { var keyGen = OverlappingKeyGenerator.withAtLeastOneOverlappingByte(2); - final long scheduleLifetime = 6; + final long scheduleLifetime = 10; return hapiTest(flattened( newKeyNamed("aKey").generator(keyGen), @@ -544,12 +554,11 @@ public Stream overlappingKeysTreatedAsExpected() { .isNotDeleted() .hasRelativeExpiry(SENDER_TXN, scheduleLifetime) .hasRecordedScheduledTxn(), - triggerSchedule(DEFERRED_XFER, 7), + triggerSchedule(DEFERRED_XFER, scheduleLifetime), getAccountBalance(ADDRESS_BOOK_CONTROL).hasTinyBars(changeFromSnapshot(BEFORE, +2)))); } - @HapiTest - @Order(14) + @RepeatableHapiTest(NEEDS_VIRTUAL_TIME_FOR_FAST_EXECUTION) public Stream retestsActivationOnSignWithEmptySigMap() { return hapiTest(flattened( newKeyNamed("a"), @@ -581,7 +590,6 @@ public Stream retestsActivationOnSignWithEmptySigMap() { } @HapiTest - @Order(15) final Stream scheduleSignWhenAllSigPresent() { return hapiTest( cryptoCreate("receiver").balance(0L).receiverSigRequired(true), @@ -594,7 +602,6 @@ final Stream scheduleSignWhenAllSigPresent() { } @HapiTest - @Order(16) final Stream scheduleSignWhenAllSigPresentNoWaitForExpiry() { return hapiTest( cryptoCreate("receiver").balance(0L).receiverSigRequired(true), @@ -605,7 +612,6 @@ final Stream scheduleSignWhenAllSigPresentNoWaitForExpiry() { } @HapiTest - @Order(18) final Stream scheduledTransactionWithWaitForExpiryFalseLessThen30Mins() { final var schedule = "s"; return hapiTest( @@ -621,7 +627,6 @@ final Stream scheduledTransactionWithWaitForExpiryFalseLessThen30Mi } @HapiTest - @Order(19) final Stream scheduledTransactionWithWaitForExpiryFalseMoreThen30Mins() { final var schedule = "s"; return hapiTest( @@ -637,7 +642,6 @@ final Stream scheduledTransactionWithWaitForExpiryFalseMoreThen30Mi } @HapiTest - @Order(20) final Stream scheduledTriggeredWhenAllKeysHaveSigned() { final var schedule = "s"; @@ -664,7 +668,6 @@ final Stream scheduledTriggeredWhenAllKeysHaveSigned() { } @HapiTest - @Order(21) final Stream scheduleSignWithNotNeededSignature() { final var schedule = "s"; @@ -680,7 +683,6 @@ final Stream scheduleSignWithNotNeededSignature() { } @HapiTest - @Order(22) final Stream scheduleSignWithEmptyKey() { final var schedule = "s"; @@ -696,7 +698,6 @@ final Stream scheduleSignWithEmptyKey() { } @HapiTest - @Order(23) final Stream scheduleSignWithTwoSignatures() { final var schedule = "s";