Skip to content

Commit 5016e3d

Browse files
zhongericalanhwu
andauthored
fix: add inline comments for internal revert tests (#317)
* add inline comments for internal revert tests * test: update decay overflow naming --------- Co-authored-by: Alan Wu <[email protected]>
1 parent 2954f97 commit 5016e3d

18 files changed

+108
-92
lines changed
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"DirectFillerFillMacroSingleOrder": "135973",
3-
"DirectFillerFillMacroSingleOrderWithFee": "174570",
4-
"DirectFillerFillMacroThreeOrdersWithFees": "433904",
5-
"DirectFillerFillMacroTwoOrders": "255553"
2+
"DirectFillerFillMacroSingleOrder": "135820",
3+
"DirectFillerFillMacroSingleOrderWithFee": "174331",
4+
"DirectFillerFillMacroThreeOrdersWithFees": "433336",
5+
"DirectFillerFillMacroTwoOrders": "255333"
66
}

snapshots/DutchOrderReactorTest.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"BaseExecuteSingleWithFee": "176379",
3-
"ExecuteBatch": "188624",
4-
"ExecuteBatchMultipleOutputs": "197968",
5-
"ExecuteBatchMultipleOutputsDifferentTokens": "251215",
6-
"ExecuteBatchNativeOutput": "184650",
7-
"ExecuteSingle": "142762",
8-
"ExecuteSingleNativeOutput": "130824",
9-
"ExecuteSingleValidation": "152072",
10-
"RevertInvalidNonce": "22192"
2+
"BaseExecuteSingleWithFee": "176167",
3+
"ExecuteBatch": "188355",
4+
"ExecuteBatchMultipleOutputs": "197673",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "250894",
6+
"ExecuteBatchNativeOutput": "184399",
7+
"ExecuteSingle": "142617",
8+
"ExecuteSingleNativeOutput": "130688",
9+
"ExecuteSingleValidation": "151906",
10+
"RevertInvalidNonce": "22119"
1111
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"DirectFillerFillMacroTestEth1Output": "147146",
3-
"DirectFillerFillMacroTestEth2Outputs": "170234"
2+
"DirectFillerFillMacroTestEth1Output": "147001",
3+
"DirectFillerFillMacroTestEth2Outputs": "170048"
44
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"EthOutputTest3OrdersWithEthAndERC20Outputs": "362445",
3-
"EthOutputTestEthOutput": "156342"
2+
"EthOutputTest3OrdersWithEthAndERC20Outputs": "362022",
3+
"EthOutputTestEthOutput": "156137"
44
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"BaseExecuteSingleWithFee": "176480",
3-
"ExecuteBatch": "188814",
4-
"ExecuteBatchMultipleOutputs": "198158",
5-
"ExecuteBatchMultipleOutputsDifferentTokens": "251405",
6-
"ExecuteBatchNativeOutput": "184840",
7-
"ExecuteSingle": "142871",
8-
"ExecuteSingleNativeOutput": "130933",
9-
"ExecuteSingleValidation": "152181",
10-
"RevertInvalidNonce": "22290"
2+
"BaseExecuteSingleWithFee": "176269",
3+
"ExecuteBatch": "188547",
4+
"ExecuteBatchMultipleOutputs": "197865",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "251086",
6+
"ExecuteBatchNativeOutput": "184591",
7+
"ExecuteSingle": "142727",
8+
"ExecuteSingleNativeOutput": "130798",
9+
"ExecuteSingleValidation": "152016",
10+
"RevertInvalidNonce": "22218"
1111
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"testExclusiveFillerSucceeds": "171199"
2+
"testExclusiveFillerSucceeds": "170979"
33
}

snapshots/LimitOrderReactorTest.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"BaseExecuteSingleWithFee": "172831",
3-
"ExecuteBatch": "181452",
4-
"ExecuteBatchMultipleOutputs": "189990",
5-
"ExecuteBatchMultipleOutputsDifferentTokens": "242428",
6-
"ExecuteBatchNativeOutput": "177478",
7-
"ExecuteSingle": "139215",
8-
"ExecuteSingleNativeOutput": "127277",
9-
"ExecuteSingleValidation": "148525",
10-
"RevertInvalidNonce": "18656"
2+
"BaseExecuteSingleWithFee": "172635",
3+
"ExecuteBatch": "181215",
4+
"ExecuteBatchMultipleOutputs": "189732",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "242149",
6+
"ExecuteBatchNativeOutput": "177259",
7+
"ExecuteSingle": "139086",
8+
"ExecuteSingleNativeOutput": "127157",
9+
"ExecuteSingleValidation": "148375",
10+
"RevertInvalidNonce": "18599"
1111
}
+10-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"V3-DutchDecay": "16413",
3-
"V3-DutchDecayFullyDecayed": "7908",
4-
"V3-DutchDecayFullyDecayedNegative": "7619",
5-
"V3-DutchDecayNegative": "15389",
6-
"V3-DutchDecayNoDecayYet": "5720",
7-
"V3-DutchDecayNoDecayYetNegative": "5694",
8-
"V3-ExtendedMultiPointDutchDecay": "106707",
9-
"V3-LocateCurvePositionMulti": "17727",
10-
"V3-LocateCurvePositionSingle": "4227",
11-
"V3-MultiPointDutchDecay": "33868"
2+
"V3-DutchDecay": "16243",
3+
"V3-DutchDecayFullyDecayed": "7838",
4+
"V3-DutchDecayFullyDecayedNegative": "7555",
5+
"V3-DutchDecayNegative": "15239",
6+
"V3-DutchDecayNoDecayYet": "5692",
7+
"V3-DutchDecayNoDecayYetNegative": "5664",
8+
"V3-ExtendedMultiPointDutchDecay": "105758",
9+
"V3-LocateCurvePositionMulti": "17610",
10+
"V3-LocateCurvePositionSingle": "4191",
11+
"V3-MultiPointDutchDecay": "33549"
1212
}
+13-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"BaseExecuteSingleWithFee": "178696",
3-
"ExecuteBatch": "193279",
4-
"ExecuteBatchMultipleOutputs": "202497",
5-
"ExecuteBatchMultipleOutputsDifferentTokens": "255617",
6-
"ExecuteBatchNativeOutput": "189305",
7-
"ExecuteSingle": "145087",
8-
"ExecuteSingleNativeOutput": "133149",
9-
"ExecuteSingleValidation": "154397",
10-
"InputPriorityFee": "147392",
11-
"OutputPriorityFee": "147396",
12-
"OutputPriorityFeeAndBaselinePriorityFee": "147396",
13-
"OverrideAuctionTargetBlock": "124529",
14-
"RevertInvalidNonce": "8853"
2+
"BaseExecuteSingleWithFee": "178476",
3+
"ExecuteBatch": "192994",
4+
"ExecuteBatchMultipleOutputs": "202189",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "255286",
6+
"ExecuteBatchNativeOutput": "189038",
7+
"ExecuteSingle": "144934",
8+
"ExecuteSingleNativeOutput": "133005",
9+
"ExecuteSingleValidation": "154223",
10+
"InputPriorityFee": "147237",
11+
"OutputPriorityFee": "147243",
12+
"OutputPriorityFeeAndBaselinePriorityFee": "147243",
13+
"OverrideAuctionTargetBlock": "124368",
14+
"RevertInvalidNonce": "8831"
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"ProtocolFeesGasComparisonTest-InterfaceAndProtocolFee": "173684",
3-
"ProtocolFeesGasComparisonTest-InterfaceAndProtocolFeeEthOutput": "162176",
4-
"ProtocolFeesGasComparisonTest-InterfaceFee": "162961",
5-
"ProtocolFeesGasComparisonTest-InterfaceFeeEthOutput": "146288",
6-
"ProtocolFeesGasComparisonTest-NoFees": "146369",
7-
"ProtocolFeesGasComparisonTest-NoFeesEthOutput": "124531"
2+
"ProtocolFeesGasComparisonTest-InterfaceAndProtocolFee": "173378",
3+
"ProtocolFeesGasComparisonTest-InterfaceAndProtocolFeeEthOutput": "161897",
4+
"ProtocolFeesGasComparisonTest-InterfaceFee": "162696",
5+
"ProtocolFeesGasComparisonTest-InterfaceFeeEthOutput": "146041",
6+
"ProtocolFeesGasComparisonTest-NoFees": "146136",
7+
"ProtocolFeesGasComparisonTest-NoFeesEthOutput": "124307"
88
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"SwapRouter02ExecutorExecute": "260669",
3-
"SwapRouter02ExecutorExecuteAlreadyApproved": "118280"
2+
"SwapRouter02ExecutorExecute": "260367",
3+
"SwapRouter02ExecutorExecuteAlreadyApproved": "117992"
44
}

snapshots/V2DutchOrderTest.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"BaseExecuteSingleWithFee": "182480",
3-
"ExclusiveFiller": "152632",
4-
"ExecuteBatch": "200865",
5-
"ExecuteBatchMultipleOutputs": "210701",
6-
"ExecuteBatchMultipleOutputsDifferentTokens": "264440",
7-
"ExecuteBatchNativeOutput": "196891",
8-
"ExecuteSingle": "148863",
9-
"ExecuteSingleNativeOutput": "136925",
10-
"ExecuteSingleValidation": "158173",
11-
"InputOverride": "152710",
12-
"OutputOverride": "152659",
13-
"RevertInvalidNonce": "28213"
2+
"BaseExecuteSingleWithFee": "182252",
3+
"ExclusiveFiller": "152472",
4+
"ExecuteBatch": "200564",
5+
"ExecuteBatchMultipleOutputs": "210371",
6+
"ExecuteBatchMultipleOutputsDifferentTokens": "264081",
7+
"ExecuteBatchNativeOutput": "196608",
8+
"ExecuteSingle": "148702",
9+
"ExecuteSingleNativeOutput": "136773",
10+
"ExecuteSingleValidation": "157991",
11+
"InputOverride": "152550",
12+
"OutputOverride": "152499",
13+
"RevertInvalidNonce": "28124"
1414
}

snapshots/V3DutchOrderTest.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"BaseExecuteSingleWithFee": "192645",
3-
"ExecuteBatch": "221374",
4-
"ExecuteBatchMultipleOutputs": "234559",
5-
"ExecuteBatchMultipleOutputsDifferentTokens": "291665",
6-
"ExecuteBatchNativeOutput": "217400",
7-
"ExecuteSingle": "159027",
8-
"ExecuteSingleNativeOutput": "147089",
9-
"ExecuteSingleValidation": "168337",
10-
"RevertInvalidNonce": "38303",
11-
"V3-ExclusiveFiller": "162895",
12-
"V3-InputOverride": "162976",
13-
"V3-OutputOverride": "162919"
2+
"BaseExecuteSingleWithFee": "192359",
3+
"ExecuteBatch": "220957",
4+
"ExecuteBatchMultipleOutputs": "234094",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "291152",
6+
"ExecuteBatchNativeOutput": "217001",
7+
"ExecuteSingle": "158808",
8+
"ExecuteSingleNativeOutput": "146879",
9+
"ExecuteSingleValidation": "168097",
10+
"RevertInvalidNonce": "38156",
11+
"V3-ExclusiveFiller": "162677",
12+
"V3-InputOverride": "162758",
13+
"V3-OutputOverride": "162701"
1414
}

test/lib/DutchDecayLib.t.sol

+7-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ contract DutchDecayLibTest is Test {
9696
assertGe(decayed, uint256(endAmount));
9797
}
9898

99+
/// forge-config: default.allow_internal_expect_revert = true
99100
function testDutchDecayInvalidTimes(
100101
uint256 startAmount,
101102
uint256 endAmount,
@@ -108,14 +109,19 @@ contract DutchDecayLibTest is Test {
108109
DutchDecayLib.decay(startAmount, endAmount, decayStartTime, decayEndTime);
109110
}
110111

111-
function testDutchDecayOverflow() public {
112+
/// forge-config: default.allow_internal_expect_revert = true
113+
function testDutchDownwardDecayOverflow() public {
112114
vm.expectRevert();
113115
DutchDecayLib.linearDecay(0, 100, 99, type(int256).max, -1);
116+
}
114117

118+
/// forge-config: default.allow_internal_expect_revert = true
119+
function testDutchUpwardDecayOverflow() public {
115120
vm.expectRevert();
116121
DutchDecayLib.linearDecay(0, 100, 99, -1, type(int256).max);
117122
}
118123

124+
/// forge-config: default.allow_internal_expect_revert = true
119125
function testDutchDecayDivByZero() public {
120126
vm.expectRevert();
121127
DutchDecayLib.linearDecay(100, 100, 99, 1, -1);

test/lib/MathExt.t.sol

+4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ contract MathExtTest is Test {
3131
assertEq(b.sub(int256(a)), b - a);
3232
}
3333

34+
/// forge-config: default.allow_internal_expect_revert = true
3435
function testSubIntFromUintNegativeUint() public {
3536
vm.expectRevert();
3637
uint256(1).sub(int256(2));
3738
}
3839

40+
/// forge-config: default.allow_internal_expect_revert = true
3941
function testSubIntFromUintOverflow() public {
4042
vm.expectRevert();
4143
UINT256_MAX.sub(-1);
@@ -92,11 +94,13 @@ contract MathExtTest is Test {
9294
assertEq(c, int256(a) - int256(b));
9395
}
9496

97+
/// forge-config: default.allow_internal_expect_revert = true
9598
function testSubUintFromUintUnderflow() public {
9699
vm.expectRevert();
97100
uint256(0).sub(type(uint256).max);
98101
}
99102

103+
/// forge-config: default.allow_internal_expect_revert = true
100104
function testSubUintFromUintOverflow() public {
101105
vm.expectRevert();
102106
UINT256_MAX.sub(uint256(1));

test/lib/NonLinearDutchDecayLib.t.sol

+2
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ contract NonlinearDutchDecayLibTest is Test, BlockNumberish {
541541
assertEq(decayOutput(curve, startAmount, decayStartBlock, 0 ether), 0);
542542
}
543543

544+
/// forge-config: default.allow_internal_expect_revert = true
544545
function testDutchOverflowDecay() public {
545546
uint256 decayStartBlock = 100;
546547
uint256 startAmount = 1 ether;
@@ -551,6 +552,7 @@ contract NonlinearDutchDecayLibTest is Test, BlockNumberish {
551552
decayOutput(curve, startAmount, decayStartBlock, 1 ether);
552553
}
553554

555+
/// forge-config: default.allow_internal_expect_revert = true
554556
function testDutchMismatchedDecay() public {
555557
uint256 decayStartBlock = 100;
556558
uint256 startAmount = 1 ether;

test/lib/PriorityFeeLib.t.sol

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ contract PriorityFeeLibTest is Test {
9595
}
9696

9797
/// @notice if the amount to scale is large enough to cause a phantom overflow in mulDivUp, we expect a revert
98+
/// forge-config: default.allow_internal_expect_revert = true
9899
function testScaleRevertsOnLargeOutput() public {
99100
uint256 priorityFee = 0;
100101
vm.txGasPrice(priorityFee);
@@ -124,6 +125,7 @@ contract PriorityFeeLibTest is Test {
124125
assertEq(scaledOutput.amount, output.amount);
125126
}
126127

128+
/// forge-config: default.allow_internal_expect_revert = true
127129
function testScaleOutputPriorityFee_fuzz(uint256 priorityFee, uint256 mpsPerPriorityFeeWei) public {
128130
// the amount of MPS to scale the output by
129131
uint256 scalingFactor = MPS;

test/lib/Uint16Array.t.sol

+2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ contract Uint16ArrayTest is Test {
2424
}
2525
}
2626

27+
/// forge-config: default.allow_internal_expect_revert = true
2728
function testToUint16ArrayRevert() public {
2829
vm.expectRevert(InvalidArrLength.selector);
2930
toUint16Array(ArrayBuilder.fillUint16(17, 1));
3031
}
3132

33+
/// forge-config: default.allow_internal_expect_revert = true
3234
function testGetElementRevert() public {
3335
Uint16Array packedArr = toUint16Array(ArrayBuilder.fillUint16(5, 1));
3436
vm.expectRevert(IndexOutOfBounds.selector);

0 commit comments

Comments
 (0)