remove superfluous TODOs/not-really-TODOs, type conversion, imports (#2025)
This commit is contained in:
parent
7473d83ea3
commit
21c4ce8fd4
|
@ -162,7 +162,7 @@ type
|
|||
parent*: BlockRef ##\
|
||||
## Not nil, except for the tail
|
||||
|
||||
slot*: Slot # TODO could calculate this by walking to root, but..
|
||||
slot*: Slot # could calculate this by walking to root, but..
|
||||
|
||||
epochRefs*: seq[EpochRef] ##\
|
||||
## Cached information about the epochs starting at this block.
|
||||
|
|
|
@ -139,7 +139,6 @@ proc is_valid_indexed_attestation*(
|
|||
|
||||
# Verify aggregate signature
|
||||
if skipBLSValidation notin flags:
|
||||
# TODO: fuse loops with blsFastAggregateVerify
|
||||
let pubkeys = mapIt(
|
||||
indexed_attestation.attesting_indices, epochRef.validator_keys[it])
|
||||
if not verify_attestation_signature(
|
||||
|
@ -164,7 +163,6 @@ proc is_valid_indexed_attestation*(
|
|||
|
||||
# Verify aggregate signature
|
||||
if skipBLSValidation notin flags:
|
||||
# TODO: fuse loops with blsFastAggregateVerify
|
||||
let pubkeys = mapIt(
|
||||
attesting_indices, epochRef.validator_keys[it])
|
||||
if not verify_attestation_signature(
|
||||
|
|
|
@ -494,7 +494,7 @@ template errorMsgLit(x: static string): ErrorMsg =
|
|||
const val = ErrorMsg toBytes(x)
|
||||
val
|
||||
|
||||
proc formatErrorMsg(msg: ErrorMSg): string =
|
||||
func formatErrorMsg(msg: ErrorMSg): string =
|
||||
let candidate = string.fromBytes(asSeq(msg))
|
||||
for c in candidate:
|
||||
# TODO UTF-8 - but let's start with ASCII
|
||||
|
|
|
@ -29,7 +29,7 @@ import
|
|||
beacon_node_common, beacon_node_types, beacon_node_status,
|
||||
block_pools/[chain_dag, quarantine, clearance, block_pools_types],
|
||||
nimbus_binary_common, network_metadata,
|
||||
eth1_monitor, version, ssz/[merkleization], merkle_minimal,
|
||||
eth1_monitor, version, ssz/merkleization,
|
||||
sync_protocol, request_manager, keystore_management, interop, statusbar,
|
||||
sync_manager, validator_duties, filepath,
|
||||
validator_slashing_protection, ./eth2_processor
|
||||
|
|
|
@ -201,7 +201,7 @@ proc onSlotStart(vc: ValidatorClient, lastSlot, scheduledSlot: Slot) {.gcsafe, a
|
|||
|
||||
# TODO I don't like these (u)int64-to-int conversions...
|
||||
let attestation = await validator.produceAndSignAttestation(
|
||||
ad, a.committee_length.int, a.validator_committee_index.int,
|
||||
ad, a.committee_length.int, a.validator_committee_index,
|
||||
vc.fork, vc.beaconGenesis.genesis_validators_root)
|
||||
|
||||
discard await vc.client.post_v1_beacon_pool_attestations(attestation)
|
||||
|
|
|
@ -187,7 +187,7 @@ proc installBeaconApiHandlers*(rpcServer: RpcServer, node: BeaconNode) =
|
|||
proc forSlot(slot: Slot, res: var seq[BeaconStatesCommitteesTuple]) =
|
||||
let committees_per_slot =
|
||||
get_committee_count_per_slot(state, slot.epoch, cache)
|
||||
if index == 0: # TODO this means if the parameter is missing (its optional)
|
||||
if index == 0: # parameter is missing (it's optional)
|
||||
for committee_index in 0'u64..<committees_per_slot:
|
||||
res.add(getCommittee(slot, committee_index.CommitteeIndex))
|
||||
else:
|
||||
|
@ -195,7 +195,7 @@ proc installBeaconApiHandlers*(rpcServer: RpcServer, node: BeaconNode) =
|
|||
raise newException(ValueError, "Committee index out of bounds")
|
||||
res.add(getCommittee(slot, index.CommitteeIndex))
|
||||
|
||||
if slot == 0: # TODO this means if the parameter is missing (its optional)
|
||||
if slot == 0: # parameter is missing (it's optional)
|
||||
for i in 0 ..< SLOTS_PER_EPOCH:
|
||||
forSlot(compute_start_slot_at_epoch(epoch.Epoch) + i, result)
|
||||
else:
|
||||
|
|
|
@ -93,7 +93,7 @@ template loopOverWords(lhs, rhs: BitSeq,
|
|||
var rhsWord: WordType
|
||||
var firstByteOfLastWord, lastByteOfLastWord: int
|
||||
|
||||
# TODO: Returing a `var` value from an iterator is always safe due to
|
||||
# TODO: Returning a `var` value from an iterator is always safe due to
|
||||
# the way inlining works, but currently the compiler reports an error
|
||||
# when a local variable escapes. We have to cheat it with this location
|
||||
# obfuscation through pointers:
|
||||
|
|
|
@ -131,8 +131,8 @@ template bytes*(x: BitList): auto = seq[byte](x)
|
|||
template `[]`*(x: BitList, idx: auto): auto = BitSeq(x)[idx]
|
||||
template `[]=`*(x: var BitList, idx: auto, val: bool) = BitSeq(x)[idx] = val
|
||||
template `==`*(a, b: BitList): bool = BitSeq(a) == BitSeq(b)
|
||||
template setBit*(x: var BitList, idx: int) = setBit(BitSeq(x), idx)
|
||||
template clearBit*(x: var BitList, idx: int) = clearBit(BitSeq(x), idx)
|
||||
template setBit*(x: var BitList, idx: Natural) = setBit(BitSeq(x), idx)
|
||||
template clearBit*(x: var BitList, idx: Natural) = clearBit(BitSeq(x), idx)
|
||||
template overlaps*(a, b: BitList): bool = overlaps(BitSeq(a), BitSeq(b))
|
||||
template combine*(a: var BitList, b: BitList) = combine(BitSeq(a), BitSeq(b))
|
||||
template isSubsetOf*(a, b: BitList): bool = isSubsetOf(BitSeq(a), BitSeq(b))
|
||||
|
|
|
@ -74,7 +74,7 @@ proc signAttestation*(v: AttachedValidator,
|
|||
|
||||
proc produceAndSignAttestation*(validator: AttachedValidator,
|
||||
attestationData: AttestationData,
|
||||
committeeLen: int, indexInCommittee: int,
|
||||
committeeLen: int, indexInCommittee: Natural,
|
||||
fork: Fork, genesis_validators_root: Eth2Digest):
|
||||
Future[Attestation] {.async.} =
|
||||
let validatorSignature = await validator.signAttestation(attestationData,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
import
|
||||
# Standard library
|
||||
math, random,
|
||||
math,
|
||||
|
||||
# Specs
|
||||
../../beacon_chain/spec/[datatypes, crypto, digest,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import
|
||||
unittest, stint, ./testutil, stew/byteutils,
|
||||
../beacon_chain/[interop, merkle_minimal, ssz],
|
||||
../beacon_chain/[interop, ssz],
|
||||
../beacon_chain/spec/[beaconstate, crypto, datatypes, presets]
|
||||
|
||||
# Interop test yaml, found here:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import
|
||||
options, stew/endians2,
|
||||
../beacon_chain/[extras, merkle_minimal, validator_pool],
|
||||
../beacon_chain/[extras, validator_pool],
|
||||
../beacon_chain/ssz/merkleization,
|
||||
../beacon_chain/spec/[beaconstate, crypto, datatypes, digest, presets,
|
||||
helpers, validator, signatures, state_transition]
|
||||
|
|
Loading…
Reference in New Issue