-
Notifications
You must be signed in to change notification settings - Fork 0
[Pushers N02] Custom Errors in require Statements #73
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
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughReplaced explicit if-revert branches with require(...) validations across multiple block-hash pusher buffer and pusher contracts. Error types and public interfaces remain unchanged; only internal validation style was unified. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
luiz-lvj
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
I did some small changes to solve conflicts with the main branch
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/contracts/block-hash-pusher/zksync/ZkSyncBuffer.sol`:
- Around line 20-24: Move the require validation so it runs before assigning the
value to the immutable: in the constructor function (constructor(address
pusher_)), validate pusher_ with require(pusher_ != address(0),
InvalidPusherAddress()) before setting _pusher = pusher_ to follow the defensive
ordering used by other buffer constructors.
🧹 Nitpick comments (3)
src/contracts/block-hash-pusher/zksync/ZkSyncPusher.sol (1)
47-49: Inconsistency: constructor still uses if-revert pattern.The constructor validation for
zkSyncDiamond_was not converted torequire, unlike constructors inLineaBuffer,ScrollBuffer, andZkSyncBufferwhich were migrated in this PR. Consider converting for consistency.Suggested fix
constructor(address zkSyncDiamond_) { - if (zkSyncDiamond_ == address(0)) { - revert InvalidZkSyncDiamondAddress(); - } + require(zkSyncDiamond_ != address(0), InvalidZkSyncDiamondAddress()); _zkSyncDiamond = zkSyncDiamond_; }src/contracts/block-hash-pusher/scroll/ScrollPusher.sol (1)
29-35: Inconsistency: constructor still uses if-revert pattern.Same as
ZkSyncPusherandLineaPusher— this constructor was not migrated while buffer constructors were. Consider converting for consistency across the PR.Suggested fix
constructor(address l1ScrollMessenger_) { - if (l1ScrollMessenger_ == address(0)) { - revert InvalidL1ScrollMessengerAddress(); - } + require(l1ScrollMessenger_ != address(0), InvalidL1ScrollMessengerAddress()); _l1ScrollMessenger = l1ScrollMessenger_; }src/contracts/block-hash-pusher/linea/LineaPusher.sol (1)
27-33: Inconsistency: constructor still uses if-revert pattern.Same pattern as the other pusher constructors — not migrated while buffer constructors were.
Suggested fix
constructor(address rollup_) { - if (rollup_ == address(0)) { - revert InvalidLineaRollupAddress(); - } + require(rollup_ != address(0), InvalidLineaRollupAddress()); _lineaRollup = rollup_; }
Summary by CodeRabbit