Skip to content

Commit 8c38dac

Browse files
committed
reorg and improvements
1 parent 162f2ee commit 8c38dac

1 file changed

Lines changed: 65 additions & 31 deletions

File tree

src/Ledger/Dijkstra/Specification/Crypto.lagda.md

Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ open import Ledger.Core.Specification.Crypto hiding (CryptoStructure)
1919

2020
## Leios Voting Crypto
2121

22+
```agda
23+
record CryptoStructure : Type₁ where
24+
field pkk : PKKScheme
25+
26+
open PKKScheme pkk public
27+
28+
field
29+
⦃ khs ⦄ : isHashableSet VKey
30+
31+
open isHashableSet khs renaming (THash to KeyHash) hiding (DecEq-T) public
32+
33+
field
34+
ScriptHash : Type
35+
VRF : Type
36+
```
37+
2238
Leios ([CIP-164]) adds a second signature scheme beside the payment scheme
2339
above: an epoch's voting committee signs endorser-block announcements with
2440
registered voting keys, and a certificate compresses a quorum of votes into
@@ -30,19 +46,13 @@ scheme, so other protocol extensions that aggregate votes (Peras) can share
3046
it.
3147

3248
```agda
33-
record CryptoStructure : Type₁ where
3449
field
35-
pkk : PKKScheme
36-
37-
open PKKScheme pkk public
38-
39-
field
40-
ScriptHash : Type
41-
VRF : Type
42-
BlsVKey BlsSig BlsPoP : Type
43-
isValidPoP : BlsVKey → BlsPoP → Type
44-
isSignedBy : BlsVKey → Ser → BlsSig → Type
45-
isSignedByAggregate : List BlsVKey → Ser → BlsSig → Type
50+
BlsVKey : Type
51+
BlsPoP : Type
52+
BlsSig : Type
53+
isValidPoP : BlsVKey → BlsPoP → Type
54+
isSignedBy : BlsVKey → Ser → BlsSig → Type
55+
isSignedByAggregate : List BlsVKey → Ser → BlsSig → Type
4656
```
4757

4858
`isValidPoP`{.AgdaField} checks a key's *proof of possession*, required with
@@ -55,22 +65,6 @@ against its signers' keys. Only verification enters the rules: the ledger
5565
never creates votes or certificates, so the scheme has no signing side and no
5666
correctness law relating one.
5767

58-
<!--
59-
```agda
60-
field ⦃ khs ⦄ : isHashableSet VKey
61-
⦃ DecEq-ScriptHash ⦄ : DecEq ScriptHash
62-
⦃ Show-ScriptHash ⦄ : Show ScriptHash
63-
⦃ DecEq-VRF ⦄ : DecEq VRF
64-
⦃ DecEq-BlsVKey ⦄ : DecEq BlsVKey
65-
⦃ DecEq-BlsSig ⦄ : DecEq BlsSig
66-
⦃ DecEq-BlsPoP ⦄ : DecEq BlsPoP
67-
⦃ Dec-isValidPoP ⦄ : isValidPoP ⁇²
68-
⦃ Dec-isSignedByAggregate ⦄ : isSignedByAggregate ⁇³
69-
70-
open isHashableSet khs renaming (THash to KeyHash) hiding (DecEq-T) public
71-
```
72-
-->
73-
7468
In Leios the committee consists of a certain number of pools with the largest
7569
stake, with ties broken by pool id. Therefore the `KeyHash`{AgdaDatatype} type
7670
carries a strict total order, `_<ᵏʰ_`{.AgdaField}, analogous to the
@@ -79,10 +73,50 @@ implementation's byte-wise comparison.
7973

8074
```agda
8175
-- Byte-wise ascending order on key hashes; the Leios committee tie-break.
82-
field _<ᵏʰ_ : KeyHash → KeyHash → Type
83-
<ᵏʰ-isSTO : IsStrictTotalOrder _≡_ _<ᵏʰ_
84-
⦃ Dec-<ᵏʰ ⦄ : _<ᵏʰ_ ⁇²
76+
field
77+
_<ᵏʰ_ : KeyHash → KeyHash → Type
78+
<ᵏʰ-isSTO : IsStrictTotalOrder _≡_ _<ᵏʰ_
8579
```
8680

81+
## Leios Hashes
82+
83+
Leios also names its objects by hash: `EBHash`{.AgdaField} identifies an
84+
endorser block, `TxRefHash`{.AgdaField} a referenced transaction (the hash of
85+
the complete transaction bytes per [CIP-164] Appendix B, not the body-only
86+
transaction id), and `RBHeaderHash`{.AgdaField} the announcing ranking-block
87+
header; the last is the message a committee vote signs.
88+
`hashEBRefs`{.AgdaField} computes an endorser block's identifier from its
89+
reference list; all four stay abstract, and
90+
`Ledger.Dijkstra.Specification.Leios.Types`{.AgdaModule} records why the
91+
identifier's byte-exact preimage is deliberately unpinned.
92+
93+
```agda
94+
field
95+
EBHash : Type
96+
TxRefHash : Type
97+
RBHeaderHash : Type
98+
hashEBRefs : List (TxRefHash × ℕ) → EBHash
99+
```
100+
101+
<!--
102+
```agda
103+
field
104+
⦃ Dec-<ᵏʰ ⦄ : _<ᵏʰ_ ⁇²
105+
⦃ Dec-isSignedBy ⦄ : isSignedBy ⁇³
106+
⦃ Dec-isSignedByAggregate ⦄ : isSignedByAggregate ⁇³
107+
⦃ Dec-isValidPoP ⦄ : isValidPoP ⁇²
108+
⦃ DecEq-BlsPoP ⦄ : DecEq BlsPoP
109+
⦃ DecEq-BlsSig ⦄ : DecEq BlsSig
110+
⦃ DecEq-BlsVKey ⦄ : DecEq BlsVKey
111+
⦃ DecEq-EBHash ⦄ : DecEq EBHash
112+
⦃ DecEq-RBHeaderHash ⦄ : DecEq RBHeaderHash
113+
⦃ DecEq-ScriptHash ⦄ : DecEq ScriptHash
114+
⦃ DecEq-TxRefHash ⦄ : DecEq TxRefHash
115+
⦃ DecEq-VRF ⦄ : DecEq VRF
116+
⦃ Show-ScriptHash ⦄ : Show ScriptHash
117+
```
118+
-->
119+
120+
87121
[CIP-164]: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0164/README.md
88122
[Epoch Boundary section]: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0164/README.md#epoch-boundary

0 commit comments

Comments
 (0)