Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-neon committed Aug 23, 2024
1 parent 2d9855c commit a3dd172
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ cache/
foundry-out/
.vscode/
broadcast/*/*/dry-run/*.json
broadcast/*/*/run-[0-9]*.json
broadcast/*/*/run-[0-9]*.json
.forge-snapshots/
9 changes: 7 additions & 2 deletions test/libraries/BipsLibrary.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {BipsLibrary} from "../../src/libraries/BipsLibrary.sol";

contract PositionConfigTest is Test {
using BipsLibrary for uint256;
uint GAS_LIMIT = 48_000_000_000_000;

function test_fuzz_calculatePortion(uint256 amount, uint256 bips) public {
amount = bound(amount, 0, uint256(type(uint128).max));
Expand Down Expand Up @@ -34,11 +35,15 @@ contract PositionConfigTest is Test {
function test_gasLimit_1_percent() public view {
/// 100 bps = 1%
// 1% of 3_000_000_000 is 30_000_000
assertEq(30_000_000, block.gaslimit.calculatePortion(100));
// But for Neon gaslimit is 48_000_000_000_000
uint gas_portion = GAS_LIMIT / 100;
assertEq(gas_portion , block.gaslimit.calculatePortion(100));
}

function test_gasLimit_1BP() public view {
/// 1bp is 0.01%
assertEq(300_000, block.gaslimit.calculatePortion(1));
// But for Neon gaslimit is 48_000_000_000_000
uint gas_portion = GAS_LIMIT / 10_000;
assertEq(gas_portion, block.gaslimit.calculatePortion(1));
}
}
3 changes: 2 additions & 1 deletion test/position-managers/PositionManager.notifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ contract PositionManagerNotifierTest is Test, PosmTestSetup, GasSnapshot {

lpm.subscribe(tokenId, config, address(badSubscriber), ZERO_BYTES);

MockReturnDataSubscriber(badSubscriber).setReturnDataSize(0x600000);
// return data size is changed to larger value to make gas limit exceed
MockReturnDataSubscriber(badSubscriber).setReturnDataSize(0x10600000);
lpm.unsubscribe(tokenId, config, ZERO_BYTES);

// the subscriber contract call failed bc it used too much gas
Expand Down

0 comments on commit a3dd172

Please sign in to comment.