Skip to content

[WIP] CIP draft #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 162 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
313b664
docs(cip): add protocol overview and ledger design section
will-break-it Jun 10, 2025
a882ba6
Update docs/cip/README.md
will-break-it Jun 12, 2025
b68571d
cip: apply review
will-break-it Jun 12, 2025
58ab653
Fix a few typos
ch1bo Jun 12, 2025
4e0b55a
Introduce a two phased approach as part of specification
ch1bo Jun 12, 2025
13c2b35
Re-organize and sketh specification section
ch1bo Jun 17, 2025
5d55a1b
CDDL (#420)
will-break-it Jun 23, 2025
c450c76
Ledger Design CDDL (Over-collateralized & Sharded Reward Account) (#424)
will-break-it Jun 26, 2025
1d143da
docs: added linear & eb-only cddls
will-break-it Jul 10, 2025
840aac0
cip: add CDDL specification (linear)
will-break-it Jul 15, 2025
4d12b5a
cip: add CDDL specification descriptions
will-break-it Jul 15, 2025
f64f25f
cip: clean up & ordering sections
will-break-it Jul 15, 2025
96bfeb4
cip: non-normative overiew of protocol
will-break-it Jul 15, 2025
339c4df
cip: non-normative key constraints of protocol
will-break-it Jul 15, 2025
9919677
cip(fix): github markdown formula error for underscore use
will-break-it Jul 15, 2025
d19f645
docs(cip): simplified protocol overview
will-break-it Jul 19, 2025
d17020c
docs(cip): rephrase EB
will-break-it Jul 19, 2025
f360cf0
docs(cip): introduce acronyms only once
will-break-it Jul 19, 2025
65284f0
docs(cip): add protocol flow
will-break-it Jul 19, 2025
2fe160e
docs(cip): fix image anchor
will-break-it Jul 19, 2025
9951487
docs(cip): fix formula
will-break-it Jul 19, 2025
a07257a
docs(cip): fix formula
will-break-it Jul 19, 2025
0ae3cf8
docs(cip): update protocol flow
will-break-it Jul 19, 2025
f0692b6
docs: update README and protocol flow diagram
will-break-it Jul 20, 2025
d33434d
docs(cip): fix use of acronym
will-break-it Jul 20, 2025
4f75ee0
docs(cip): add RB, EB size
will-break-it Jul 20, 2025
4f5cdb1
docs(cip): align CDDLs
will-break-it Jul 20, 2025
ef4fcc8
docs(cip): typo
will-break-it Jul 20, 2025
a4c5c4e
docs(cip): add thoughts for sections mini-protocols; node changes; me…
will-break-it Jul 20, 2025
1280a09
docs(cip): add thoughts for invenctives given GH discussion
will-break-it Jul 20, 2025
4e95882
docs(cip): reorder parameters based on interdependency
will-break-it Jul 21, 2025
6b2404f
docs(cip): add back diff for RB
will-break-it Jul 21, 2025
07fc3b2
docs(cip): move up protocol flow figure
will-break-it Jul 21, 2025
a3ba1d1
docs(cip): updated protocol flow figure
will-break-it Jul 21, 2025
5260cfd
docs(cip): remove f_EB as it is linked to f_RB
will-break-it Jul 21, 2025
fdcedc7
docs(cip): add mini protocols; add collapsable for CDDLs; simplified …
will-break-it Jul 21, 2025
aa572a8
docs(cip): update mini protocols sections;
will-break-it Jul 21, 2025
f76ed5c
docs(cip): add note for realistic EB inclusion rates
will-break-it Jul 21, 2025
1ae4799
docs(cip): test formula rendering
will-break-it Jul 21, 2025
543040c
docs(cip): remove glossary until needed; fix headline links
will-break-it Jul 21, 2025
25a7ce1
docs(cip): shorten mini protocols
will-break-it Jul 21, 2025
3483f52
docs(cip): add chain sync figure and description
will-break-it Jul 21, 2025
382d9b0
docs(cip): reduce repetitivness in mini protocols
will-break-it Jul 22, 2025
34c7523
docs: update cddls for eb announcement (linear leios); refactor netwo…
will-break-it Jul 22, 2025
f7faa2d
docs(haskell): mini protocols draft
will-break-it Jul 22, 2025
744c61e
docs(cip): refactoring mini protocols
will-break-it Jul 22, 2025
25b926c
docs(cip): refactored specification protocol overview & flow; add net…
will-break-it Jul 24, 2025
50ba2d3
docs(cip): remove appendix for crypto benchmarks of certs & votes; mo…
will-break-it Jul 24, 2025
a93b0f3
docs(cip): fix headline anchors
will-break-it Jul 24, 2025
c708e68
docs(cip): tx refs
will-break-it Jul 24, 2025
ec51ff1
docs(cip): headline order
will-break-it Jul 24, 2025
96b74fe
docs(cip): headline order/ anchoring
will-break-it Jul 24, 2025
e71bec5
docs(cip): remove L_eb; L_val and L_txfetch
will-break-it Jul 24, 2025
f4fcb0c
Update rationale "how" and comment out analogies
ch1bo Jul 21, 2025
275dbbc
Add a "why not more concurrency" to rationale
ch1bo Jul 21, 2025
58b0197
Updated section on why practical to implement
ch1bo Jul 22, 2025
f523e2f
Move bottom line into rationale and mention chain growth
ch1bo Jul 22, 2025
a2a7520
Rationale of avoiding high latency
ch1bo Jul 22, 2025
091d806
Formulate high concurrency paragraph
ch1bo Jul 22, 2025
5b41603
Merge and re-order rationale sections according to feedback
ch1bo Jul 22, 2025
748af2e
Add myself as author
ch1bo Jul 22, 2025
589f763
Add reviewer feedback
ch1bo Jul 24, 2025
dca3071
docs(cip): draft node behavior
will-break-it Jul 25, 2025
0be54ff
docs(cip): use same format for tau as for L
will-break-it Jul 25, 2025
6109e37
docs(cip): fix caution
will-break-it Jul 25, 2025
99a0b3b
docs(cip): fix warning
will-break-it Jul 25, 2025
af3b9ac
docs(cip): fix warning
will-break-it Jul 25, 2025
0684878
docs(cip): made sequence diagram less redundant + more compact
will-break-it Jul 25, 2025
0a66503
docs(cip): updated sequence diagram size
will-break-it Jul 25, 2025
8953138
docs(cip): updated sequence diagram
will-break-it Jul 25, 2025
6f871dd
docs(cip): add Nick and Giorgos as co-authors
will-break-it Jul 30, 2025
e41a9cb
docs(cip): refactor node behavior
will-break-it Aug 1, 2025
a38b0af
docs(cip): add single vote constraint per EB in case of multiple avai…
will-break-it Aug 1, 2025
cd55a88
docs(cip): add requested changes by review
will-break-it Aug 1, 2025
551d8d2
docs(cip): refactor node behavior
will-break-it Aug 1, 2025
22f9fce
docs(cip): add vote bundling remark
will-break-it Aug 4, 2025
7c22148
docs(cip): replace CDDL for vote bundling
will-break-it Aug 4, 2025
302e4e5
docs(cip): update node behavior section
will-break-it Aug 4, 2025
8dd991b
docs(cip): update mini protocols from monthly review table
will-break-it Aug 4, 2025
da7fd71
docs(cip): remove n2c mentions
will-break-it Aug 4, 2025
86d2539
docs(cip): add rbheader relay mini protocol section
will-break-it Aug 4, 2025
de4626c
Added pseudo-/mini-mainnet paragraph to CIP. (#480)
bwbush Aug 4, 2025
b0ceee3
docs(cip): remove n2c mentions
will-break-it Aug 4, 2025
ddc004f
docs(cip): address Brian feedback; include voting/ certification sche…
will-break-it Aug 4, 2025
b567c09
docs(cip): add rbheaderrelay draft
will-break-it Aug 4, 2025
2de4285
docs(cip): clarify RB header fields
will-break-it Aug 4, 2025
4089077
docs(cip): add changes for Yuriy review
will-break-it Aug 4, 2025
7a5e1f3
docs(cip): refactor sequence diagram based on Sebastians review; add …
will-break-it Aug 4, 2025
02e87a8
docs(cip): clarify sequence steps for serving EBs after fetching txs
will-break-it Aug 4, 2025
d4fc60b
docs(cip): remove implementation considerations
will-break-it Aug 5, 2025
65c1302
docs(cip): node behavior steps descriptions
will-break-it Aug 5, 2025
2c9fbaf
docs(cip): node behavior steps descriptions - step 2
will-break-it Aug 5, 2025
692d64f
docs(cip): node behavior steps descriptions - step 4
will-break-it Aug 5, 2025
6ab4156
docs(cip): epoch boundary bheavio
will-break-it Aug 5, 2025
db1b3cd
docs(cip): node behavior steps descriptions - merge step 7/8
will-break-it Aug 5, 2025
64505f4
docs(cip): node behavior steps descriptions - merge step 11
will-break-it Aug 5, 2025
f31ea60
docs(cip): node behavior steps descriptions - step 9
will-break-it Aug 5, 2025
16fbbcd
docs(cip): node behavior steps descriptions - step 9
will-break-it Aug 5, 2025
1a2b6fe
docs(cip): protocol overview - match 5 voting requirements
will-break-it Aug 5, 2025
5ae56c7
docs(cip): validation dependency
will-break-it Aug 5, 2025
1991def
docs(cip): node behavior steps descriptions - step 6
will-break-it Aug 5, 2025
25c410c
Changes done by SN and WW on hackmd
ch1bo Aug 5, 2025
aa5c1b7
docs(cip): rbheaderrelay minimal
will-break-it Aug 5, 2025
82caa2c
docs(cip): integrated review for protocol overview, flow, components …
will-break-it Aug 5, 2025
5f10438
docs(cip): update votes and certificates
will-break-it Aug 5, 2025
a0096b7
docs(cip): update votes and certificates
will-break-it Aug 5, 2025
a1eee84
docs(cip): update votes and certificates
will-break-it Aug 5, 2025
96022be
docs(cip): fix appendix
will-break-it Aug 5, 2025
b59225c
docs(cip): fix appendix
will-break-it Aug 5, 2025
cf95e50
docs(cip): fix appendix
will-break-it Aug 5, 2025
cf80092
docs(cip): fix appendix & cddls
will-break-it Aug 5, 2025
0460e16
docs(cip): fix cddls
will-break-it Aug 5, 2025
1647291
docs(cip): update node behavior with integrated steps description; cl…
will-break-it Aug 6, 2025
8aaf1a9
docs(cip): fix anchor naming
will-break-it Aug 6, 2025
17a0bfe
docs(cip): add eb chain selection paragraph
will-break-it Aug 6, 2025
f55ff59
docs(cip): fix paragraph grammar
will-break-it Aug 6, 2025
258cd1f
docs(cip): add Fiat Accompli reference
will-break-it Aug 6, 2025
c538935
docs(cip): minor fix
will-break-it Aug 6, 2025
70deb7b
docs(cip): remove state machine svgs
will-break-it Aug 6, 2025
60a9e38
docs(cip): remove mini protocol md doc from PR
will-break-it Aug 6, 2025
96fc648
docs(cip): fix link
will-break-it Aug 6, 2025
5b6fcc8
docs(cip): add reviewers to CIP authors
will-break-it Aug 7, 2025
7c76fff
docs(cip): add 4th rule for inclusion of empty EBs; update EB delta d…
will-break-it Aug 12, 2025
d861440
docs(cip): integrate dual mode for protocol
will-break-it Aug 12, 2025
dc5b8ad
docs(cip): update protocol flow mode
will-break-it Aug 12, 2025
a9ef8df
docs(cip): update protocol flow mode
will-break-it Aug 12, 2025
c70e6d2
docs(cip): fix link
will-break-it Aug 12, 2025
2311c54
docs(cip): test svg links
will-break-it Aug 12, 2025
ee4e766
docs(cip): add interactive links for svg components to CIP sections
will-break-it Aug 12, 2025
1abdf05
CIP/Rationale & Motivation (#487)
will-break-it Aug 12, 2025
7fe3f54
docs(cip): add table of figures/ tables
will-break-it Aug 12, 2025
c68d9a6
docs(cip): rename modes
will-break-it Aug 13, 2025
c86a397
docs(cip): clarify corrections with reference
will-break-it Aug 13, 2025
cfd0418
docs(cip): update mode transition descriptions
will-break-it Aug 13, 2025
c4e47c5
docs(cip): update note
will-break-it Aug 13, 2025
dad02e9
docs(cip): update acronyms
will-break-it Aug 13, 2025
26e5e06
docs(cip): fix hashes to transaction ids
will-break-it Aug 13, 2025
4a92d3e
docs(cip): update protocol parameters table to include L_recover
will-break-it Aug 13, 2025
1bac91a
docs(cip): update legends for protocol flow
will-break-it Aug 13, 2025
27bca0b
docs(cip): clarify corrections
will-break-it Aug 13, 2025
4b53bcf
Linear Leios simulation text and figures for CIP (#490)
bwbush Aug 13, 2025
3513fcd
docs(cip): add bitmap size constraints
will-break-it Aug 14, 2025
94a5423
docs(cip): add bitmap size constraints
will-break-it Aug 14, 2025
ea248ce
docs(cip): remove preprod min tx size since we mainnet
will-break-it Aug 14, 2025
75855e9
docs(cip): add bitmap size constraints (#494)
will-break-it Aug 14, 2025
18dde0e
docs(cip): reference mainnet min tx
will-break-it Aug 14, 2025
61f698e
docs(cip): merged corrections PR
will-break-it Aug 14, 2025
c4c04e6
docs(cip): fix mainnet min tx size reference
will-break-it Aug 14, 2025
63a77ca
doc(cip): update figures for L_recover specification approach
will-break-it Aug 14, 2025
e84c8e0
docs(cip): refactor specification for L_recover
will-break-it Aug 14, 2025
8034766
docs(cip): update figures
will-break-it Aug 14, 2025
9e59ae8
docs(cip): add EB availability limitations
will-break-it Aug 14, 2025
ec3ae79
Cip/l recover (#496)
will-break-it Aug 15, 2025
98f10d6
docs(cip): trim to two key factors
will-break-it Aug 15, 2025
d5be1fb
docs(cip): fix formula in subcaption
will-break-it Aug 15, 2025
ff5aa72
docs(cip): fix pp section
will-break-it Aug 15, 2025
0bd85df
docs(cip): fix pp section
will-break-it Aug 15, 2025
0800fb9
docs(cip): integrate Nicks feedback on node behavior
will-break-it Aug 15, 2025
1c63a75
docs(cip): draft incentives
will-break-it Aug 15, 2025
dbcb255
docs(cip): fix section headline
will-break-it Aug 15, 2025
abeaeae
docs(cip): add node behavior sequence svg
will-break-it Aug 15, 2025
2fc40df
docs(cip): update node behavior sequence svg
will-break-it Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions analysis/profitability-leios.ipynb

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions docs/cddl/diffs/common/endorser-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Endorser Blocks - Leios CDDL

Endorser Blocks (EBs) are new block types in Leios that aggregate multiple Input Blocks from the current pipeline.

## Endorser Block Sortition

**Single EB Limit**: Each producer can generate **at most one Endorser Block per pipeline**, following the crypto-benchmarks implementation approach rather than the full Poisson sortition used in simulations.

**VRF Lottery**: Eligibility uses the simplified probability model:

$$P = 1 - e^{-f_{EB} \cdot \sigma}$$

Where $f_{EB}$ is the per-pipeline EB generation rate and $\sigma$ is the producer's stake fraction.

> [!Important]
> **Precision Requirements**: This computation MUST be performed using machine precision-independent arithmetic to ensure deterministic results across all implementations. The exponential function SHALL be computed using rational arithmetic (e.g., `num_rational::Ratio<BigInt>`) with a Taylor series expansion to a predefined precision (minimum 34 decimal places as implemented in crypto-benchmarks). This prevents floating-point precision variations between different hardware architectures and ensures consensus consistency.

Sources: [Crypto-benchmarks Sortition](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/Specification.md#L63-L65), [Rust Simulation EB Generation](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/sim/node.rs#L606-L641), [Rational Arithmetic Implementation](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/sortition.rs#L1-L25), [Technical Report - Deterministic Computation](https://github.com/input-output-hk/ouroboros-leios/blob/main/docs/technical-report-1.md?plain=1#L510-L513)

## Block Structure

```diff
+ endorser_block =
+ [ eb_header : eb_header
+ , eb_body : eb_body
+ ]
```

## Header Structure

```diff
+ eb_header =
+ [ eb_header_body : eb_header_body
+ , body_signature : kes_signature
+ ]
+
+ eb_header_body =
+ [ slot : slot_no ; Slot when EB was created
+ , producer : pool_id ; Block producer identifier
+ , ? vrf_proof : vrf_cert ; VRF proof of eligibility to produce EB
+ ]
```
Sources: [Haskell Simulation EndorserBlock](https://github.com/input-output-hk/ouroboros-leios/blob/main/simulation/src/LeiosProtocol/Common.hs#L160-L171), [Rust Simulation EndorserBlock](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/model.rs#L167-L176), [Formal Spec EndorserBlockOSig](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Blocks.agda#L97-L106)

## Body Structure

**Design Rationale**: The block references are separated into the body to align with the network protocol design. At high TPS, the combined size of IB and EB references could exceed TCP MTU, making separate header/body transmission essential for efficient network diffusion.

```diff
+ eb_body =
+ [ input_blocks : [* ib_reference] ; References to input blocks
+ , ? endorser_blocks : [* eb_reference] ; References to earlier endorser blocks (Full Leios)
+ ]
```
Sources: [Network Specification - Relay Protocol](https://github.com/input-output-hk/ouroboros-leios/blob/main/docs/technical-report-2.md#relay-mini-protocol), [Network Specification - Fetch Protocol](https://github.com/input-output-hk/ouroboros-leios/blob/main/docs/technical-report-2.md#fetch-mini-protocol)

## Input Block Reference Structure

```diff
+ ; References to input blocks within endorser blocks
+ ib_reference = hash32 ; Hash identifier of the input block
```

**Design Rationale**: IB references contain only the hash identifier, following the principle that references should include only what's needed for unique identification. Producer and slot information can be obtained by fetching the block header when needed. This aligns with the formal specification's `IBRef = Hash` approach.

Sources: [Haskell Simulation - InputBlockId](https://github.com/input-output-hk/ouroboros-leios/blob/main/simulation/src/LeiosProtocol/Common.hs#L100-L105), [Rust Simulation - InputBlockId](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/model.rs#L98-L105), [Formal Spec - IBRef](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Blocks.agda#L33), [Formal Spec - ibRefs](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Blocks.agda#L101)

## Endorser Block Reference Structure

```diff
+ ; References to earlier endorser blocks (for Full Leios)
+ eb_reference = hash32 ; Hash identifier of the endorser block
```
Sources: [Haskell Simulation](https://github.com/input-output-hk/ouroboros-leios/blob/main/simulation/src/LeiosProtocol/Common.hs#L161-L163), [Rust Simulation](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/model.rs#L148-L152), [Formal Spec](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Blocks.agda#L34)

## Supporting Types

```diff
+ pool_id = bytes .size 28 ; Stake pool identifier (28 bytes)
+ slot_no = uint64 ; Slot number
+ hash32 = bytes .size 32 ; 32-byte hash
+ vrf_cert = bytes ; VRF certificate/proof
+ kes_signature = bytes ; KES signature
```

## Next
**→ [Input Block - CDDL](input-blocks.md)**
55 changes: 55 additions & 0 deletions docs/cddl/diffs/common/input-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Input Blocks - Leios CDDL

**Single IB Limit**: Each producer can generate **at most one Input Block per slot**, following the crypto-benchmarks implementation approach rather than the full Poisson sortition used in simulations.

**VRF Lottery**: Eligibility uses the simplified probability model:

$$P = 1 - e^{-f_{IB} \cdot \sigma}$$

Where $f_{IB}$ is the per-slot IB generation rate and $\sigma$ is the producer's stake fraction.

Sources: [Crypto-benchmarks Sortition](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/Specification.md?plain=1#L64), [Rust Simulation IB Generation](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/sim/node.rs#L561-L597)

## Block Structure

```diff
+ input_block =
+ [ ib_header : ib_header
+ , transaction_bodies : [* transaction_body]
+ , transaction_witness_sets : [* transaction_witness_set]
+ , auxiliary_data_set : {* transaction_index => auxiliary_data}
+ , invalid_transactions : [* transaction_index]
+ ]
```
Sources: [Formal Spec](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Blocks.agda#L40-L57), [Haskell Simulation](https://github.com/input-output-hk/ouroboros-leios/blob/main/simulation/src/LeiosProtocol/Common.hs#L138-L142), [Rust Simulation](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/model.rs#L136-L141)

## Header Structure

```diff
+ ib_header =
+ [ ib_header_body : ib_header_body
+ , body_signature : kes_signature
+ ]
+
+ ib_header_body =
+ [ slot : slot_no ; Slot when IB was created
+ , producer_id : pool_id ; Block producer identifier
+ , vrf_proof : vrf_cert ; VRF proof of eligibility to produce IB
+ , ranking_block_ref : hash32 ; Reference to ranking block for ledger state
+ ]
```
Sources: [Formal Spec](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Blocks.agda#L40-L45), [Haskell Simulation](https://github.com/input-output-hk/ouroboros-leios/blob/main/simulation/src/LeiosProtocol/Common.hs#L114-L124), [Rust Simulation](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/model.rs#L127-L133)

## Supporting Types

```diff
+ ; Block identifiers
+ ib_id = hash32 ; Input block identifier (hash)
+
+ ; Basic types
+ pool_id = bytes ; Pool/producer identifier
+ slot_no = uint64 ; Slot number
+ hash32 = bytes .size 32 ; 32-byte hash
+ vrf_cert = bytes ; VRF certificate/proof
+ kes_signature = bytes ; KES signature
```
20 changes: 20 additions & 0 deletions docs/cddl/diffs/common/ranking-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Ranking Blocks - Leios CDDL

Ranking Blocks (RBs) are extended Praos blocks that include optional Leios certificates.

## Block Structure - (Conway) Extension

```diff
ranking_block =
[ header : block_header
, transaction_bodies : [* transaction_body]
, transaction_witness_sets : [* transaction_witness_set]
, auxiliary_data_set : {* transaction_index => auxiliary_data}
, invalid_transactions : [* transaction_index]
+ , ? leios_cert : leios_certificate
]
```
Sources: [Conway Base](https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl#L8-L14), [Leios Base](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Base.agda#L21-L22)

## Next
**→ [Votes and Certificates - CDDL](votes-certificates.md)**
106 changes: 106 additions & 0 deletions docs/cddl/diffs/common/votes-certificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Votes and Certificates - Leios CDDL

Leios introduces a new BLS-based voting system with certificates for endorser block validation.

## Certificate Structure

Leios certificates are embedded in Ranking Blocks as described in [Ranking Block - CDDL](ranking-blocks.md). These certificates attest to the validity of Endorser Blocks as described in [Endorser Block - CDDL](endorser-blocks.md). Here is the complete certificate structure:

```cddl
; Complete Leios certificate structure (from crypto-benchmarks implementation)
leios_certificate =
[ election_id : election_id ; 8-byte election identifier (EID)
, endorser_block_hash : hash32 ; Hash of the endorsed block (EB)
, persistent_voters : [* persistent_voter_id] ; Set of persistent voter IDs
, nonpersistent_voters : {* pool_id => bls_signature} ; Non-persistent voters with eligibility proofs
, ? aggregate_elig_sig : bls_signature ; Aggregate eligibility signature (present when non-persistent voters exist)
, aggregate_vote_sig : bls_signature ; Aggregate BLS signature on (election_id || endorser_block_hash)
]
```
Sources: [Certificate Reference Implementation](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/cert.rs#L13-L21), [Certificate Abstract Interface](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Base.agda#L24-L28)

## Vote Structure

The Leios voting system supports two types of voters: persistent voters (selected per epoch) and non-persistent voters (selected per election via local sortition).

> [!Note]
> Individual votes are ephemeral data structures used during the voting process. They are aggregated into certificates and do not appear on the ledger or persistent storage. Only the resulting certificates are stored permanently.

```cddl
; Vote bundle containing votes for multiple endorser blocks from same voter
leios_vote_bundle = persistent_vote_bundle / non_persistent_vote_bundle

persistent_vote_bundle =
[ 0 ; Vote type identifier for persistent voter
, election_id ; 8-byte election identifier
, persistent_voter_id ; 2-byte epoch-specific pool identifier
, vote_entries ; Map of endorser blocks to signatures
]

non_persistent_vote_bundle =
[ 1 ; Vote type identifier for non-persistent voter
, election_id ; 8-byte election identifier
, pool_id ; 28-byte pool identifier
, eligibility_signature ; 48-byte BLS signature proving eligibility
, vote_entries ; Map of endorser blocks to signatures
]

vote_entries = {* endorser_block_hash => vote_signature}
```
Sources: [Vote Reference Implementation](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/vote.rs#L13-L27), [Formal Specification - Vote Abstract Interface](https://github.com/input-output-hk/ouroboros-leios-formal-spec/blob/main/formal-spec/Leios/Abstract.agda#L24-L27), [Haskell Bundle Usage](https://github.com/input-output-hk/ouroboros-leios/blob/main/simulation/src/LeiosProtocol/Short.hs#L231-L234), [Rust Vote Bundle](https://github.com/input-output-hk/ouroboros-leios/blob/main/sim-rs/sim-core/src/model.rs#L208-L212)

## BLS Key Registration

For pools to participate in Leios voting, they must register BLS keys in their operational certificates:

```diff
operational_cert =
[ hot_vkey : kes_vkey
, sequence_number : uint .size 8
, kes_period : uint
, sigma : signature
+ , ? bls_key_reg : bls_key_registration
]
```
Sources: [Conway Base](https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl#L114-L119)

```cddl
; BLS key registration for voting (included in operational certificates)
bls_key_registration =
[ pool_id : pool_id ; Pool identifier (28 bytes)
, bls_public_key : bls_vkey ; BLS12-381 G2 public key (96 bytes)
, proof_of_possession : bls_proof_of_possession ; Proof of secret key possession (96 bytes)
, kes_signature : kes_signature ; KES signature over the registration (448 bytes)
]

; Total size: 28 + 96 + 96 + 448 = 668 bytes
```
Sources: [Registration Struct](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/key.rs#L156-L162), [Proof Generation](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/bls_vote.rs#L19-L23)

## Cryptographic Types

```cddl
; Core BLS cryptographic primitives
bls_signature = bytes .size 48 ; BLS12-381 G1 signature (compressed)
bls_vkey = bytes .size 96 ; BLS12-381 G2 public key (compressed)
bls_proof_of_possession =
[ mu1 : bls_signature ; Signature on public key
, mu2 : bls_signature ; Signature on empty message
]

; Leios-specific identifiers
election_id = bytes .size 8 ; Slot-based election identifier
persistent_voter_id = uint .size 2 ; Epoch-specific voter identifier (0-65535)
pool_id = bytes .size 28 ; Stake pool identifier
endorser_block_hash = bytes .size 32 ; Hash of endorser block

; Additional Cardano types used
kes_signature = bytes .size 448 ; KES signature
hash32 = bytes .size 32 ; 32-byte hash (used for endorser_block_hash)
```
Sources: [Sig](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/key.rs#L100), [PubKey](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/key.rs#L62), [PoP](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/key.rs#L139-L143), [Eid](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/primitive.rs#L76), [PersistentId](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/registry.rs#L14), [PoolKeyhash](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/primitive.rs#L14), [EbHash](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/primitive.rs#L117), [KesSig](https://github.com/input-output-hk/ouroboros-leios/blob/main/crypto-benchmarks.rs/src/primitive.rs#L170)



## Next
**→ [Endorser Block - CDDL](endorser-blocks.md)**
22 changes: 22 additions & 0 deletions docs/cddl/diffs/eb-only/endorser-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Endorser Blocks - Eb-Only Leios

This file specifies the CDDL modifications for Endorser Blocks in Stracciatella Leios, which contain transaction references directly instead of introducing input blocks (IBs).

## EB Extensions

Stracciatella Leios extends the common endorser block structure from [Common Endorser Blocks](../common/endorser-blocks.md):

```diff
eb_body =
[
- input_blocks : [* ib_reference] ; References to input blocks
, ? endorser_blocks : [* eb_reference] ; References to earlier endorser blocks (Full Leios)
+ , transaction_references: [* tx_reference] ; Transaction references instead of full transactions
]
```

## Transaction Reference Structure

```cddl
tx_reference = bytes .size 32, ; Transaction ID (hash)
```
41 changes: 41 additions & 0 deletions docs/cddl/diffs/full-sharding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Full Sharding - Leios

This directory contains CDDL specifications for the **full sharding** approach to Leios ledger design.

## Sharding Approaches

The full sharding design provides two complementary mechanisms that **prevent transaction conflicts and duplicates** by ensuring potentially conflicting transactions are processed sequentially within the same shard rather than concurrently across different shards:

### 1. UTxO Sharding ([Spec](./utxo.md))

- **Mechanism**: Explicit `shard_label` field in transaction outputs matches implicit IB `shard` derived by its VRF proof
- **Shard Assignment**: IB shard derived from VRF proof:

$$\text{shardId} = \text{vrf\_value} \bmod \text{totalShards}$$
- **Network Overhead**: +2 bytes per labeled output

### 2. Reward Account Sharding ([Spec](./reward-account.md))

- **Mechanism**: Implicit shard assignment where transactions using reward accounts for collateral/withdrawals must match the IB's shard
- **Shard Assignment**: Reward account shard derived from hash function:

$$\text{shardId} = \text{hash}(\text{rewardAccount}) \bmod \text{totalShards}$$
- **Network Overhead**: 0 bytes (computed on-demand)

## Sharding Benefits

Both mechanisms contribute to the broader sharding strategy that:
- **Prevents conflicts** by processing potentially conflicting transactions sequentially within the same shard
- **Reduces duplicates** through per-shard mempool segmentation

## Comparison

| Aspect | UTxO Sharding | Reward Account Sharding |
|--------|---------------|------------------------|
| **Explicitness** | Explicit `shard_label` field | Implicit hash-based |
| **Network Overhead** | +2 bytes per output | 0 bytes |
| **Flexibility** | Can choose shard | Deterministic shard |
| **Bootstrapping** | Requires labeled UTxOs | Immediate availability |

> [!Note]
> **Design Rationale**: These approaches serve different purposes and can be used together or independently. Reward account sharding enables immediate onboarding while UTxO sharding provides operational control.
Loading