From d8a8cc4ed7164fc34e95b8abecd1ad90fe9bcaa2 Mon Sep 17 00:00:00 2001 From: Gabriel Fukushima Date: Mon, 30 Sep 2024 08:25:08 +1000 Subject: [PATCH] Add get-earliest-available-block-slot to debug tool (#8649) * add get-earliest-available-block-slot to debug tool Signed-off-by: Gabriel Fukushima --------- Signed-off-by: Gabriel Fukushima --- .../cli/subcommand/debug/DebugDbCommand.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java index 4dec9e32a9d..381cd27cb20 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java @@ -142,6 +142,29 @@ public int getFinalizedState( } } + @Command( + name = "get-earliest-available-block-slot", + description = "Get the earliest available block slot in the database", + mixinStandardHelpOptions = true, + showDefaultValues = true, + abbreviateSynopsis = true, + versionProvider = PicoCliVersionProvider.class, + synopsisHeading = "%n", + descriptionHeading = "%nDescription:%n%n", + optionListHeading = "%nOptions:%n", + footerHeading = "%n", + footer = "Teku is licensed under the Apache License 2.0") + public int getEarliestAvailableBlockSlot( + @Mixin final BeaconNodeDataOptions beaconNodeDataOptions, + @Mixin final Eth2NetworkOptions eth2NetworkOptions) + throws Exception { + try (final Database database = createDatabase(beaconNodeDataOptions, eth2NetworkOptions)) { + Optional earliestAvailableBlockSlot = database.getEarliestAvailableBlockSlot(); + earliestAvailableBlockSlot.ifPresent(System.out::println); + } + return 0; + } + @Command( name = "get-finalized-state-indices", description = "Display the slots of finalized states that are stored.",