Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Rank by surplus driver V3 #2448
Rank by surplus driver V3 #2448
Changes from 17 commits
4dcb2fc
baab382
cfd645f
e399b3b
7558286
0f67ca6
3146882
f7c46f5
3193947
281f5ae
616fb19
b79e2eb
21cef14
64acb18
370a714
5098dfb
a808add
677e2ff
b176f23
c6baef0
47e8cc3
23ca5b9
cef632d
320a04f
4b29c66
243792d
5d8cdcf
ecea9e6
4c91250
43c0630
8e8f3db
3559c9f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Potential overflow of
U256
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 think overflow here is not realistic. Also I think we don't want to cover all theoretically possible places with
checked
functions, but rather the ones that can realistically happen.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.
Potential sum overflow
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: For consistency I would have expected a scaled limit buy amount.
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.
Potential multiplication overflow
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.
Unchecked multiplication
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.
You could multiply using
BigRational
numbers. That way you should have accurate results without having to multiply the factor with a huge number.Since I see you defining that function twice it might be a good idea to have that as a general helper function in our
number
crate.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 think we should avoid blindly adding a new error type for every potential call that could fail and instead ask us if we can group them in some sensible way. What is the advantage of having these strongly typed subtypes? I believe it's to then handle different types of errors differently (how are we realistically going to handle a
TypeConversion
differently from aDivisionByZero
?)Looking at
Factor
for instance, the only way this can happen is if the multiplication overflows (so really it's the same as Error::Overflow). I wonder if even the last three should be combined to something likeMath(anyhow::Error)
.I think by and large there are three types of error here:
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.
Factor also happens when the factor = 1.0
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.
did some cleanup, not sure if good enough