Skip to content

Commit cedd091

Browse files
committed
implementation plan
1 parent 5ed16ba commit cedd091

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

docs/leios-design/README.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,12 @@ Non-persistent voters, on the other hand, are selected independently for each EB
505505
Registered voters can generate and cast votes, each including an `endorser_block_hash` field that uniquely identifies the target EB.
506506
Collected votes are then aggregated into a compact certificate.
507507

508-
#### Leios Voting in a Nutshell
508+
**Leios Voting in a Nutshell**
509509
- **Key Generation**
510510
- A secret key ($sk$) is created to generate signatures for the corresponding signature scheme.
511511
- The public key ($pk$) is securely derived from $sk$ and used to verify the corresponding signatures.
512512
- A proof of possession ($PoP$) is generated for $sk$ to ensure key ownership.
513513
> Note that keys are not rotated periodically, as forward security is not required for IBs, EBs, or votes.
514-
515514
- **Key Registration**
516515
- The registration process is responsible for storing public keys and verifying proof of possession.
517516
- Each stake pool registers with the following information:
@@ -520,17 +519,14 @@ Collected votes are then aggregated into a compact certificate.
520519
- $PoP$
521520
- A KES signature over the Pool ID, $pk$, and $PoP$
522521
- Nodes verify the $PoP$s of all received $pk$s to confirm their validity.
523-
524522
- **Voter Determination**
525523
- For each epoch, *persistent voters* are selected based on the stake distribution and participate in every election during that epoch.
526524
- Within the same epoch, *non-persistent voters* are chosen randomly and independently for each election.
527-
528525
- **Voting**
529526
- Voters sign the election ID and the EB hash with their $sk$.
530527
- Each vote includes the election ID, the EB hash, and the corresponding signature.
531528
- Persistent votes additionally include an epoch-specific identifier of the stake pool.
532529
- Non-persistent votes include the Pool ID and an eligibility signature on the election ID.
533-
534530
- **Certificate Generation**
535531
- Upon receiving votes, both voter identities and their signatures are verified.
536532
- Non-persistent votes are further validated for eligibility.
@@ -541,7 +537,8 @@ Collected votes are then aggregated into a compact certificate.
541537
- Eligibility proofs for non-persistent voters
542538
- An aggregate signature combining all individual voter signatures
543539

544-
#### Requirements
540+
**Requirements**
541+
545542
The voting and certificate scheme in Leios must satisfy key requirements to ensure security, efficiency, and practical deployability.
546543

547544
Key registration should be lightweight, requiring minimal data exchange or coordination among participants.
@@ -563,7 +560,7 @@ The large size of Praos KES signatures makes them unsuitable, highlighting the n
563560
Lastly, the cryptographic operations for eligibility verification, vote generation, and certificate validation must be highly efficient.
564561
The total workload should stay well within the CPU budget for Leios stages, ensuring strong performance and scalability under real-world conditions.
565562

566-
#### Design Choices
563+
**Design Choices**
567564

568565
Several certificate schemes were evaluated for Leios, including ALBA variants, SNARK-based voting schemes, and BLS-based certificates, with the goal of identifying a design that best satisfies the security, efficiency, and deployability requirements described above.
569566
After comparison, BLS certificates based on the *Fait Accompli* sortition scheme were selected as the preferred approach.
@@ -577,6 +574,42 @@ This approach is advantageous because it enables the aggregation of public keys
577574
Beyond Leios, the BLS mechanism is also relevant to other Cardano subsystems; Mithril already employs BLS-based aggregation, and Peras is expected to adopt a similar approach in future implementations.
578575

579576
#### Implementation Plan
577+
To implement the linear Leios design, efficient BLS signature functionality is essential for achieving fast and compact certificate generation.
578+
With the adoption of [CIP-0381](https://cips.cardano.org/cip/CIP-0381), `cardano-base` already provides foundational utilities for BLS operations, offering a solid basis for this integration.
579+
Building on these capabilities, the implementation plan introduces additional bindings and helper modules to ensure smooth interaction with the Leios protocol within the Haskell node.
580+
581+
This section presents the implementation plan for extending `cardano-base` with BLS signature support and outlines the modifications required to satisfy Leios-specific needs.
582+
The requirements are organized into two main categories: **core functionality**, which defines the essential BLS operations needed, and **performance and quality**, which ensures the implementation meets the expected efficiency, reliability, and maintainability standards.
583+
584+
**Core functionality**
585+
- **BLS types:** The `BLS12_381.Internal` module in `cardano-base` already provides a comprehensive set of types designed for safe interaction with the linked C functions from the `blst` library. As part of the integration effort, it is necessary to evaluate which additional types should be introduced beyond those already defined, ensuring full support for the BLS functionality required by Leios.
586+
- **Key generation:**
587+
- Secure key generation must ensure strong randomness and resilience against side-channel attacks. To achieve this, an integration with the `blst` library through a FFI is required. This involves adding the necessary foreign function imports to the `BLS12_381.Internal` module and implementing the corresponding `SecretKey` type to enable safe and efficient handling of secret keys within the Haskell environment.
588+
- The `blst` library exposes a key-generation function [`blst_keygen`](https://github.com/supranational/blst/blob/e7f90de551e8df682f3cc99067d204d8b90d27ad/bindings/blst.h#L330)
589+
```C
590+
void blst_keygen(blst_scalar *out_SK, const byte *IKM, size_t IKM_len, const byte *info DEFNULL, size_t info_len DEFNULL);
591+
```
592+
which derives a secret key from input keying material (IKM) and optional `info`. To use this safely in `cardano-base`, we need to clarify the security guarantees of this construction: what qualifies as a cryptographically secure IKM (length, entropy, generation source) and how `info` should be used (additional entropy vs. domain/context bytes). In parallel, we should examine how `cardano-base` currently sources seeds for other schemes in the `DSIGN` class, review the `blst` keygen C implementation to assess robustness and side-channel posture, align our requirements with the IETF BLS draft’s guidance on key generation (see the “KeyGen” section in the CFRG draft), and determine whether `info` is treated as entropy input or merely contextual/domain-separation data; documenting these findings will let us standardize secure IKM generation and `info` usage for BLS within `cardano-base`.
593+
- **Proof-of-Possession:** The `blst` C library does not provide a direct interface for generating a proof of possession ($PoP$). Therefore, this functionality must be implemented manually in `cardano-base`, leveraging the existing `blst` bindings to construct a $PoP$ from the available primitives.
594+
- **Public key derivation:** Implement deterministic derivation of the public key ($pk$) from the corresponding secret key ($sk$) for the selected BLS variant. This requires adding a FFI binding to the `blst` library to enable secure and efficient key derivation within `cardano-base`.
595+
- **Signature:** Implement signature generation and verification APIs that are variant-agnostic and support domain separation, with DST provided by the caller.
596+
- **Aggregation**
597+
- **Batch verification**
598+
- **DSIGN integration**
599+
- **Serialization**
600+
- **Conformance vectors**
601+
602+
**Performance and quality**
603+
- **Performance benchmarks**
604+
- **Rust parity**
605+
- **Determinism portability**
606+
- **Documentation**
607+
608+
**Other utilities**
609+
- **Registration**
610+
- **Fa sortition**
611+
- **Local sortition**
612+
- ...
580613

581614
#### BLS12-381 Integration (New)
582615

0 commit comments

Comments
 (0)