ipfs / ipfs/boxo

[ipfs/go-bitswap] Invariant Testing

Open
#127 0 comments 0 reactions 0 assignees View on GitHub
kind/test
Dominant language
Go
Stars
316
Forks
163
Avg merge
4d 12h
Merged PRs (30d)
8

Description

Given the complexity of bitswap, we should add some invariant testing. I'm thinking something like:

* Log all events (using zap):
* want(type/cancel) sent for X, to peer Y, as part of session Z/broadcast
* want(type/cancel) received for X, from peer Y.
* sent X to peer Y, responding to want of TYPE.
* receive block/want-have/dont-want for X from peer Y in sessions Z(s).
* peer added/removed to/from session
* latency determined
* timeouts
* Process the events after the fact to make sure we:
* Don't send wants for things we have.
* Send cancels.
* Send want/haves once.
* Don't timeout waiting for something we shouldn't have waited on.
* E.g., peer sent us something and we still process a timeout for it.
* Etc...

The goal is _not_ to modify the existing tests, just to make sure we aren't violating any invariants when running them. Fortunately for the network, and unfortunately for testing, bitswap is pretty robust against errors so many tests are likely to continue succeeding even when we've technically broken something.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.