-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(slash): Add the historical voting power to the slashing record #271
base: develop
Are you sure you want to change the base?
feat(slash): Add the historical voting power to the slashing record #271
Conversation
WalkthroughThis pull request introduces a new field Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
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
🧹 Nitpick comments (1)
x/operator/keeper/slash.go (1)
164-168
: Consider more robust error handling for JSON marshaling.While ignoring the JSON marshal error is acceptable for logging, consider adding debug logging when the error occurs to help troubleshoot potential issues.
- snapshotJSON, _ := json.Marshal(snapshot) - k.Logger(ctx).Info("the voting power snapshot info is:", "filter_height", slashEventEpochStartHeight, "snapshot", string(snapshotJSON)) + snapshotJSON, err := json.Marshal(snapshot) + if err != nil { + k.Logger(ctx).Debug("failed to marshal snapshot", "error", err) + k.Logger(ctx).Info("the voting power snapshot info is:", "filter_height", slashEventEpochStartHeight, "snapshot", snapshot) + } else { + k.Logger(ctx).Info("the voting power snapshot info is:", "filter_height", slashEventEpochStartHeight, "snapshot", string(snapshotJSON)) + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
x/operator/types/genesis.pb.go
is excluded by!**/*.pb.go
x/operator/types/tx.pb.go
is excluded by!**/*.pb.go
x/oracle/types/params.pb.go
is excluded by!**/*.pb.go
📒 Files selected for processing (3)
proto/exocore/operator/v1/tx.proto
(1 hunks)x/operator/keeper/slash.go
(4 hunks)x/operator/keeper/usd_value.go
(1 hunks)
🔇 Additional comments (4)
proto/exocore/operator/v1/tx.proto (1)
224-225
: LGTM! The historical voting power field is well-defined.
The new field is properly documented and uses an appropriate type (int64) for storing voting power.
x/operator/keeper/slash.go (2)
4-4
: LGTM! Import added for JSON marshaling.
The import is required for the new snapshot marshaling functionality.
91-91
: LGTM! Historical voting power field properly initialized.
The field is correctly populated with the parameter's Power value.
x/operator/keeper/usd_value.go (1)
393-395
: LGTM! Enhanced logging improves debuggability.
The detailed logging of USD value calculations will be valuable for debugging slashing events, including all relevant values like asset details, amounts, and prices.
Description
This PR adds the historical voting power to the slashing record and additional logs for slashing events.
Summary by CodeRabbit
New Features
historical_voting_power
, to enhance slashing event logging.Bug Fixes
Refactor