Skip to content

Snapshots, rollback & time

View Markdown ↗

Yano’s devnet controls let tests create history, rewind it, and explore epoch boundaries. They require a devnet-capable recipe and are not general public-network administration tools.

import org.yanoproject.testkit.devnet.YanoDevnetTestConfig;
import org.yanoproject.testkit.devnet.YanoDevnetTestKit;
try (YanoDevnetTestConfig config = YanoDevnetTestConfig.builder()
.temporaryRocksDbStorage().blockTimeMillis(200).build();
YanoDevnetTestKit kit = YanoDevnetTestKit.devnet(config)) {
kit.start();
var baseline = kit.snapshots().create("baseline");
kit.time().advanceSlots(10);
kit.snapshots().restore(baseline.name());
}

From your extracted JVM release directory:

Terminal window
java -Dquarkus.profile=devnet \
-Dyano.block-producer.past-time-travel-mode=true \
-jar yano.jar

Production is deferred until you shift the genesis:

Terminal window
curl -fsS -X POST http://localhost:7070/api/v1/devnet/epochs/shift \
-H 'Content-Type: application/json' -d '{"epochs":4}'
curl -fsS -X POST http://localhost:7070/api/v1/devnet/epochs/catch-up

The shift starts the chain in the past; catch-up moves toward wall-clock and live production. Use fresh isolated storage for a new scenario. Timing derives from genesis; sparse backfill can be configured with yano.block-producer.backfill-block-interval-slots. Consult source configuration and compatibility tests before changing that interval.

Terminal window
curl -fsS -X POST http://localhost:7070/api/v1/devnet/rollback \
-H 'Content-Type: application/json' -d '{"count":3}'

Specify exactly one of count, slot, or blockNumber. The operation uses the normal state rollback path and notifies downstream N2N clients. Use it to test whether an indexer or application reverses observations correctly.