Skip to content

Commit 9804808

Browse files
javierdiaz72amesgen
authored andcommitted
Add alias for type of 64-byte VRF outputs
1 parent 6770198 commit 9804808

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/agda-spec/src/Spec/BlockDefinitions.lagda

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ record BlockStructure : Type₁ where
3434
\emph{Concrete types}
3535
\begin{code}
3636
BlockNo = ℕ -- block number
37+
Certifiedℕ = ∃[ n ] n < 2 ^ 512 -- [0, 2^512) (64-byte VRF output)
3738
\end{code}
3839
\emph{Operational Certificate}
3940
\begin{AgdaSuppressSpace}
@@ -87,7 +88,7 @@ record BlockStructure : Type₁ where
8788
headerSize : BHeader → ℕ -- size of a block header
8889
slotToSeed : Slot → Seed -- big-endian encoding of the slot number in 8 bytes
8990
prevHashToNonce : Maybe HashHeader → Nonce
90-
serHashToℕ : SerHash → ∃[ n ] n < 2 ^ 512 -- [0, 2^512) (64-byte VRF output)
91+
serHashToℕ : SerHash → Certifiedℕ
9192
serHashToNonce : SerHash → Nonce
9293
\end{code}
9394
\end{AgdaAlign}

docs/agda-spec/src/Spec/Protocol.lagda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ data
9393
\begin{figure*}[h]
9494
\emph{Protocol helper functions}
9595
\begin{code}
96-
hBLeader : BHBody → ∃[ n ] n < 2 ^ 512 -- [0, 2^512)
96+
hBLeader : BHBody → Certifiedℕ
9797
hBLeader bhb = serHashToℕ (hash (encode "L" ∥ encode vrfRes))
9898
where open BHBody bhb
9999

100100
hBNonce : BHBody → Nonce
101101
hBNonce bhb = serHashToNonce (hash (encode "N" ∥ encode vrfRes))
102102
where open BHBody bhb
103103

104-
checkLeaderVal : ∃[ n ] n < 2 ^ 512 → PosUnitInterval → ℚ → Type
104+
checkLeaderVal : Certifiedℕ → PosUnitInterval → ℚ → Type
105105
checkLeaderVal (certℕ , certℕprf) (f , posf , f≤1) σ =
106106
if f ≡ 1ℚ then ⊤ else λ{f≢1ℚ} →
107107
let

0 commit comments

Comments
 (0)