|
4 | 4 |
|
5 | 5 | [1. First Full Leios Simulation Analysis](https://github.com/input-output-hk/ouroboros-leios/blob/main/analysis/sims/2025w13/analysis.ipynb) |
6 | 6 |
|
7 | | -2. Optimistic Ledger State Options |
| 7 | +[2. Optimistic Ledger State References](#2-optimistic-ledger-state-references) |
8 | 8 |
|
9 | 9 | 3. Community |
10 | 10 |
|
| 11 | +## 2. Optimistic Ledger State References |
| 12 | + |
| 13 | +The discussion focused on different approaches for handling optimistic ledger state references in the Leios protocol. The core problem is how to validate Input Blocks (IBs) against a ledger state that is not yet settled in a Ranking Block (RB). This is essential for enabling transaction chaining, where new transactions can build upon the outputs of previous transactions. |
| 14 | + |
| 15 | +### Problem Statement |
| 16 | + |
| 17 | +Validating an Input Block (IB) requires a reference to a ledger state that can be used to verify the validity of its transactions. The choice of this reference state involves a trade-off between security and latency. The most secure approach is to reference the RB from k blocks ago, where k is defined as the stability horizon and represents the length of the volatile chain suffix. This boundary provides perfect security as we can be confident that any older block referenced will be included in all possible futures of the chain. However, this approach introduces significant latency (potentially hours), making it impractical for many use cases that require quick transaction confirmation. |
| 18 | + |
| 19 | +As we move to more recent blocks to reduce latency, we face increasing security challenges. Not every node in the network may have seen the same recent blocks due to network latency or temporary forks. For example, if an IB references the most recent RB, nodes that haven't received that RB yet cannot validate the IB. This creates a coordination problem where we need to ensure that the reference state is available to enough nodes to reach consensus on IB validity. |
| 20 | + |
| 21 | +### Solution Space |
| 22 | + |
| 23 | +Each of the following approaches describes a solution where an Input Block (IB) references a different block variant which provides a ledger reference for validation. |
| 24 | + |
| 25 | +| Reference | Description | Security | Latency | Implementation<br />Complexity | Computational<br />Cost | |
| 26 | +|-----------|-------------|----------|---------|--------------------------|-------------------| |
| 27 | +| [RB](#rb-reference-approach) | IBs reference an older RB | Best | Worst | Best | Min | |
| 28 | +| [EB](#eb-reference-approach) | IBs reference a certified Endorsement Block (EB) | Medium | Medium | Medium | Medium | |
| 29 | +| [IB](#) | IBs reference other IBs | Worst | Best | Worst | Max | |
| 30 | + |
11 | 31 | > [!Note] |
12 | | -> Check again later this week. |
| 32 | +> The choice of referenceable ledger states cannot be arbitrary, not only due to security considerations but also due to practical system constraints. Maintaining too many potential reference states would lead to excessive memory usage and computational overhead as each node would need to track and validate numerous parallel ledger states. We have estimated the associated computation cost in the last column of each approach. |
| 33 | +
|
| 34 | +### Data Flow Diagrams |
| 35 | + |
| 36 | +#### IB-to-RB Reference Approach |
| 37 | + |
| 38 | +The simplified diagram below shows respective lower and upper bounds for selecting an RB as ledger state reference for IB validation - each showing the extreme ends of trading off latency for security. Realistically, both are not good choices and some RB such as tip-6 might be more suitable. Note, that even the tip-3 example would introduce on average a delay of 3×20s = 90s before a user could reference outputs from a previously submitted transaction. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +> [!Note] |
| 43 | +> The parameter k defines the stability horizon, which is the period during which the last k blocks of the chain remain mutable. After k blocks are added, all preceding blocks become immutable or in other words become part of the stable chain prefix. |
| 44 | +
|
| 45 | +Thus, we can define a new parameter to define stability for Leios which ranges between k on the upper bound and zero on the lower (representing the tip of the chain). |
| 46 | + |
| 47 | +##### 1. Including EBs |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +This diagram shows the same ledger reference approach - pointing to RBs, but also includes EBs which have been hidden in the previous example for the stake of simplicity. |
| 52 | + |
| 53 | +##### 2. Different IB-to-RB references |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +The above diagram displays a more realistic picture of different IBs referencing different RBs as their ledger state reference for validation. |
| 58 | + |
| 59 | +#### EB Reference Approach |
| 60 | + |
| 61 | +The EB reference approach offers a middle ground between security and latency. Certified EBs (those that have received votes from a majority of stake) provide security guarantees with lower latency than the [RB-reference approach](#rb-reference-approach), as they indicate that enough nodes have seen and validated them. Several core variations of the EB reference approach were discussed: |
| 62 | + |
| 63 | +##### 1. **IB-to-EB-to-RB Reference**: IBs directly reference certified EBs, which themselves reference an older RB. |
| 64 | + |
| 65 | + |
| 66 | +Different to the [IB-to-RB referencing](#ib-to-rb-reference-approach), this approach has IBs reference an EB instead which itself references an RB. |
| 67 | + |
| 68 | +We briefly discussed an alternative design choice, in which IBs reference an EB and an RB. However, that design would result in many ledger states that would need to be computed and was therefore dismissed as too expensive. |
| 69 | + |
| 70 | +In this design, one gets a ledger state for each RB which gives a ledger state for each EB to be reused and IBs are validated with respect to that same state. On the contrary, due to EBs referencing an RB, there is still the same trade-off to be made as in the [IB-to-RB reference approach](#ib-to-rb-reference-approach) - having to chose more or less stable RBs for EBs resulting in higher latency or higher loss in EBs. |
| 71 | + |
| 72 | + |
| 73 | +##### 2. **EB Chain/ IB-to-EB(-to-EB)*-to-RB** |
| 74 | + |
| 75 | +In this approach IBs reference an EB which itself may reference another EB, which creates this chain of EBs that anchors on some older RB reference. Thus, EBs may have an RB reference or another EB reference of an EB that has not made it into an RB yet (full Leios variant). RBs on the other hand can only exactly reference one certified EB. IBs reference one of these EBs. |
| 76 | + |
| 77 | +This approach allows for more recent state references while maintaining security through the chain of certified EBs, and handles edge-case scenarios, where multiple EBs have been produced: |
| 78 | + |
| 79 | +- from different pipelines in parallel (see EB ordering below) |
| 80 | +- from the same pipeline |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +**Extensions and Implementation Details:** |
| 85 | + |
| 86 | +- **Minimum Age Requirement**: A constraint where EBs must reference an RB that is at least a certain age (e.g., 5 minutes old) to ensure it's widely available in the network. |
| 87 | + |
| 88 | +- **EB Ordering by Slot**: In the Leios protocol, multiple pipelines run in parallel, each ideally producing one RB. With parameters set for 1.5 EBs per stage (with randomness via VRF functions potentially producing more), there may be multiple EBs to choose from for inclusion in an RB. |
| 89 | + |
| 90 | +- **EB State Reuse**: An optimization technique where, when computing ledger states for EBs in a chain, we reuse the ledger state from referenced EBs and only replay the IBs in the current EB, reducing computational overhead, especially important when dealing with multiple pipelines and stages. |
| 91 | + |
| 92 | +#### IB Reference Approach |
| 93 | + |
| 94 | +> [!Warning] |
| 95 | +> We have not discussed this approach further and decided against progressing on it as it does not |
| 96 | +> meet the security requirements. It also comes with a high implementation complexity and |
| 97 | +> computational overhead. The IB reference approach would require maintaining multiple speculative |
| 98 | +> ledger states, creating potential for state explosion and significantly increasing validation costs |
| 99 | +> without providing adequate security guarantees. |
| 100 | +
|
| 101 | +### Key Considerations |
| 102 | + |
| 103 | +1. **Security vs Latency Trade-off**: Each approach represents a different balance between security guarantees and latency reduction. |
| 104 | + |
| 105 | +2. **State Management**: The certified EB reference approach requires careful management of EB ordering and state reconstruction, but provides a good balance of security and latency. |
| 106 | + |
| 107 | +3. **Certification**: Certified EBs provide stability similar to RBs but with lower latency, making them a promising middle ground. |
| 108 | + |
| 109 | +### Next Steps |
| 110 | + |
| 111 | +Further analysis of the EB reference approach, particularly around: |
| 112 | + - EB ordering mechanisms |
| 113 | + - State reconstruction efficiency (computational cost) |
| 114 | + - Security guarantees |
0 commit comments