Skip to content

Commit 9e716b3

Browse files
authored
address some XDeclaredButNotUsed hints (#2028)
1 parent de4e119 commit 9e716b3

File tree

7 files changed

+11
-30
lines changed

7 files changed

+11
-30
lines changed

beacon_chain/deposit_contract.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ proc sendDeposits*(deposits: seq[LaunchPadDeposit],
165165
await sleepAsync(delayGenerator())
166166

167167
break
168-
except CatchableError as err:
168+
except CatchableError:
169169
await sleepAsync(60.seconds)
170170
web3 = await initWeb3(web3Url, privateKey)
171171

beacon_chain/eth2_network.nim

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ proc disconnect*(peer: Peer, reason: DisconnectionReason,
443443
peer.network.addSeen(peer.info.peerId, seenTime)
444444
await peer.network.switch.disconnect(peer.info.peerId)
445445
peer.connectionState = Disconnected
446-
except CatchableError as exc:
446+
except CatchableError:
447447
# We do not care about exceptions in disconnection procedure.
448448
trace "Exception while disconnecting peer", peer = peer.info.peerId,
449449
reason = reason
@@ -465,11 +465,6 @@ proc getRequestProtoName(fn: NimNode): NimNode =
465465

466466
return newLit("")
467467

468-
template raisePeerDisconnected(msg: string, r: DisconnectionReason) =
469-
var e = newException(PeerDisconnected, msg)
470-
e.reason = r
471-
raise e
472-
473468
proc writeChunk*(conn: Connection,
474469
responseCode: Option[ResponseCode],
475470
payload: Bytes): Future[void] =
@@ -991,7 +986,7 @@ proc startListening*(node: Eth2Node) {.async.} =
991986
if node.discoveryEnabled:
992987
try:
993988
node.discovery.open()
994-
except CatchableError as err:
989+
except CatchableError:
995990
fatal "Failed to start discovery service. UDP port may be already in use"
996991
quit 1
997992

beacon_chain/keystore_management.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ proc keyboardGetPassword[T](prompt: string, attempts: int,
202202
let passphrase =
203203
try:
204204
readPasswordFromStdin(prompt)
205-
except IOError as exc:
205+
except IOError:
206206
error "Could not read password from stdin"
207207
return
208208
os.sleep(1000 * counter)

beacon_chain/spec/beaconstate.nim

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,6 @@ proc initialize_hashed_beacon_state_from_eth1*(
320320
preset, eth1_block_hash, eth1_timestamp, deposits, flags)
321321
HashedBeaconState(data: genesisState[], root: hash_tree_root(genesisState[]))
322322

323-
func is_valid_genesis_state(preset: RuntimePreset,
324-
state: BeaconState,
325-
active_validator_indices: seq[ValidatorIndex]): bool =
326-
if state.genesis_time < preset.MIN_GENESIS_TIME:
327-
return false
328-
# This is an okay get_active_validator_indices(...) for the time being.
329-
if active_validator_indices.lenu64 < preset.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT:
330-
return false
331-
true
332-
333323
func emptyBeaconBlockBody(): BeaconBlockBody =
334324
# TODO: This shouldn't be necessary if OpaqueBlob is the default
335325
BeaconBlockBody(randao_reveal: ValidatorSig(kind: OpaqueBlob))

beacon_chain/sync_manager.nim

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,6 @@ proc getBlocks*[A, B](man: SyncManager[A, B], peer: A,
721721
template headAge(): uint64 =
722722
wallSlot - headSlot
723723

724-
template peerAge(): uint64 =
725-
if peerSlot > wallSlot: 0'u64 else: wallSlot - peerSlot
726-
727724
template queueAge(): uint64 =
728725
wallSlot - man.queue.outSlot
729726

@@ -753,7 +750,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
753750
local_head_slot = headSlot, peer = peer, index = index,
754751
tolerance_value = man.toleranceValue, peer_speed = peer.netKbps(),
755752
peer_score = peer.getScore(), topics = "syncman"
756-
let failure = SyncFailure.init(SyncFailureKind.StatusInvalid, peer)
753+
discard SyncFailure.init(SyncFailureKind.StatusInvalid, peer)
757754
return
758755

759756
# 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.} =
772769
debug "Failed to get remote peer's status, exiting", peer = peer,
773770
peer_score = peer.getScore(), peer_head_slot = peerSlot,
774771
peer_speed = peer.netKbps(), index = index, topics = "syncman"
775-
let failure = SyncFailure.init(SyncFailureKind.StatusDownload, peer)
772+
discard SyncFailure.init(SyncFailureKind.StatusDownload, peer)
776773
return
777774
except CatchableError as exc:
778775
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.} =
826823
debug "Failed to get remote peer's status, exiting", peer = peer,
827824
peer_score = peer.getScore(), peer_head_slot = peerSlot,
828825
peer_speed = peer.netKbps(), index = index, topics = "syncman"
829-
let failure = SyncFailure.init(SyncFailureKind.StatusDownload, peer)
826+
discard SyncFailure.init(SyncFailureKind.StatusDownload, peer)
830827
return
831828
except CatchableError as exc:
832829
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.} =
919916
request_step = req.step, peer = peer,
920917
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
921918
index = index, topics = "syncman"
922-
let failure = SyncFailure.init(SyncFailureKind.BadResponse, peer)
919+
discard SyncFailure.init(SyncFailureKind.BadResponse, peer)
923920
return
924921

925922
# Scoring will happen in `syncUpdate`.
@@ -933,7 +930,7 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
933930
request_step = req.step, peer = peer, index = index,
934931
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
935932
topics = "syncman"
936-
let failure = SyncFailure.init(SyncFailureKind.BlockDownload, peer)
933+
discard SyncFailure.init(SyncFailureKind.BlockDownload, peer)
937934
return
938935

939936
except CatchableError as exc:
@@ -1054,7 +1051,7 @@ proc syncLoop[A, B](man: SyncManager[A, B]) {.async.} =
10541051
let op1 = man.queue.opcounter
10551052
await sleepAsync(chronos.seconds(pauseTime))
10561053
let op2 = man.queue.opcounter
1057-
let (map, sleeping, waiting, pending) = man.getWorkersStats()
1054+
let (_, _, _, pending) = man.getWorkersStats()
10581055
if pending == 0:
10591056
pauseTime = MinPauseTime
10601057
else:

beacon_chain/validator_duties.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ proc broadcastAggregatedAttestations(
438438
# the corresponding one -- whatver they are, they match.
439439

440440
let
441-
bs = BlockSlot(blck: aggregationHead, slot: aggregationSlot)
442441
epochRef = node.chainDag.getEpochRef(aggregationHead, aggregationSlot.epoch)
443442
fork = node.chainDag.headState.data.data.fork
444443
genesis_validators_root =

beacon_chain/validator_slashing_protection.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ proc get(db: SlashingProtectionDB,
313313
dataLen = data.len,
314314
expectedSize = ExpectedNodeSszSize
315315
discard
316-
except SerializationError as e:
316+
except SerializationError:
317317
# If the data can't be deserialized, it could be because it's from a
318318
# version of the software that uses a different SSZ encoding
319319
warn "Unable to deserialize data, old database?",

0 commit comments

Comments
 (0)