Skip to content

Commit 8ab8390

Browse files
authored
Merge pull request #1755 from lidofinance/fix/vaulthub-report-safecast
fix(VaultHub): add safe cast for reported values
2 parents 7b46fa6 + cbcc6d1 commit 8ab8390

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
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),

deployed-mainnet.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@
409409
},
410410
"implementation": {
411411
"contract": "contracts/0.8.25/vaults/LazyOracle.sol",
412-
"address": "0x47f3a6b1E70F7Ec7dBC3CB510B1fdB948C863a5B",
412+
"address": "0x96c9a897D116ef660086d3aA67b3af653324aB37",
413413
"constructorArgs": ["0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"]
414414
}
415415
},
@@ -736,7 +736,7 @@
736736
},
737737
"implementation": {
738738
"contract": "contracts/0.8.25/vaults/VaultHub.sol",
739-
"address": "0x7c7d957D0752AB732E73400624C4a1eb1cb6CF50",
739+
"address": "0x6330fE7756FBE8649adfb9A541d61C5edB8B4D70",
740740
"constructorArgs": [
741741
"0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb",
742742
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",

0 commit comments

Comments
 (0)