rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
143 stars 65 forks source link

[Test] Introduce fuzzing proptest #140

Open jolestar opened 1 year ago

jolestar commented 1 year ago
yubing744 commented 1 year ago

i will try this task.

yubing744 commented 1 year ago

The design concept of Proptest mainly corresponds to two themes, namely "input generation" and "result reduction".

"Input generation" refers to programmatically defining a way to generate arbitrary values representing the space of possible inputs. Instead of predefining a specific set of test cases, Proptest randomly generates a large number of different inputs according to set rules, which can help find anomalies that developers have not predicted or considered.

The concept of "result reduction" is that when Proptest finds a failing example, it tries to simplify or "reduce" the input until it finds the most simplified input that still fails the test. This feature is useful because simply providing random inputs that cause a test to fail can place a heavy analysis burden on the developer. In contrast, Proptest tries to provide minimal failure cases, allowing developers to better understand and fix problems.

Overall, Proptest is designed to automate the generation of random and broad-coverage test inputs as much as possible, while providing concise feedback when problems are found.

yubing744 commented 1 year ago

I will try to generate a mock struct of MoveAction, which will be used later to detect whether a maliciously constructed MoveAction will cause Rooch to crash.