-
Notifications
You must be signed in to change notification settings - Fork 274
cli: refactor sanitizeMinBid #641
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
Conversation
cli/main.go
Outdated
| return nil, errors.New("minimum bid is too large, please ensure min-bid is denominated in Ethers") | ||
| } | ||
| if minBid > 0.0 { | ||
| log.Infof("Minimum bid: %v eth", minBid) |
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.
nit: should log after error checking and should not be in sanitizeMinBid
|
The linter fails, because it complains about dynamic errors and enforces static errors. I kinda disagree with the linter. Declaring static errors makes everything more spaghetti and this method is not used from a context where the type checking you get with static errors is useful. I am going to declare them as static anyway, to make the linter happy, but I think it makes the code worse and you should consider disabling the |
jtraglia
left a comment
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.
LGTM, just one suggestion around min bid log.
cli/main.go
Outdated
| log.Infof("minimum bid: %v eth", *relayMinBidEth) | ||
| } | ||
|
|
||
| relayMinBidWei, err := common.FloatEthTo256Wei(*relayMinBidEth) | ||
| relayMinBidWei, err := sanitizeMinBid(*relayMinBidEth) | ||
| if err != nil { | ||
| log.WithError(err).Fatal("failed converting min bid") | ||
| log.WithError(err).Fatal("Failed sanitizing min bid") | ||
| } | ||
| if relayMinBidWei.BigInt().Sign() > 0 { | ||
| log.Infof("Min bid set to %v wei", relayMinBidWei) |
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.
This changes the log from Eth to Wei. Maybe we should log both.
log.Infof("Min bid set to %v eth (%v wei)", relayMinBidEth, relayMinBidWei)
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #641 +/- ##
===========================================
- Coverage 52.37% 52.30% -0.07%
===========================================
Files 14 14
Lines 1600 1602 +2
===========================================
Hits 838 838
- Misses 703 706 +3
+ Partials 59 58 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
metachris
left a comment
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.
Looks great, thanks!
About the error linter -- you making a strong case definitely means a lot to me and I'd like to consider it. Do you feel strongly enough to create an issue on this repo, to continue the conversation there?
Refactor sanitizeMinBid