Skip to content
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

add getting started guide #153

Merged
merged 2 commits into from
Aug 2, 2023
Merged

add getting started guide #153

merged 2 commits into from
Aug 2, 2023

Conversation

daejunpark
Copy link
Collaborator

No description provided.


- You need to be careful not to exclude valid inputs by setting too strong input conditions.

- In symbolic tests, avoid using `bound()` as it tends to perform poorly. Instead, use `vm.assume()` which is more efficient and easier to read and write.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would give an example like this:

uint256 tokenId = svm.createSymbolicUint256("tokenId");

// ❌ don't do this
tokenId = bound(tokenId, 1, MAX_TOKEN_ID);

// ✅ do this
vm.assume(1 <= tokenId && tokenId <= MAX_TOKEN_ID);

unfortunaly the bad pattern is more concise than our recommended pattern, maybe we want to introduce svm.bound(val, min, max)?

Comment on lines +207 to +209
(bool success,) = address(token).call(
abi.encodeWithSelector(token.transfer.selector, receiver, amount)
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to add assert(!success) in the example?

that's something we could probably be doing by implementing vm.expectRevert(), right?

@daejunpark daejunpark merged commit 2444e34 into main Aug 2, 2023
88 checks passed
@daejunpark daejunpark deleted the docs/getting-started branch August 2, 2023 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants