tari-project / validator-node

The core code repository for the Tari validator node
2 stars 1 forks source link

Use sled's approach for testing template executors and consensus logic #7

Open dunnock opened 4 years ago

dunnock commented 4 years ago

Validator Node is stateful distributed system, which complicates testing as we should account for issues:

For more background on why this matters read Error Handling in a Correctness-Critical Rust Project. For more inspiration watch "Testing Distributed Systems w/ Deterministic Simulation" by Will Wilson

The easiest way to implement such approach I saw is in sled's test_tree_fail_points.rs, where test runner is enumerating possible operations and starts system in controllable environment, then with a property testing feeding random inputs sequences optionally mixed with fail points triggers, validates that every new regular operation output is as expected.

This might be a nice approach for testing:

the-mog commented 4 years ago

heya, not a bad idea i think. similar to how we are implementing our fuzzer for security testing. the approach: 0) generate initial corpus with proptest 1) derive arbitrary trait for custom types 2) use cargo-fuzz to run the tests.

dunnock commented 4 years ago

@the-mog nice, do you have a link to the actual code?

the-mog commented 4 years ago

not yet.