add vanity mascot for upcoming fork to status bar (#5761)

To simplify supporting "am I ready for the fork" requests, add a simple
marker to the default status bar that indicates readiness by displaying
the fork's corresponding mascot. This is the same one that is also
displayed during the actual fork transition, so does not introduce
new dependencies. It also only shows in default status bar, not in logs.
This commit is contained in:
Etan Kissling 2024-01-16 18:33:46 +01:00 committed by GitHub
parent 06551dd320
commit ad74c1a6a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 3 deletions

View File

@ -132,6 +132,19 @@ func getVanityLogs(stdoutKind: StdoutLogKind): VanityLogs =
onUpgradeToDeneb: onUpgradeToDeneb:
(proc() = notice "🐟 Proto-Danksharding is ON 🐟")) (proc() = notice "🐟 Proto-Danksharding is ON 🐟"))
func getVanityMascot(consensusFork: ConsensusFork): string =
case consensusFork
of ConsensusFork.Deneb:
"🐟"
of ConsensusFork.Capella:
"🦉"
of ConsensusFork.Bellatrix:
"🐼"
of ConsensusFork.Altair:
""
of ConsensusFork.Phase0:
"🦏"
proc loadChainDag( proc loadChainDag(
config: BeaconNodeConf, config: BeaconNodeConf,
cfg: RuntimeConfig, cfg: RuntimeConfig,
@ -1473,7 +1486,8 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
await node.updateGossipStatus(slot + 1) await node.updateGossipStatus(slot + 1)
func formatNextConsensusFork(node: BeaconNode): Opt[string] = func formatNextConsensusFork(
node: BeaconNode, withVanityArt = false): Opt[string] =
let consensusFork = let consensusFork =
node.dag.cfg.consensusForkAtEpoch(node.dag.head.slot.epoch) node.dag.cfg.consensusForkAtEpoch(node.dag.head.slot.epoch)
if consensusFork == ConsensusFork.high: if consensusFork == ConsensusFork.high:
@ -1483,7 +1497,9 @@ func formatNextConsensusFork(node: BeaconNode): Opt[string] =
nextForkEpoch = node.dag.cfg.consensusForkEpoch(nextConsensusFork) nextForkEpoch = node.dag.cfg.consensusForkEpoch(nextConsensusFork)
if nextForkEpoch == FAR_FUTURE_EPOCH: if nextForkEpoch == FAR_FUTURE_EPOCH:
return Opt.none(string) return Opt.none(string)
Opt.some($nextConsensusFork & ":" & $nextForkEpoch) Opt.some(
(if withVanityArt: nextConsensusFork.getVanityMascot & " " else: "") &
$nextConsensusFork & ":" & $nextForkEpoch)
func syncStatus(node: BeaconNode, wallSlot: Slot): string = func syncStatus(node: BeaconNode, wallSlot: Slot): string =
let optimistic_head = not node.dag.head.executionValid let optimistic_head = not node.dag.head.executionValid
@ -1970,7 +1986,8 @@ when not defined(windows):
formatGwei(node.attachedValidatorBalanceTotal) formatGwei(node.attachedValidatorBalanceTotal)
of "next_consensus_fork": of "next_consensus_fork":
let nextConsensusForkDescription = node.formatNextConsensusFork() let nextConsensusForkDescription =
node.formatNextConsensusFork(withVanityArt = true)
if nextConsensusForkDescription.isNone: if nextConsensusForkDescription.isNone:
"" ""
else: else: