[tor-commits] [tor] 07/08: Implement proposal 275: don't put "published" times in md consensus

gitolite role git at cupani.torproject.org
Mon May 16 12:55:09 UTC 2022


This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit 96f1e69f24ec5c056964b44cb8538004649c504d
Author: Nick Mathewson <nickm at torproject.org>
AuthorDate: Tue Nov 9 13:43:48 2021 -0500

    Implement proposal 275: don't put "published" times in md consensus
    
    When a new consensus method is negotiated, these values will all get
    replaced with "2038-01-01 00:00:00".
    
    This change should be safe because:
    
      * As of 0.2.9.11 / 0.3.0.7 / 0.3.1.1-alpha, Tor takes no action
        about published_on times in the future.
    
      * The only remaining parties relying on published_on values are (we
        believe) relays running 0.3.5.x, which rely on the values in a NS
        consensus to see whether their descriptors are out of date.  But
        this patch only changes microdesc consensuses.
    
      * The latest Tor no longer looks at this field in consensuses.
    
    Why make this change?  In experiments, replacing these values with a
    fixed value made the size of compressed consensus diffs much much
    smaller.  (Like, by over 50%!)
    
    Implements proposal 275; Implements #40130.
---
 changes/prop275                         | 12 ++++++++++++
 src/feature/dirauth/dirvote.c           | 16 +++++++++++++++-
 src/feature/dirauth/dirvote.h           |  8 +++++++-
 src/feature/nodelist/fmt_routerstatus.c |  2 +-
 4 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/changes/prop275 b/changes/prop275
new file mode 100644
index 0000000000..bbbf38d959
--- /dev/null
+++ b/changes/prop275
@@ -0,0 +1,12 @@
+  o Minor features (directory authority):
+    - Add a new consensus method in which the "published" times on router
+      entries in a microdesc consensus are all set to a meaningless fixed
+      date.  Doing this will make the download size for compressed microdesc
+      consensus diffs much smaller.
+      Part of ticket 40130; implements proposal 275.
+
+  o Minor features (network documents):
+    - Clients and relays no longer track the "published on" time declared
+      for relays in any consensus documents.  When reporting this time on
+      the control port, they instead report a fixed date in the future.
+      Part of ticket 40130.
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
index 71f059dbc8..b4a9f83f19 100644
--- a/src/feature/dirauth/dirvote.c
+++ b/src/feature/dirauth/dirvote.c
@@ -2048,7 +2048,6 @@ networkstatus_compute_consensus(smartlist_t *votes,
       memcpy(rs_out.descriptor_digest, rs->status.descriptor_digest,
              DIGEST_LEN);
       tor_addr_copy(&rs_out.ipv4_addr, &rs->status.ipv4_addr);
-      time_t published_on = rs->published_on;
       rs_out.ipv4_dirport = rs->status.ipv4_dirport;
       rs_out.ipv4_orport = rs->status.ipv4_orport;
       tor_addr_copy(&rs_out.ipv6_addr, &alt_orport.addr);
@@ -2056,6 +2055,21 @@ networkstatus_compute_consensus(smartlist_t *votes,
       rs_out.has_bandwidth = 0;
       rs_out.has_exitsummary = 0;
 
+      time_t published_on = rs->published_on;
+
+      /* Starting with this consensus method, we no longer include a
+         meaningful published_on time for microdescriptor consensuses.  This
+         makes their diffs smaller and more compressible.
+
+         We need to keep including a meaningful published_on time for NS
+         consensuses, however, until 035 relays are all obsolete. (They use
+         it for a purpose similar to the current StaleDesc flag.)
+      */
+      if (consensus_method >= MIN_METHOD_TO_SUPPRESS_MD_PUBLISHED &&
+          flavor == FLAV_MICRODESC) {
+        published_on = -1;
+      }
+
       if (chosen_name && !naming_conflict) {
         strlcpy(rs_out.nickname, chosen_name, sizeof(rs_out.nickname));
       } else {
diff --git a/src/feature/dirauth/dirvote.h b/src/feature/dirauth/dirvote.h
index 64aaec116e..ae8d43a6f0 100644
--- a/src/feature/dirauth/dirvote.h
+++ b/src/feature/dirauth/dirvote.h
@@ -53,7 +53,7 @@
 #define MIN_SUPPORTED_CONSENSUS_METHOD 28
 
 /** The highest consensus method that we currently support. */
-#define MAX_SUPPORTED_CONSENSUS_METHOD 32
+#define MAX_SUPPORTED_CONSENSUS_METHOD 33
 
 /**
  * Lowest consensus method where microdescriptor lines are put in canonical
@@ -74,6 +74,12 @@
  */
 #define MIN_METHOD_FOR_MIDDLEONLY 32
 
+/**
+ * Lowest consensus method for which we suppress the published time in
+ * microdescriptor consensuses.
+ */
+#define MIN_METHOD_TO_SUPPRESS_MD_PUBLISHED 33
+
 /** Default bandwidth to clip unmeasured bandwidths to using method >=
  * MIN_METHOD_TO_CLIP_UNMEASURED_BW.  (This is not a consensus method; do not
  * get confused with the above macros.) */
diff --git a/src/feature/nodelist/fmt_routerstatus.c b/src/feature/nodelist/fmt_routerstatus.c
index 07b4e63472..e068c87c9b 100644
--- a/src/feature/nodelist/fmt_routerstatus.c
+++ b/src/feature/nodelist/fmt_routerstatus.c
@@ -58,7 +58,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
   char digest64[BASE64_DIGEST_LEN+1];
   smartlist_t *chunks = smartlist_new();
 
-  if (declared_publish_time != -1) {
+  if (declared_publish_time >= 0) {
     format_iso_time(published, declared_publish_time);
   } else if (vrs) {
     format_iso_time(published, vrs->published_on);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list