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

Try/Catch should be treated as branch #852

Open
cgewecke opened this issue Feb 7, 2024 · 0 comments
Open

Try/Catch should be treated as branch #852

cgewecke opened this issue Feb 7, 2024 · 0 comments
Labels

Comments

@cgewecke
Copy link
Member

cgewecke commented Feb 7, 2024

This is mostly only helpful if you have an empty catch clause. Normally the contents of the blocks are treated as lines and statements so you can tell they weren't hit. And the try statement itself is covered.

Example of a place where it could be overlooked is at zeppelin:GovernorTimelockAccess.sol

// It is important that all calls have an opportunity to be cancelled. We chose to ignore
// potential failures of some of the cancel operations to give the other operations a chance to
// be properly cancelled. In particular cancel might fail if the operation was already cancelled
// by guardians previously. We don't match on the revert reason to avoid encoding assumptions
// about specific errors.
try _manager.cancel(address(this), targets[i], calldatas[i]) {} catch {}

This semantic structure is kind of complicated - there can be multiple catch clauses etc. Maybe only treat the empty catch clause case as a branch...not sure that makes it any easier to implement though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant