-
Notifications
You must be signed in to change notification settings - Fork 4k
refactor(simulation): adjust unjail operation weight and clarify skip reason #25294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughReduces DefaultWeightMsgUnjail from 100 to 5 in slashing simulation operations and updates comments in SimulateMsgUnjail to note frequent skip behavior when validators aren’t jailed. No functional changes to runtime behavior; non-jailed path still returns a NoOpMsg. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
x/slashing/simulation/operations.go (1)
164-166
: Potential nil dereference on error path (res may be nil).If SimDeliver returns err with a nil res, accessing res.Log will panic.
- if err != nil { - return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "unable to deliver tx"), nil, errors.New(res.Log) - } + if err != nil { + if res != nil && len(res.Log) > 0 { + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "unable to deliver tx"), nil, errors.New(res.Log) + } + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "unable to deliver tx"), nil, err + }
🧹 Nitpick comments (1)
x/slashing/simulation/operations.go (1)
90-92
: Avoid hardcoding the weight value in comments.Refer to the constant to prevent drift if it changes again.
- // This operation is often skipped because validators are rarely jailed in simulations. - // The weight has been reduced to 5 to reflect this reality. + // Often skipped because validators are rarely jailed in sims; see DefaultWeightMsgUnjail for the current weight rationale.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting
📒 Files selected for processing (1)
x/slashing/simulation/operations.go
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (1)
x/slashing/simulation/operations.go (1)
25-25
: Good call lowering the default weight to 5.Aligns with actual sim behavior and avoids wasting cycles on an op that usually skips.
Description
Fixes the slashing simulation operation weight issue where MsgUnjail was almost always skipped.
Summary by CodeRabbit
Chores
Documentation