Skip to content

Commit

Permalink
add get-earliest-available-block-slot to debug tool
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
  • Loading branch information
gfukushima committed Sep 27, 2024
1 parent 7066de7 commit d7e5e36
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,29 @@ public int getFinalizedState(
}
}

@Command(
name = "get-earliest-available-block-slot",
description = "Get the finalized state, if available, as SSZ",
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<UInt64> 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.",
Expand Down Expand Up @@ -868,4 +891,5 @@ private int writeBlock(final Path outputFile, final Optional<SignedBeaconBlock>
}
return 0;
}

}

0 comments on commit d7e5e36

Please sign in to comment.