rust-fuzz / arbitrary

Generating structured data from arbitrary, unstructured input.

Home Page:https://docs.rs/arbitrary/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use same `Arbitrary` trait as quickcheck?

jhpratt opened this issue · comments

It doesn't look like this has been brought up before in this crate. Using a single trait for both cargo-fuzz and quickcheck would be super, but right now it requires two trait implementations that are very similar.

I think we may want to actually remove the shrinking implementations and instead shrink the raw input bytes to generically shrink any T: Arbitrary regardless whether T has explicitly overridden the default/empty shrink method.

It should certainly be possible for quickcheck to use this Arbitrary trait, though it would be a breaking change. I kind of got the impression that @BurntSushi was only passively maintaining quickcheck these days though, so I'm not sure it is worth the effort.

Yeah, I don't think I'd have the energy to do a big change like that. And it's not clear to me that shrinking at the byte level is the right path in every case. In quickcheck, shrinking happens at the data type level. But maybe I'm misunderstanding.

I'm referring to the method of shrinking detailed in this paper: https://drmaciver.github.io/papers/reduction-via-generation-preview.pdf

I agree that there are probably cases where something more specific to a type will do better, but this approach is much less effort since you write it once and it works for all types. It depends what the ultimate goal and effort budget is, I suppose. I've personally had really good experiences with this approach and our Arbitrary trait with wasm-smith.

Anyways this is all a bit of an aside.

I think we can close this issue given that you don't have the energy.

Thanks for the input everyone!