Skip to content

Commit

Permalink
fuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Nov 24, 2023
1 parent 7982d85 commit f2d9cf5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GenericPoolOrderBookV3ArbOrderTakerTest:testGenericPoolMinimumOutput((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256,uint256,uint256) (runs: 5096, μ: 332052, ~: 330383)
GenericPoolOrderBookV3ArbOrderTakerTest:testGenericPoolTakeOrdersSender((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256) (runs: 5096, μ: 266210, ~: 265260)
GenericPoolOrderBookV3ArbOrderTakerInitTest:testGenericPoolOrderBookV3ArbOrderTakerInitInvalidInputs(bytes) (runs: 5096, μ: 112556, ~: 112571)
GenericPoolOrderBookV3ArbOrderTakerSenderTest:testGenericPoolMinimumOutput((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256,uint256,uint256) (runs: 5096, μ: 332057, ~: 330383)
GenericPoolOrderBookV3ArbOrderTakerSenderTest:testGenericPoolTakeOrdersSender((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256) (runs: 5096, μ: 266214, ~: 265260)
GenericPoolOrderBookV3FlashBorrowerTest:testGenericPoolOrderBookV3FlashBorrowerMinimumOutput((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256,uint256,uint256) (runs: 5096, μ: 609059, ~: 605057)
GenericPoolOrderBookV3FlashBorrowerTest:testGenericPoolOrderBookV3FlashBorrowerTakeOrdersSender((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256) (runs: 5096, μ: 522448, ~: 519675)
LibOrderTest:testHashEqual((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[])) (runs: 5096, μ: 196882, ~: 195948)
Expand Down Expand Up @@ -86,5 +87,6 @@ OrderBookWithdrawTest:testWithdrawFullVault(address,uint256,uint256,uint256) (ru
OrderBookWithdrawTest:testWithdrawMany((bool,address,address,uint256,uint248)[]) (runs: 5096, μ: 3169906, ~: 3156574)
OrderBookWithdrawTest:testWithdrawPartialVault(address,uint256,uint256,uint256) (runs: 5096, μ: 49439, ~: 49439)
OrderBookWithdrawTest:testWithdrawZero(address,address,uint256) (runs: 5096, μ: 12809, ~: 12809)
RouteProcessorOrderBookV3ArbOrderTakerTest:testRouteProcessorMinimumOutput((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256,uint256,uint256) (runs: 5096, μ: 332202, ~: 330538)
RouteProcessorOrderBookV3ArbOrderTakerTest:testRouteProcessorTakeOrdersSender((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256) (runs: 5096, μ: 266376, ~: 265424)
RouteProcessorOrderBookV3ArbOrderTakerInitTest:testRouteProcessorOrderBookV3ArbOrderTakerInitInvalidInputs(bytes) (runs: 5096, μ: 135462, ~: 135478)
RouteProcessorOrderBookV3ArbOrderTakerSenderTest:testRouteProcessorMinimumOutput((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256,uint256,uint256) (runs: 5096, μ: 332199, ~: 330538)
RouteProcessorOrderBookV3ArbOrderTakerSenderTest:testRouteProcessorTakeOrdersSender((address,bool,(address,address,address),(address,uint8,uint256)[],(address,uint8,uint256)[]),uint256,uint256) (runs: 5096, μ: 266375, ~: 265424)
9 changes: 6 additions & 3 deletions test/concrete/GenericPoolOrderBookV3ArbOrderTaker.init.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ import {IParserV1} from "rain.interpreter/src/interface/IParserV1.sol";
import {NonZeroBeforeArbInputs} from "src/abstract/OrderBookV3ArbOrderTaker.sol";

contract GenericPoolOrderBookV3ArbOrderTakerInitTest is GenericPoolOrderBookV3ArbOrderTakerTest {
function testGenericPoolOrderBookV3ArbOrderTakerInitInvalidInputs() public {
function testGenericPoolOrderBookV3ArbOrderTakerInitInvalidInputs(bytes memory io) public {
vm.assume(io.length >= 2);
vm.assume(io.length % 2 == 0);
vm.assume(io[0] != 0);
address testArb = Clones.clone(iImplementation);
vm.mockCall(
iDeployer,
abi.encodeWithSelector(IExpressionDeployerV3.deployExpression2.selector),
abi.encode(address(0), address(0), address(0), "0100")
abi.encode(address(0), address(0), address(0), io)
);
vm.expectRevert(abi.encodeWithSelector(NonZeroBeforeArbInputs.selector, 48));
vm.expectRevert(abi.encodeWithSelector(NonZeroBeforeArbInputs.selector, uint256(uint8(io[0]))));
ICloneableV2(testArb).initialize(
abi.encode(
OrderBookV3ArbOrderTakerConfigV1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ import {EvaluableConfigV3, IExpressionDeployerV3} from "src/interface/unstable/I
import {NonZeroBeforeArbInputs} from "src/abstract/OrderBookV3ArbOrderTaker.sol";

contract RouteProcessorOrderBookV3ArbOrderTakerInitTest is RouteProcessorOrderBookV3ArbOrderTakerTest {
function testRouteProcessorOrderBookV3ArbOrderTakerInitInvalidInputs() public {
function testRouteProcessorOrderBookV3ArbOrderTakerInitInvalidInputs(bytes memory io) public {
vm.assume(io.length >= 2);
vm.assume(io.length % 2 == 0);
vm.assume(io[0] != 0);
address testArb = Clones.clone(iImplementation);
vm.mockCall(
iDeployer,
abi.encodeWithSelector(IExpressionDeployerV3.deployExpression2.selector),
abi.encode(address(0), address(0), address(0), "0100")
abi.encode(address(0), address(0), address(0), io)
);
vm.expectRevert(abi.encodeWithSelector(NonZeroBeforeArbInputs.selector, 48));
vm.expectRevert(abi.encodeWithSelector(NonZeroBeforeArbInputs.selector, uint256(uint8(io[0]))));
ICloneableV2(testArb).initialize(
abi.encode(
OrderBookV3ArbOrderTakerConfigV1(
Expand Down

0 comments on commit f2d9cf5

Please sign in to comment.