|
7 | 7 | - Error handling, initial error reporting |
8 | 8 | - Trace verification starting from other than initial state |
9 | 9 |
|
| 10 | +### Informal review of Haskell simulator for Leios |
| 11 | + |
| 12 | +We reviewed existing code and documents related to the Haskell simulator, and assessed its state of completeness. See also the discussion in [PR#353](https://github.com/input-output-hk/ouroboros-leios/pull/353). |
| 13 | + |
| 14 | +- Statistics |
| 15 | + - ELOC: 17,035 lines |
| 16 | + - TODO: 51 lines |
| 17 | + - Comments 1437 lines |
| 18 | +- Organization |
| 19 | + - Some intertwining of concerns |
| 20 | + - Simulation |
| 21 | + - Data analysis |
| 22 | + - Visualization |
| 23 | + - Examples |
| 24 | + - Praos cleanly separated from Leios. |
| 25 | + - Leios specifics are concentrated in just three modules. |
| 26 | +- Code quality |
| 27 | + - Generally readable and well organized code. |
| 28 | + - Especially understandable by those already familiar with the Cardano codebase. |
| 29 | + - Most types and functions are not documented. |
| 30 | + - The best documentation is for the typed protocols. |
| 31 | + - Networking code is most mature, with few changes for many months. |
| 32 | + - Block management is also mature. |
| 33 | + - Only three tests in the test suite, and these do not relate to the protocol |
| 34 | + - `test_benchTopologyIsConnected` |
| 35 | + - `test_defaultConfigOnDiskMatchesDef` |
| 36 | + - `test_canParseConstantDistribution` |
| 37 | +- Design |
| 38 | + - Leios variants handled via pattern matching on sum types. |
| 39 | + - Moderately high fidelity treatment of TCP. |
| 40 | + - Faithful to Leios specification regarding input blocks, endorser blocks, votes, Praos blocks, CPU resources, and networking behavior. |
| 41 | + - Uses typed mini-protocols for blocks and votes in a unified manner |
| 42 | + - Some node operations are modeled as parallel threads. |
| 43 | + - The network is static, so the input topology needs to reflect a snapshot of a typical p2p network. |
| 44 | + - The fidelity of the network representation is greater than needed for SRL4 analyses. |
| 45 | + - No representation or modeling of transactions. |
| 46 | + - Essentially no representation of adversarial behavior, though there is one placeholder. |
| 47 | + - There is no provision for modeling network dynamism such as coming/going of nodes or communication disruptions. |
| 48 | + - "Full Short" Leios implementation is slightly out of sync with the recent v0.2 changes. |
| 49 | +- Implementation |
| 50 | + - Single threaded execution because of its reliance of `IOSim`. |
| 51 | + - Runs 40x slower than Rust simulator. |
| 52 | + - Simulations of 3000 nodes for one hour takes ~24 hours for high TPS. |
| 53 | + - Dependencies our the production Ouroboros packages and a few Cardano packages. |
| 54 | + - Does not account for CPU resources needed for ledger updates. |
| 55 | +- Documentation |
| 56 | + - The readme files (`README.md` and `simulation/README.md`) are slightly out of date. |
| 57 | + - The "Network Specification" document is terse but complete enough to be useful in comparing against the implementation. It is unclear how closely the implementation matches or if there are major gaps (aside from the to-do list in its header) in the documentation. |
| 58 | + - The "Simulation Realism" document mostly consists of figures, with some brief text introducing them and pointing out interesting features. The document is not complete enough to make a sound case for the realism of the simulation. |
| 59 | + - Evidently, the simulations were compared to graph-theory models of idealized behavior, but there does not seem to be documentation of this. |
| 60 | + - There is no high-level design documentation for the simulation itself. |
| 61 | +- Assessment |
| 62 | + - The trace logs currently fail the conformance tests in the Leios trace verifier. |
| 63 | + - Changes to the networking model would require great care and understanding. |
| 64 | + - Most prospective changes to the Leios protocol would only involve a small fraction of the codebase and would likely be straightforward. |
| 65 | + - Addition of memory pool and transactions is feasible but would likely take ~100-200 hours of labor. |
| 66 | + - Many aspects of transactions could leverage the existing network code and protocol patterns. |
| 67 | + - Understanding the details of the existing Praos memory pool and transaction diffusion would be critical to implementing Leios transactions in the simulation. |
| 68 | + - Major speedup or parallelization of execution might require a lot of effort, but the code should be profiled to identify easily mitigated hotspots. |
| 69 | + - QA on the network implementation would require detailed understanding of TCP and reverse-engineering requirements documents. |
| 70 | + |
10 | 71 | ### Documentation housekeeping |
11 | 72 |
|
12 | 73 | We relocated the ancient report on Leios from `report/` to [docs/obsolete-report/](docs/obsolete-report/) in order to avoid confusing that the report still represents the Leios design. It does contain useful background information and design principles, however. |
|
0 commit comments