enable --styleCheck:error in ncli/ and research/ (#6014)

This commit is contained in:
tersec 2024-03-02 05:25:17 +00:00 committed by GitHub
parent d8b8aee7b7
commit b4db011daf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 13 deletions

View File

@ -32,19 +32,19 @@ func forkEpochConfigKey*(consensusFork: ConsensusFork): string =
doAssert consensusFork > ConsensusFork.Phase0 doAssert consensusFork > ConsensusFork.Phase0
($consensusFork).toUpperAscii() & "_FORK_EPOCH" ($consensusFork).toUpperAscii() & "_FORK_EPOCH"
proc getOrDefault*(info: VCRuntimeConfig, name: string, func getOrDefault*(info: VCRuntimeConfig, name: string,
default: uint64): uint64 = default: uint64): uint64 =
let numstr = info.getOrDefault(name, "missing") let numstr = info.getOrDefault(name, "missing")
if numstr == "missing": return default if numstr == "missing": return default
Base10.decode(uint64, numstr).valueOr: Base10.decode(uint64, numstr).valueOr:
return default return default
proc getOrDefault*(info: VCRuntimeConfig, name: string, default: Epoch): Epoch = func getOrDefault*(info: VCRuntimeConfig, name: string, default: Epoch): Epoch =
Epoch(info.getOrDefault(name, uint64(default))) Epoch(info.getOrDefault(name, uint64(default)))
func getForkVersion( func getForkVersion(
info: VCRuntimeConfig, info: VCRuntimeConfig,
consensusFork: Consensusfork): Result[Opt[Version], string] = consensusFork: ConsensusFork): Result[Opt[Version], string] =
let key = consensusFork.forkVersionConfigKey() let key = consensusFork.forkVersionConfigKey()
let stringValue = info.getOrDefault(key, "missing") let stringValue = info.getOrDefault(key, "missing")
if stringValue == "missing": return ok Opt.none(Version) if stringValue == "missing": return ok Opt.none(Version)

View File

@ -112,7 +112,7 @@ proc registerSyncDuty*(
tracker.syncDuties[pubkey] = until_epoch tracker.syncDuties[pubkey] = until_epoch
reset(tracker.lastSyncUpdate) reset(tracker.lastSyncUpdate)
proc hasSyncDuty*( func hasSyncDuty*(
tracker: ActionTracker, pubkey: ValidatorPubKey, epoch: Epoch): bool = tracker: ActionTracker, pubkey: ValidatorPubKey, epoch: Epoch): bool =
epoch < tracker.syncDuties.getOrDefault(pubkey, GENESIS_EPOCH) epoch < tracker.syncDuties.getOrDefault(pubkey, GENESIS_EPOCH)
@ -227,7 +227,7 @@ func updateActions*(
# Update proposals # Update proposals
tracker.proposingSlots[epoch mod 2] = 0 tracker.proposingSlots[epoch mod 2] = 0
for i, proposer in beacon_proposers: for i, proposer in beaconProposers:
if proposer.isSome and proposer.get() in validatorIndices: if proposer.isSome and proposer.get() in validatorIndices:
tracker.proposingSlots[epoch mod 2] = tracker.proposingSlots[epoch mod 2] =
tracker.proposingSlots[epoch mod 2] or (1'u32 shl i) tracker.proposingSlots[epoch mod 2] or (1'u32 shl i)

View File

@ -976,9 +976,9 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) =
startEpoch = startEpoch, endEpoch = endEpoch startEpoch = startEpoch, endEpoch = endEpoch
let let
startSlot = startEpoch.start_slot startEpochSlot = startEpoch.start_slot
endSlot = endEpoch.start_slot + SLOTS_PER_EPOCH endSlot = endEpoch.start_slot + SLOTS_PER_EPOCH
blockRefs = dag.getBlockRange(startSlot, endSlot) blockRefs = dag.getBlockRange(startEpochSlot, endSlot)
if not unaggregatedFilesOutputDir.dirExists: if not unaggregatedFilesOutputDir.dirExists:
try: try:
@ -1006,7 +1006,7 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) =
let tmpState = newClone(dag.headState) let tmpState = newClone(dag.headState)
var cache = StateCache() var cache = StateCache()
let slot = if startSlot > 0: startSlot - 1 else: 0.Slot let slot = if startEpochSlot > 0: startEpochSlot - 1 else: 0.Slot
if blockRefs.len > 0: if blockRefs.len > 0:
discard dag.updateState( discard dag.updateState(
tmpState[], dag.atSlot(blockRefs[^1], slot).expect("block"), false, cache) tmpState[], dag.atSlot(blockRefs[^1], slot).expect("block"), false, cache)

View File

@ -1,5 +1,5 @@
# beacon_chain # beacon_chain
# Copyright (c) 2019-2023 Status Research & Development GmbH # Copyright (c) 2019-2024 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).
@ -10,6 +10,6 @@
-d:"libp2p_pki_schemes=secp256k1" -d:"libp2p_pki_schemes=secp256k1"
--styleCheck:usages --styleCheck:usages
--styleCheck:hint --styleCheck:error
--hint[ConvFromXtoItselfNotNeeded]:off --hint[ConvFromXtoItselfNotNeeded]:off
--hint[Processing]:off --hint[Processing]:off

View File

@ -85,7 +85,7 @@ proc getInfo(parent_hash: Eth2Digest):
parent_hash: parent_hash, parent_hash: parent_hash,
fee_recipient: default(ExecutionAddress), # only a CL suggestion fee_recipient: default(ExecutionAddress), # only a CL suggestion
logs_bloom: default(BloomLogs), logs_bloom: default(BloomLogs),
timestamp: parentBlockInfo.timestamp, timestamp: parent_block_info.timestamp,
prev_randao: prev_randao, prev_randao: prev_randao,
block_number: parent_block_info.block_number, block_number: parent_block_info.block_number,
gas_limit: DEFAULT_GAS_LIMIT, gas_limit: DEFAULT_GAS_LIMIT,

View File

@ -1,5 +1,5 @@
# beacon_chain # beacon_chain
# Copyright (c) 2022-2023 Status Research & Development GmbH # Copyright (c) 2022-2024 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).
@ -10,6 +10,6 @@
-d:"libp2p_pki_schemes=secp256k1" -d:"libp2p_pki_schemes=secp256k1"
--styleCheck:usages --styleCheck:usages
--styleCheck:hint --styleCheck:error
--hint[ConvFromXtoItselfNotNeeded]:off --hint[ConvFromXtoItselfNotNeeded]:off
--hint[Processing]:off --hint[Processing]:off