Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flattening deposit snapshot path config options #7869

Closed
wants to merge 17 commits into from

Conversation

lucassaldanha
Copy link
Member

PR Description

This PR is part 1 of the deposit snapshots changes support for checkpoint sync url.

In this PR, we are breaking the deposit snapshot path option into 3 separate options:

  • custom path set by the user
  • path from our bundles distributed as part of Teku
  • path for downloading the snapshot from the checkpoint sync url endpoint

At this point, we are not changing our existing behaviour:

  1. default behaviour: using the bundled deposit tree snapshot by default

  2. when using --Xdeposit-snapshot: don't use the bundled version and use the path specified on --Xdeposit-snapshot

Fixed Issue(s)

related to #7715

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@lucassaldanha lucassaldanha changed the title flattening deposit snapshot path config options Flattening deposit snapshot path config options Jan 10, 2024
Comment on lines 98 to 100
public Optional<String> getCheckpointSyncDepositSnapshotUrl() {
return checkpointSyncDepositSnapshotUrl;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is not being used atm. It will be relevant in my follow-up PR.

@lucassaldanha lucassaldanha requested a review from zilm13 January 10, 2024 01:54
import tech.pegasys.teku.spec.TestSpecFactory;
import tech.pegasys.teku.spec.networks.Eth2Network;

class PowchainConfigurationTest {

Check notice

Code scanning / CodeQL

Unused classes and interfaces

Unused class: PowchainConfigurationTest is not referenced within this codebase. If not used as an external API it should be removed.
Copy link
Contributor

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be not the best way to mix two options parsing in DepositOptions. We'd better set all input from appropriate options to configuration. Validate and throw in validate() part of builder and set as many fields as we need for decision in final configuration. It will look better and easier to maintain and analyze. Also we could add DepositSnapshot inner class in PowChainConfiguration for better readability, so the options could be accessed like tekuConfig.powchain().depositSnapshot().enabled() or tekuConfig.powchain().depositSnapshot().bundledPath()


private boolean parseDepositSnapshotEnabled() {
return depositSnapshotEnabled;
if (parseResult.hasMatchedOption("--Xdeposit-snapshot")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logic of lines starting from here could be implemented without using low level picocli api. We should have values set here already

final CommandLine.ParseResult parseResult = commandSpec.commandLine().getParseResult();

final String checkpointSyncUrlCliOption = "--checkpoint-sync-url";
final boolean checkpointSyncUrlSet = parseResult.hasMatchedOption(checkpointSyncUrlCliOption);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this way of using data from other options module. Is it possible to implement the same logic more casual way by checking options here and there in TekuConfiguration.java? As initialState could be set not only by "--checkpoint-sync-url" we could add the property checkpointSyncUrlSet as boolean to `Eth2NetworkConfiguration to clarify this case.

b.useMissingDepositEventLogging(useMissingDepositEventLogging);
b.customDepositSnapshotPath(depositSnapshotPath);
b.depositSnapshotEnabled(depositSnapshotEnabled);
if (checkpointSyncUrlSet) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be very difficult to maintain and follow when foreign option is checked and set here.

@lucassaldanha lucassaldanha deleted the teku-7715 branch July 31, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants