-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add is_higher_value_bid helper for bid forwarding threshold
#4792
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
base: master
Are you sure you want to change the base?
Conversation
- Use overflow-safe integer arithmetic via quotient/remainder splitting - Add MIN_BID_INCREASE_PERCENT config (minimum % increase to forward) - Add unit tests for threshold boundary cases
| quotient = current_bid.value // 100 | ||
| remainder = current_bid.value % 100 | ||
| min_increase = quotient * MIN_BID_INCREASE_PERCENT | ||
| min_increase += (remainder * MIN_BID_INCREASE_PERCENT + 99) // 100 |
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 is a ceiling so technically the threshold is ceiling of MIN_BID_INCREASE_PERCENT percent of current bid's value. I guess percentage gives us enough precision as value is in Gwei?
| - _[REJECT]_ `bid.execution_payment` is zero. | ||
| - _[IGNORE]_ this is the first signed bid seen with a valid signature from the | ||
| given builder for this slot. | ||
| - _[IGNORE]_ this bid is the highest value bid seen for the corresponding slot |
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.
Is it better to describe something like "higher than other bids by at least MIN_BID_INCREASE_PERCENT"?
For DoS prevention, we should require that new bids be at least N% greater in value than the previous highest value bid before forwarding it to peers. This PR defines the percentage as 3% but we can change that to whatever we want. With 3%, an attacker would need to send ~701 valid signed bids to "spam" from 1 gwei to 1 ETH. This is the worst case scenario.
Also:
MIN_BID_INCREASE_PERCENTconfig (minimum % increase to forward)