address some XDeclaredButNotUsed hints (#2028)
This commit is contained in:
parent
de4e119726
commit
9e716b32bd
|
@ -165,7 +165,7 @@ proc sendDeposits*(deposits: seq[LaunchPadDeposit],
|
||||||
await sleepAsync(delayGenerator())
|
await sleepAsync(delayGenerator())
|
||||||
|
|
||||||
break
|
break
|
||||||
except CatchableError as err:
|
except CatchableError:
|
||||||
await sleepAsync(60.seconds)
|
await sleepAsync(60.seconds)
|
||||||
web3 = await initWeb3(web3Url, privateKey)
|
web3 = await initWeb3(web3Url, privateKey)
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,7 @@ proc disconnect*(peer: Peer, reason: DisconnectionReason,
|
||||||
peer.network.addSeen(peer.info.peerId, seenTime)
|
peer.network.addSeen(peer.info.peerId, seenTime)
|
||||||
await peer.network.switch.disconnect(peer.info.peerId)
|
await peer.network.switch.disconnect(peer.info.peerId)
|
||||||
peer.connectionState = Disconnected
|
peer.connectionState = Disconnected
|
||||||
except CatchableError as exc:
|
except CatchableError:
|
||||||
# We do not care about exceptions in disconnection procedure.
|
# We do not care about exceptions in disconnection procedure.
|
||||||
trace "Exception while disconnecting peer", peer = peer.info.peerId,
|
trace "Exception while disconnecting peer", peer = peer.info.peerId,
|
||||||
reason = reason
|
reason = reason
|
||||||
|
@ -465,11 +465,6 @@ proc getRequestProtoName(fn: NimNode): NimNode =
|
||||||
|
|
||||||
return newLit("")
|
return newLit("")
|
||||||
|
|
||||||
template raisePeerDisconnected(msg: string, r: DisconnectionReason) =
|
|
||||||
var e = newException(PeerDisconnected, msg)
|
|
||||||
e.reason = r
|
|
||||||
raise e
|
|
||||||
|
|
||||||
proc writeChunk*(conn: Connection,
|
proc writeChunk*(conn: Connection,
|
||||||
responseCode: Option[ResponseCode],
|
responseCode: Option[ResponseCode],
|
||||||
payload: Bytes): Future[void] =
|
payload: Bytes): Future[void] =
|
||||||
|
@ -991,7 +986,7 @@ proc startListening*(node: Eth2Node) {.async.} =
|
||||||
if node.discoveryEnabled:
|
if node.discoveryEnabled:
|
||||||
try:
|
try:
|
||||||
node.discovery.open()
|
node.discovery.open()
|
||||||
except CatchableError as err:
|
except CatchableError:
|
||||||
fatal "Failed to start discovery service. UDP port may be already in use"
|
fatal "Failed to start discovery service. UDP port may be already in use"
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ proc keyboardGetPassword[T](prompt: string, attempts: int,
|
||||||
let passphrase =
|
let passphrase =
|
||||||
try:
|
try:
|
||||||
readPasswordFromStdin(prompt)
|
readPasswordFromStdin(prompt)
|
||||||
except IOError as exc:
|
except IOError:
|
||||||
error "Could not read password from stdin"
|
error "Could not read password from stdin"
|
||||||
return
|
return
|
||||||
os.sleep(1000 * counter)
|
os.sleep(1000 * counter)
|
||||||
|
|
|
@ -320,16 +320,6 @@ proc initialize_hashed_beacon_state_from_eth1*(
|
||||||
preset, eth1_block_hash, eth1_timestamp, deposits, flags)
|
preset, eth1_block_hash, eth1_timestamp, deposits, flags)
|
||||||
HashedBeaconState(data: genesisState[], root: hash_tree_root(genesisState[]))
|
HashedBeaconState(data: genesisState[], root: hash_tree_root(genesisState[]))
|
||||||
|
|
||||||
func is_valid_genesis_state(preset: RuntimePreset,
|
|
||||||
state: BeaconState,
|
|
||||||
active_validator_indices: seq[ValidatorIndex]): bool =
|
|
||||||
if state.genesis_time < preset.MIN_GENESIS_TIME:
|
|
||||||
return false
|
|
||||||
# This is an okay get_active_validator_indices(...) for the time being.
|
|
||||||
if active_validator_indices.lenu64 < preset.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT:
|
|
||||||
return false
|
|
||||||
true
|
|
||||||
|
|
||||||
func emptyBeaconBlockBody(): BeaconBlockBody =
|
func emptyBeaconBlockBody(): BeaconBlockBody =
|
||||||
# TODO: This shouldn't be necessary if OpaqueBlob is the default
|
# TODO: This shouldn't be necessary if OpaqueBlob is the default
|
||||||
BeaconBlockBody(randao_reveal: ValidatorSig(kind: OpaqueBlob))
|
BeaconBlockBody(randao_reveal: ValidatorSig(kind: OpaqueBlob))
|
||||||
|
|
|
@ -721,9 +721,6 @@ proc getBlocks*[A, B](man: SyncManager[A, B], peer: A,
|
||||||
template headAge(): uint64 =
|
template headAge(): uint64 =
|
||||||
wallSlot - headSlot
|
wallSlot - headSlot
|
||||||
|
|
||||||
template peerAge(): uint64 =
|
|
||||||
if peerSlot > wallSlot: 0'u64 else: wallSlot - peerSlot
|
|
||||||
|
|
||||||
template queueAge(): uint64 =
|
template queueAge(): uint64 =
|
||||||
wallSlot - man.queue.outSlot
|
wallSlot - man.queue.outSlot
|
||||||
|
|
||||||
|
@ -753,7 +750,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
|
||||||
local_head_slot = headSlot, peer = peer, index = index,
|
local_head_slot = headSlot, peer = peer, index = index,
|
||||||
tolerance_value = man.toleranceValue, peer_speed = peer.netKbps(),
|
tolerance_value = man.toleranceValue, peer_speed = peer.netKbps(),
|
||||||
peer_score = peer.getScore(), topics = "syncman"
|
peer_score = peer.getScore(), topics = "syncman"
|
||||||
let failure = SyncFailure.init(SyncFailureKind.StatusInvalid, peer)
|
discard SyncFailure.init(SyncFailureKind.StatusInvalid, peer)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if we need to update peer's status information
|
# Check if we need to update peer's status information
|
||||||
|
@ -772,7 +769,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
|
||||||
debug "Failed to get remote peer's status, exiting", peer = peer,
|
debug "Failed to get remote peer's status, exiting", peer = peer,
|
||||||
peer_score = peer.getScore(), peer_head_slot = peerSlot,
|
peer_score = peer.getScore(), peer_head_slot = peerSlot,
|
||||||
peer_speed = peer.netKbps(), index = index, topics = "syncman"
|
peer_speed = peer.netKbps(), index = index, topics = "syncman"
|
||||||
let failure = SyncFailure.init(SyncFailureKind.StatusDownload, peer)
|
discard SyncFailure.init(SyncFailureKind.StatusDownload, peer)
|
||||||
return
|
return
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
debug "Unexpected exception while updating peer's status",
|
debug "Unexpected exception while updating peer's status",
|
||||||
|
@ -826,7 +823,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
|
||||||
debug "Failed to get remote peer's status, exiting", peer = peer,
|
debug "Failed to get remote peer's status, exiting", peer = peer,
|
||||||
peer_score = peer.getScore(), peer_head_slot = peerSlot,
|
peer_score = peer.getScore(), peer_head_slot = peerSlot,
|
||||||
peer_speed = peer.netKbps(), index = index, topics = "syncman"
|
peer_speed = peer.netKbps(), index = index, topics = "syncman"
|
||||||
let failure = SyncFailure.init(SyncFailureKind.StatusDownload, peer)
|
discard SyncFailure.init(SyncFailureKind.StatusDownload, peer)
|
||||||
return
|
return
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
debug "Unexpected exception while updating peer's status",
|
debug "Unexpected exception while updating peer's status",
|
||||||
|
@ -919,7 +916,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
|
||||||
request_step = req.step, peer = peer,
|
request_step = req.step, peer = peer,
|
||||||
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
|
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
|
||||||
index = index, topics = "syncman"
|
index = index, topics = "syncman"
|
||||||
let failure = SyncFailure.init(SyncFailureKind.BadResponse, peer)
|
discard SyncFailure.init(SyncFailureKind.BadResponse, peer)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Scoring will happen in `syncUpdate`.
|
# Scoring will happen in `syncUpdate`.
|
||||||
|
@ -933,7 +930,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
|
||||||
request_step = req.step, peer = peer, index = index,
|
request_step = req.step, peer = peer, index = index,
|
||||||
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
|
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
|
||||||
topics = "syncman"
|
topics = "syncman"
|
||||||
let failure = SyncFailure.init(SyncFailureKind.BlockDownload, peer)
|
discard SyncFailure.init(SyncFailureKind.BlockDownload, peer)
|
||||||
return
|
return
|
||||||
|
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
|
@ -1054,7 +1051,7 @@ proc syncLoop[A, B](man: SyncManager[A, B]) {.async.} =
|
||||||
let op1 = man.queue.opcounter
|
let op1 = man.queue.opcounter
|
||||||
await sleepAsync(chronos.seconds(pauseTime))
|
await sleepAsync(chronos.seconds(pauseTime))
|
||||||
let op2 = man.queue.opcounter
|
let op2 = man.queue.opcounter
|
||||||
let (map, sleeping, waiting, pending) = man.getWorkersStats()
|
let (_, _, _, pending) = man.getWorkersStats()
|
||||||
if pending == 0:
|
if pending == 0:
|
||||||
pauseTime = MinPauseTime
|
pauseTime = MinPauseTime
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -438,7 +438,6 @@ proc broadcastAggregatedAttestations(
|
||||||
# the corresponding one -- whatver they are, they match.
|
# the corresponding one -- whatver they are, they match.
|
||||||
|
|
||||||
let
|
let
|
||||||
bs = BlockSlot(blck: aggregationHead, slot: aggregationSlot)
|
|
||||||
epochRef = node.chainDag.getEpochRef(aggregationHead, aggregationSlot.epoch)
|
epochRef = node.chainDag.getEpochRef(aggregationHead, aggregationSlot.epoch)
|
||||||
fork = node.chainDag.headState.data.data.fork
|
fork = node.chainDag.headState.data.data.fork
|
||||||
genesis_validators_root =
|
genesis_validators_root =
|
||||||
|
|
|
@ -313,7 +313,7 @@ proc get(db: SlashingProtectionDB,
|
||||||
dataLen = data.len,
|
dataLen = data.len,
|
||||||
expectedSize = ExpectedNodeSszSize
|
expectedSize = ExpectedNodeSszSize
|
||||||
discard
|
discard
|
||||||
except SerializationError as e:
|
except SerializationError:
|
||||||
# If the data can't be deserialized, it could be because it's from a
|
# If the data can't be deserialized, it could be because it's from a
|
||||||
# version of the software that uses a different SSZ encoding
|
# version of the software that uses a different SSZ encoding
|
||||||
warn "Unable to deserialize data, old database?",
|
warn "Unable to deserialize data, old database?",
|
||||||
|
|
Loading…
Reference in New Issue