[tor-commits] [tor/master] Disable consensus methods before 25.

nickm at torproject.org nickm at torproject.org
Mon Apr 23 00:01:16 UTC 2018


commit 69347f48e00ae31222ce10d66c507293954e4fcc
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Apr 9 14:31:51 2018 -0400

    Disable consensus methods before 25.
    
    Consensus method 25 is the oldest one supported by any stable
    version of 0.2.9, which is our current most-recent LTS.  Thus, by
    proposal 290, they should be removed.
    
    This commit does not actually remove the code to implement these
    methods: it only makes it so authorities will no longer support
    them.  I'll remove the backend code for them in later commits.
---
 src/or/dirvote.c    |  8 +-------
 src/or/dirvote.h    |  2 +-
 src/test/test_dir.c | 14 ++++++++------
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index c3cd0d3cd..265715505 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -3951,13 +3951,7 @@ static const struct consensus_method_range_t {
   int low;
   int high;
 } microdesc_consensus_methods[] = {
-  {MIN_SUPPORTED_CONSENSUS_METHOD, MIN_METHOD_FOR_A_LINES - 1},
-  {MIN_METHOD_FOR_A_LINES, MIN_METHOD_FOR_P6_LINES - 1},
-  {MIN_METHOD_FOR_P6_LINES, MIN_METHOD_FOR_NTOR_KEY - 1},
-  {MIN_METHOD_FOR_NTOR_KEY, MIN_METHOD_FOR_ID_HASH_IN_MD - 1},
-  {MIN_METHOD_FOR_ID_HASH_IN_MD, MIN_METHOD_FOR_ED25519_ID_IN_MD - 1},
-  {MIN_METHOD_FOR_ED25519_ID_IN_MD,
-    MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC - 1},
+  {MIN_SUPPORTED_CONSENSUS_METHOD, MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC - 1},
   {MIN_METHOD_FOR_NO_A_LINES_IN_MICRODESC, MAX_SUPPORTED_CONSENSUS_METHOD},
   {-1, -1}
 };
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index deeb27bfe..91da4edee 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -56,7 +56,7 @@
 #define ROUTERSTATUS_FORMAT_NO_CONSENSUS_METHOD 0
 
 /** The lowest consensus method that we currently support. */
-#define MIN_SUPPORTED_CONSENSUS_METHOD 13
+#define MIN_SUPPORTED_CONSENSUS_METHOD 25
 
 /** The highest consensus method that we currently support. */
 #define MAX_SUPPORTED_CONSENSUS_METHOD 28
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 5fac045b2..6cafa7cb3 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -2917,8 +2917,9 @@ gen_routerstatus_for_umbw(int idx, time_t now)
       rs->addr = 0x99008801;
       rs->or_port = 443;
       rs->dir_port = 8000;
-      /* all flags but running cleared */
+      /* all flags but running and valid cleared */
       rs->is_flagged_running = 1;
+      rs->is_valid = 1;
       /*
        * This one has measured bandwidth below the clip cutoff, and
        * so shouldn't be clipped; we'll have to test that it isn't
@@ -2991,8 +2992,9 @@ gen_routerstatus_for_umbw(int idx, time_t now)
       rs->addr = 0xC0000203;
       rs->or_port = 500;
       rs->dir_port = 1999;
-      /* all flags but running cleared */
+      /* all flags but running and valid cleared */
       rs->is_flagged_running = 1;
+      rs->is_valid = 1;
       /*
        * This one has unmeasured bandwidth below the clip cutoff, and
        * so shouldn't be clipped; we'll have to test that it isn't
@@ -3014,7 +3016,7 @@ gen_routerstatus_for_umbw(int idx, time_t now)
   if (vrs) {
     vrs->microdesc = tor_malloc_zero(sizeof(vote_microdesc_hash_t));
     tor_asprintf(&vrs->microdesc->microdesc_hash_line,
-                 "m 9,10,11,12,13,14,15,16,17 "
+                 "m 25,26,27,28 "
                  "sha256=xyzajkldsdsajdadlsdjaslsdksdjlsdjsdaskdaaa%d\n",
                  idx);
   }
@@ -3040,7 +3042,7 @@ vote_tweaks_for_umbw(networkstatus_t *v, int voter, time_t now)
   smartlist_clear(v->supported_methods);
   /* Method 17 is MIN_METHOD_TO_CLIP_UNMEASURED_BW_KB */
   smartlist_split_string(v->supported_methods,
-                         "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17",
+                         "25 26 27 28",
                          NULL, 0, -1);
   /* If we're using a non-default clip bandwidth, add it to net_params */
   if (alternate_clip_bw > 0) {
@@ -3202,9 +3204,9 @@ test_routerstatus_for_umbw(routerstatus_t *rs, time_t now)
     tt_assert(!rs->is_fast);
     tt_assert(!rs->is_possible_guard);
     tt_assert(!rs->is_stable);
-    /* (If it wasn't running it wouldn't be here) */
+    /* (If it wasn't running and valid it wouldn't be here) */
     tt_assert(rs->is_flagged_running);
-    tt_assert(!rs->is_valid);
+    tt_assert(rs->is_valid);
     tt_assert(!rs->is_named);
     /* This one should have measured bandwidth below the clip cutoff */
     tt_assert(rs->has_bandwidth);





More information about the tor-commits mailing list