Closed iand closed 9 months ago
The mock clock should be used in tests and simulations where another endpoint
/ Router
than the libp2p Router
is used. As soon as we use the libp2p network stack, sequentiality is lost, so it doesn't really make sense to use a mock clock.
We should implement an alternative in memory Router
in order to conduct reproducible tests and simulations using the mock clock.
Closing as resolved as we have the in memory router implementation now
The DHT allows a mock clock to be specified in configuration which can be used to create tests that control the passage of time. This causes problems when interacting with lower level libp2p components that are not aware of the fake clock. For example, setting deadlines using the clock results in times that are far in the past causing the stream to be immediately reset.
Example: https://github.com/libp2p/go-libp2p-kad-dht/blob/v2-develop/v2/stream.go#L86-L88