Commit d38aa554 authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Remove implementation code for all pre-13 consensus methods.

Also remove a test for the way that we generated parameter votes
before consensus method 12.
parent 908bd4ce
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -602,6 +602,7 @@ dirvote_compute_params(smartlist_t *votes, int method, int total_authorities)
  const int n_votes = smartlist_len(votes);
  smartlist_t *output;
  smartlist_t *param_list = smartlist_new();
  (void) method;

  /* We require that the parameter lists in the votes are well-formed: that
     is, that their keywords are unique and sorted, and that their values are
@@ -648,8 +649,7 @@ dirvote_compute_params(smartlist_t *votes, int method, int total_authorities)
      /* We've reached the end of a series. */
      /* Make sure enough authorities voted on this param, unless the
       * the consensus method we use is too old for that. */
      if (method < MIN_METHOD_FOR_MAJORITY_PARAMS ||
          i > total_authorities/2 ||
      if (i > total_authorities/2 ||
          i >= MIN_VOTES_FOR_PARAM) {
        int32_t median = median_int32(vals, i);
        char *out_string = tor_malloc(64+cur_param_len);
@@ -1553,9 +1553,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
      }

      /* Fix bug 2203: Do not count BadExit nodes as Exits for bw weights */
      if (consensus_method >= MIN_METHOD_TO_CUT_BADEXIT_WEIGHT) {
      is_exit = is_exit && !is_bad_exit;
      }

      {
        if (rs_out.has_bandwidth) {
@@ -1659,7 +1657,6 @@ networkstatus_compute_consensus(smartlist_t *votes,
      }

      if (flavor == FLAV_MICRODESC &&
          consensus_method >= MIN_METHOD_FOR_MANDATORY_MICRODESC &&
          tor_digest256_is_zero(microdesc_digest)) {
        /* With no microdescriptor digest, we omit the entry entirely. */
        continue;
+0 −7
Original line number Diff line number Diff line
@@ -27,13 +27,6 @@
/** The highest consensus method that we currently support. */
#define MAX_SUPPORTED_CONSENSUS_METHOD 18

/** Lowest consensus method that doesn't count bad exits as exits for weight */
#define MIN_METHOD_TO_CUT_BADEXIT_WEIGHT 11

/** Lowest consensus method that ensures a majority of authorities voted
  * for a param. */
#define MIN_METHOD_FOR_MAJORITY_PARAMS 12

/** Lowest consensus method where microdesc consensuses omit any entry
 * with no microdesc. */
#define MIN_METHOD_FOR_MANDATORY_MICRODESC 13
+3 −6
Original line number Diff line number Diff line
@@ -2047,6 +2047,7 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
  double Gtotal=0, Mtotal=0, Etotal=0;
  const char *casename = NULL;
  int valid = 1;
  (void) consensus_method;

  weight_scale = networkstatus_get_weight_scale_param(ns);
  Wgg = networkstatus_get_bw_weight(ns, "Wgg", -1);
@@ -2126,12 +2127,8 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
  // Then, gather G, M, E, D, T to determine case
  SMARTLIST_FOREACH_BEGIN(ns->routerstatus_list, routerstatus_t *, rs) {
    int is_exit = 0;
    if (consensus_method >= MIN_METHOD_TO_CUT_BADEXIT_WEIGHT) {
    /* Bug #2203: Don't count bad exits as exits for balancing */
    is_exit = rs->is_exit && !rs->is_bad_exit;
    } else {
      is_exit = rs->is_exit;
    }
    if (rs->has_bandwidth) {
      T += rs->bandwidth_kb;
      if (is_exit && rs->is_possible_guard) {
+0 −16
Original line number Diff line number Diff line
@@ -736,10 +736,6 @@ test_dir_param_voting(void)
  /* Do the first tests without adding all the other votes, for
   * networks without many dirauths. */

  res = dirvote_compute_params(votes, 11, 6);
  test_streq(res, "ab=90 abcd=20 cw=50 x-yz=-99");
  tor_free(res);

  res = dirvote_compute_params(votes, 12, 2);
  test_streq(res, "");
  tor_free(res);
@@ -750,10 +746,6 @@ test_dir_param_voting(void)

  smartlist_add(votes, &vote2);

  res = dirvote_compute_params(votes, 11, 2);
  test_streq(res, "ab=27 abcd=20 cw=5 x-yz=-99");
  tor_free(res);

  res = dirvote_compute_params(votes, 12, 2);
  test_streq(res, "ab=27 cw=5 x-yz=-99");
  tor_free(res);
@@ -768,10 +760,6 @@ test_dir_param_voting(void)

  smartlist_add(votes, &vote3);

  res = dirvote_compute_params(votes, 11, 3);
  test_streq(res, "ab=27 abcd=20 c=60 cw=50 x-yz=-9 zzzzz=101");
  tor_free(res);

  res = dirvote_compute_params(votes, 12, 3);
  test_streq(res, "ab=27 abcd=20 cw=50 x-yz=-9");
  tor_free(res);
@@ -786,10 +774,6 @@ test_dir_param_voting(void)

  smartlist_add(votes, &vote4);

  res = dirvote_compute_params(votes, 11, 4);
  test_streq(res, "ab=90 abcd=20 c=1 cw=50 x-yz=-9 zzzzz=101");
  tor_free(res);

  res = dirvote_compute_params(votes, 12, 4);
  test_streq(res, "ab=90 abcd=20 cw=50 x-yz=-9");
  tor_free(res);