fix some stylecheck consistency Name hints in ncli/ and research/ (#6004)
This commit is contained in:
parent
f076502e25
commit
d7e9ff2a98
|
@ -8,7 +8,6 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/strutils,
|
|
||||||
confutils, json_serialization,
|
confutils, json_serialization,
|
||||||
snappy,
|
snappy,
|
||||||
../beacon_chain/spec/eth2_apis/eth2_rest_serialization,
|
../beacon_chain/spec/eth2_apis/eth2_rest_serialization,
|
||||||
|
@ -16,6 +15,7 @@ import
|
||||||
|
|
||||||
from std/os import splitFile
|
from std/os import splitFile
|
||||||
from std/stats import RunningStat
|
from std/stats import RunningStat
|
||||||
|
from std/strutils import cmpIgnoreCase
|
||||||
from stew/byteutils import toHex
|
from stew/byteutils import toHex
|
||||||
from stew/io2 import readAllBytes
|
from stew/io2 import readAllBytes
|
||||||
from ../beacon_chain/networking/network_metadata import getRuntimeConfig
|
from ../beacon_chain/networking/network_metadata import getRuntimeConfig
|
||||||
|
@ -23,7 +23,7 @@ from ../research/simutils import printTimers, withTimer, withTimerRet
|
||||||
|
|
||||||
type
|
type
|
||||||
Cmd* = enum
|
Cmd* = enum
|
||||||
hashTreeRoot = "Compute hash tree root of SSZ object"
|
hash_tree_root = "Compute hash tree root of SSZ object"
|
||||||
pretty = "Pretty-print SSZ object"
|
pretty = "Pretty-print SSZ object"
|
||||||
transition = "Run state transition function"
|
transition = "Run state transition function"
|
||||||
slots = "Apply empty slots"
|
slots = "Apply empty slots"
|
||||||
|
@ -41,7 +41,7 @@ type
|
||||||
# TODO confutils argument pragma doesn't seem to do much; also, the cases
|
# TODO confutils argument pragma doesn't seem to do much; also, the cases
|
||||||
# are largely equivalent, but this helps create command line usage text
|
# are largely equivalent, but this helps create command line usage text
|
||||||
case cmd* {.command}: Cmd
|
case cmd* {.command}: Cmd
|
||||||
of hashTreeRoot:
|
of hash_tree_root:
|
||||||
htrKind* {.
|
htrKind* {.
|
||||||
argument
|
argument
|
||||||
desc: "kind of SSZ object: attester_slashing, attestation, signed_block, block, block_body, block_header, deposit, deposit_data, eth1_data, state, proposer_slashing, or voluntary_exit"}: string
|
desc: "kind of SSZ object: attester_slashing, attestation, signed_block, block, block_body, block_header, deposit, deposit_data, eth1_data, state, proposer_slashing, or voluntary_exit"}: string
|
||||||
|
@ -202,7 +202,7 @@ proc doSSZ(conf: NcliConf) =
|
||||||
|
|
||||||
let (kind, file) =
|
let (kind, file) =
|
||||||
case conf.cmd:
|
case conf.cmd:
|
||||||
of hashTreeRoot: (conf.htrKind, conf.htrFile)
|
of hash_tree_root: (conf.htrKind, conf.htrFile)
|
||||||
of pretty: (conf.prettyKind, conf.prettyFile)
|
of pretty: (conf.prettyKind, conf.prettyFile)
|
||||||
else:
|
else:
|
||||||
raiseAssert "doSSZ() only implements hashTreeRoot and pretty commands"
|
raiseAssert "doSSZ() only implements hashTreeRoot and pretty commands"
|
||||||
|
@ -214,7 +214,7 @@ proc doSSZ(conf: NcliConf) =
|
||||||
newClone(loadFile(file, bytes, t))
|
newClone(loadFile(file, bytes, t))
|
||||||
|
|
||||||
case conf.cmd:
|
case conf.cmd:
|
||||||
of hashTreeRoot:
|
of hash_tree_root:
|
||||||
let root = withTimerRet(timers[tCompute]):
|
let root = withTimerRet(timers[tCompute]):
|
||||||
when t is ForkySignedBeaconBlock:
|
when t is ForkySignedBeaconBlock:
|
||||||
hash_tree_root(v[].message)
|
hash_tree_root(v[].message)
|
||||||
|
@ -265,7 +265,7 @@ when isMainModule:
|
||||||
conf = NcliConf.load()
|
conf = NcliConf.load()
|
||||||
|
|
||||||
case conf.cmd:
|
case conf.cmd:
|
||||||
of hashTreeRoot: doSSZ(conf)
|
of hash_tree_root: doSSZ(conf)
|
||||||
of pretty: doSSZ(conf)
|
of pretty: doSSZ(conf)
|
||||||
of transition: doTransition(conf)
|
of transition: doTransition(conf)
|
||||||
of slots: doSlots(conf)
|
of slots: doSlots(conf)
|
||||||
|
|
|
@ -33,9 +33,9 @@ template findIt*(s: openArray, predicate: untyped): int =
|
||||||
break
|
break
|
||||||
res
|
res
|
||||||
|
|
||||||
func findValidator(validators: seq[Validator], pubKey: ValidatorPubKey):
|
func findValidator(validators: seq[Validator], pubkey: ValidatorPubKey):
|
||||||
Opt[ValidatorIndex] =
|
Opt[ValidatorIndex] =
|
||||||
let idx = validators.findIt(it.pubkey == pubKey)
|
let idx = validators.findIt(it.pubkey == pubkey)
|
||||||
if idx == -1:
|
if idx == -1:
|
||||||
Opt.none ValidatorIndex
|
Opt.none ValidatorIndex
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue