stylecheck fixes (#3595)

This commit is contained in:
tersec 2022-04-15 12:46:56 +00:00 committed by GitHub
parent 1f7e6c7342
commit 9e738a92b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 14 deletions

View File

@ -165,7 +165,7 @@ proc sendDeposits*(deposits: seq[LaunchPadDeposit],
while true: while true:
try: try:
let tx = depositContract.deposit( let tx = depositContract.deposit(
Bytes48(dp.pubKey.toRaw()), Bytes48(dp.pubkey.toRaw()),
Bytes32(dp.withdrawal_credentials.data), Bytes32(dp.withdrawal_credentials.data),
Bytes96(dp.signature.toRaw()), Bytes96(dp.signature.toRaw()),
FixedBytes[32](hash_tree_root(dp).data)) FixedBytes[32](hash_tree_root(dp).data))
@ -195,7 +195,7 @@ proc main() {.async.} =
if conf.cmd == StartUpCommand.generateSimulationDeposits: if conf.cmd == StartUpCommand.generateSimulationDeposits:
let let
mnemonic = generateMnemonic(rng[]) mnemonic = generateMnemonic(rng[])
seed = getSeed(mnemonic, KeyStorePass.init "") seed = getSeed(mnemonic, KeystorePass.init "")
cfg = getRuntimeConfig(conf.eth2Network) cfg = getRuntimeConfig(conf.eth2Network)
if (let res = secureCreatePath(string conf.outValidatorsDir); res.isErr): if (let res = secureCreatePath(string conf.outValidatorsDir); res.isErr):

View File

@ -305,8 +305,8 @@ template asBlockHash*(x: Eth2Digest): BlockHash =
func asConsensusExecutionPayload*(rpcExecutionPayload: ExecutionPayloadV1): func asConsensusExecutionPayload*(rpcExecutionPayload: ExecutionPayloadV1):
bellatrix.ExecutionPayload = bellatrix.ExecutionPayload =
template getTransaction(t: TypedTransaction): bellatrix.Transaction = template getTransaction(tt: TypedTransaction): bellatrix.Transaction =
bellatrix.Transaction.init(t.distinctBase) bellatrix.Transaction.init(tt.distinctBase)
bellatrix.ExecutionPayload( bellatrix.ExecutionPayload(
parent_hash: rpcExecutionPayload.parentHash.asEth2Digest, parent_hash: rpcExecutionPayload.parentHash.asEth2Digest,
@ -331,8 +331,8 @@ func asConsensusExecutionPayload*(rpcExecutionPayload: ExecutionPayloadV1):
func asEngineExecutionPayload*(executionPayload: bellatrix.ExecutionPayload): func asEngineExecutionPayload*(executionPayload: bellatrix.ExecutionPayload):
ExecutionPayloadV1 = ExecutionPayloadV1 =
template getTypedTransaction(t: bellatrix.Transaction): TypedTransaction = template getTypedTransaction(tt: bellatrix.Transaction): TypedTransaction =
TypedTransaction(t.distinctBase) TypedTransaction(tt.distinctBase)
engine_api.ExecutionPayloadV1( engine_api.ExecutionPayloadV1(
parentHash: executionPayload.parent_hash.asBlockHash, parentHash: executionPayload.parent_hash.asBlockHash,

View File

@ -246,7 +246,7 @@ proc collectEpochRewardsAndPenalties*(
state, base_reward, active_increments, state, base_reward, active_increments,
unslashed_participating_increment, unslashed_participating_increment,
PARTICIPATION_FLAG_WEIGHTS[flag_index].uint64, PARTICIPATION_FLAG_WEIGHTS[flag_index].uint64,
finalityDelay) finality_delay)
case flag_index case flag_index
of TIMELY_SOURCE_FLAG_INDEX: of TIMELY_SOURCE_FLAG_INDEX:

View File

@ -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 import
std/[os, strutils, streams, parsecsv], std/[os, strutils, streams, parsecsv],
stew/[io2, byteutils], chronicles, confutils, snappy, stew/[io2, byteutils], chronicles, confutils, snappy,
@ -158,7 +165,7 @@ proc addValidatorData*(aggregator: var ValidatorDbAggregator,
else: else:
aggregator.aggregatedRewardsAndPenalties[index] += rp aggregator.aggregatedRewardsAndPenalties[index] += rp
inc aggregator.participationEpochsCount[index] inc aggregator.participationEpochsCount[index]
if rp.inclusionDelay.isSome: if rp.inclusion_delay.isSome:
inc aggregator.inclusionDelaysCount[index] inc aggregator.inclusionDelaysCount[index]
proc advanceEpochs*(aggregator: var ValidatorDbAggregator, epoch: Epoch, proc advanceEpochs*(aggregator: var ValidatorDbAggregator, epoch: Epoch,

View File

@ -33,7 +33,7 @@ template findIt*(s: openArray, predicate: untyped): int =
proc findValidator(validators: seq[Validator], pubKey: ValidatorPubKey): proc findValidator(validators: seq[Validator], pubKey: ValidatorPubKey):
Option[ValidatorIndex] = Option[ValidatorIndex] =
let idx = validators.findIt(it.pubKey == pubKey) let idx = validators.findIt(it.pubkey == pubKey)
if idx == -1: if idx == -1:
none(ValidatorIndex) none(ValidatorIndex)
else: else:
@ -254,7 +254,7 @@ cli do(validatorsDir: string, secretsDir: string,
else: else:
agg = AggregateSignature.init(sig) agg = AggregateSignature.init(sig)
inited = true inited = true
sync_aggregate.sync_committee_bits.setBit(i) syncAggregate.sync_committee_bits.setBit(i)
if inited: if inited:
sync_aggregate.sync_committee_signature = finish(agg).toValidatorSig() syncAggregate.sync_committee_signature = finish(agg).toValidatorSig()

View File

@ -84,7 +84,7 @@ proc initialLoad(
let signedBlock = ForkedSignedBeaconBlock.init(phase0.SignedBeaconBlock( let signedBlock = ForkedSignedBeaconBlock.init(phase0.SignedBeaconBlock(
message: blk, message: blk,
# signature: - unused as it's trusted # signature: - unused as it's trusted
root: hashTreeRoot(blk) root: hash_tree_root(blk)
)) ))
ChainDAGRef.preInit( ChainDAGRef.preInit(

View File

@ -221,7 +221,7 @@ proc sszCheck(baseDir, sszType, sszSubType: string) =
of "bitlist": checkBitList(sszSubType, dir, expectedHash) of "bitlist": checkBitList(sszSubType, dir, expectedHash)
of "containers": of "containers":
var name: string var name: string
let wasMatched = scanf(sszSubtype, "$+_", name) let wasMatched = scanf(sszSubType, "$+_", name)
doAssert wasMatched doAssert wasMatched
case name case name
of "SingleFieldTestStruct": checkBasic(SingleFieldTestStruct, dir, expectedHash) of "SingleFieldTestStruct": checkBasic(SingleFieldTestStruct, dir, expectedHash)

View File

@ -175,7 +175,7 @@ suite "Light client" & preset():
# Initialize new DAG from checkpoint # Initialize new DAG from checkpoint
let cpDb = BeaconChainDB.new("", inMemory = true) let cpDb = BeaconChainDB.new("", inMemory = true)
ChainDAGRef.preInit( ChainDAGRef.preInit(
cpDB, genesisState[], cpDb, genesisState[],
dag.headState, dag.getForkedBlock(dag.head.bid).get) dag.headState, dag.getForkedBlock(dag.head.bid).get)
let cpDag = ChainDAGRef.init( let cpDag = ChainDAGRef.init(
cfg, cpDb, validatorMonitor, {}, cfg, cpDb, validatorMonitor, {},