From b4db011daffc2b1520b2273693585783e98f5c76 Mon Sep 17 00:00:00 2001 From: tersec Date: Sat, 2 Mar 2024 05:25:17 +0000 Subject: [PATCH] enable --styleCheck:error in ncli/ and research/ (#6014) --- beacon_chain/spec/eth2_apis/rest_fork_config.nim | 6 +++--- beacon_chain/validators/action_tracker.nim | 4 ++-- ncli/ncli_db.nim | 6 +++--- ncli/nim.cfg | 4 ++-- research/mev_mock.nim | 2 +- research/nim.cfg | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/beacon_chain/spec/eth2_apis/rest_fork_config.nim b/beacon_chain/spec/eth2_apis/rest_fork_config.nim index f263cf259..dcfc5d62d 100644 --- a/beacon_chain/spec/eth2_apis/rest_fork_config.nim +++ b/beacon_chain/spec/eth2_apis/rest_fork_config.nim @@ -32,19 +32,19 @@ func forkEpochConfigKey*(consensusFork: ConsensusFork): string = doAssert consensusFork > ConsensusFork.Phase0 ($consensusFork).toUpperAscii() & "_FORK_EPOCH" -proc getOrDefault*(info: VCRuntimeConfig, name: string, +func getOrDefault*(info: VCRuntimeConfig, name: string, default: uint64): uint64 = let numstr = info.getOrDefault(name, "missing") if numstr == "missing": return default Base10.decode(uint64, numstr).valueOr: 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))) func getForkVersion( info: VCRuntimeConfig, - consensusFork: Consensusfork): Result[Opt[Version], string] = + consensusFork: ConsensusFork): Result[Opt[Version], string] = let key = consensusFork.forkVersionConfigKey() let stringValue = info.getOrDefault(key, "missing") if stringValue == "missing": return ok Opt.none(Version) diff --git a/beacon_chain/validators/action_tracker.nim b/beacon_chain/validators/action_tracker.nim index 278ebf127..55b80e2b3 100644 --- a/beacon_chain/validators/action_tracker.nim +++ b/beacon_chain/validators/action_tracker.nim @@ -112,7 +112,7 @@ proc registerSyncDuty*( tracker.syncDuties[pubkey] = until_epoch reset(tracker.lastSyncUpdate) -proc hasSyncDuty*( +func hasSyncDuty*( tracker: ActionTracker, pubkey: ValidatorPubKey, epoch: Epoch): bool = epoch < tracker.syncDuties.getOrDefault(pubkey, GENESIS_EPOCH) @@ -227,7 +227,7 @@ func updateActions*( # Update proposals 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: tracker.proposingSlots[epoch mod 2] = tracker.proposingSlots[epoch mod 2] or (1'u32 shl i) diff --git a/ncli/ncli_db.nim b/ncli/ncli_db.nim index 0dcfc48ac..ca45fbe47 100644 --- a/ncli/ncli_db.nim +++ b/ncli/ncli_db.nim @@ -976,9 +976,9 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) = startEpoch = startEpoch, endEpoch = endEpoch let - startSlot = startEpoch.start_slot + startEpochSlot = startEpoch.start_slot endSlot = endEpoch.start_slot + SLOTS_PER_EPOCH - blockRefs = dag.getBlockRange(startSlot, endSlot) + blockRefs = dag.getBlockRange(startEpochSlot, endSlot) if not unaggregatedFilesOutputDir.dirExists: try: @@ -1006,7 +1006,7 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) = let tmpState = newClone(dag.headState) 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: discard dag.updateState( tmpState[], dag.atSlot(blockRefs[^1], slot).expect("block"), false, cache) diff --git a/ncli/nim.cfg b/ncli/nim.cfg index 9846ad37e..b6eeb89c4 100644 --- a/ncli/nim.cfg +++ b/ncli/nim.cfg @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2019-2023 Status Research & Development GmbH +# Copyright (c) 2019-2024 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). @@ -10,6 +10,6 @@ -d:"libp2p_pki_schemes=secp256k1" --styleCheck:usages ---styleCheck:hint +--styleCheck:error --hint[ConvFromXtoItselfNotNeeded]:off --hint[Processing]:off diff --git a/research/mev_mock.nim b/research/mev_mock.nim index 8aa0009f7..be9840bab 100644 --- a/research/mev_mock.nim +++ b/research/mev_mock.nim @@ -85,7 +85,7 @@ proc getInfo(parent_hash: Eth2Digest): parent_hash: parent_hash, fee_recipient: default(ExecutionAddress), # only a CL suggestion logs_bloom: default(BloomLogs), - timestamp: parentBlockInfo.timestamp, + timestamp: parent_block_info.timestamp, prev_randao: prev_randao, block_number: parent_block_info.block_number, gas_limit: DEFAULT_GAS_LIMIT, diff --git a/research/nim.cfg b/research/nim.cfg index 78ed1f292..dc3a25bb0 100644 --- a/research/nim.cfg +++ b/research/nim.cfg @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2022-2023 Status Research & Development GmbH +# Copyright (c) 2022-2024 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). @@ -10,6 +10,6 @@ -d:"libp2p_pki_schemes=secp256k1" --styleCheck:usages ---styleCheck:hint +--styleCheck:error --hint[ConvFromXtoItselfNotNeeded]:off --hint[Processing]:off