Skip to content

Commit 4420f0a

Browse files
tizocdannywillems
authored andcommitted
docs(handover): Expand the testing infrastructure documentation with a section about limitations related to including OCaml nodes in the test
1 parent 80ccf04 commit 4420f0a

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

docs/handover/testing-infrastructure.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,67 @@ Features:
9393
- Network topology control
9494
- Debugger integration
9595

96+
### OCaml Node Limitations
97+
98+
When including OCaml nodes in test scenarios, there are several important limitations compared to Rust nodes:
99+
100+
**Time Control:**
101+
- OCaml nodes use real wall-clock time and cannot be controlled via `AdvanceTime` or `AdvanceNodeTime` steps
102+
- Only Rust nodes support deterministic time advancement
103+
- This can cause timing-dependent test failures when OCaml and Rust nodes get out of sync
104+
105+
**Visibility and Debugging:**
106+
- OCaml nodes are "black boxes" - we cannot inspect their internal state like we can with Rust nodes
107+
- No access to OCaml node's internal execution, state changes, or data structures
108+
- Limited logging and debugging capabilities compared to Rust nodes
109+
- Cannot use invariant checking on OCaml node state
110+
111+
**Network Control:**
112+
- Cannot manually disconnect OCaml peers using test framework commands
113+
- Network topology changes must be done externally or through OCaml node's own mechanisms
114+
- Limited control over OCaml node's P2P behavior and connection management
115+
116+
**Behavioral Control:**
117+
- No control over OCaml node's internal execution flow or decision-making
118+
- Cannot trigger specific OCaml node behaviors on demand
119+
- Cannot guarantee that expected operations will be executed at all
120+
- This limits the determinism of tests involving OCaml nodes
121+
122+
**Testing Implications:**
123+
- Tests with OCaml nodes are inherently less deterministic
124+
- Focus should be on testing interoperability rather than detailed protocol behavior
125+
- Use OCaml nodes primarily for cross-implementation validation
126+
- Consider using Rust-only scenarios when precise control is needed
127+
128+
### Potential OCaml Node Testing Improvements
129+
130+
To improve OCaml node testing capabilities, the following changes could be made to the OCaml implementation:
131+
132+
**Deterministic Time Control:**
133+
- Add support for controllable time advancement instead of wall-clock time
134+
- Implement time mocking or virtual time system that can be controlled by the test framework
135+
- This would enable synchronization between OCaml and Rust nodes in tests
136+
137+
**Testing API:**
138+
- Expose internal state inspection endpoints for testing purposes
139+
- Add hooks or callbacks for test frameworks to monitor internal execution
140+
- Implement test-specific logging and debugging interfaces
141+
142+
**Network Control:**
143+
- Add testing APIs to manually control P2P connections
144+
- Implement test hooks for network topology manipulation
145+
- Provide mechanisms to trigger specific network behaviors on demand
146+
147+
**Behavioral Control:**
148+
- Add test-specific triggers for protocol operations
149+
- Implement deterministic execution modes for testing
150+
- Provide APIs to control or observe internal decision-making processes
151+
152+
**Implementation Notes:**
153+
- These improvements would require coordination with the OCaml Mina team
154+
- Changes should be designed to not affect production behavior
155+
- Testing improvements could be implemented as optional testing-only features
156+
96157
## Invariant Checking System
97158

98159
### What are Invariants?

0 commit comments

Comments
 (0)