The ADD-01 fix ensures that the slashed amounts are correctly accounted for in the node.withdrawableCreditedNodeETH variable. This variable tracks the latest amount of ETH available for withdrawal, and the fix deducts the slashedWithdrawable amount directly from it.
This helps maintain an accurate record of the ETH that remains withdrawable after a slashing event, thereby preventing discrepancies in user balances.
function _burnSlashed(address nodeOwner) internal {
NativeVaultLib.Storage storage self = _state();
NativeVaultLib.NativeNode storage node = self.ownerToNode[nodeOwner];
uint256 slashedAssets;
// Account for rounding errors which might make convertToAssets() > totalRestakedETH
if (node.totalRestakedETH > convertToAssets(balanceOf(nodeOwner))) {
// slashed ETH = total restaked ETH (node + beacon) - share price equivalent ETH
slashedAssets = node.totalRestakedETH - convertToAssets(balanceOf(nodeOwner));
}
// sweepable ETH = min(ETH available on node that has been minted shares for, total slashed ETH)
uint256 slashedWithdrawable = Math.min(node.withdrawableCreditedNodeETH, slashedAssets);
// withdraw sweepable ETH to slashStore
INativeNode(node.nodeAddress).withdraw(address(0), slashedWithdrawable);
// update total restaked ETH available (node + beacon)
node.totalRestakedETH -= slashedWithdrawable;
node.withdrawableCreditedNodeETH -= slashedWithdrawable;
}
Lines of code
Vulnerability details
Comments
link
The ADD-01 fix ensures that the slashed amounts are correctly accounted for in the
node.withdrawableCreditedNodeETH
variable. This variable tracks the latest amount of ETH available for withdrawal, and the fix deducts theslashedWithdrawable
amount directly from it.This helps maintain an accurate record of the ETH that remains withdrawable after a slashing event, thereby preventing discrepancies in user balances.