Remove remaining type casts - #5606
Conversation
| adjusted_total_slashing_balance = min( | ||
| Gwei(sum(state.slashings)) | ||
| sum(state.slashings) | ||
| # [Modified in Bellatrix] | ||
| * PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX, | ||
| total_balance, | ||
| ) |
There was a problem hiding this comment.
Hmm as long as the linter doesn't complain, I guess this is fine. sum() does not return a Gwei value here, it will return an int. This means adjusted_total_slashing_balance could be either type.
| if bit | ||
| ] | ||
| previous_slot = max(state.slot, Slot(1)) - 1 | ||
| previous_slot = state.slot - min(state.slot, 1) |
jtraglia
left a comment
There was a problem hiding this comment.
As long as the linter is happy with this, LGTM 👍 We should consider not using min, max, and sum helpers. They don't work as well with custom types. Or we could consider shadowing them with our own. A problem for another day.
Would you prefer to introduce like a saturate_sub helper? |
Yes, but in a different PR. And named "saturating sub" for consistency with rust and c++. |
This PR removes remaining type casts after #5588.