[Pushers L03] BlockHashesPushedis emitted when storage is not written.#80
[Pushers L03] BlockHashesPushedis emitted when storage is not written.#80
BlockHashesPushedis emitted when storage is not written.#80Conversation
📝 WalkthroughWalkthroughThis PR enhances the BaseBuffer contract with validation to reject zero-valued firstBlockNumber and implements conditional event emission—BlockHashesPushed is now emitted only when new hashes are actually written, preventing spurious events during duplicate or empty writes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 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)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
The IBuffer.receiveHashes NatSpec comment specifies that "the last block in the buffer must be less than the last block being pushed", implying strictly monotonic pushes. However, BaseBuffer._receiveHashes silently skips writes for any blockNumber <= existingBlockNumber and unconditionally emits BlockHashesPushed(firstBlockNumber, lastBlockNumber) regardless of whether any hashes were stored.
Since pushers are permissionless, third parties can enqueue duplicate or out-of-order batches. If the buffer contains hashes up to block 100 and a message arrives for blocks 90-99, all writes are skipped yet BlockHashesPushed(90, 99) is emitted. Off-chain systems monitoring these events may misinterpret them as progress. In addition, block 0 is permanently unwriteable because _blockNumberBuffer defaults to zero and the skip condition always triggers.
This PR updates the behavior by verifying if at least one block hash is written in order to emit the event.
Summary by CodeRabbit
New Features
Bug Fixes