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

fix incorrect config validation regression from #5959 #5966

Merged
merged 1 commit into from Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions beacon_chain/validator_client/common.nim
Expand Up @@ -1440,23 +1440,24 @@ proc updateRuntimeConfig*(vc: ValidatorClientRef,
localForkEpoch: Epoch,
forkVersion: Opt[Version]): Result[void, string] =
if localForkVersion.isNone():
discard # Potentially discovered new fork, save it at end of function
ok() # Potentially discovered new fork, save it at end of function
else:
if forkVersion.isSome():
if forkVersion.get() == localForkVersion.get():
discard # Already known
ok() # Already known
else:
return err("Beacon node has conflicting " &
consensusFork.forkVersionConfigKey() & " value")
err("Beacon node has conflicting " &
consensusFork.forkVersionConfigKey() & " value")
else:
if wallEpoch < localForkEpoch:
debug "Beacon node must be updated before fork activates",
node = node,
consensusFork,
forkEpoch = localForkEpoch
ok()
else:
return err("Beacon node must be updated and report correct " &
$consensusFork & " config value")
err("Beacon node must be updated and report correct " &
$consensusFork & " config value")

? ConsensusFork.Capella.validateForkVersionCompatibility(
localForkConfig.capellaVersion,
Expand All @@ -1468,23 +1469,24 @@ proc updateRuntimeConfig*(vc: ValidatorClientRef,
localForkEpoch: Epoch,
forkEpoch: Epoch): Result[void, string] =
if localForkEpoch == FAR_FUTURE_EPOCH:
discard # Potentially discovered new fork, save it at end of function
ok() # Potentially discovered new fork, save it at end of function
else:
if forkEpoch != FAR_FUTURE_EPOCH:
if forkEpoch == localForkEpoch:
discard # Already known
ok() # Already known
else:
return err("Beacon node has conflicting " &
consensusFork.forkEpochConfigKey() & " value")
err("Beacon node has conflicting " &
consensusFork.forkEpochConfigKey() & " value")
else:
if wallEpoch < localForkEpoch:
debug "Beacon node must be updated before fork activates",
node = node,
consensusFork,
forkEpoch = localForkEpoch
ok()
else:
return err("Beacon node must be updated and report correct " &
$consensusFork & " config value")
err("Beacon node must be updated and report correct " &
$consensusFork & " config value")

? ConsensusFork.Altair.validateForkEpochCompatibility(
localForkConfig.altairEpoch, forkConfig.altairEpoch)
Expand Down