Cosmetic improvements to the status bar; Attempt to fix the CI
This commit is contained in:
parent
f72a58595f
commit
c23b011c77
|
@ -865,6 +865,11 @@ when hasPrompt:
|
||||||
else:
|
else:
|
||||||
p[].writeLine("Unknown command: " & cmd)
|
p[].writeLine("Unknown command: " & cmd)
|
||||||
|
|
||||||
|
proc slotOrZero(time: BeaconTime): Slot =
|
||||||
|
let exSlot = time.toSlot
|
||||||
|
if exSlot.afterGenesis: exSlot.slot
|
||||||
|
else: Slot(0)
|
||||||
|
|
||||||
proc initPrompt(node: BeaconNode) =
|
proc initPrompt(node: BeaconNode) =
|
||||||
if isatty(stdout) and node.config.statusbar:
|
if isatty(stdout) and node.config.statusbar:
|
||||||
enableTrueColors()
|
enableTrueColors()
|
||||||
|
@ -892,7 +897,21 @@ when hasPrompt:
|
||||||
of "last_finalized_epoch":
|
of "last_finalized_epoch":
|
||||||
var head = node.blockPool.finalizedHead
|
var head = node.blockPool.finalizedHead
|
||||||
# TODO: Should we display a state root instead?
|
# TODO: Should we display a state root instead?
|
||||||
$(head.slot) & "(" & shortLog(head.blck.root) & ")"
|
$(head.slot.epoch) & " (" & shortLog(head.blck.root) & ")"
|
||||||
|
|
||||||
|
of "epoch":
|
||||||
|
$node.beaconClock.now.slotOrZero.epoch
|
||||||
|
|
||||||
|
of "epoch_slot":
|
||||||
|
$(node.beaconClock.now.slotOrZero mod SLOTS_PER_EPOCH)
|
||||||
|
|
||||||
|
of "slots_per_epoch":
|
||||||
|
$SLOTS_PER_EPOCH
|
||||||
|
|
||||||
|
of "slot_trailing_digits":
|
||||||
|
var slotStr = $node.beaconClock.now.slotOrZero
|
||||||
|
if slotStr.len > 3: slotStr = slotStr[^3..^1]
|
||||||
|
slotStr
|
||||||
|
|
||||||
of "attached_validators_balance":
|
of "attached_validators_balance":
|
||||||
var balance = uint64(0)
|
var balance = uint64(0)
|
||||||
|
|
|
@ -54,7 +54,9 @@ type
|
||||||
|
|
||||||
statusbarContents* {.
|
statusbarContents* {.
|
||||||
desc: ""
|
desc: ""
|
||||||
defaultValue: "peers: $connected_peers; finalized epoch: $last_finalized_epoch |" &
|
defaultValue: "peers: $connected_peers; " &
|
||||||
|
"epoch: $epoch, slot: $epoch_slot/$slots_per_epoch (..$slot_trailing_digits); " &
|
||||||
|
"finalized epoch: $last_finalized_epoch |" &
|
||||||
"ETH: $attached_validators_balance" }: string
|
"ETH: $attached_validators_balance" }: string
|
||||||
|
|
||||||
case cmd* {.
|
case cmd* {.
|
||||||
|
|
|
@ -68,6 +68,9 @@ func compute_epoch_of_slot*(slot: Slot|uint64): Epoch =
|
||||||
# Return the epoch number of the given ``slot``.
|
# Return the epoch number of the given ``slot``.
|
||||||
(slot div SLOTS_PER_EPOCH).Epoch
|
(slot div SLOTS_PER_EPOCH).Epoch
|
||||||
|
|
||||||
|
template epoch*(slot: Slot): Epoch =
|
||||||
|
compute_epoch_of_slot(slot)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.3/specs/core/0_beacon-chain.md#compute_start_slot_of_epoch
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.3/specs/core/0_beacon-chain.md#compute_start_slot_of_epoch
|
||||||
func compute_start_slot_of_epoch*(epoch: Epoch): Slot =
|
func compute_start_slot_of_epoch*(epoch: Epoch): Slot =
|
||||||
# Return the start slot of ``epoch``.
|
# Return the start slot of ``epoch``.
|
||||||
|
|
3
nim.cfg
3
nim.cfg
|
@ -11,6 +11,9 @@
|
||||||
--passL:"-Wl,--stack,8388608"
|
--passL:"-Wl,--stack,8388608"
|
||||||
# https://github.com/nim-lang/Nim/issues/4057
|
# https://github.com/nim-lang/Nim/issues/4057
|
||||||
--tlsEmulation:off
|
--tlsEmulation:off
|
||||||
|
# The dynamic Chronicles output currently prevents us from using colors on Windows
|
||||||
|
# because these require direct manipulations of the stdout File object.
|
||||||
|
-d:"chronicles_colors=off"
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@if testnet_docker_node:
|
@if testnet_docker_node:
|
||||||
|
|
Loading…
Reference in New Issue