rs-stellar-xdr icon indicating copy to clipboard operation
rs-stellar-xdr copied to clipboard

Add fuzz and historically-guided tests

Open leighmcculloch opened this issue 3 years ago • 2 comments

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 least LedgerEntry and related types and meta types.
  • Reasonably realistic entries.
  • Test against a set of invariants expected to be true.

leighmcculloch avatar May 11 '22 22:05 leighmcculloch

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.

leighmcculloch avatar May 11 '22 22:05 leighmcculloch

@MonsieurNicolas @graydon Which quarter-end do we need this lib to be stable / well tested? Q4?

leighmcculloch avatar May 11 '22 22:05 leighmcculloch