summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamian Johnson <atagar@torproject.org>2018-01-27 13:11:53 -0800
committerDamian Johnson <atagar@torproject.org>2018-01-27 13:16:47 -0800
commit76e8eb5f766639081b76d092d6ea0d784bec5f59 (patch)
tree7fe1f4b6b36d494685654332f48c1fad208682f2
parentac536965c8e053a7304f6d38f4000020833cfe37 (diff)
Consensus didn't expect shared_randomness_*_reveal_count to be present
Oops. When we re-added the shared_randomness_*_value in... https://gitweb.torproject.org/stem.git/commit/?id=d713b29 ... we didn't include the shared_randomness_*_reveal_count which are part of the same lines. These attributes *were* available when the shared_randomness_*_value was fetched first due to lazy loading, but they were unavailable before that. Caught by Tom on... https://trac.torproject.org/projects/tor/ticket/25046
-rw-r--r--docs/change_log.rst1
-rw-r--r--stem/descriptor/networkstatus.py20
2 files changed, 17 insertions, 4 deletions
diff --git a/docs/change_log.rst b/docs/change_log.rst
index fcfc0115..5a209b43 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -55,6 +55,7 @@ The following are only available within Stem's `git repository
* `Fallback directory v2 support <https://lists.torproject.org/pipermail/tor-dev/2017-December/012721.html>`_, which adds *nickname* and *extrainfo*
* Reduced maximum descriptors fetched by the remote module to match tor's new limit (:trac:`24743`)
+ * Consensus **shared_randomness_*_reveal_count** attributes undocumented, and unavailable if retrieved before their corresponding shared_randomness_*_value attribute (:trac:`25046`)
* **Website**
diff --git a/stem/descriptor/networkstatus.py b/stem/descriptor/networkstatus.py
index 9f14d4f8..3d3a33a9 100644
--- a/stem/descriptor/networkstatus.py
+++ b/stem/descriptor/networkstatus.py
@@ -826,8 +826,13 @@ class NetworkStatusDocumentV3(NetworkStatusDocument):
:var int consensus_method: method version used to generate this consensus
:var dict bandwidth_weights: dict of weight(str) => value(int) mappings
+ :var int shared_randomness_current_reveal_count: number of commitments
+ used to generate the current shared random value
:var str shared_randomness_current_value: base64 encoded current shared
random value
+
+ :var int shared_randomness_previous_reveal_count: number of commitments
+ used to generate the last shared random value
:var str shared_randomness_previous_value: base64 encoded last shared random
value
@@ -860,8 +865,15 @@ class NetworkStatusDocumentV3(NetworkStatusDocument):
required_client_protocols, and required_relay_protocols.
.. versionchanged:: 1.6.0
- The shared randomness attributes were misdocumented in the tor spec and as
- such never set. They're now an attribute of **directory_authorities**.
+ The is_shared_randomness_participate and shared_randomness_commitments
+ were misdocumented in the tor spec and as such never set. They're now an
+ attribute of votes in the **directory_authorities**.
+
+ .. versionchanged:: 1.7.0
+ The shared_randomness_current_reveal_count and
+ shared_randomness_previous_reveal_count attributes were undocumented and
+ not provided properly if retrieved before their shred_randomness_*_value
+ counterpart.
"""
ATTRIBUTES = {
@@ -888,7 +900,9 @@ class NetworkStatusDocumentV3(NetworkStatusDocument):
'required_client_protocols': ({}, _parse_required_client_protocols_line),
'required_relay_protocols': ({}, _parse_required_relay_protocols_line),
'params': ({}, _parse_header_parameters_line),
+ 'shared_randomness_previous_reveal_count': (None, _parse_shared_rand_previous_value),
'shared_randomness_previous_value': (None, _parse_shared_rand_previous_value),
+ 'shared_randomness_current_reveal_count': (None, _parse_shared_rand_current_value),
'shared_randomness_current_value': (None, _parse_shared_rand_current_value),
'signatures': ([], _parse_footer_directory_signature_line),
@@ -1025,8 +1039,6 @@ class NetworkStatusDocumentV3(NetworkStatusDocument):
self.is_shared_randomness_participate = False
self.shared_randomness_commitments = []
- self.shared_randomness_previous_reveal_count = None
- self.shared_randomness_current_reveal_count = None
self._default_params = default_params
self._header(document_file, validate)