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:
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):

View File

@ -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,

View File

@ -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:

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
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,

View File

@ -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()

View File

@ -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(

View File

@ -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)

View File

@ -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, {},