-
Notifications
You must be signed in to change notification settings - Fork 4
add: fixes + last upgrade addresses #6
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
Open
sirpy
wants to merge
4
commits into
master
Choose a base branch
from
sayfer-audit-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
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.
Hey - I've found 1 issue, and left some high level feedback:
- In
setBridgeFeesthe validation usesbridgeFees.fee <= 10000instead offees.fee <= 10000, so the require condition is checking the old value rather than the new input; this should be corrected to validate the new fees being set. - For consistency and clarity, consider validating the input struct
fees.feein the constructor as well (even thoughbridgeFeesis immediately set fromfees) so the require reads the same way in both constructor andsetBridgeFees. - The private key selection logic in
hardhat.config.tsrelies onprocess.argvcontaining the substringstestnetorstaging, which may be brittle across different invocation patterns; consider basing this on named environment variables or Hardhat network names instead.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `setBridgeFees` the validation uses `bridgeFees.fee <= 10000` instead of `fees.fee <= 10000`, so the require condition is checking the old value rather than the new input; this should be corrected to validate the new fees being set.
- For consistency and clarity, consider validating the input struct `fees.fee` in the constructor as well (even though `bridgeFees` is immediately set from `fees`) so the require reads the same way in both constructor and `setBridgeFees`.
- The private key selection logic in `hardhat.config.ts` relies on `process.argv` containing the substrings `testnet` or `staging`, which may be brittle across different invocation patterns; consider basing this on named environment variables or Hardhat network names instead.
## Individual Comments
### Comment 1
<location> `packages/bridge-contracts/contracts/messagePassingBridge/MessagePassingBridge.sol:268` </location>
<code_context>
_onlyAvatar();
if (amount == 0) amount = IERC20(token).balanceOf(address(this));
- IERC20(token).transfer(msg.sender, amount);
+ require(IERC20(token).transfer(msg.sender, amount), 'withdraw failed');
}
</code_context>
<issue_to_address>
**question (bug_risk):** Requiring the raw `transfer` return value may break compatibility with non-standard ERC-20 tokens.
The code previously ignored the `transfer` return value; now it assumes a `bool` is returned. Many popular or legacy ERC-20 tokens either don’t return a value or revert on failure, so this `require` will itself revert even when the transfer is actually successful under their behavior. If you need to support such tokens, use a SafeERC20-style wrapper that treats missing return values as success instead of requiring the raw `bool`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
packages/bridge-contracts/contracts/messagePassingBridge/MessagePassingBridge.sol
Outdated
Show resolved
Hide resolved
add: fixes + last upgrade addresses
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.