Skip to content

Commit

Permalink
fix: freeze time reset check (#15429)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
  • Loading branch information
tinker-michaelj authored Sep 13, 2024
1 parent 5c06347 commit 4eb9c5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public boolean startUserTransaction(@NonNull final Instant consensusTime, @NonNu
// Also check to see if this is the first transaction we're handling after a freeze restart. If so, we also
// start a new block.
final var isFirstTransactionAfterFreezeRestart = platformState.freezeTime() != null
&& platformState.freezeTimeOrThrow().equals(platformState.freezeTime());
&& platformState.freezeTimeOrThrow().equals(platformState.lastFrozenTime());
if (isFirstTransactionAfterFreezeRestart) {
new WritablePlatformStateStore(state.getWritableStates(PlatformStateService.NAME)).setFreezeTime(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import static com.hedera.services.bdd.junit.hedera.MarkerFile.EXEC_IMMEDIATE_MF;
import static com.hedera.services.bdd.spec.queries.QueryVerbs.getVersionInfo;
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer;
import static com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer.tinyBarsFromTo;
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.blockingOrder;
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.buildUpgradeZipFrom;
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.doAdhoc;
Expand All @@ -33,6 +35,7 @@
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.waitForFrozenNetwork;
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.waitForMf;
import static com.hedera.services.bdd.spec.utilops.upgrade.BuildUpgradeZipOp.FAKE_UPGRADE_ZIP_LOC;
import static com.hedera.services.bdd.suites.HapiSuite.FUNDING;
import static com.hedera.services.bdd.suites.HapiSuite.GENESIS;
import static com.hedera.services.bdd.suites.freeze.CommonUpgradeResources.DEFAULT_UPGRADE_FILE_ID;
import static com.hedera.services.bdd.suites.freeze.CommonUpgradeResources.FAKE_ASSETS_LOC;
Expand Down Expand Up @@ -132,7 +135,10 @@ default SpecOperation upgradeToNextConfigVersion() {
*/
default SpecOperation restartAtNextConfigVersion() {
return blockingOrder(
freezeOnly().startingIn(5).seconds().payingWith(GENESIS),
freezeOnly().startingIn(5).seconds().payingWith(GENESIS).deferStatusResolution(),
// Immediately submit a transaction in the same round to ensure freeze time is only
// reset when last frozen time matches it (i.e., in a post-upgrade transaction)
cryptoTransfer(tinyBarsFromTo(GENESIS, FUNDING, 1)),
confirmFreezeAndShutdown(),
sourcing(() -> FakeNmt.restartNetwork(CURRENT_CONFIG_VERSION.incrementAndGet())),
waitForActiveNetwork(RESTART_TIMEOUT));
Expand Down

0 comments on commit 4eb9c5b

Please sign in to comment.