eqlabs / pathfinder

A Starknet full node written in Rust
https://eqlabs.github.io/pathfinder/
Other
613 stars 222 forks source link

p2p stream tests #2075

Closed CHr15F0x closed 4 weeks ago

CHr15F0x commented 1 month ago

So far this covers only transaction stream testing. My idea was to write a single test that is easily expandable by utilizing rstest. If you find this approach acceptable, mimicking it for state diffs, classes, and events will be straightforward.

TaggedDebug is used to help quickly identify the items visible in failing asserts because the data is pretty much random and its default Debug representation makes it hard to associate what one sees in the console with the actual test fixtures used in the code. An unregistered type has the same representation as std's Debug derive.

If you like the idea of TaggedDebug I can update it to work only for debug/test builds so that it's still usable in tests and can be derived directly in our core types without any newtype wrappers like TestTxn, which will reduce boilerplate. Ofc by that I only mean core types that are actually used in these tests.

Btw, as for test wrapper newtypes I cannot avoid one for external types that already derive Debug, namely PeerId.