-
Notifications
You must be signed in to change notification settings - Fork 41
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
Update the MsgMarketCommitmentSettle cli stuff use the keyring if a from is provided. #2001
Conversation
WalkthroughThe recent updates primarily focus on enhancing the Changes
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 Configration 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: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- CHANGELOG.md (1 hunks)
- x/exchange/client/cli/cli_test.go (3 hunks)
- x/exchange/client/cli/flags_test.go (6 hunks)
- x/exchange/client/cli/query_setup.go (1 hunks)
- x/exchange/client/cli/query_setup_test.go (2 hunks)
- x/exchange/client/cli/tx_setup_test.go (2 hunks)
Files skipped from review due to trivial changes (1)
- x/exchange/client/cli/flags_test.go
Additional comments not posted (27)
x/exchange/client/cli/cli_test.go (3)
1315-1319
: RefactorednewClientContext
to include keyring setup aligns with PR objectives.
1337-1349
: Properly sets up keyring in client context with error handling.
1331-1335
: Ensure sensitive keyring constants are securely managed.#!/bin/bash # Description: Verify that keyring constants are not exposed inappropriately. # Test: Search for the keyring constants usage. Expect: No exposure in logs or other insecure places. rg --type go $'keyringName|keyringMnemonic|keyringAddr'x/exchange/client/cli/query_setup_test.go (1)
71-71
: Change fromnewClientContextWithCodec
tonewClientContext
aligns with the PR's objective to simplify client context setup.x/exchange/client/cli/tx_setup_test.go (22)
Line range hint
73-91
: The test functionTestSetupCmdTxCreateAsk
correctly sets up and validates the command flags for creating an ask in the market exchange context.
Line range hint
93-126
: The test functionTestMakeMsgCreateAsk
thoroughly tests the message creation logic for an "ask" order under various scenarios, including error handling.
Line range hint
128-146
: The test functionTestSetupCmdTxCreateBid
correctly sets up and validates the command flags for creating a bid in the market exchange context.
Line range hint
148-181
: The test functionTestMakeMsgCreateBid
thoroughly tests the message creation logic for a "bid" order under various scenarios, including error handling.
Line range hint
183-201
: The test functionTestSetupCmdTxCommitFunds
correctly sets up and validates the command flags for committing funds in the market exchange context.
Line range hint
203-236
: The test functionTestMakeMsgCommitFunds
thoroughly tests the message creation logic for committing funds under various scenarios, including error handling.
Line range hint
238-256
: The test functionTestSetupCmdTxCancelOrder
correctly sets up and validates the command flags for canceling an order in the market exchange context.
Line range hint
258-291
: The test functionTestMakeMsgCancelOrder
thoroughly tests the message creation logic for canceling an order under various scenarios, including error handling.
Line range hint
293-311
: The test functionTestSetupCmdTxFillBids
correctly sets up and validates the command flags for filling bids in the market exchange context.
Line range hint
313-346
: The test functionTestMakeMsgFillBids
thoroughly tests the message creation logic for filling bids under various scenarios, including error handling.
Line range hint
348-366
: The test functionTestSetupCmdTxFillAsks
correctly sets up and validates the command flags for filling asks in the market exchange context.
Line range hint
368-401
: The test functionTestMakeMsgFillAsks
thoroughly tests the message creation logic for filling asks under various scenarios, including error handling.
Line range hint
403-421
: The test functionTestSetupCmdTxMarketSettle
correctly sets up and validates the command flags for market settlement in the market exchange context.
Line range hint
423-456
: The test functionTestMakeMsgMarketSettle
thoroughly tests the message creation logic for market settlement under various scenarios, including error handling.
Line range hint
458-476
: The test functionTestSetupCmdTxMarketCommitmentSettle
correctly sets up and validates the command flags for market commitment settlement in the market exchange context.
Line range hint
478-735
: The test functionTestMakeMsgMarketCommitmentSettle
thoroughly tests the message creation logic for market commitment settlement under various scenarios, including error handling.
Line range hint
737-755
: The test functionTestSetupCmdTxMarketReleaseCommitments
correctly sets up and validates the command flags for releasing market commitments in the market exchange context.
Line range hint
757-794
: The test functionTestMakeMsgMarketReleaseCommitments
thoroughly tests the message creation logic for releasing market commitments under various scenarios, including error handling.
Line range hint
796-814
: The test functionTestSetupCmdTxMarketSetOrderExternalID
correctly sets up and validates the command flags for setting an external ID on a market order in the market exchange context.
Line range hint
816-849
: The test functionTestMakeMsgMarketSetOrderExternalID
thoroughly tests the message creation logic for setting an external ID on a market order under various scenarios, including error handling.
Line range hint
851-869
: The test functionTestSetupCmdTxMarketWithdraw
correctly sets up and validates the command flags for withdrawing from a market in the market exchange context.
Line range hint
871-904
: The test functionTestMakeMsgMarketWithdraw
thoroughly tests the message creation logic for withdrawing from a market under various scenarios, including error handling.CHANGELOG.md (1)
95-95
: The update to theCHANGELOG.md
correctly reflects the integration of keyring functionality into thecommitment-settlement-fee-calc
CLI query as described in the PR summary and AI-generated summary.
if addr, err := sdk.AccAddressFromBech32(clientCtx.From); err == nil { | ||
clientCtx.FromAddress = addr | ||
} else { | ||
clientCtx.FromAddress, clientCtx.From, _, errs[1] = client.GetFromFields(clientCtx, clientCtx.Keyring, clientCtx.From) | ||
} |
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.
Enhance error handling in address conversion logic.
The current implementation attempts to convert the from
address from Bech32 format and falls back to the keyring if it fails. Consider adding more detailed error handling or logging to provide clearer feedback on what went wrong in case of an error. This could improve debugging and user experience.
- clientCtx.FromAddress, clientCtx.From, _, errs[1] = client.GetFromFields(clientCtx, clientCtx.Keyring, clientCtx.From)
+ clientCtx.FromAddress, clientCtx.From, _, errs[1] = client.GetFromFields(clientCtx, clientCtx.Keyring, clientCtx.From)
+ if errs[1] != nil {
+ // Log or handle the error appropriately
+ }
Committable suggestion was skipped due low confidence.
…rom is provided. (#2001) * Update the MsgMarketCommitmentSettle cli stuff use the keyring if a from is provided. * Add changelog entry. * Add test case for unknown keyring name.
Description
This PR makes the
provenanced query exchange commitment-settlement-fee-calc
command use the keyring to get the from address (just like the related tx command would do).Prior to this PR, you could provide the admin address using the '--from' flag, but it didn't use the keyring, so it had to be an address. That means that, if you wanted to use a named keyring entry when doing the tx, you couldn't provide the same flags to the query command (to check it before you try it). After this PR, you can provide the same
--from
value to both commands.Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passesSummary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests