rs-stellar-xdr
rs-stellar-xdr copied to clipboard
Add fuzz and historically-guided tests
Requirements:
- Test both valid and invalid types.
- Cover major types used by a large number of applications like
Transaction,TransactionResult,TransactionMeta, as well as objs critical to core (that is probably all of them), but at leastLedgerEntryand related types and meta types. - Reasonably realistic entries.
- Test against a set of invariants expected to be true.
Ideas:
- Typical code-coverage guided fuzz testing to identify:
- Crashes.
- Invariants.
- Use proptest to hand craft some tests of major types such as
Transaction. - Look at randxdr which is used to fuzz test the Go Stellar XDR impl, and possibly:
- Adopt the same pattern here from scratch.
- Or, add a CLI build to randxdr that outputs random xdr to stdout, which can be piped into tests here.
- So something similar to Horizon's verify-range testing, where ledgers and data are pulled from Stellar archives and run through this lib and a set of invariants are checked. This would be different to what Horizon does but possibly:
- Pick random transactions from archives.
- Pick random ledgers and try parsing the entire ledger.
@MonsieurNicolas @graydon Which quarter-end do we need this lib to be stable / well tested? Q4?