162-consensus-flavors.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. Filename: 162-consensus-flavors.txt
  2. Title: Publish the consensus in multiple flavors
  3. Author: Nick Mathewson
  4. Created: 14-May-2009
  5. Target: 0.2.2
  6. Status: Open
  7. Overview:
  8. This proposal describes a way to publish each consensus in
  9. multiple simultaneous formats, or "flavors". This will reduce the
  10. amount of time needed to deploy new consensus-like documents, and
  11. reduce the size of consensus documents in the long term.
  12. Motivation:
  13. In the future, we will almost surely want different fields and
  14. data in the network-status document. Examples include:
  15. - Publishing hashes of microdescriptors instead of hashes of
  16. full descriptors (Proposal 158).
  17. - Including different digests of descriptors, instead of the
  18. perhaps-soon-to-be-totally-broken SHA1.
  19. Note that in both cases, from the client's point of view, this
  20. information _replaces_ older information. If we're using a
  21. SHA256 hash, we don't need to see the SHA1. If clients only want
  22. microdescriptors, they don't (necessarily) need to see hashes of
  23. other things.
  24. Our past approach to cases like this has been to shovel all of
  25. the data into the consensus document. But this is rather poor
  26. for bandwidth. Adding a single SHA256 hash to a consensus for
  27. each router increases the compressed consensus size by 47%. In
  28. comparison, replacing a single SHA1 hash with a SHA256 hash for
  29. each listed router increases the consensus size by only 18%.
  30. Design in brief:
  31. Let the voting process remain as it is, until a consensus is
  32. generated. With future versions of the voting algorithm, instead
  33. of just a single consensus being generated, multiple consensus
  34. "flavors" are produced.
  35. Consensuses (all of them) include a list of which flavors are
  36. being generated. Caches fetch and serve all flavors of consensus
  37. that are listed, regardless of whether they can parse or validate
  38. them, and serve them to clients. Thus, once this design is in
  39. place, we won't need to deploy more cache changes in order to get
  40. new flavors of consensus to be cached.
  41. Clients download only the consensus flavor they want.
  42. A note on hashes:
  43. Everything in this document is specified to use SHA256, and to be
  44. upgradeable to use better hashes in the future.
  45. Spec modifications:
  46. 1. URLs and changes to the current consensus format.
  47. Every consensus flavor has a name consisting of a sequence of one
  48. or more alphanumeric characters and dashes. For compatibility
  49. current descriptor flavor is called "ns".
  50. The supported consensus flavors are defined as part of the
  51. authorities' consensus method.
  52. For each supported flavor, every authority calculates another
  53. consensus document of as-yet-unspecified format, and exchanges
  54. detached signatures for these documents as in the current consensus
  55. design.
  56. In addition to the consensus currently served at
  57. /tor/status-vote/(current|next)/consensus.z , authorities serve
  58. another consensus of each flavor "F" from the location
  59. /tor/status-vote/(current|next)/F/consensus.z.
  60. When caches serve these documents, they do so from the same
  61. locations.
  62. 2. Document format: generic consensus.
  63. The format of a flavored consensus is as-yet-unspecified, except
  64. that the first line is:
  65. "network-status-version" SP version SP flavor NL
  66. where version is 3 or higher, and the flavor is a string
  67. consisting of alphanumeric characters and dashes, matching the
  68. corresponding flavor listed in the unflavored consensus.
  69. 3. Document format: detached signatures.
  70. In addition to the current detached signature format, we allow
  71. the first line to take the form,
  72. "consensus-digest" SP flavor SP 1*(Algname "=" Digest) NL
  73. The consensus-signatures URL should contain the signatures
  74. for _all_ flavors of consensus.
  75. 4. The consensus index:
  76. Authorities additionally generate and serve a consensus-index
  77. document. Its format is:
  78. Header ValidAfter ValidUntil Documents Signatures
  79. Header = "consensus-index" SP version NL
  80. ValidAfter = as in a consensus
  81. ValidUntil = as in a consensus
  82. Documents = Document*
  83. Document = "document" SP flavor SP SignedLength
  84. 1*(SP AlgorithmName "=" Digest) NL
  85. Signatures = Signature*
  86. Signature = "directory-signature" SP algname SP identity
  87. SP signing-key-digest NL signature
  88. There must be one Document line for each generated consensus flavor.
  89. Each Document line describes the length of the signed portion of
  90. a consensus (the signatures themselves are not included), along
  91. with one or more digests of that signed portion. Digests are
  92. given in hex. The algorithm "sha256" MUST be included; others
  93. are allowed.
  94. The algname part of a signature describes what algorithm was
  95. used to hash the identity and signing keys, and to compute the
  96. signature. The algorithm "sha256" MUST be recognized;
  97. signatures with unrecognized algorithms MUST be ignored.
  98. (See below).
  99. The consensus index is made available at
  100. /tor/status-vote/(current|next)/consensus-index.z.
  101. Caches should fetch this document so they can check the
  102. correctness of the different consensus documents they fetch.
  103. They do not need to check anything about an unrecognized
  104. consensus document beyond its digest.
  105. 4.1. The "sha256" signature format.
  106. The 'SHA256' signature format for directory objects is defined as
  107. the RSA signature of the OAEP+-padded SHA256 digest of the SHA256
  108. digest of the item to be signed. When checking signatures,
  109. the signature MUST be treated as valid if the signature material
  110. begins with SHA256(SHA256(document)); this allows us to add other
  111. data later.
  112. Considerations:
  113. - We should not create a new flavor of consensus when adding a
  114. field instead wouldn't be too onerous.
  115. - We should not proliferate flavors lightly: clients will be
  116. distinguishable based on which flavor they download.
  117. Migration:
  118. - Stage one: authorities begin generating and serving
  119. consensus-index files.
  120. - Stage two: Caches begin downloading consensus-index files,
  121. validating them, and using them to decide what flavors of
  122. consensus documents to cache. They download all listed
  123. documents, and compare them to the digests given in the
  124. consensus.
  125. - Stage three: Once we want to make a significant change to the
  126. consensus format, we deploy another flavor of consensus at the
  127. authorities. This will immediately start getting cached by the
  128. caches, and clients can start fetching the new flavor without
  129. waiting a version or two for enough caches to begin supporting
  130. it.
  131. Acknowledgements:
  132. Aspects of this design and its applications to hash migration were
  133. heavily influenced by IRC conversations with Marian.