Repository navigation
LZ Bridge (L-02): Emit actual LZ native fee in Bridged event - #270
Conversation
burnAndSend now returns the MessagingReceipt from the LZ endpoint, and LZCrossChainBridge.sendOhm surfaces receipt.fee.nativeFee in the Bridged event alongside the supplied msg.value. Previously the event recorded msg.value, which overstates the paid fee when callers overpay and the LZ endpoint refunds the excess to msg.sender. Extend tests: BurnAndSend verifies receipt.fee.nativeFee matches the estimate and is strictly less than totalSent on overpayment; SendOhm adds test_sendOhm_emitsActualNativeFeeOnOverpayment to assert the Bridged event reports the real nativeFee and the supplied msgValue.
📝 WalkthroughWalkthroughThe PR updates the LayerZero cross-chain bridge to capture and propagate the ChangesLayerZero Receipt Propagation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/periphery/interfaces/ILZCrossChainBridge.sol (1)
29-35:Bridgedevent ABI change breaks existing off-chain consumers.The event topic (
keccak256("Bridged(address,uint256,uint32,uint256)")) changes tokeccak256("Bridged(address,uint256,uint32,uint256,uint256)"). Any subgraph, analytics pipeline, or frontend listener that subscribed to the old signature will silently stop receiving events after the contract is upgraded.Ensure that all subgraphs, indexers, and event decoders (frontend, off-chain services) are updated to the new ABI before or immediately after deployment.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/periphery/interfaces/ILZCrossChainBridge.sol` around lines 29 - 35, The Bridged event signature was changed (event Bridged(...) now includes msgValue) which will break any off-chain consumers relying on the old keccak256 topic; to fix, either restore the original Bridged ABI or preserve backward compatibility by keeping the original Bridged declaration and adding a new event (e.g., BridgedV2 or BridgedWithMsgValue) or emitting both events from the bridging logic; then update all off-chain artifacts (ABI files, subgraph mappings/manifest, indexer decoders, frontend listeners) to the new event name/signature and re-deploy/re-index so consumers pick up the change — check and modify usages referring to the Bridged symbol and any Graph mappings that decode its topics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/periphery/interfaces/ILZCrossChainBridge.sol`:
- Around line 29-35: The Bridged event signature was changed (event Bridged(...)
now includes msgValue) which will break any off-chain consumers relying on the
old keccak256 topic; to fix, either restore the original Bridged ABI or preserve
backward compatibility by keeping the original Bridged declaration and adding a
new event (e.g., BridgedV2 or BridgedWithMsgValue) or emitting both events from
the bridging logic; then update all off-chain artifacts (ABI files, subgraph
mappings/manifest, indexer decoders, frontend listeners) to the new event
name/signature and re-deploy/re-index so consumers pick up the change — check
and modify usages referring to the Bridged symbol and any Graph mappings that
decode its topics.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 611802e7-b96b-41c3-b266-30329f46c228
📒 Files selected for processing (6)
src/periphery/bridge/LZCrossChainBridge.solsrc/periphery/interfaces/ILZCrossChainBridge.solsrc/policies/bridge/LZBridgeGateway.solsrc/policies/interfaces/ILZBridgeGateway.solsrc/test/periphery/bridge/LZCrossChainBridge/LZCrossChainBridge_SendOhm.t.solsrc/test/policies/bridge/LZBridgeGateway/LZBridgeGateway_BurnAndSend.t.sol
Summary by CodeRabbit
Bug Fixes
Tests