Skip to content
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(oracle): add slashing events #2532

Merged
merged 4 commits into from
May 29, 2024
Merged

feat(oracle): add slashing events #2532

merged 4 commits into from
May 29, 2024

Conversation

robert-zaremba
Copy link
Member

Description

Add oracle slashing events

@robert-zaremba robert-zaremba requested review from a team as code owners May 28, 2024 20:23
Copy link
Contributor

coderabbitai bot commented May 28, 2024

Walkthrough

The recent updates introduce a new event EventSlash in the oracle module, emitted during exchange rate updates to provide detailed slashing information. The SlashAndResetMissCounters function has been modified to emit this event. Additionally, the auction module's error handling practices have been refined by removing specific linting directives.

Changes

File Path Change Summary
proto/umee/oracle/v1/events.proto Added EventSlash message for emitting slashing details during exchange rate updates.
x/oracle/keeper/slash.go Updated SlashAndResetMissCounters to emit EventSlash event with validator slashing details.
CHANGELOG.md Documented the addition of the slashing event in the x/oracle module via PR #2532.
x/auction/keeper/rewards.go Removed //nolint: gosec directive from error handling in storeAllRewardsBids and storeAllRewardsAuctions.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant OracleModule
    participant EventSystem
    participant Validator

    Note over OracleModule: Exchange Rate Update
    OracleModule->>OracleModule: SlashAndResetMissCounters()
    OracleModule->>EventSystem: Emit EventSlash (validator address, slash factor, reason, jailed status)
    EventSystem-->>Validator: Notify Slashing Event
Loading

Poem

In the realm of code so bright,
Slashing events now take flight.
Validators beware, take care,
For EventSlash is in the air!
Error handling, now secure,
Auction bids and rewards, so pure.
🐰✨


Tip

Early Access Features
  • gpt-4o model for chat

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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between f97029c and 0705c2b.
Files ignored due to path filters (2)
  • swagger/swagger.yaml is excluded by !**/*.yaml
  • x/oracle/types/events.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
Files selected for processing (1)
  • proto/umee/oracle/v1/events.proto (1 hunks)
Additional comments not posted (1)
proto/umee/oracle/v1/events.proto (1)

32-44: The new EventSlash message definition looks well-formed and follows protobuf conventions.

However, ensure that the field validator is consistently named across different messages if it refers to the same entity.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0705c2b and 2177555.
Files selected for processing (1)
  • x/oracle/keeper/slash.go (2 hunks)
Additional comments not posted (1)
x/oracle/keeper/slash.go (1)

6-7: Imports added for sdkutil and oracle/types.

Ensure that these libraries are used appropriately in the codebase and check for any potential version conflicts.

x/oracle/keeper/slash.go Show resolved Hide resolved
Copy link

codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.64%. Comparing base (7f05ad4) to head (ff0714a).
Report is 484 commits behind head on main.

Current head ff0714a differs from pull request most recent head 44ff3ae

Please upload reports for the commit 44ff3ae to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2532       +/-   ##
===========================================
- Coverage   75.38%   62.64%   -12.75%     
===========================================
  Files         100      276      +176     
  Lines        8025    15943     +7918     
===========================================
+ Hits         6050     9988     +3938     
- Misses       1589     5182     +3593     
- Partials      386      773      +387     
Files Coverage Δ
x/oracle/keeper/slash.go 94.28% <100.00%> (+0.16%) ⬆️

... and 237 files with indirect coverage changes

@robert-zaremba robert-zaremba added the skip-e2e-test Skip the e2e tests label May 29, 2024
@robert-zaremba robert-zaremba enabled auto-merge May 29, 2024 14:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2177555 and 44ff3ae.
Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • x/auction/keeper/rewards.go (2 hunks)
Additional Context Used
LanguageTool (13)
CHANGELOG.md (13)

Near line 116: Using ‘plenty’ without ‘of’ is considered to be informal.
Context: .../pull/2368) Fix inflow amount calculation. Previously, the inflow amount of the t...
Rule ID: PLENTY_OF_NOUNS


Near line 117: Possible missing preposition found.
Context: ...nd SDK account sequence setting changes the calling client. ### API Breaking - [2...
Rule ID: AI_HYDRA_LEO_MISSING_TO


Near line 218: Did you mean “limiting”? Or maybe you should add a pronoun? In active voice, ‘allow’ + ‘to’ takes an object, usually a pronoun.
Context: ...veragedLiquidate.MaxRepay` which allows to limit the liquidation size using the leverage...
Rule ID: ALLOW_TO


Near line 351: The singular proper name ‘Bridge’ must be used with a third-person or a past tense verb.
Context: ...-network/umee/pull/1967) Gravity Bridge phase out phase-2: disable Umee -> Ethereum t...
Rule ID: HE_VERB_AGR


Near line 352: The singular proper name ‘Bridge’ must be used with a third-person or a past tense verb.
Context: ...-network/umee/pull/1967) Gravity Bridge phase out phase-2: disable Umee -> Ethereum t...
Rule ID: HE_VERB_AGR


Near line 402: Make sure that the singular noun after the number ‘4.1’ is correct.
Context: ...e/pull/1807) Fixes BNB ibc denom in 4.1 migration - [1812](https://github.com/umee-networ...
Rule ID: CD_POINT_CD_NN


Near line 420: In contexts where ‘if’ is followed by ‘or’, using ‘whether’ may be more appropriate (and formal).
Context: ...rowandMsgRepay` won't return errors if there is nothing to withdraw, borrow or...
Rule ID: IF_WHETHER


Near line 467: Possible missing article found.
Context: ...of the build process (you must build on same host as you run the binary, or copy the...
Rule ID: AI_HYDRA_LEO_MISSING_THE


Near line 471: Possible typo: you repeated a word
Context: ...e/pull/1555) Updates IBC to v5.1.0 that adds adds optional memo field to `FungibleTokenPa...
Rule ID: ENGLISH_WORD_REPEAT_RULE


Near line 528: A comma may be missing after the conjunctive/linking adverb ‘Also’.
Context: ...ableLend, docs, and internal functions. Also QueryLoaned similar queries to QuerySup...
Rule ID: SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA


Near line 532: This word is normally spelled as one.
Context: ...roto getters in x/leverage and x/oracle proto types. - [1126](https://github.com/umee-netwo...
Rule ID: EN_COMPOUNDS_PROTO_TYPES


Near line 553: Possible missing comma found.
Context: ...umee/pull/1157) Added PrintOrErr util function optimizing the CLI code flow. - [1118](...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 651: Possible typo: you repeated a word
Context: ...k/umee/pull/1358/files) Disable Gravity Bridge bridge messages. ### Improvements - [#1355](...
Rule ID: ENGLISH_WORD_REPEAT_RULE

Additional comments not posted (3)
x/auction/keeper/rewards.go (2)

124-124: Improved error handling by directly returning the error from store.SetValue.


166-166: Consistent improvement in error handling across related functions.

CHANGELOG.md (1)

55-55: The changelog entry is correctly formatted and accurately reflects the addition made by PR #2532.

@robert-zaremba robert-zaremba added this pull request to the merge queue May 29, 2024
Merged via the queue into main with commit 2fb394e May 29, 2024
23 of 24 checks passed
@robert-zaremba robert-zaremba deleted the robert/oracle-events branch May 29, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-e2e-test Skip the e2e tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants