-
Notifications
You must be signed in to change notification settings - Fork 3
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
Apply TxFeeCap conversion #321
base: celo11
Are you sure you want to change the base?
Conversation
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.
Generally looks good to me, however I don't understand why you converted the float multiplier instead of the gas-price.
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.
There's one remaining nitpick from my side, otherwise it's good to go now!
rate, ok := rates[*feeCurrency] | ||
if !ok { | ||
return 0, fmt.Errorf("could not convert from native to fee currency (fee-currency=%s): %w ", feeCurrency, exchange.ErrUnregisteredFeeCurrency) | ||
log.Warn("Failed to get exchange rates for latest block", "err", err) |
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.
I believe this is overly verbose - especially since this warning can't be correlated to the request arguments and failed RPC requests are already logged with additional request-context:
Lines 476 to 481 in 055f61b
if resp.Error != nil { | |
logctx = append(logctx, "err", resp.Error.Message) | |
if resp.Error.Data != nil { | |
logctx = append(logctx, "errdata", formatErrorData(resp.Error.Data)) | |
} | |
h.log.Warn("Served "+msg.Method, logctx...) |
So I'd just pass along the error, or wrap the error when the additional message should also be visible to the caller in the response.
return 0, fmt.Errorf("failed to accurately convert fee currency to float64") | ||
gasPriceInCelo, err := exchange.ConvertCurrencyToCelo(rates, feeCurrency, gasPrice) | ||
if err != nil { | ||
log.Warn("Failed to convert gas price", "err", err, "currency", feeCurrency) |
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.
see other comment
Closes #313
This PR adds fee cap conversion in
CheckTxFee
.ConvertTxFeeCapToCurrency
fetches TxFeeCap from backend and convert it to a tx fee currency.