You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
pass a cloned version of it through the reduce() function, then assert that it is equal to the original value. This can be easily done by using build_support_map and comparing the results. This means that the reduction algorithm, as expected, will just remove some edges but has no effect on the final outcome. I have written a function in my other PR to help with this:
Basically just run this over a sensibly large random input.
There should also be an assertion that the encoded length of the result is always less than or equal to that of the original one. We cannot make this strict to just less than since the random generation might actually lead to some graphs that cannot be reduced. A very good bonus is to tell us the size of reduced on average by how many percent.
Likewise, the main elect function can also be compared to the float implementation. This has less priority at the moment. There is also a helper for this: run_and_compare in primitives/phragmen/mock.rs which is doing exactly that. The It just need to be fed some sensible data.
There should be a fuzzer that does the following:
pass a cloned version of it through the
reduce()
function, then assert that it is equal to the original value. This can be easily done by usingbuild_support_map
and comparing the results. This means that the reduction algorithm, as expected, will just remove some edges but has no effect on the final outcome. I have written a function in my other PR to help with this:substrate/primitives/phragmen/src/mock.rs
Lines 410 to 438 in ca68e24
Basically just run this over a sensibly large random input.
There should also be an assertion that the encoded length of the result is always less than or equal to that of the original one. We cannot make this strict to just less than since the random generation might actually lead to some graphs that cannot be reduced. A very good bonus is to tell us the size of reduced on average by how many percent.
elect
function can also be compared to the float implementation. This has less priority at the moment. There is also a helper for this:run_and_compare
inprimitives/phragmen/mock.rs
which is doing exactly that. The It just need to be fed some sensible data.cc @shawntabrizi
The text was updated successfully, but these errors were encountered: