[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove MIN_METHOD_FOR_{PACKAGE_LINES, GUARDFRACTION, ED25519_ID_IN_MD}



commit 4d6f21bb6b43fb79bb4a659ced8aa898a42389a8
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Apr 9 14:59:34 2018 -0400

    Remove MIN_METHOD_FOR_{PACKAGE_LINES,GUARDFRACTION,ED25519_ID_IN_MD}
    
    Also remove a rest for pre-19 microdesc versions.
---
 src/or/dirvote.c          | 19 +++----------------
 src/or/dirvote.h          | 12 ------------
 src/test/test_microdesc.c | 15 ---------------
 3 files changed, 3 insertions(+), 43 deletions(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 1a21def46..80db32eb5 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -664,13 +664,6 @@ compute_consensus_method(smartlist_t *votes)
 static int
 consensus_method_is_supported(int method)
 {
-  if (method == MIN_METHOD_FOR_ED25519_ID_IN_MD) {
-    /* This method was broken due to buggy code accidentally left in
-     * dircollate.c; do not actually use it.
-     */
-    return 0;
-  }
-
   return (method >= MIN_SUPPORTED_CONSENSUS_METHOD) &&
     (method <= MAX_SUPPORTED_CONSENSUS_METHOD);
 }
@@ -1455,11 +1448,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
                                                       n_versioning_servers);
     client_versions = compute_consensus_versions_list(combined_client_versions,
                                                       n_versioning_clients);
-    if (consensus_method >= MIN_METHOD_FOR_PACKAGE_LINES) {
-      packages = compute_consensus_package_lines(votes);
-    } else {
-      packages = tor_strdup("");
-    }
+    packages = compute_consensus_package_lines(votes);
 
     SMARTLIST_FOREACH(combined_server_versions, char *, cp, tor_free(cp));
     SMARTLIST_FOREACH(combined_client_versions, char *, cp, tor_free(cp));
@@ -1971,8 +1960,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
 
       /* If it's a guard and we have enough guardfraction votes,
          calculate its consensus guardfraction value. */
-      if (is_guard && num_guardfraction_inputs > 2 &&
-          consensus_method >= MIN_METHOD_FOR_GUARDFRACTION) {
+      if (is_guard && num_guardfraction_inputs > 2) {
         rs_out.has_guardfraction = 1;
         rs_out.guardfraction_percentage = median_uint32(measured_guardfraction,
                                                      num_guardfraction_inputs);
@@ -3865,8 +3853,7 @@ dirvote_create_microdescriptor(const routerinfo_t *ri, int consensus_method)
   {
     char idbuf[ED25519_BASE64_LEN+1];
     const char *keytype;
-    if (consensus_method >= MIN_METHOD_FOR_ED25519_ID_IN_MD &&
-        ri->cache_info.signing_key_cert &&
+    if (ri->cache_info.signing_key_cert &&
         ri->cache_info.signing_key_cert->signing_key_included) {
       keytype = "ed25519";
       ed25519_public_to_base64(idbuf,
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index 334dc0732..14fa8e0ad 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -61,18 +61,6 @@
 /** The highest consensus method that we currently support. */
 #define MAX_SUPPORTED_CONSENSUS_METHOD 28
 
-/** Lowest consensus method where we include "package" lines*/
-#define MIN_METHOD_FOR_PACKAGE_LINES 19
-
-/** Lowest consensus method where authorities may include
- * GuardFraction information in microdescriptors. */
-#define MIN_METHOD_FOR_GUARDFRACTION 20
-
-/** Lowest consensus method where authorities may include an "id" line for
- * ed25519 identities in microdescriptors. (Broken; see
- * consensus_method_is_supported() for more info.) */
-#define MIN_METHOD_FOR_ED25519_ID_IN_MD 21
-
 /** Lowest consensus method where authorities vote on ed25519 ids and ensure
  * ed25519 id consistency. */
 #define MIN_METHOD_FOR_ED25519_ID_VOTING 22
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index fc565ebf3..3d02fc1a5 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -396,16 +396,6 @@ static const char test_md_18[] =
   "p reject 25,119,135-139,445,563,1214,4661-4666,6346-6429,6699,6881-6999\n"
   "id rsa1024 Cd47okjCHD83YGzThGBDptXs9Z4\n";
 
-static const char test_md2_18[] =
-  "onion-key\n"
-  "-----BEGIN RSA PUBLIC KEY-----\n"
-  "MIGJAoGBAL2R8EfubUcahxha4u02P4VAR0llQIMwFAmrHPjzcK7apcQgDOf2ovOA\n"
-  "+YQnJFxlpBmCoCZC6ssCi+9G0mqo650lFuTMP5I90BdtjotfzESfTykHLiChyvhd\n"
-  "l0dlqclb2SU/GKem/fLRXH16aNi72CdSUu/1slKs/70ILi34QixRAgMBAAE=\n"
-  "-----END RSA PUBLIC KEY-----\n"
-  "ntor-onion-key hbxdRnfVUJJY7+KcT4E3Rs7/zuClbN3hJrjSBiEGMgI=\n"
-  "id rsa1024 t+J/EEITw28T5+mCkYKEXklZl6A\n";
-
 static const char test_md2_21[] =
   "onion-key\n"
   "-----BEGIN RSA PUBLIC KEY-----\n"
@@ -441,11 +431,6 @@ test_md_generate(void *arg)
 
   microdesc_free(md);
   md = NULL;
-  md = dirvote_create_microdescriptor(ri, 18);
-  tt_str_op(md->body, OP_EQ, test_md2_18);
-
-  microdesc_free(md);
-  md = NULL;
   md = dirvote_create_microdescriptor(ri, 21);
   tt_str_op(md->body, OP_EQ, test_md2_21);
   tt_assert(ed25519_pubkey_eq(md->ed25519_identity_pkey,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits