Skip to content

Commit 702ef9d

Browse files
committed
fix(VaultHub): add safe cast for reported values
1 parent 7b46fa6 commit 702ef9d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contracts/0.8.25/vaults/VaultHub.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,8 @@ contract VaultHub is PausableUntilWithRoles {
11071107
uint256 _reportMaxLiabilityShares,
11081108
uint256 _reportSlashingReserve
11091109
) internal {
1110-
_record.cumulativeLidoFees = uint128(_reportCumulativeLidoFees);
1111-
_record.minimalReserve = uint128(Math256.max(CONNECT_DEPOSIT, _reportSlashingReserve));
1110+
_record.cumulativeLidoFees = SafeCast.toUint128(_reportCumulativeLidoFees);
1111+
_record.minimalReserve = SafeCast.toUint128(Math256.max(CONNECT_DEPOSIT, _reportSlashingReserve));
11121112

11131113
// We want to prevent 1 tx looping here:
11141114
// 1. bring ETH (TV+)
@@ -1121,8 +1121,10 @@ contract VaultHub is PausableUntilWithRoles {
11211121
// if any stETH is minted on funds added after the refslot
11221122
// in that case we don't update it (preventing unlock)
11231123
if (_record.maxLiabilityShares == _reportMaxLiabilityShares) {
1124-
_record.maxLiabilityShares = uint96(Math256.max(_record.liabilityShares, _reportLiabilityShares));
1124+
_record.maxLiabilityShares = SafeCast.toUint96(Math256.max(_record.liabilityShares, _reportLiabilityShares));
11251125
}
1126+
1127+
// report values is not safecasted because they're checked extensively in LazyOracle
11261128
_record.report = Report({
11271129
totalValue: uint104(_reportTotalValue),
11281130
inOutDelta: int104(_reportInOutDelta),

0 commit comments

Comments
 (0)