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

Invariant test suite #35

Merged
merged 6 commits into from
Feb 23, 2024
Merged

Invariant test suite #35

merged 6 commits into from
Feb 23, 2024

Conversation

wildmolasses
Copy link
Collaborator

@wildmolasses wildmolasses commented Jan 25, 2024

Resolves #11

This suite should not be considered complete. It's a solid base from which to expand, and tests the invariants listed in #11 as well as others.

@wildmolasses wildmolasses force-pushed the 01-25-Start_Invariant_Testing branch 2 times, most recently from 20797c5 to 7a6f026 Compare January 26, 2024 14:43
@wildmolasses wildmolasses force-pushed the 01-25-Start_Invariant_Testing branch 3 times, most recently from c077aa4 to 8db1191 Compare February 13, 2024 17:33
@wildmolasses wildmolasses force-pushed the 01-25-Start_Invariant_Testing branch from 53e0558 to 33cedd0 Compare February 21, 2024 17:16
@wildmolasses wildmolasses changed the title Begin invariant test suite Invariant test suite Feb 21, 2024
@wildmolasses wildmolasses marked this pull request as ready for review February 21, 2024 17:16
@@ -0,0 +1,68 @@
# Invariant Suite
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is the detail here appropriate for public consumption, or do we want to cull it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The info is good, it may be clearer if the unimplemented actions are removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

chatted a bit with @apbendi, going to keep them around for now

Copy link
Collaborator

@alexkeating alexkeating left a comment

Choose a reason for hiding this comment

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

Looks good, a bunch of nits

address rewardsNotifier;

function setUp() public {
// deploy UniStaker
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment should probably be removed or moved to line 28

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

mapping(address => bool) saved;
}

library LibAddressSet {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this taken from the article? It may be good to add a comment and link to where this came from.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added a comment, thanks

address public admin;

// actors, deposit state
address internal currentActor;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: should this have an underscore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good call, changed!

ghost_rewardsNotified += _amount;
}

// TODO: distinguish between valid and invalid stake
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are this and the TODO below still todos?

Copy link
Collaborator Author

@wildmolasses wildmolasses Feb 22, 2024

Choose a reason for hiding this comment

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

yes -- invalid stake is not yet included in harness, nor is invalid withdraw

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah okay it may be good to move these to issues then

foundry.toml Outdated
fail_on_revert = false
include_push_bytes = true
include_storage = true
runs = 100
Copy link
Collaborator

Choose a reason for hiding this comment

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

It may be worth bumping some of these for CI runs.

Copy link
Collaborator Author

@wildmolasses wildmolasses Feb 22, 2024

Choose a reason for hiding this comment

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

i'm happy to do that. what values would be good?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe bump them back to the default values for runs and depth

@wildmolasses wildmolasses force-pushed the 01-25-Start_Invariant_Testing branch from ccc3fa3 to 7fe1451 Compare February 22, 2024 15:47
@apbendi apbendi force-pushed the 01-25-Start_Invariant_Testing branch from cf66d54 to c6e46f4 Compare February 23, 2024 00:16
Copy link

Coverage after merging 01-25-Start_Invariant_Testing into main will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   UniStaker.sol99.49%95.83%100%100%611
   V3FactoryOwner.sol100%100%100%100%

@apbendi apbendi merged commit 489f4d6 into main Feb 23, 2024
4 checks passed
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.

Tracking Issue: Invariant Test Ideas
3 participants