Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erc721 CT2 invariant failure #770

Merged
merged 5 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ contract BasicERC721PoolInvariants is BasicInvariants {
(, collateral, , , ) = _erc721pool.bucketInfo(bucketIndex);
bucketCollateral += collateral;
}
// add collateral that could be compensated at MAX_FENWICK_INDEX when auction settled
(, collateral, , , ) = _erc721pool.bucketInfo(7388);
bucketCollateral += collateral;
EdNoepel marked this conversation as resolved.
Show resolved Hide resolved

assertEq(collateralBalance, bucketCollateral + _erc721pool.pledgedCollateral(), "Collateral Invariant CT2");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,21 @@ contract RegressionTestReserveERC721Pool is ReserveERC721PoolInvariants {
invariant_Lps_B4();
invariant_Buckets_B2_B3();
}

function test_regression_erc721_CT2() external {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide comments that outline what is happening in this test / why it is helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean, was failing and then fixed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added with 9b7eb7b

_reserveERC721PoolHandler.settleAuction(13652854, 3, 22274361584262295180502534344873136686717874240, 77611568702503302987473072664549443425918559);
_reserveERC721PoolHandler.withdrawBonds(707, 12156087, 19174970663707445513928200315780515094988880044);
_reserveERC721PoolHandler.kickWithDeposit(3, 3, 672444647);
_reserveERC721PoolHandler.kickAuction(56848152111578191493999238385381542863095352, 58529940235731531982925635292876828548122574070883324158957672865569214, 899039491413, 107401523435280391282671144);
_reserveERC721PoolHandler.settleAuction(19634294495748734616428837200, 4937, 77655590346650144951112602856523781688846543008934920669778106922357739827346, 994969230863047393940054601942);
_reserveERC721PoolHandler.removeQuoteToken(115792089237316195423570985008687907853269984665640564039457584007913129639934, 71512, 2, 3);
_reserveERC721PoolHandler.moveQuoteToken(15905680501786579444933931057811252717108353959172, 115792089237316195423570985008687907853269984665640564039457584007913129639934, 271318302293, 0, 40);
_reserveERC721PoolHandler.kickAuction(115792089237316195423570985008687907853269984665640564039457584007913129639935, 1, 273285540430841592066075105397763679903422015958, 266767292382552685109896561555);
_reserveERC721PoolHandler.moveQuoteToken(19067960621863745617958471469, 2999999999999999996834739158156220923161820262, 20085132340471043072465796726, 92001987806333700856071384682550468910212704266158266358190575554223580054768, 8420);
_reserveERC721PoolHandler.pledgeCollateral(107821936054956412679567988, 1727154709158370, 3);
_reserveERC721PoolHandler.mergeCollateral(742, 36731090122697131118614904036939339014023299978771437847280286066139902285955);
_reserveERC721PoolHandler.bucketTake(115792089237316195423570985008687907853269984665640564039457584007913129639933, 115792089237316195423570985008687907853269984665640564039457584007913129639932, true, 115792089237316195423570985008687907853269984665640564039457584007913129639933, 4);

invariant_CT2();
}
}
2 changes: 1 addition & 1 deletion tests/forge/unit/PositionManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract contract PositionManagerERC20PoolHelperContract is ERC20HelperContract
uint256 tokenId_,
uint256 deadline_,
uint256 ownerPrivateKey_
) internal returns (uint8 v, bytes32 r, bytes32 s) {
) internal view returns (uint8 v, bytes32 r, bytes32 s) {
return vm.sign(
ownerPrivateKey_,
keccak256(
Expand Down