-
Notifications
You must be signed in to change notification settings - Fork 193
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(perp): Add DNR Epoch Wiring #1683
Conversation
# Conflicts: # .github/workflows/docker-publish.yml
Warning Rate Limit Exceeded@testinginprod has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 9 minutes and 11 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe updates involve the introduction of a new Discounts and Rebates (DnR) epoch mechanism within a blockchain module. A field to track the DnR epoch name has been added to the genesis state and keeper structure. New logic ensures that when an epoch ends, if it matches the DnR epoch name, a new DnR epoch is started. Additionally, tests have been added to verify the correct behavior of the DnR epoch functionality. Changes
TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- x/perp/v2/types/genesis.pb.go
Files selected for processing (7)
- proto/nibiru/perp/v2/genesis.proto (1 hunks)
- x/perp/v2/keeper/dnr.go (1 hunks)
- x/perp/v2/keeper/dnr_test.go (2 hunks)
- x/perp/v2/keeper/hooks.go (1 hunks)
- x/perp/v2/keeper/keeper.go (3 hunks)
- x/perp/v2/module/genesis.go (2 hunks)
- x/perp/v2/module/genesis_test.go (2 hunks)
Files skipped from review due to trivial changes (2)
- proto/nibiru/perp/v2/genesis.proto
- x/perp/v2/module/genesis.go
Additional comments: 9
x/perp/v2/keeper/dnr_test.go (4)
5-13: The imports added are consistent with the summary and seem to be necessary for the new test functions introduced.
257-261: The new type
actionFn
and its methodDo
are correctly implemented and follow the description provided in the summary.264-282: The new functions
dnrEpochIdentifierIs
,triggerEpoch
, andexpectDnREpoch
are implemented as described in the summary and return anactionFn
as expected.263-301: The
TestDnREpoch
function is correctly implemented with test cases for DnR epochs, including scenarios for valid and invalid identifiers, as outlined in the summary.x/perp/v2/keeper/keeper.go (3)
38-45: The addition of the
DnREpochName
field to theKeeper
struct aligns with the summary and the purpose of the pull request to track the DnR epoch identifier.129-138: The initialization of the
DnREpochName
field in theNewKeeper
function is correctly done using thecollections.NewItem()
with the appropriate namespace and value encoder.151-155: The addition of the
NamespaceDnrEpochName
constant is consistent with the new field added to theKeeper
struct and is necessary for the correct functioning of theDnREpochName
field.x/perp/v2/module/genesis_test.go (2)
104-108: The addition of setting
DnREpochName
andDnREpoch
in the context is consistent with the summary and the pull request description. This ensures that the DnR feature is correctly initialized with the epoch mechanism.156-157: The assertions for
DnrEpochName
andDnrEpoch
are correctly placed to ensure that the genesis state is properly initialized and exported with the new fields related to the DnR feature.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1683 +/- ##
=======================================
Coverage 73.92% 73.93%
=======================================
Files 192 192
Lines 15398 15418 +20
=======================================
+ Hits 11383 11399 +16
- Misses 3355 3358 +3
- Partials 660 661 +1
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- x/perp/v2/keeper/dnr_test.go (2 hunks)
Additional comments: 4
x/perp/v2/keeper/dnr_test.go (4)
9-9: The addition of
"github.com/stretchr/testify/require"
is appropriate for the new test cases that userequire
assertions.258-262: The
actionFn
type and itsDo
method are well-defined and provide a clear way to define actions for test cases.265-283: The helper functions
dnrEpochIdentifierIs
,triggerEpoch
, andexpectDnREpoch
are correctly implemented to facilitate the testing of DnR epoch functionality.286-300: The test cases in
TestDnREpoch
are well-structured, using the helper functions to effectively test both valid and invalid DnR epoch identifiers.
Description
This PR wires the AfterEpochEnd hook to the DnR StartNewEpoch function.
Purpose
Wraps up DnR feature.
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Documentation
Tests