-
Notifications
You must be signed in to change notification settings - Fork 115
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
[TRA-505] Add x/listing testing framework and test for CreateMarket #1974
Conversation
WalkthroughThe recent changes enhance modularity and functionality in the blockchain application by integrating additional keepers into the Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant ListingModule
participant MarketKeeper
participant ErrorHandler
App->>ListingModule: Create Market
ListingModule->>MarketKeeper: Validate Ticker
MarketKeeper-->>ErrorHandler: Ticker Valid?
alt Valid Ticker
MarketKeeper->>ListingModule: Market Created
else Invalid Ticker
MarketKeeper-->>ErrorHandler: ErrMarketNotFound
ErrorHandler->>ListingModule: Return Error
end
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 as PR comments)
Additionally, you can add 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- protocol/app/app.go (1 hunks)
- protocol/testutil/app/app.go (2 hunks)
- protocol/testutil/keeper/listing.go (1 hunks)
- protocol/x/listing/keeper/listing.go (1 hunks)
- protocol/x/listing/keeper/listing_test.go (1 hunks)
- protocol/x/listing/module.go (1 hunks)
- protocol/x/listing/types/errors.go (1 hunks)
Additional comments not posted (10)
protocol/x/listing/types/errors.go (2)
7-11
: LGTM!The new error declaration
ErrMarketNotFound
is correctly registered and follows the existing pattern.
13-17
: LGTM!The error declaration
ErrReferencePriceZero
is correctly registered and follows the existing pattern.protocol/x/listing/keeper/listing_test.go (1)
15-67
: LGTM!The test case
TestCreateMarket
is correctly implemented, covers the intended scenarios, and follows best practices.protocol/testutil/keeper/listing.go (2)
25-71
: LGTM!The utility function
ListingKeepers
is correctly implemented and follows best practices.
74-103
: LGTM!The utility function
createListingKeeper
is correctly implemented and follows best practices.protocol/x/listing/keeper/listing.go (1)
45-45
: Improved error handling.The error handling has been made more specific by returning
types.ErrMarketNotFound
. This improves the clarity of the error.protocol/x/listing/module.go (2)
101-105
: Enhanced functionality with additional keepers.The
AppModule
struct now includes four new fields:pricesKeeper
,clobKeeper
,marketMapKeeper
, andperpetualsKeeper
. This enhances the module's functionality.
111-122
: Proper initialization of new keepers.The constructor function
NewAppModule
has been updated to accept and initialize the new keeper parameters. This ensures proper initialization of the new fields.protocol/testutil/app/app.go (1)
270-271
: Extended functionality to supportlistingtypes.GenesisState
.The function
UpdateGenesisDocWithAppStateForModule
now includes a case forlistingtypes.GenesisState
, enhancing its capability to process the listing module'sGenesisState
.protocol/app/app.go (1)
1171-1178
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
listingModule
match the new signature.Verification successful
LGTM! But verify the function usage in the codebase.
The code changes are approved.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `listingModule` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type go -A 5 $'listingmodule.NewAppModule'Length of output: 307
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- protocol/testutil/keeper/listing.go (1 hunks)
- protocol/x/listing/keeper/listing.go (5 hunks)
- protocol/x/listing/keeper/listing_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- protocol/testutil/keeper/listing.go
- protocol/x/listing/keeper/listing.go
- protocol/x/listing/keeper/listing_test.go
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- protocol/app/app.go (1 hunks)
- protocol/x/listing/keeper/listing_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- protocol/app/app.go
- protocol/x/listing/keeper/listing_test.go
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/x/listing/keeper/listing_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- protocol/x/listing/keeper/listing_test.go
Changelist
[Describe or list the changes made in this PR]
Test Plan
[Describe how this PR was tested (if applicable)]
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation