-
Notifications
You must be signed in to change notification settings - Fork 686
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
AA-507 Min Penalty Threshold #534
Conversation
uint256 private constant PENALTY_PERCENT = 10; | ||
// Threshold below which no penalty would be charged | ||
uint256 private constant PENALTY_GAS_THRESHOLD = 4e4; |
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.
- don't use exponential notation in solidity code. better 40_000
- what is the rationale for this value?
@@ -819,7 +822,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT | |||
|
|||
function _getUnusedGasPenalty(uint256 gasUsed, uint256 gasLimit) internal pure returns (uint256) { | |||
unchecked { | |||
if (gasLimit <= gasUsed) { | |||
if (gasLimit <= gasUsed || gasLimit - gasUsed <= PENALTY_GAS_THRESHOLD) { |
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.
Damn solidity, doesn't optimize gasLimit-gasUsed
which is done twice...
better add below if (unusedGas<=PENALTY_GAS_THRESHOLD) return 0;
(which is also slightly more readable)
No description provided.