Skip to content

Auditing: Widen tranche-escalation comparand to 16 bits#534

Open
philoniare wants to merge 1 commit into
gavofyork:mainfrom
philoniare:widen-audit-escalation
Open

Auditing: Widen tranche-escalation comparand to 16 bits#534
philoniare wants to merge 1 commit into
gavofyork:mainfrom
philoniare:widen-audit-escalation

Conversation

@philoniare

Copy link
Copy Markdown

Issue: The later-tranche audit rule (auditing.tex, eq. latertranches) compares a single byte of VRF output against the no-show count. The bias factor defined right under it is F = 2 — "the expected number of validators … required to issue a judgment … given a single no-show." A single byte can't actually deliver 2: at one no-show only the byte value 0 passes the test, so the mean number summoned is 1023/256 ≈ 3.996, about double. It's not a rounding thing either — with one byte every reachable mean is a multiple of 1023/256 ≈ 3.996, and 2 isn't on that grid.

Fix: decode bytes 0–1 of the same VRF output as a little-endian u16.

Explanation:
correction.pdf

POC — exact, by enumeration:

from fractions import Fraction
V, F = 1023, 2
def expected_summons(bits, m):
    space = 2 ** bits
    q = sum(1 for r in range(space) if Fraction(V * r, space * F) < m)
    return V * Fraction(q, space)
assert expected_summons(8, 1)  == Fraction(1023, 256)       # 3.996
assert expected_summons(16, 1) == Fraction(131967, 65536)   # 2.014

The later-tranche audit selector (eq. latertranches) compares a single
byte of VRF output against the no-show count. The smallest realisable
non-zero expectation is therefore |kappa|/256 ~ 3.996 summoned validators
per no-show -- roughly twice the defined bias factor F = 2, which is not
representable at byte granularity.

Decode bytes 0..1 of the same VRF output as a 16-bit little-endian
integer and scale by 2^16; the expected summons at a single no-show
becomes 1023 * 129 / 65536 ~ 2.014. No new cryptography -- the byte is
already present in the 32-byte output. F and all other behaviour are
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant