mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
🐼 (#3670)
* 🐼
* rm panda refs outside core module; preprocess text/ANSI artwork sources
* credit artwork to beatscribe
This commit is contained in:
parent
bf1763fdef
commit
01534b0431
@ -19,9 +19,11 @@ import
|
|||||||
../validators/validator_monitor,
|
../validators/validator_monitor,
|
||||||
./block_dag, block_pools_types_light_client
|
./block_dag, block_pools_types_light_client
|
||||||
|
|
||||||
|
from "."/vanity_logs/pandas import VanityLogs
|
||||||
|
|
||||||
export
|
export
|
||||||
options, sets, tables, hashes, helpers, beacon_chain_db, era_db, block_dag,
|
options, sets, tables, hashes, helpers, beacon_chain_db, era_db, block_dag,
|
||||||
block_pools_types_light_client, validator_monitor
|
block_pools_types_light_client, validator_monitor, VanityLogs
|
||||||
|
|
||||||
# ChainDAG and types related to forming a DAG of blocks, keeping track of their
|
# ChainDAG and types related to forming a DAG of blocks, keeping track of their
|
||||||
# relationships and allowing various forms of lookups
|
# relationships and allowing various forms of lookups
|
||||||
@ -200,6 +202,12 @@ type
|
|||||||
## value with other components which don't have access to the
|
## value with other components which don't have access to the
|
||||||
## full ChainDAG.
|
## full ChainDAG.
|
||||||
|
|
||||||
|
vanityLogs*: VanityLogs
|
||||||
|
## Upon the merge activating, these get displayed, at least once when the
|
||||||
|
## head becomes post-merge and then when the merge is finalized. If chain
|
||||||
|
## reorgs happen around the initial merge onMergeTransitionBlock might be
|
||||||
|
## called several times.
|
||||||
|
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# Data to enable light clients to stay in sync with the network
|
# Data to enable light clients to stay in sync with the network
|
||||||
|
|
||||||
|
@ -663,7 +663,8 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
|
|||||||
onLCFinalityUpdateCb: OnLightClientFinalityUpdateCallback = nil,
|
onLCFinalityUpdateCb: OnLightClientFinalityUpdateCallback = nil,
|
||||||
onLCOptimisticUpdateCb: OnLightClientOptimisticUpdateCallback = nil,
|
onLCOptimisticUpdateCb: OnLightClientOptimisticUpdateCallback = nil,
|
||||||
serveLightClientData = false,
|
serveLightClientData = false,
|
||||||
importLightClientData = ImportLightClientData.None): ChainDAGRef =
|
importLightClientData = ImportLightClientData.None,
|
||||||
|
vanityLogs = default(VanityLogs)): ChainDAGRef =
|
||||||
# TODO move fork version sanity checking elsewhere?
|
# TODO move fork version sanity checking elsewhere?
|
||||||
let forkVersions =
|
let forkVersions =
|
||||||
[cfg.GENESIS_FORK_VERSION, cfg.ALTAIR_FORK_VERSION,
|
[cfg.GENESIS_FORK_VERSION, cfg.ALTAIR_FORK_VERSION,
|
||||||
@ -705,6 +706,8 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
|
|||||||
updateFlags: {verifyFinalization} * updateFlags,
|
updateFlags: {verifyFinalization} * updateFlags,
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
|
|
||||||
|
vanityLogs: vanityLogs,
|
||||||
|
|
||||||
serveLightClientData: serveLightClientData,
|
serveLightClientData: serveLightClientData,
|
||||||
importLightClientData: importLightClientData,
|
importLightClientData: importLightClientData,
|
||||||
|
|
||||||
@ -1547,8 +1550,16 @@ proc updateHead*(
|
|||||||
error "Cannot update head to block without parent"
|
error "Cannot update head to block without parent"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
template getHeadStateMergeComplete(): bool =
|
||||||
|
withState(dag.headState):
|
||||||
|
when stateFork >= BeaconStateFork.Bellatrix:
|
||||||
|
is_merge_transition_complete(state.data)
|
||||||
|
else:
|
||||||
|
false
|
||||||
|
|
||||||
let
|
let
|
||||||
lastHeadStateRoot = getStateRoot(dag.headState)
|
lastHeadStateRoot = getStateRoot(dag.headState)
|
||||||
|
lastHeadMergeComplete = getHeadStateMergeComplete()
|
||||||
|
|
||||||
# Start off by making sure we have the right state - updateState will try
|
# Start off by making sure we have the right state - updateState will try
|
||||||
# to use existing in-memory states to make this smooth
|
# to use existing in-memory states to make this smooth
|
||||||
@ -1562,8 +1573,12 @@ proc updateHead*(
|
|||||||
fatal "Unable to load head state during head update, database corrupt?",
|
fatal "Unable to load head state during head update, database corrupt?",
|
||||||
lastHead = shortLog(lastHead)
|
lastHead = shortLog(lastHead)
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
dag.head = newHead
|
dag.head = newHead
|
||||||
|
|
||||||
|
if getHeadStateMergeComplete() and not lastHeadMergeComplete:
|
||||||
|
dag.vanityLogs.onMergeTransitionBlock()
|
||||||
|
|
||||||
dag.db.putHeadBlock(newHead.root)
|
dag.db.putHeadBlock(newHead.root)
|
||||||
|
|
||||||
updateBeaconMetrics(dag.headState, dag.head.bid, cache)
|
updateBeaconMetrics(dag.headState, dag.head.bid, cache)
|
||||||
@ -1659,6 +1674,10 @@ proc updateHead*(
|
|||||||
|
|
||||||
dag.db.updateFinalizedBlocks(newFinalized)
|
dag.db.updateFinalizedBlocks(newFinalized)
|
||||||
|
|
||||||
|
if oldFinalizedHead.blck.executionBlockRoot.isZero and
|
||||||
|
not dag.finalizedHead.blck.executionBlockRoot.isZero:
|
||||||
|
dag.vanityLogs.onFinalizedMergeTransitionBlock()
|
||||||
|
|
||||||
# Pruning the block dag is required every time the finalized head changes
|
# Pruning the block dag is required every time the finalized head changes
|
||||||
# in order to clear out blocks that are no longer viable and should
|
# in order to clear out blocks that are no longer viable and should
|
||||||
# therefore no longer be considered as part of the chain we're following
|
# therefore no longer be considered as part of the chain we're following
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
[0;0m[46C[31m.
|
||||||
|
[0m[34C[31m.[0m[10C[31m:[1;33m ___
|
||||||
|
[0m[19C[1;33m [0;31m`[1;33m ___ [0;31m:[1;33m._ \.[0m[9C[1;33m\\ ) ) [0;31m.
|
||||||
|
[0m[25C[1;33m\\ .)`\ )\ \ \ ./') / ; ;
|
||||||
|
[0m[26C[1;33m)`/ [0m [33m`\/ (''('('/ '` (.__/\
|
||||||
|
[0m[15C[1;33m [0;31m.[0m[7C[1;33m/''[0m dMb [1m [33m" " "[0m [0m[5C,mMm [1m [33m /
|
||||||
|
[0m[15C[1;33m [0;31m .[1;33m ( [0m d;::`bmd""""""""""""bd':::`.[1m [33m(' [0;31m.
|
||||||
|
[0m[21C[31m.[1;33m \ [0m{::::;[18C.;;;)[1m [33m ) [0;31m.
|
||||||
|
[0m[5C[1;33m [0;31m.[0m[10C[1;33m./: }[0m `;;' .:::. .::::. ;.;'[1m [33m { . [0;31m\[1;33m. [0m [1;33m [0;31m.
|
||||||
|
[0m[5C[1;33m `.[0m[7C[1;33m// \\ {'[0m d'' ::(*): :(*):: \.[1m [33m `}// \\ [0m [1;33m ;
|
||||||
|
[0m[11C[1;33m)\ . (e`\ /'; \[0m |[5C:::::' `:::::[5C|[1;33m ./'{ /' ) /(
|
||||||
|
[0m[5C[31m`[1;33m / /' ; \th(.{ }[0m |[5C`::;'______`:::'[5C|[1;33m { \^/'[0m [33m / /^'\ \ [0;31m,
|
||||||
|
[0m[5C[1;33m ; ( ( (| `)\ \`\'[0m |[6C`" :_ _; "'[6C|[1;33m ` /' { / ( ( ( [0;31m;
|
||||||
|
[0m[5C[1;33m /| `.`\ \`\| `\) `[0m `b[11C||[11Cd' [1;33m'[0m[6C[1;33m\`\ \`.\ \.
|
||||||
|
[0m[5C[1;33m( `\. \ `\) .[0m [0m md$n[5C`-_+'`+_-'[5Cd$b.[6C[1;33m' [0m [1;33m(/' / ./' )
|
||||||
|
[0m[5C[1;33m \. `\ | [0m [1;33m; . [0m ...[0m;;;;;;` m `=='[5Cm ' ;;;.. [1;33m [0;31m.[1;0m [33m | /' ./
|
||||||
|
[0m[5C[1;33m ` \. `' [0m[5C.;;;;;:::;:::;::::.......;::::::::::::;;;. [1;33m [0m [1;33m'' ./ [0;31m.
|
||||||
|
[0m[5C[1;33m [0;31m;[1;33m \ `[0;31m.[0m .::;::::;:'' """"[36m""[32m"""[0m""""""" `:::;:::'. [31m [1;33m / ;
|
||||||
|
[0m[5C[1;33m ( \/'[0m[7C/:::::;:::' [36m [0m [36m .[32m . [0m[11C`:::;:;::\ [31m : [0m [1;33m`\/ )
|
||||||
|
[0m [31m:[0m [1;33m \ [0m [31m.[0m[5C/;:::;::::' m[36mm. [0m [36m |[32m : [0m [36m.m[32mm:[0m `::;:;:;:; [31m [0m [1;33m . /
|
||||||
|
[0m [1;33m . .'.[0m[5C/;;:::Mmmm;;;;;/'[32m:[36m:| [0m [36m ||[0m [32m::[0m [36m|:[32m: [0m\_:::::mmm:::";\ [31m . [0m [31mb[1;33m`. [0;31m.
|
||||||
|
[0m [1;33m /\ ;[0;31mn[1;33m [0m |::::::::;:`"""::[32m;[36m:/ [0m [36m |||[0m [32m:::[0m [36m\:[32m:[0m::'"""'::;:;;:;:|[31m [0m [31m ea[1;33m; /
|
||||||
|
{ `'[0;31mi[1;33m [0m |::;::::;::::;:;:[32m:[36m{ [0m [36m ||\\[0m [32m//:: [0m [36m}[32m;[0m;::;:::;:;;::;::| [31m'[0m [31m`t[1;33m''[0;31m,
|
||||||
|
[1;33m ./ . [0;31mm'[1;33m [0;31m [0m `::::;::::;::::[32m;:;[36m\ [0m [36m|\\\\[0m [32m////:[0m [36m /:[32m:[0m::;:::;::::::::;`[5C[31m;sc[1;33m(
|
||||||
|
} [0;31mb.[1;33m [0;31m .[1;0m [0m """mm:::::::::::[32m\[36m_}[0m [32m..[36m \\ [32m//[36m ..[0m [36m{_[32m::[0m::::::::::mm""" [31m. . [0m [31m`ri[1;33m)
|
||||||
|
/ .:/ [0;31mus[1;33m.[0;31m. .'[1;0m [0;31m.[0m """"mmmmPQ._[32m:[36m)[0m [32m`::..[36m ..:;'[0m [36m(-:[32m:[0m:QPmmmm""" [31m.:[1;0m [0;31m.[1;0m [0;31m . ;[0m [31m`be
|
||||||
|
[0m[31C[1;0m [0m [36m`'[0m [32m`::[36m ::' [0m [36m`"
|
||||||
|
[5m[0;5m [36mQM$Mb .d$b. .d$b. .d$b. .d$b. $$$$$ $[0m[32m\[36m /[5m$ $: $$ .d$b. $$$$$ $$$$$ $$$b. d$P
|
||||||
|
[0;5m [36m|:[0;5m [36md$ $: $$ $b."P $: $$ $: "" [$: [$: Q$:$P $: $$ [0;5m [36m[$: $P.[0;5m.[36m $: Q$ .$$;
|
||||||
|
[0;5m [32mP[36mb"' $: $$ `""b. $$22$ $: mm [$[0;5m: [36m [$: Q$P $$$$$ [$: $b"" $: d$ `$[32m:
|
||||||
|
[0;5m [32m|$b `Q$P' `MpM; $: $$ `Q$P' [$: $$$$$ `$' $: $$ [$: $$ETH $$$$' mm[0m
|
@ -0,0 +1,31 @@
|
|||||||
|
[0;0m[46C[31m.
|
||||||
|
[0m[34C[31m.[0m[10C[31m:[1;33m ___
|
||||||
|
[0m[19C[1;33m [0;31m`[1;33m ___ [0;31m:[1;33m._ \.[0m[9C[1;33m\\ ) ) [0;31m.
|
||||||
|
[0m[25C[1;33m\\ .)`\ )\ \ \ ./') / ; ;
|
||||||
|
[0m[26C[1;33m)`/ [0m [33m`\/ (''('('/ '` (.__/\
|
||||||
|
[0m[15C[1;33m [0;31m.[0m[7C[1;33m/''[0m dMb [1m [33m" " "[0m [0m[5C,mMm [1m [33m /
|
||||||
|
[0m[15C[1;33m [0;31m .[1;33m ( [0m d;::`bmd""""""""""""bd':::`.[1m [33m(' [0;31m.
|
||||||
|
[0m[21C[31m.[1;33m \ [0m{::::;[18C.;;;)[1m [33m ) [0;31m.
|
||||||
|
[0m[5C[1;33m [0;31m.[0m[10C[1;33m./: }[0m `;;' .:::. .::::. ;.;'[1m [33m { . [0;31m\[1;33m. [0m [1;33m [0;31m.
|
||||||
|
[0m[5C[1;33m `.[0m[7C[1;33m// \\ {'[0m d'' ::(*): :(*):: \.[1m [33m `}// \\ [0m [1;33m ;
|
||||||
|
[0m[11C[1;33m)\ . (e`\ /'; \[0m |[5C:::::' `:::::[5C|[1;33m ./'{ /' ) /(
|
||||||
|
[0m[5C[31m`[1;33m / /' ; \th(.{ }[0m |[5C`::;'______`:::'[5C|[1;33m { \^/'[0m [33m / /^'\ \ [0;31m,
|
||||||
|
[0m[5C[1;33m ; ( ( (| `)\ \`\'[0m |[6C`" :_ _; "'[6C|[1;33m ` /' { / ( ( ( [0;31m;
|
||||||
|
[0m[5C[1;33m /| `.`\ \`\| `\) `[0m `b[11C||[11Cd' [1;33m'[0m[6C[1;33m\`\ \`.\ \.
|
||||||
|
[0m[5C[1;33m( `\. \ `\) .[0m [0m md$n[5C`-_+'`+_-'[5Cd$b.[6C[1;33m' [0m [1;33m(/' / ./' )
|
||||||
|
[0m[5C[1;33m \. `\ | [0m [1;33m; . [0m ...[0m;;;;;;` m `=='[5Cm ' ;;;.. [1;33m [0;31m.[1;0m [33m | /' ./
|
||||||
|
[0m[5C[1;33m ` \. `' [0m[5C.;;;;;:::;:::;::::.......;::::::::::::;;;. [1;33m [0m [1;33m'' ./ [0;31m.
|
||||||
|
[0m[5C[1;33m [0;31m;[1;33m \ `[0;31m.[0m .::;::::;:'' """"[36m""[32m"""[0m""""""" `:::;:::'. [31m [1;33m / ;
|
||||||
|
[0m[5C[1;33m ( \/'[0m[7C/:::::;:::' [36m [0m [36m .[32m . [0m[11C`:::;:;::\ [31m : [0m [1;33m`\/ )
|
||||||
|
[0m [31m:[0m [1;33m \ [0m [31m.[0m[5C/;:::;::::' m[36mm. [0m [36m |[32m : [0m [36m.m[32mm:[0m `::;:;:;:; [31m [0m [1;33m . /
|
||||||
|
[0m [1;33m . .'.[0m[5C/;;:::Mmmm;;;;;/'[32m:[36m:| [0m [36m ||[0m [32m::[0m [36m|:[32m: [0m\_:::::mmm:::";\ [31m . [0m [31mb[1;33m`. [0;31m.
|
||||||
|
[0m [1;33m /\ ;[0;31mn[1;33m [0m |::::::::;:`"""::[32m;[36m:/ [0m [36m |||[0m [32m:::[0m [36m\:[32m:[0m::'"""'::;:;;:;:|[31m [0m [31m ea[1;33m; /
|
||||||
|
{ `'[0;31mi[1;33m [0m |::;::::;::::;:;:[32m:[36m{ [0m [36m ||\\[0m [32m//:: [0m [36m}[32m;[0m;::;:::;:;;::;::| [31m'[0m [31m`t[1;33m''[0;31m,
|
||||||
|
[1;33m ./ . [0;31mm'[1;33m [0;31m [0m `::::;::::;::::[32m;:;[36m\ [0m [36m|\\\\[0m [32m////:[0m [36m /:[32m:[0m::;:::;::::::::;`[5C[31m;sc[1;33m(
|
||||||
|
} [0;31mb.[1;33m [0;31m .[1;0m [0m """mm:::::::::::[32m\[36m_}[0m [32m..[36m \\ [32m//[36m ..[0m [36m{_[32m::[0m::::::::::mm""" [31m. . [0m [31m`ri[1;33m)
|
||||||
|
/ .:/ [0;31mus[1;33m.[0;31m. .'[1;0m [0;31m.[0m """"mmmmPQ._[32m:[36m)[0m [32m`::..[36m ..:;'[0m [36m(-:[32m:[0m:QPmmmm""" [31m.:[1;0m [0;31m.[1;0m [0;31m . ;[0m [31m`be
|
||||||
|
[0m[31C[1;0m [0m [36m`'[0m [32m`::[36m ::' [0m [36m`"
|
||||||
|
[0m [36mQM$Mb .d$b. .d$b. .d$b. .d$b. $$$$$ $[32m\[36m /$ $: $$ .d$b. $$$$$ $$$$$ $$$b. d$P
|
||||||
|
[0m [36m|:[0m [36md$ $: $$ $b."P $: $$ $: "" [$: [$: Q$:$P $: $$ [0m [36m[$: $P.[0m.[36m $: Q$ .$$;
|
||||||
|
[0m [32mP[36mb"' $: $$ `""b. $$22$ $: mm [$[0m: [36m [$: Q$P $$$$$ [$: $b"" $: d$ `$[32m:
|
||||||
|
[0m [32m|$b `Q$P' `MpM; $: $$ `Q$P' [$: $$$$$ `$' $: $$ [$: $$ETH $$$$' mm[0m
|
38
beacon_chain/consensus_object_pools/vanity_logs/pandas.nim
Normal file
38
beacon_chain/consensus_object_pools/vanity_logs/pandas.nim
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# beacon_chain
|
||||||
|
# Copyright (c) 2022 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
|
import chronicles
|
||||||
|
from ".."/".."/conf import StdoutLogKind
|
||||||
|
|
||||||
|
type
|
||||||
|
VanityLogs* = object
|
||||||
|
onMergeTransitionBlock*: proc() {.gcsafe, raises: [Defect].}
|
||||||
|
onFinalizedMergeTransitionBlock*: proc() {.gcsafe, raises: [Defect].}
|
||||||
|
|
||||||
|
# Created by http://beatscribe.com/ (beatscribe#1008 on Discord)
|
||||||
|
# These need to be the main body of the log not to be reformatted or escaped.
|
||||||
|
proc mono🐼() = notice "text-version.txt".staticRead
|
||||||
|
proc color🐼() = notice "color-version.ans".staticRead
|
||||||
|
proc blink🐼() = notice "blink-version.ans".staticRead
|
||||||
|
|
||||||
|
func getPandas*(stdoutKind: StdoutLogKind): VanityLogs =
|
||||||
|
case stdoutKind
|
||||||
|
of StdoutLogKind.Auto: raiseAssert "inadmissable here"
|
||||||
|
of StdoutLogKind.Colors:
|
||||||
|
VanityLogs(
|
||||||
|
onMergeTransitionBlock: color🐼,
|
||||||
|
onFinalizedMergeTransitionBlock: blink🐼)
|
||||||
|
of StdoutLogKind.NoColors:
|
||||||
|
VanityLogs(
|
||||||
|
onMergeTransitionBlock: mono🐼,
|
||||||
|
onFinalizedMergeTransitionBlock: mono🐼)
|
||||||
|
of StdoutLogKind.Json, StdoutLogKind.None:
|
||||||
|
VanityLogs(
|
||||||
|
onMergeTransitionBlock: (proc() = notice "🐼 Proof of Stake Activated 🐼"),
|
||||||
|
onFinalizedMergeTransitionBlock: (proc() = notice "🐼 Proof of Stake Finalized 🐼"))
|
@ -0,0 +1,31 @@
|
|||||||
|
.
|
||||||
|
. : ___
|
||||||
|
` ___ :._ \. \\ ) ) .
|
||||||
|
\\ .)`\ )\ \ \ ./') / ; ;
|
||||||
|
)`/ `\/ (''('('/ '` (.__/\
|
||||||
|
. /'' dMb " " " ,mMm /
|
||||||
|
. ( d;::`bmd""""""""""""bd':::`. (' .
|
||||||
|
. \ {::::; .;;;) ) .
|
||||||
|
. ./: } `;;' .:::. .::::. ;.;' { . \. .
|
||||||
|
`. // \\ {' d'' ::(*): :(*):: \. `}// \\ ;
|
||||||
|
)\ . (e`\ /'; \ | :::::' `::::: | ./'{ /' ) /(
|
||||||
|
` / /' ; \th(.{ } | `::;'______`:::' | { \^/' / /^'\ \ ,
|
||||||
|
; ( ( (| `)\ \`\' | `" :_ _; "' | ` /' { / ( ( ( ;
|
||||||
|
/| `.`\ \`\| `\) ` `b || d' ' \`\ \`.\ \.
|
||||||
|
( `\. \ `\) . md$n `-_+'`+_-' d$b. ' (/' / ./' )
|
||||||
|
\. `\ | ; . ...;;;;;;` m `==' m ' ;;;.. . | /' ./
|
||||||
|
` \. `' .;;;;;:::;:::;::::.......;::::::::::::;;;. '' ./ .
|
||||||
|
; \ `. .::;::::;:'' """""""""""""""" `:::;:::'. / ;
|
||||||
|
( \/' /:::::;:::' . . `:::;:;::\ : `\/ )
|
||||||
|
: \ . /;:::;::::' mm. | : .mm: `::;:;:;:; . /
|
||||||
|
. .'. /;;:::Mmmm;;;;;/'::| || :: |:: \_:::::mmm:::";\ . b`. .
|
||||||
|
/\ ;n |::::::::;:`"""::;:/ ||| ::: \::::'"""'::;:;;:;:| ea; /
|
||||||
|
{ `'i |::;::::;::::;:;::{ ||\\ //:: };;::;:::;:;;::;::| ' `t'',
|
||||||
|
./ . m' `::::;::::;::::;:;\ |\\\\ ////: /::::;:::;::::::::;` ;sc(
|
||||||
|
} b. . """mm:::::::::::\_} .. \\ // .. {_::::::::::::mm""" . . `ri)
|
||||||
|
/ .:/ us.. .' . """"mmmmPQ._:) `::.. ..:;' (-:::QPmmmm""" .: . . ; `be
|
||||||
|
`' `:: ::' `"
|
||||||
|
QM$Mb .d$b. .d$b. .d$b. .d$b. $$$$$ $\ /$ $: $$ .d$b. $$$$$ $$$$$ $$$b. d$P
|
||||||
|
|: d$ $: $$ $b."P $: $$ $: "" [$: [$: Q$:$P $: $$ [$: $P.. $: Q$ .$$;
|
||||||
|
Pb"' $: $$ `""b. $$22$ $: mm [$: [$: Q$P $$$$$ [$: $b"" $: d$ `$:
|
||||||
|
|$b `Q$P' `MpM; $: $$ `Q$P' [$: $$$$$ `$' $: $$ [$: $$ETH $$$$' mm
|
@ -30,6 +30,8 @@ from
|
|||||||
import
|
import
|
||||||
TopicParams, validateParameters, init
|
TopicParams, validateParameters, init
|
||||||
|
|
||||||
|
from consensus_object_pools/vanity_logs/pandas import getPandas
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
|
||||||
@ -179,7 +181,8 @@ proc loadChainDag(
|
|||||||
onLCFinalityUpdateCb = onLightClientFinalityUpdateCb,
|
onLCFinalityUpdateCb = onLightClientFinalityUpdateCb,
|
||||||
onLCOptimisticUpdateCb = onLightClientOptimisticUpdateCb,
|
onLCOptimisticUpdateCb = onLightClientOptimisticUpdateCb,
|
||||||
serveLightClientData = config.serveLightClientData.get,
|
serveLightClientData = config.serveLightClientData.get,
|
||||||
importLightClientData = config.importLightClientData.get)
|
importLightClientData = config.importLightClientData.get,
|
||||||
|
vanityLogs = getPandas(detectTTY(config.logStdout)))
|
||||||
databaseGenesisValidatorsRoot =
|
databaseGenesisValidatorsRoot =
|
||||||
getStateField(dag.headState, genesis_validators_root)
|
getStateField(dag.headState, genesis_validators_root)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -83,6 +83,19 @@ proc updateLogLevel*(logLevel: string) {.raises: [Defect, ValueError].} =
|
|||||||
if not setTopicState(topicName, settings.state, settings.logLevel):
|
if not setTopicState(topicName, settings.state, settings.logLevel):
|
||||||
warn "Unrecognized logging topic", topic = topicName
|
warn "Unrecognized logging topic", topic = topicName
|
||||||
|
|
||||||
|
proc detectTTY*(stdoutKind: StdoutLogKind): StdoutLogKind =
|
||||||
|
if stdoutKind == StdoutLogKind.Auto:
|
||||||
|
if isatty(stdout):
|
||||||
|
# On a TTY, let's be fancy
|
||||||
|
StdoutLogKind.Colors
|
||||||
|
else:
|
||||||
|
# When there's no TTY, we output no colors because this matches what
|
||||||
|
# released binaries were doing before auto-detection was around and
|
||||||
|
# looks decent in systemd-captured journals.
|
||||||
|
StdoutLogKind.NoColors
|
||||||
|
else:
|
||||||
|
stdoutKind
|
||||||
|
|
||||||
proc setupLogging*(
|
proc setupLogging*(
|
||||||
logLevel: string, stdoutKind: StdoutLogKind, logFile: Option[OutFile]) =
|
logLevel: string, stdoutKind: StdoutLogKind, logFile: Option[OutFile]) =
|
||||||
# In the cfg file for nimbus, we create two formats: textlines and json.
|
# In the cfg file for nimbus, we create two formats: textlines and json.
|
||||||
@ -135,18 +148,7 @@ proc setupLogging*(
|
|||||||
|
|
||||||
defaultChroniclesStream.outputs[1].writer = fileWriter
|
defaultChroniclesStream.outputs[1].writer = fileWriter
|
||||||
|
|
||||||
let tmp =
|
let tmp = detectTTY(stdoutKind)
|
||||||
if stdoutKind == StdoutLogKind.Auto:
|
|
||||||
if isatty(stdout):
|
|
||||||
# On a TTY, let's be fancy
|
|
||||||
StdoutLogKind.Colors
|
|
||||||
else:
|
|
||||||
# When there's no TTY, we output no colors because this matches what
|
|
||||||
# released binaries were doing before auto-detection was around and
|
|
||||||
# looks decent in systemd-captured journals.
|
|
||||||
StdoutLogKind.NoColors
|
|
||||||
else:
|
|
||||||
stdoutKind
|
|
||||||
|
|
||||||
case tmp
|
case tmp
|
||||||
of StdoutLogKind.Auto: raiseAssert "checked above"
|
of StdoutLogKind.Auto: raiseAssert "checked above"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user