From 9e738a92b4a7ca6f74adb6e787b7209e6c16ed71 Mon Sep 17 00:00:00 2001 From: tersec Date: Fri, 15 Apr 2022 12:46:56 +0000 Subject: [PATCH] stylecheck fixes (#3595) --- beacon_chain/eth1/deposit_contract.nim | 4 ++-- beacon_chain/eth1/eth1_monitor.nim | 8 ++++---- ncli/ncli_common.nim | 2 +- ncli/validator_db_aggregator.nim | 9 ++++++++- research/wss_sim.nim | 6 +++--- tests/consensus_spec/test_fixture_fork_choice.nim | 2 +- tests/consensus_spec/test_fixture_ssz_generic_types.nim | 2 +- tests/test_light_client.nim | 2 +- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/beacon_chain/eth1/deposit_contract.nim b/beacon_chain/eth1/deposit_contract.nim index 2b5cc7cb9..43cc43219 100644 --- a/beacon_chain/eth1/deposit_contract.nim +++ b/beacon_chain/eth1/deposit_contract.nim @@ -165,7 +165,7 @@ proc sendDeposits*(deposits: seq[LaunchPadDeposit], while true: try: let tx = depositContract.deposit( - Bytes48(dp.pubKey.toRaw()), + Bytes48(dp.pubkey.toRaw()), Bytes32(dp.withdrawal_credentials.data), Bytes96(dp.signature.toRaw()), FixedBytes[32](hash_tree_root(dp).data)) @@ -195,7 +195,7 @@ proc main() {.async.} = if conf.cmd == StartUpCommand.generateSimulationDeposits: let mnemonic = generateMnemonic(rng[]) - seed = getSeed(mnemonic, KeyStorePass.init "") + seed = getSeed(mnemonic, KeystorePass.init "") cfg = getRuntimeConfig(conf.eth2Network) if (let res = secureCreatePath(string conf.outValidatorsDir); res.isErr): diff --git a/beacon_chain/eth1/eth1_monitor.nim b/beacon_chain/eth1/eth1_monitor.nim index 9eec40187..7f70cc2ba 100644 --- a/beacon_chain/eth1/eth1_monitor.nim +++ b/beacon_chain/eth1/eth1_monitor.nim @@ -305,8 +305,8 @@ template asBlockHash*(x: Eth2Digest): BlockHash = func asConsensusExecutionPayload*(rpcExecutionPayload: ExecutionPayloadV1): bellatrix.ExecutionPayload = - template getTransaction(t: TypedTransaction): bellatrix.Transaction = - bellatrix.Transaction.init(t.distinctBase) + template getTransaction(tt: TypedTransaction): bellatrix.Transaction = + bellatrix.Transaction.init(tt.distinctBase) bellatrix.ExecutionPayload( parent_hash: rpcExecutionPayload.parentHash.asEth2Digest, @@ -331,8 +331,8 @@ func asConsensusExecutionPayload*(rpcExecutionPayload: ExecutionPayloadV1): func asEngineExecutionPayload*(executionPayload: bellatrix.ExecutionPayload): ExecutionPayloadV1 = - template getTypedTransaction(t: bellatrix.Transaction): TypedTransaction = - TypedTransaction(t.distinctBase) + template getTypedTransaction(tt: bellatrix.Transaction): TypedTransaction = + TypedTransaction(tt.distinctBase) engine_api.ExecutionPayloadV1( parentHash: executionPayload.parent_hash.asBlockHash, diff --git a/ncli/ncli_common.nim b/ncli/ncli_common.nim index 6eef9c31b..0eb7c96d5 100644 --- a/ncli/ncli_common.nim +++ b/ncli/ncli_common.nim @@ -246,7 +246,7 @@ proc collectEpochRewardsAndPenalties*( state, base_reward, active_increments, unslashed_participating_increment, PARTICIPATION_FLAG_WEIGHTS[flag_index].uint64, - finalityDelay) + finality_delay) case flag_index of TIMELY_SOURCE_FLAG_INDEX: diff --git a/ncli/validator_db_aggregator.nim b/ncli/validator_db_aggregator.nim index c73befaca..26a657cde 100644 --- a/ncli/validator_db_aggregator.nim +++ b/ncli/validator_db_aggregator.nim @@ -1,3 +1,10 @@ +# 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. + import std/[os, strutils, streams, parsecsv], stew/[io2, byteutils], chronicles, confutils, snappy, @@ -158,7 +165,7 @@ proc addValidatorData*(aggregator: var ValidatorDbAggregator, else: aggregator.aggregatedRewardsAndPenalties[index] += rp inc aggregator.participationEpochsCount[index] - if rp.inclusionDelay.isSome: + if rp.inclusion_delay.isSome: inc aggregator.inclusionDelaysCount[index] proc advanceEpochs*(aggregator: var ValidatorDbAggregator, epoch: Epoch, diff --git a/research/wss_sim.nim b/research/wss_sim.nim index e5624b69a..d8c4ffc99 100644 --- a/research/wss_sim.nim +++ b/research/wss_sim.nim @@ -33,7 +33,7 @@ template findIt*(s: openArray, predicate: untyped): int = proc findValidator(validators: seq[Validator], pubKey: ValidatorPubKey): Option[ValidatorIndex] = - let idx = validators.findIt(it.pubKey == pubKey) + let idx = validators.findIt(it.pubkey == pubKey) if idx == -1: none(ValidatorIndex) else: @@ -254,7 +254,7 @@ cli do(validatorsDir: string, secretsDir: string, else: agg = AggregateSignature.init(sig) inited = true - sync_aggregate.sync_committee_bits.setBit(i) + syncAggregate.sync_committee_bits.setBit(i) if inited: - sync_aggregate.sync_committee_signature = finish(agg).toValidatorSig() + syncAggregate.sync_committee_signature = finish(agg).toValidatorSig() diff --git a/tests/consensus_spec/test_fixture_fork_choice.nim b/tests/consensus_spec/test_fixture_fork_choice.nim index ab108f18b..21adddf52 100644 --- a/tests/consensus_spec/test_fixture_fork_choice.nim +++ b/tests/consensus_spec/test_fixture_fork_choice.nim @@ -84,7 +84,7 @@ proc initialLoad( let signedBlock = ForkedSignedBeaconBlock.init(phase0.SignedBeaconBlock( message: blk, # signature: - unused as it's trusted - root: hashTreeRoot(blk) + root: hash_tree_root(blk) )) ChainDAGRef.preInit( diff --git a/tests/consensus_spec/test_fixture_ssz_generic_types.nim b/tests/consensus_spec/test_fixture_ssz_generic_types.nim index dec2520f3..7bba813c6 100644 --- a/tests/consensus_spec/test_fixture_ssz_generic_types.nim +++ b/tests/consensus_spec/test_fixture_ssz_generic_types.nim @@ -221,7 +221,7 @@ proc sszCheck(baseDir, sszType, sszSubType: string) = of "bitlist": checkBitList(sszSubType, dir, expectedHash) of "containers": var name: string - let wasMatched = scanf(sszSubtype, "$+_", name) + let wasMatched = scanf(sszSubType, "$+_", name) doAssert wasMatched case name of "SingleFieldTestStruct": checkBasic(SingleFieldTestStruct, dir, expectedHash) diff --git a/tests/test_light_client.nim b/tests/test_light_client.nim index 4c0d25c0e..26fe31af8 100644 --- a/tests/test_light_client.nim +++ b/tests/test_light_client.nim @@ -175,7 +175,7 @@ suite "Light client" & preset(): # Initialize new DAG from checkpoint let cpDb = BeaconChainDB.new("", inMemory = true) ChainDAGRef.preInit( - cpDB, genesisState[], + cpDb, genesisState[], dag.headState, dag.getForkedBlock(dag.head.bid).get) let cpDag = ChainDAGRef.init( cfg, cpDb, validatorMonitor, {},