fix: enforce rate limit on outbound ibc transfers#116
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRate limit keeper initialization is reordered to occur after the transfer keeper is created, then explicitly connected to it via Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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 docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions 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 |
fix: enforce rate limit on outbound ibc transfers
Motivation 💡
TransferKeeperwas constructed withapp.IBCKeeper.ChannelKeeperas itsICS4Wrapper, so outbound transfers calledtransfer.SendPacket -> channel.SendPacketdirectly, completely bypassing the rate-limit middleware. Rate limiting only applied to inbound packets (via theIBCModulemiddleware chain), leaving the outbound path unprotected.Changes 🛠
RateLimitKeeperinitialization to run afterTransferKeepercreationapp.TransferKeeper.WithICS4Wrapper(&app.RateLimitKeeper)so outbound transfers flow through rate limiting before reaching the channelrecoveryandclaimsmiddlewaresConsiderations 🤔
transferKeeper.SendPacket -> rateLimitKeeper.SendPacket -> channel.SendPacket. Inbound chain remainschannel.RecvPacket -> erc20.OnRecvPacket -> rateLimit.OnRecvPacket -> transfer.OnRecvPacket.WithICS4Wrapperis called beforetransfer.NewAppModuleandtransfer.NewIBCModule, which take the keeper by value, so the module copies observe the correctics4Wrapper.Erc20Keeperholds a pointer toTransferKeeper, so it also sees the updated wiring.&app.RateLimitKeeper(pointer) rather than a value copy to preserve identity and future-proof against later mutations of the keeper.Summary by CodeRabbit
Bug Fixes
Documentation