[tor-dev] tor's definition of 'median'
Nick Mathewson
nickm at alum.mit.edu
Mon Aug 10 18:44:32 UTC 2015
On Mon, Aug 10, 2015 at 1:11 PM, nusenu <nusenu at openmailbox.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Hi,
>
> https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n2028
>
>> If 3 or more authorities provide a Measured= keyword for a router,
>> the authorities produce a consensus containing a "w" Bandwidth=
>> keyword equal to the median of the Measured= votes.
>
> a random sample from recent votes:
>
> grep 37.59.38.117 -A 3 *|grep Measured
> w Bandwidth=6869 Measured=7570
> w Bandwidth=6869 Measured=15500
> w Bandwidth=6869 Measured=18100
> w Bandwidth=6869 Measured=30500
>
> Tor says the median value is
> 15500
>
> 2015-08-10-16-00-00-consensus:
> w Bandwidth=15500
>
> but the median of these 4 values is actually:
> (18100+15500)/2 = 16800
> no?
>
> Has tor a different definition of 'median' and simply takes always the
> second ordered measurement vote out of 4 votes or is there a bug in
> the spec or implementation?
There's one misplaced throwaway sentence in dir-spec.txt:
" All ties in computing medians are broken in favor of the smaller or
earlier item.
"
We should bring this, and probably other things, into a "definitions"
section earlier in dir-spec.txt. Patches welcome. ;)
--
Nick
More information about the tor-dev
mailing list