Skip to content

Conversation

@pepebndc
Copy link
Collaborator

@pepebndc pepebndc commented Feb 10, 2026

The LineaBuffer and ScrollBuffer constructors do not validate that the pusher_ argument is non-zero, while ZkSyncBuffer enforces this check at deployment time. Although both Linea and Scroll buffers perform this validation at runtime within their receiveHashes functions, the absence of a constructor check allows deployment of a non-functional buffer that would revert on every call. Similarly, zero address checks are missing in the constructors of LineaPusher, ScrollPusher and ZkSyncPusher.

Consider adding a zero-address check for the pusher argument in the constructors of LineaBuffer and ScrollBuffer to fail fast at deployment and maintain consistency across all buffer implementations. Likewise, consider including similar validations for the constructors of LineaPusher, ScrollPusher, and ZkSyncPusher. Additionally, consider removing this check within the execution of each receiveHashes function, as the value of the _pusher account would already be checked upon deployment.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added zero-address validation checks at contract initialization across Linea, Scroll, and ZkSync implementations to prevent misconfiguration.
  • Improvements

    • Moved validation logic to constructor for earlier error detection and clearer error messages.
  • Tests

    • Added comprehensive constructor validation test coverage to verify zero-address rejection across all Buffer and Pusher contracts.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

The PR adds zero-address validation to constructors across block-hash-pusher contracts (Linea, Scroll, ZkSync), moving input validation from runtime functions to initialization time. Custom error messages are introduced for each contract implementation, and corresponding test coverage is added to verify constructor-level validation behavior.

Changes

Cohort / File(s) Summary
Linea Pusher/Buffer
src/contracts/block-hash-pusher/linea/LineaBuffer.sol, src/contracts/block-hash-pusher/linea/LineaPusher.sol
Added constructor-level zero-address validation for pusher and rollup addresses with custom errors. Validation moved from receiveHashes to constructor in LineaBuffer, eliminating redundant checks.
Scroll Pusher/Buffer
src/contracts/block-hash-pusher/scroll/ScrollBuffer.sol, src/contracts/block-hash-pusher/scroll/ScrollPusher.sol
Added constructor-level zero-address validation for pusher and L1 scroll messenger addresses with custom errors. ScrollBuffer validation occurs before storage assignments; removed pre-existing zero-check in receiveHashes.
ZkSync Pusher/Buffer
src/contracts/block-hash-pusher/zksync/ZkSyncBuffer.sol, src/contracts/block-hash-pusher/zksync/ZkSyncPusher.sol
Added constructor-level validation for ZkSync diamond address. ZkSyncBuffer removed defensive check in aliasedPusher, relying on constructor validation instead.
Linea Tests
test/block-hash-pusher/linea/LineaBuffer.t.sol, test/block-hash-pusher/linea/LineaPusher.t.sol
Added tests for constructor reverts on zero-address pusher/L2 message service/rollup. Updated existing sender-validation test to align with new constructor validation logic.
Scroll Tests
test/block-hash-pusher/scroll/ScrollBuffer.t.sol, test/block-hash-pusher/scroll/ScrollPusher.t.sol
Added tests verifying constructor reverts for zero-address pusher/L2 scroll messenger/L1 scroll messenger inputs.
ZkSync Tests
test/block-hash-pusher/zksync/ZkSyncBuffer.t.sol, test/block-hash-pusher/zksync/ZkSyncPusher.t.sol
Added tests for constructor reverts on zero-address pusher and ZkSync diamond address inputs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Add Linea pusher and buffer #59: Directly modifies the same LineaBuffer.sol and LineaPusher.sol contracts, moving zero-address checks into constructors and adding corresponding error types.
  • Update pushHashes function signature #60: Makes similar constructor-level validation and address immutability changes across pusher/buffer wiring, including pusher/rollup/buffer address handling.
  • Add Scroll pusher and buffer  #57: Introduces ScrollBuffer and ScrollPusher contracts that receive the same zero-address constructor validation and error patterns in this PR.

Suggested reviewers

  • frangio
  • nahimterrazas

Poem

🐰 A rabbit hops through code with cheer,
Zero addresses vanish here!
Constructors guard with watchful care,
No bad addresses slip through there!
Safety checks in every line,
The code grows stronger, oh so fine! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary objective of the changeset: adding zero-address validation checks to the Linea and Scroll buffer constructors, while also covering the pusher implementations.
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-L01

No actionable comments were generated in the recent review. 🎉


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.

Copy link
Collaborator

@luiz-lvj luiz-lvj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luiz-lvj luiz-lvj merged commit 785896a into main Feb 11, 2026
3 checks passed
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.

2 participants