Skip to content

Commit c46de76

Browse files
committed
test(wip): todos
1 parent 1856b33 commit c46de76

File tree

3 files changed

+313
-24
lines changed

3 files changed

+313
-24
lines changed

src/test/integration/IntegrationBase.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ abstract contract IntegrationBase is IntegrationDeployer {
809809
uint prevShare = prevShares[i];
810810
uint curShare = curShares[i];
811811

812-
assertEq(prevShare - removedShares[i], curShare, err);
812+
assertApproxEqAbs(prevShare - removedShares[i], curShare, 1, err);
813813
}
814814
}
815815

@@ -850,7 +850,7 @@ abstract contract IntegrationBase is IntegrationDeployer {
850850
uint prevBalance = prevTokenBalances[i];
851851
uint curBalance = curTokenBalances[i];
852852

853-
assertEq(prevBalance + addedTokens[i], curBalance, err);
853+
assertApproxEqAbs(prevBalance + addedTokens[i], curBalance, 1, err);
854854
}
855855
}
856856

src/test/integration/IntegrationChecks.t.sol

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ contract IntegrationCheckUtils is IntegrationBase {
338338
ALLOCATION MANAGER CHECKS
339339
*******************************************************************************/
340340

341+
function _calculateSlippage(uint256 x, uint256 y, uint256 z) internal pure returns (uint256 r) {
342+
return mulmod(x, y, z) > 0 ? 1 : 0;
343+
}
344+
341345
function check_Withdrawal_AsTokens_State_AfterSlash(
342346
User staker,
343347
User operator,
@@ -348,19 +352,23 @@ contract IntegrationCheckUtils is IntegrationBase {
348352
) internal {
349353
IERC20[] memory tokens = new IERC20[](withdrawal.strategies.length);
350354

351-
for (uint256 i; i < withdrawal.strategies.length; i++) {
355+
for (uint i; i < withdrawal.strategies.length; i++) {
352356
IStrategy strat = withdrawal.strategies[i];
353357

354358
bool isBeaconChainETHStrategy = strat == beaconChainETHStrategy;
355359

356360
tokens[i] = isBeaconChainETHStrategy ? NATIVE_ETH : withdrawal.strategies[i].underlyingToken();
357361

358362
if (slashingParams.strategies.contains(strat)) {
359-
uint256 wadToSlash = slashingParams.wadsToSlash[slashingParams.strategies.indexOf(strat)];
363+
uint wadToSlash = slashingParams.wadsToSlash[slashingParams.strategies.indexOf(strat)];
360364

361365
expectedTokens[i] -= expectedTokens[i]
362366
.mulWadRoundUp(allocateParams.newMagnitudes[i].mulWadRoundUp(wadToSlash));
363367

368+
uint256 max = allocationManager.getMaxMagnitude(address(operator), strat);
369+
370+
withdrawal.scaledShares[i] -= withdrawal.scaledShares[i].calcSlashedAmount(WAD, max);
371+
364372
// Round down to the nearest gwei for beaconchain ETH strategy.
365373
if (isBeaconChainETHStrategy) {
366374
expectedTokens[i] -= expectedTokens[i] % 1 gwei;

0 commit comments

Comments
 (0)