[tor-commits] [doctor/master] Stacktrace when shared random commitment isn't present

atagar at torproject.org atagar at torproject.org
Sun Jan 29 20:20:19 UTC 2017


commit 13f979325bc0bf91bb8ba17f4018ed6128b5b3bd
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jan 29 12:19:43 2017 -0800

    Stacktrace when shared random commitment isn't present
    
    Not entirely sure what's up yet but got the following stacktrace on 1/26/17...
    
      Traceback (most recent call last):
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 879, in <module>
          main()
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 244, in main
          issues += run_checks(consensuses, votes)
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 336, in run_checks
          issues = checker(latest_consensus, consensuses, votes)
        File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 810, in shared_random_reveal_partitioning
          our_reveal = [c.reveal for c in vote.directory_authorities[0].shared_randomness_commitments if c.identity == our_v3ident][0]
      IndexError: list index out of range
---
 consensus_health_checker.py | 10 ++++++++--
 data/consensus_health.cfg   |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index 0f633c8..e67f798 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -807,8 +807,14 @@ def shared_random_reveal_partitioning(latest_consensus, consensuses, votes):
 
   for authority, vote in votes.items():
     our_v3ident = DIRECTORY_AUTHORITIES[authority].v3ident
-    our_reveal = [c.reveal for c in vote.directory_authorities[0].shared_randomness_commitments if c.identity == our_v3ident][0]
-    self_reveals[our_v3ident] = our_reveal
+    our_reveals = [c.reveal for c in vote.directory_authorities[0].shared_randomness_commitments if c.identity == our_v3ident]
+
+    if not our_reveals:
+      issues.append(Issue(Runlevel.WARNING, 'SHARED_RANDOM_NO_REVEAL', authority = authority, to = [authority]))
+    elif len(our_reveals) > 1:
+      issues.append(Issue(Runlevel.WARNING, 'SHARED_RANDOM_MULTIPLE_REVEAL', authority = authority, count = len(our_reveals), to = [authority]))
+    else:
+      self_reveals[our_v3ident] = our_reveals[0]
 
   for authority, vote in votes.items():
     commitments = vote.directory_authorities[0].shared_randomness_commitments
diff --git a/data/consensus_health.cfg b/data/consensus_health.cfg
index be58b26..0103a0e 100644
--- a/data/consensus_health.cfg
+++ b/data/consensus_health.cfg
@@ -22,6 +22,8 @@ msg AUTHORITY_UNAVAILABLE => Unable to retrieve the {fetch_type} from {authority
 msg UNABLE_TO_REACH_ORPORT => Unable to reach the ORPort of {authority} ({address}, port {port}): {error}
 msg CURRENT_SHARED_RANDOM_MISSING => Consensus is missing a current shared random value (shared-rand-current-value)
 msg PREVIOUS_SHARED_RANDOM_MISSING => Consensus is missing a previous shared random value (shared-rand-previous-value)
+msg SHARED_RANDOM_NO_REVEAL => {authority} didn't provide a shared randomness commitment
+msg SHARED_RANDOM_MULTIPLE_REVEAL => {authority} provided {count} shared randomness commitments
 msg SHARED_RANDOM_COMMITMENT_MISMATCH => Shared randomness commitment {authority} reported for {their_v3ident} doesn't match their actual value ({authority}: {our_value}, theirs: {their_value})
 msg SHARED_RANDOM_REVEAL_MISSING => During the reveal phase the vote from {authority} lacked a shared random value for {their_v3ident}, which should be {their_value}
 msg SHARED_RANDOM_REVEAL_DUPLICATED => During the reveal phase the vote from {authority} reported multiple commitments for {their_v3ident}



More information about the tor-commits mailing list