Napier pool owner can unfairly increase protocol fees on swaps to earn more revenue
Currently there is no limit to how often a `poolOwner` can update fees which can be abused to earn more fees by charging users higher swap fees than they expect.\\nThe `NapierPool::setFeeParameter` function allows the `poolOwner` to set the `protocolFeePercent` at any point to a maximum value of 100%. The `poolOwner` is a trusted party but should not be able to abuse protocol settings to earn more revenue. There are no limits to how often this can be updated.\\n```\\n function test_protocol_owner_frontRuns_swaps_with_higher_fees() public whenMaturityNotPassed {\\n        // pre-condition\\n        vm.warp(maturity - 30 days);\\n        deal(address(pts[0]), alice, type(uint96).max, false); // ensure alice has enough pt\\n        uint256 preBaseLptSupply = tricrypto.totalSupply();\\n        uint256 ptInDesired = 100 * ONE_UNDERLYING;\\n        uint256 expectedBaseLptIssued = tricrypto.calc_token_amount([ptInDesired, 0, 0], true);\\n\\n        // Pool owner sees swap about to occur and front runs updating fees to max value\\n        vm.startPrank(owner);\\n        pool.setFeeParameter("protocolFeePercent", 100);\\n        vm.stopPrank();\\n\\n        // execute\\n        vm.prank(alice);\\n        uint256 underlyingOut = pool.swapPtForUnderlying(\\n            0, ptInDesired, recipient, abi.encode(CallbackInputType.SwapPtForUnderlying, SwapInput(underlying, pts[0]))\\n        );\\n        // sanity check\\n        uint256 protocolFee = SwapEventsLib.getProtocolFeeFromLastSwapEvent(pool);\\n        assertGt(protocolFee, 0, "fee should be charged");\\n    }\\n```\\n
Introduce a delay in fee updates to ensure users receive the fees they expect.
A malicious `poolOwner` could change the protocol swap fees unfairly for users by front-running swaps and increasing fees to higher values on unsuspecting users. An example scenario is:\\nThe `poolOwner` sets swap fees to 1% to attract users\\nThe `poolOwner` front runs all swaps and changes the swap fees to the maximum value of 100%\\nAfter the swap the `poolOwner` resets `protocolFeePercent` to a low value to attract more users
```\\n function test_protocol_owner_frontRuns_swaps_with_higher_fees() public whenMaturityNotPassed {\\n        // pre-condition\\n        vm.warp(maturity - 30 days);\\n        deal(address(pts[0]), alice, type(uint96).max, false); // ensure alice has enough pt\\n        uint256 preBaseLptSupply = tricrypto.totalSupply();\\n        uint256 ptInDesired = 100 * ONE_UNDERLYING;\\n        uint256 expectedBaseLptIssued = tricrypto.calc_token_amount([ptInDesired, 0, 0], true);\\n\\n        // Pool owner sees swap about to occur and front runs updating fees to max value\\n        vm.startPrank(owner);\\n        pool.setFeeParameter("protocolFeePercent", 100);\\n        vm.stopPrank();\\n\\n        // execute\\n        vm.prank(alice);\\n        uint256 underlyingOut = pool.swapPtForUnderlying(\\n            0, ptInDesired, recipient, abi.encode(CallbackInputType.SwapPtForUnderlying, SwapInput(underlying, pts[0]))\\n        );\\n        // sanity check\\n        uint256 protocolFee = SwapEventsLib.getProtocolFeeFromLastSwapEvent(pool);\\n        assertGt(protocolFee, 0, "fee should be charged");\\n    }\\n```\\n