From ad74c1a6a557092e3b291e2ae174eaeb8a5c89ec Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 16 Jan 2024 18:33:46 +0100 Subject: [PATCH] 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. --- beacon_chain/nimbus_beacon_node.nim | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index de4fdf353..72199f938 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -132,6 +132,19 @@ func getVanityLogs(stdoutKind: StdoutLogKind): VanityLogs = onUpgradeToDeneb: (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( config: BeaconNodeConf, cfg: RuntimeConfig, @@ -1473,7 +1486,8 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} = await node.updateGossipStatus(slot + 1) -func formatNextConsensusFork(node: BeaconNode): Opt[string] = +func formatNextConsensusFork( + node: BeaconNode, withVanityArt = false): Opt[string] = let consensusFork = node.dag.cfg.consensusForkAtEpoch(node.dag.head.slot.epoch) if consensusFork == ConsensusFork.high: @@ -1483,7 +1497,9 @@ func formatNextConsensusFork(node: BeaconNode): Opt[string] = nextForkEpoch = node.dag.cfg.consensusForkEpoch(nextConsensusFork) if nextForkEpoch == FAR_FUTURE_EPOCH: return Opt.none(string) - Opt.some($nextConsensusFork & ":" & $nextForkEpoch) + Opt.some( + (if withVanityArt: nextConsensusFork.getVanityMascot & " " else: "") & + $nextConsensusFork & ":" & $nextForkEpoch) func syncStatus(node: BeaconNode, wallSlot: Slot): string = let optimistic_head = not node.dag.head.executionValid @@ -1970,7 +1986,8 @@ when not defined(windows): formatGwei(node.attachedValidatorBalanceTotal) of "next_consensus_fork": - let nextConsensusForkDescription = node.formatNextConsensusFork() + let nextConsensusForkDescription = + node.formatNextConsensusFork(withVanityArt = true) if nextConsensusForkDescription.isNone: "" else: