-
Notifications
You must be signed in to change notification settings - Fork 14
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
Atleth bonding accounting #76
Conversation
if (_deposits < _claims + _withdrawals) { | ||
// CASE: in deficit, subtract from bonded balance | ||
uint256 amountOwed = _claims + _withdrawals - _deposits; | ||
if (_assign(winningSolver, amountOwed)) revert InsufficientTotalBalance((_claims + _withdrawals) - deposits); |
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.
Can we just use amountOwed
here as its calculated the same way, just above?
if (_assign(winningSolver, amountOwed)) revert InsufficientTotalBalance((_claims + _withdrawals) - deposits); | |
if (_assign(winningSolver, amountOwed)) revert InsufficientTotalBalance(amountOwed); |
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.
so amountOwed uses _deposits
, a memory variable, whereas the revert uses deposits
, which is a storage variable. The reason the revert uses the storage variable is because _assign()
increments it up to where we need it to be to calculate the shortfall rather than the total amount owed.
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.
it may be redundant though... that storage write in _assign doesn't need to happen at the end. There's probably a better way to do it.
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 good so far, I think it simplifies AtlETH
and GasAccounting
a lot
Co-authored-by: Ben Sparks <[email protected]>
Co-authored-by: Ben Sparks <[email protected]>
Co-authored-by: Ben Sparks <[email protected]>
…nc in AtlETH so automatically draw from any free unbonding atlETH.
…y - gas cost should only accrue to irresponsible actors, and be marginally cheaper for everyone else
…ne-Labs/atlas into atleth-bonding-accounting
…ne-Labs/atlas into atleth-bonding-accounting
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!
WIP
note the _assign() and _credit() methods in GasAccounting.