[tor-bugs] #20765 [Metrics/metrics-lib]: adapt to new lines in votes and consensus and make the adaption to protocol changes easier

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Dec 5 13:58:28 UTC 2016


#20765: adapt to new lines in votes and consensus and make the adaption to protocol
changes easier
---------------------------------+-----------------------------------
 Reporter:  iwakeh               |          Owner:  metrics-team
     Type:  enhancement          |         Status:  new
 Priority:  Medium               |      Milestone:  metrics-lib 1.6.0
Component:  Metrics/metrics-lib  |        Version:
 Severity:  Normal               |     Resolution:
 Keywords:                       |  Actual Points:
Parent ID:                       |         Points:
 Reviewer:                       |        Sponsor:
---------------------------------+-----------------------------------

Comment (by karsten):

 Replying to [comment:2 iwakeh]:
 > Replying to [comment:1 karsten]:
 > > See also #19634 here for the `shared-rand-*` lines.
 > >
 > > Regarding making these changes without compiling, I'm not certain what
 the benefit would be.  We'll have to put out a new release to make sense
 of these new lines anyway.  And we'll want to include tests.
 > >
 >
 > Yes, that's true.  Still it might be useful (especially for testing) to
 have something other than a bunch of if-else-if statements; maybe in form
 of an enum.

 Agreed, having cleaner code there would be good.  Maybe that comes
 together with rewriting that code for better performance (lazy parsing,
 better control over parsed-descriptor buffer).

 > > Speaking of, I think we accumulated enough changes for a new metrics-
 lib release in December.  Let's discuss that either here or at the next
 meeting.
 >
 > Yes, a December metrics-lib release makes sense!

 Cool!

 I started identifying the code that needs changing by throwing CollecTor's
 November tarballs into a descriptor reader and handling any unrecognized
 lines:

 {{{
 diff --git
 a/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
 b/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
 index f528033..dd5fac7 100644
 ---
 a/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
 +++
 b/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
 @@ -95,6 +95,9 @@ public class NetworkStatusEntryImpl implements
 NetworkStatusEntry {
          case "v":
            this.parseVLine(line, parts);
            break;
 +        case "pr":
 +          // TODO
 +          break;
          case "w":
            this.parseWLine(line, parts);
            break;
 diff --git
 a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
 b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
 index 2bf8e88..e0cfdb7 100644
 ---
 a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
 +++
 b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
 @@ -117,6 +117,18 @@ public class RelayNetworkStatusVoteImpl extends
 NetworkStatusImpl
          case "server-versions":
            this.parseServerVersionsLine(line, parts);
            break;
 +        case "recommended-relay-protocols":
 +          // TODO
 +          break;
 +        case "recommended-client-protocols":
 +          // TODO
 +          break;
 +        case "required-relay-protocols":
 +          // TODO
 +          break;
 +        case "required-client-protocols":
 +          // TODO
 +          break;
          case "package":
            this.parsePackageLine(line, parts);
            break;
 @@ -135,6 +147,15 @@ public class RelayNetworkStatusVoteImpl extends
 NetworkStatusImpl
          case "contact":
            this.parseContactLine(line, parts);
            break;
 +        case "shared-rand-participate":
 +          // TODO
 +          break;
 +        case "shared-rand-commit":
 +          // TODO
 +          break;
 +        case "shared-rand-current-value":
 +          // TODO
 +          break;
          case "dir-key-certificate-version":
            this.parseDirKeyCertificateVersionLine(line, parts);
            break;
 diff --git
 a/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
 b/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
 index 622e9a4..4c5b00b 100644
 ---
 a/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
 +++
 b/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
 @@ -80,6 +80,9 @@ public abstract class ServerDescriptorImpl extends
 DescriptorImpl
          case "platform":
            this.parsePlatformLine(line, lineNoOpt, partsNoOpt);
            break;
 +        case "proto":
 +          // TODO
 +          break;
          case "published":
            this.parsePublishedLine(line, lineNoOpt, partsNoOpt);
            break;
 }}}

 Note that the code above does not handle any new lines in consensuses (or
 microdesc-consensuses) that will only be added when enough votes support
 the new lines.  We'll have to look at proposals and/or dir-spec.txt.  But
 the code above might help us identify proposals that we should read.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20765#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list