From 818ec76d907cf4394b1a96672713b577cb6771cb Mon Sep 17 00:00:00 2001 From: vgorkavenko Date: Wed, 20 Dec 2023 13:35:17 +0400 Subject: [PATCH] fix: tests --- test/CSAccounting.t.sol | 144 ---------------------------------------- 1 file changed, 144 deletions(-) diff --git a/test/CSAccounting.t.sol b/test/CSAccounting.t.sol index 81485937..bf1ebc68 100644 --- a/test/CSAccounting.t.sol +++ b/test/CSAccounting.t.sol @@ -231,150 +231,6 @@ abstract contract CSAccountingBondStateBaseTest is function test_WithMissingBondAndOneWithdrawnValidator() public virtual; } -contract CSAccountingGetExcessBondTest is CSAccountingBondStateBaseTest { - function test_default() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 33 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 1 ether, 1 wei); - } - - function test_WithCurve() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 33 ether }); - _curve(defaultCurve); - assertApproxEqAbs(accounting.getExcessBond(0), 16 ether, 1 wei); - } - - function test_WithLocked() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 33 ether }); - _lock({ id: 0, amount: 1 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 0 ether, 1 wei); - } - - function test_WithCurveAndLocked() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 33 ether }); - _curve(defaultCurve); - _lock({ id: 0, amount: 1 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 15 ether, 1 wei); - } - - function test_WithOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 32 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 2 ether, 1 wei); - } - - function test_WithBond() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 32 ether }); - assertEq(accounting.getExcessBond(0), 0); - } - - function test_WithBondAndOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 32 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 2 ether, 1 wei); - } - - function test_WithExcessBond() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 64 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 32 ether, 1 wei); - } - - function test_WithExcessBondAndOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 64 ether }); - assertApproxEqAbs(accounting.getExcessBond(0), 34 ether, 1 wei); - } - - function test_WithMissingBond() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 16 ether }); - assertEq(accounting.getExcessBond(0), 0); - } - - function test_WithMissingBondAndOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 16 ether }); - assertEq(accounting.getExcessBond(0), 0); - } -} - -contract CSAccountingGetMissingBondTest is CSAccountingBondStateBaseTest { - function test_default() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 16 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 16 ether, 1 wei); - } - - function test_WithCurve() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 16 ether }); - _curve(defaultCurve); - assertApproxEqAbs(accounting.getMissingBond(0), 1 ether, 1 wei); - } - - function test_WithLocked() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 16 ether }); - _lock({ id: 0, amount: 1 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 17 ether, 1 wei); - } - - function test_WithCurveAndLocked() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 16 ether }); - _curve(defaultCurve); - _lock({ id: 0, amount: 1 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 2 ether, 1 wei); - } - - function test_WithOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 16 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 14 ether, 1 wei); - } - - function test_WithBond() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 32 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 0, 1 wei); - } - - function test_WithBondAndOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 32 ether }); - assertEq(accounting.getMissingBond(0), 0 ether); - } - - function test_WithExcessBond() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 64 ether }); - assertEq(accounting.getMissingBond(0), 0); - } - - function test_WithExcessBondAndOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 64 ether }); - assertEq(accounting.getMissingBond(0), 0); - } - - function test_WithMissingBond() public override { - _operator({ ongoing: 16, withdrawn: 0 }); - _deposit({ bond: 8 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 24 ether, 2 wei); - } - - function test_WithMissingBondAndOneWithdrawnValidator() public override { - _operator({ ongoing: 16, withdrawn: 1 }); - _deposit({ bond: 8 ether }); - assertApproxEqAbs(accounting.getMissingBond(0), 22 ether, 2 wei); - } -} - contract CSAccountingGetUnbondedKeysCountTest is CSAccountingBondStateBaseTest { function test_default() public override { _operator({ ongoing: 16, withdrawn: 0 });