-
Notifications
You must be signed in to change notification settings - Fork 75
feat: Add PermissionSplitter test script scaffolding #411
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
Conversation
Signed-off-by: nicholaspai <npai.nyc@gmail.com>
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
Signed-off-by: nicholaspai <npai.nyc@gmail.com>
This reverts commit af8716b.
mrice32
left a comment
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.
LGTM!
| vm.prank(pauseAdmin); | ||
| hubPoolProxy.setPaused(true); | ||
| assertTrue(hubPool.paused()); |
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.
Two nits:
- Do you want to test calling it with the default admin as well?
- Should we reset it to unpaused after the test to ensure other tests aren't impacted by the state change?
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.
| assertEq(address(hubPool).balance, balBefore); | ||
| } | ||
|
|
||
| /// forge-config: default.fuzz.runs = 300 |
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.
This is a cool use of fuzzing!
FYI, solidity compilation will fail if function selectors collide: https://ethereum.stackexchange.com/a/46188/47801. So the HubPool, by definition can't have colliding selectors.
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.
oh ok, so we really only need to compare the Proxy functions with the HubPool functions then?
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!
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.
But collisions are a superset of that case, so collisions are fine to test for -- just wanted to mention it.
| vm.stopPrank(); | ||
| } | ||
|
|
||
| function testFallback() public { |
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.
Great test! +1 for covering this case.
…re robust fuzz testing of fallback()/receive() Signed-off-by: nicholaspai <npai.nyc@gmail.com>
mrice32
left a comment
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.
LGTM!
| vm.prank(defaultAdmin); | ||
| (bool success, ) = address(hubPoolProxy).call{ value: 1 ether }(""); | ||
| assertTrue(success); | ||
| assertEq(address(hubPool).balance, balBefore); |
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.
nit: should we also check the balance of the proxy to make sure the ETH got through?
| } | ||
|
|
||
| function testFallback() public { | ||
| function testTransferOwnership() public { |
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.
Nice
| hubPoolProxy.setPaused(false); | ||
| assertFalse(hubPool.paused()); | ||
|
|
||
| // Multiple EOA's can be granted the pause role. |
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.
Ahhh, good call
This PR was created by running
forge install foundry-rs/forge-stdwhich created a locallib/directory to storeuseful forge contracts for testing, like
forge-std. I also created a new directorytest/foundryto store foundry tests from here on out.I've been running the following test script with
forge test --fork-url https://mainnet.infura.io/v3/<KEY> -vvvv(the four "v" flags are for for maximum logging)Fixes ACX-1827