-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix required opt validation bugs in CLI #5274
Fix required opt validation bugs in CLI #5274
Conversation
The offer volume is shown so traders know how much fiat they are sending or receiving without having to call getoffer. Changed the 'Fiat Sent' and 'Fiat Received' column headers to show which fiat is being transfered, e.g., 'EUR Sent', 'EUR Received'. Adjusted apitest's trade-simulation-utils.sh to the modified gettrade output.
A new handleExceptionAsWarning method logs warn(ex.msg) instead of the full stack trace.
The gRPC interceptor was not using the correct method/ratemeter map key, and failing to find a rate meter for the server call. - Fix the rate meter key lookup bug. - Disable most strict, default call rate meters in tests. Made an adjustment to the test harness' scaffold setup so an interceptor testing or disabling config file is always picked up by bob and alice daemons. - Set arbitration daemon's registerDisputeAgent rate @ 10/second, so it does not interfere with the test harness. (There is no pre-existing arb node appDataDir before that daemon starts.) Note: The test harness cannot install the custom rate metering file in an arb daemon's appDataDir before it starts because there is no dao-setup file for that node type. TODO: Adjust api simulation scripts to interceptor bug fix.
This change replaces the hard coded strings used as keys in interceptor rate-metering lookup maps. Now, the fullMethodName defined in each bisq.proto.grpc.* class' io.grpc.MethodDescriptor is used, not a hard coded String. For example, the rate metering lookup key for 'GetBalances', in 'GrpcWalletsService', is the fullMethodName = SERVICE_NAME + '/' + "GetBalances", where SERVICE_NAME = "io.bisq.protobuffer.Wallets". Also adjusted affected tests, and tidy'd up interceptor logging.
- Fix tx-fee-rate opt validation bug. - Tell user what option value is not a number. - Append ", server may not be running" text to "io exception" exception msg.
Now prints '<integer> sats/byte' to console.
Unset empty string default values on some the createoffer method's required option declarations in CreateOfferOptionParser, and adds a check for presence of required currency-code option. - Removes default "" value from required opt direction. - Removes default "" value from required opt currency-code. - Removes default "" value from required opt amount. - Removes default "" value from required opt min-amount. - Removes default "" value from required opt fixed-price. - Removes default "" value from required opt security-deposit. - Check for required currency-code option. Unset empty string default values on some of the createoffer method's required option declarations in TakeOfferOptionParser. - Removes default "" value from required opt offer-id. - Removes default "" value from required opt payment-account. Other opt parser default values removed from: - CancelOfferOptionParser#offer-id - CreatePaymentAcctOptionParser#payment-account-form - GetAddressBalanceOptionParser#address - GetBTCMarketPriceOptionParser#currency-code - GetOfferOptionParser#offer-id - GetOffersOptionParser#direction - GetOffersOptionParser#currency-code - GetPaymentAcctFormOptionParser#payment-method-id - GetTradeOptionParser#trade-id - GetTransactionOptionParser#transaction-id - RegisterDisputeAgentOptionParser#registration-key - RegisterDisputeAgentOptionParser#dispute-agent-type - RemoveWalletPasswordOptionParser#wallet-password - SendBsqOptionParser#address - SendBsqOptionParser#amount - SendBtcOptionParser#address - SendBtcOptionParser#amount - SetTxFeeRateOptionParser#tx-fee-rate - SetWalletPasswordOptionParser#wallet-password - UnlockWalletOptionParser#wallet-password - UnlockWalletOptionParser#timeout - WithdrawFundsOptionParser#trade-id - WithdrawFundsOptionParser#address
Make sure non-empty opt values are present in the parsers' custom validation, or jsimpleopt will throw exceptions with stylistically inconsisent messages.
Does not check every combination of options for every method, but we finally have an option parser test case to build on.
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.
The last part of commit d01a7b7 's message is incorrect. Commit d01a7b7 makes empty opt values invalid, and throws an exception with the conventional no <opt> specified
error message. Before this change, the CLI's opt parser accepted --offer-id=
as a valid option, with an empty value.
The next commit makes the option parser throw option parser exceptions due to missing (not empty) option values. The next commit will result in a stylistically consistent error message printed to the console when --offer-id
is present without an =
delimiter (as if it were a no-arg option).
This change ensure a stylistically consistent error message is printed to the CLI console if an option is present, but without the '=' sign.
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.
utACK
Closed with merge of next PR #5284 (without file conflicts). |
Many required CLI opt checks were incorrectly passing due to assignment of
""
default values. Server side validation was helping cover up some of affects of this type of bug, but this change resolves the issue in the CLI side.Credit to @BtcContributor for exposing the problem while beta testing the api.
Changes are listed below.
Unsets empty string default values on some the
createoffer
method's required option declarations in CreateOfferOptionParser, and adds a check for presence of required currency-code option.Unsets empty string default values on some of the
takeoffer
method's required option declarations in TakeOfferOptionParser.Other opt parser default values removed from:
PR #5273 should be reviewed & merged before this one.