-
Notifications
You must be signed in to change notification settings - Fork 387
Fuzz tests ERC1155 #1348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fuzz tests ERC1155 #1348
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1348 +/- ##
=======================================
Coverage 89.42% 89.42%
=======================================
Files 81 81
Lines 3500 3500
=======================================
Hits 3130 3130
Misses 370 370
Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good @immrsd, but let's use 0.38.0 feature for fuzzing to avoid the extra boilerplate.
values: Span<u256>, | ||
} | ||
|
||
fn prepare_tokens(ids_len_seed: u32, value_mult_seed: u32) -> TokenList { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to avoid this by using the new Fuzzing derivable trait from foundry 0.38.0. Let's update that before merging this to avoid the extra boilerplate.
@@ -71,3 +71,13 @@ pub fn assert_entrypoint_not_found_error<T, +Drop<T>>( | |||
panic!("{selector} call was expected to fail, but succeeded"); | |||
} | |||
} | |||
|
|||
/// Creates and returns a new array consisting of the given `element` repeated `n_times` times. | |||
pub fn repeat<T, N, +Copy<T>, +Drop<T>, +Into<N, u256>>(element: T, n_times: N) -> Array<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should export this as part of our external API from testing, it should be an internal test_common item instead. We don't want the testing API to grow to big, so we should include utilities that will be potentially often used, and I think this is not the case.
Adds fuzz test cases for ERC1155