Skip to content

Commit

Permalink
Fix VC DB conversion when no proposer settings is defined and add `Ex…
Browse files Browse the repository at this point in the history
…perimental` flag in the `--enable-minimal-slashing-protection` help. (#13691)

* VC: Allow DB conversion without proposer settings.

* `enable-minimal-slashing-protection` flag: Add `Experimental warning`.
  • Loading branch information
nalepae authored and rkapka committed Mar 7, 2024
1 parent 818d075 commit f807c5d
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 212 deletions.
2 changes: 1 addition & 1 deletion config/features/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var (
}
EnableMinimalSlashingProtection = &cli.BoolFlag{
Name: "enable-minimal-slashing-protection",
Usage: "Enables the minimal slashing protection. See EIP-3076 for more details.",
Usage: "(Experimental): Enables the minimal slashing protection. See EIP-3076 for more details.",
}
enableDoppelGangerProtection = &cli.BoolFlag{
Name: "enable-doppelganger",
Expand Down
17 changes: 11 additions & 6 deletions validator/db/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ func ConvertDatabase(ctx context.Context, sourceDataDir string, targetDataDir st
// -----------------
// Get the proposer settings.
proposerSettings, err := sourceDatabase.ProposerSettings(ctx)
if err != nil {
return errors.Wrap(err, "could not get proposer settings from source database")
}

// Save the proposer settings.
if err := targetDatabase.SaveProposerSettings(ctx, proposerSettings); err != nil {
return errors.Wrap(err, "could not save proposer settings")
switch err {
case nil:
// Save the proposer settings.
if err := targetDatabase.SaveProposerSettings(ctx, proposerSettings); err != nil {
return errors.Wrap(err, "could not save proposer settings")
}

case kv.ErrNoProposerSettingsFound, filesystem.ErrNoProposerSettingsFound:
// Nothing to do.
default:
return errors.Wrap(err, "could not get proposer settings from source database")
}

// Attestations
Expand Down
Loading

0 comments on commit f807c5d

Please sign in to comment.