This repository was archived by the owner on Mar 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
guards #3416
Merged
Merged
guards #3416
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6f6cd63 to
d07fce2
Compare
Contributor
|
I'll merge early, but I want to see the all token tests run here or locally first |
Contributor
|
Just checked - all other instances of |
Contributor
|
|
mvines
reviewed
Aug 3, 2022
| } | ||
|
|
||
| #[test] | ||
| fn test_instruction_unpack_panic() { |
Contributor
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.
As a follow-up, perhaps something more exhaustive?
#[test]
fn test_instruction_unpack_panic() {
for i in 0..255u8 {
for j in 1..10 {
let mut data = vec![0;j];
data[0] = i;
let _no_panic = TokenInstruction::unpack(&data);
}
}
}
Contributor
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.
Yep, on my list already :)
Member
Author
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 am fuzzing it with
#[test]
fn test_instruction_unpack_fuzz() {
for _ in 0..10000000 {
let r: usize = rand::thread_rng().gen_range(0..10);
let data: Vec<u8> = (0..r).map(|_| rand::thread_rng().gen()).collect();
_ = TokenInstruction::unpack(&data);
}
}
joncinque
added a commit
to joncinque/solana-program-library
that referenced
this pull request
Aug 3, 2022
This reverts commit 22faa05.
CriesofCarrots
pushed a commit
to CriesofCarrots/solana-program-library
that referenced
this pull request
Aug 3, 2022
CriesofCarrots
pushed a commit
that referenced
this pull request
Aug 4, 2022
* check that unpack is tolerant of small sizes (#3416) * Refactor unpack and make test more robust (#3417) * Refactor hasty fix to match token-2022 * Make test exhaustive * cargo fmt Co-authored-by: Michael Vines <[email protected]> * Readd proptests without losing unit test, #3421 Co-authored-by: anatoly yakovenko <[email protected]> Co-authored-by: Michael Vines <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.