stylecheck fixes (#3593)

This commit is contained in:
tersec 2022-04-14 15:39:37 +00:00 committed by GitHub
parent 5592c7c674
commit 61ba308e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 15 deletions

View File

@ -142,7 +142,7 @@ proc addHeadBlock*(
## Try adding a block to the chain, verifying first that it passes the state
## transition function and contains correct cryptographic signature.
##
## Cryptographic checks can be skipped by adding skipBLSValidation to
## Cryptographic checks can be skipped by adding skipBlsValidation to
## dag.updateFlags
logScope:
blockRoot = shortLog(signedBlock.root)
@ -230,8 +230,8 @@ proc addHeadBlock*(
let stateDataTick = Moment.now()
# First, batch-verify all signatures in block
if skipBLSValidation notin dag.updateFlags:
# TODO: remove skipBLSValidation
if skipBlsValidation notin dag.updateFlags:
# TODO: remove skipBlsValidation
var sigs: seq[SignatureSet]
if (let e = sigs.collectSignatureSets(
signedBlock, dag.db.immutableValidators,

View File

@ -128,7 +128,7 @@ proc is_valid_indexed_attestation*(
return err("is_valid_indexed_attestation: no attesting indices")
# Verify aggregate signature
if not (skipBLSValidation in flags or attestation.signature is TrustedSig):
if not (skipBlsValidation in flags or attestation.signature is TrustedSig):
var
pubkeys = newSeqOfCap[CookedPubKey](sigs)
for index in get_attesting_indices(

View File

@ -424,7 +424,7 @@ proc is_valid_indexed_attestation*(
return err("indexed attestation: indices not sorted and unique")
# Verify aggregate signature
if not (skipBLSValidation in flags or indexed_attestation.signature is TrustedSig):
if not (skipBlsValidation in flags or indexed_attestation.signature is TrustedSig):
let pubkeys = mapIt(
indexed_attestation.attesting_indices, state.validators[it].pubkey)
if not verify_attestation_signature(
@ -483,7 +483,7 @@ proc is_valid_indexed_attestation*(
return err("is_valid_indexed_attestation: no attesting indices")
# Verify aggregate signature
if not (skipBLSValidation in flags or attestation.signature is TrustedSig):
if not (skipBlsValidation in flags or attestation.signature is TrustedSig):
var
pubkeys = newSeqOfCap[ValidatorPubKey](sigs)
for index in get_attesting_indices(

View File

@ -214,7 +214,7 @@ proc state_transition_block_aux(
# by the block proposer. Every actor in the network will update its state
# according to the contents of this block - but first they will validate
# that the block is sane.
if skipBLSValidation notin flags:
if skipBlsValidation notin flags:
? verify_block_signature(state.data, signedBlock)
trace "state_transition: processing block, signature passed",

View File

@ -85,7 +85,7 @@ proc process_randao(
let
epoch = state.get_current_epoch()
if skipBLSValidation notin flags:
if skipBlsValidation notin flags:
let proposer_pubkey = state.validators.asSeq()[proposer_index.get].pubkey
if not verify_epoch_signature(
@ -296,7 +296,7 @@ proc process_deposit*(cfg: RuntimeConfig,
else:
# Verify the deposit signature (proof of possession) which is not checked
# by the deposit contract
if skipBLSValidation in flags or verify_deposit_signature(cfg, deposit.data):
if skipBlsValidation in flags or verify_deposit_signature(cfg, deposit.data):
# New validator! Add validator and balance entries
if not state.validators.add(get_validator_from_deposit(deposit.data)):
return err("process_deposit: too many validators")

View File

@ -390,7 +390,7 @@ cli do(slots = SLOTS_PER_EPOCH * 6,
let newDeposits = int clamp(gauss(r, 5.0, 8.0), 0.0, 1000.0)
for i in 0 ..< newDeposits:
let validatorIdx = merkleizer.getChunkCount.int
let d = makeDeposit(validatorIdx, {skipBLSValidation})
let d = makeDeposit(validatorIdx, {skipBlsValidation})
eth1Block.deposits.add d
merkleizer.addChunk hash_tree_root(d).data

View File

@ -532,7 +532,7 @@ suite "Attestation pool processing" & preset():
test "Trying to add a duplicate block from an old pruned epoch is tagged as an error":
# Note: very sensitive to stack usage
dag.updateFlags.incl {skipBLSValidation}
dag.updateFlags.incl {skipBlsValidation}
var cache = StateCache()
let
b10 = addTestBlock(state[], cache).phase0Data

View File

@ -136,7 +136,7 @@ suite "Interop":
test "Interop signatures":
for dep in depositsConfig:
let computed_sig = bls_sign(
let computed_sig = blsSign(
privkey = dep.privkey,
message = dep.signing_root
)

View File

@ -1,3 +1,10 @@
# beacon_chain
# Copyright (c) 2021-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.
{.used.}
import
@ -40,7 +47,7 @@ proc contentEquals(filePath, expectedContent: string): bool =
let
rng = keys.newRng()
mnemonic = generateMnemonic(rng[])
seed = getSeed(mnemonic, KeyStorePass.init "")
seed = getSeed(mnemonic, KeystorePass.init "")
cfg = defaultRuntimeConfig
validatorDirRes = secureCreatePath(testValidatorsDir)

View File

@ -53,7 +53,7 @@ func makeDeposit*(
withdrawal_credentials: withdrawal_credentials,
amount: MAX_EFFECTIVE_BALANCE)
if skipBLSValidation notin flags:
if skipBlsValidation notin flags:
result.signature = get_deposit_signature(cfg, result, privkey).toValidatorSig()
func makeInitialDeposits*(
@ -234,7 +234,7 @@ func makeAttestation*(
var aggregation_bits = CommitteeValidatorsBits.init(committee.len)
aggregation_bits.setBit sac_index
let sig = if skipBLSValidation in flags:
let sig = if skipBlsValidation in flags:
ValidatorSig()
else:
makeAttestationSig(