Skip to content

Comments

[Pushers N02] Using if else instead of require#86

Open
luiz-lvj wants to merge 1 commit intomainfrom
fix/pushers-N02
Open

[Pushers N02] Using if else instead of require#86
luiz-lvj wants to merge 1 commit intomainfrom
fix/pushers-N02

Conversation

@luiz-lvj
Copy link
Collaborator

@luiz-lvj luiz-lvj commented Feb 19, 2026

This PR updates Pushers contracts to use require instead of if else

Summary by CodeRabbit

  • Refactor
    • Enhanced code consistency by standardizing parameter validation logic across smart contract constructors, implementing uniform error handling patterns for address validation during initialization.

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Three smart contract constructors refactored to replace conditional revert patterns with require statements for zero-address validation. LineaPusher, ScrollPusher, and ZkSyncPusher each now use require checks to enforce non-zero rollup/messenger/diamond addresses during initialization, maintaining identical error handling behavior through custom error types.

Changes

Cohort / File(s) Summary
Constructor Validation Refactoring
src/contracts/block-hash-pusher/linea/LineaPusher.sol, src/contracts/block-hash-pusher/scroll/ScrollPusher.sol, src/contracts/block-hash-pusher/zksync/ZkSyncPusher.sol
Replaced manual if-condition revert patterns with require statements to validate constructor parameters are non-zero addresses. Each contract's zero-address check now uses a single require statement instead of conditional revert logic, with error reporting via custom error types (InvalidLineaRollupAddress, InvalidL1ScrollMessengerAddress, InvalidZkSyncDiamondAddress).

Possibly related PRs

Poem

🐰 Three pushers grew wise today,
No more tangled ifs in their way,
Require statements, clean and bright,
Zero-check validation done right! ✨

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims the PR uses 'if else instead of require,' but the actual changes replace 'if-else with revert' patterns with 'require' statements—the opposite of what the title states. Update the title to accurately reflect the changes, such as '[Pushers N02] Use require instead of if-else' or '[Pushers N02] Replace if-else patterns with require statements.'
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/pushers-N02

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@luiz-lvj luiz-lvj requested a review from pepebndc February 20, 2026 15:06
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.

1 participant