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

[Part 1 of 3] v4-core dependency + gas snapshot + ci runs tweak (s52) #74

Merged
merged 5 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion .forge-snapshots/BaseActionsRouter_mock10commands.snap

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionDescriptorOffChainSize.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_burn_empty.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_burn_empty_native.snap

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_collect_native.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_collect_sameRange.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_collect_withClose.snap

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_decrease_burnEmpty.snap

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_decrease_take_take.snap

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_mint_native.snap

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_mint_sameRange.snap

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_mint_withClose.snap

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_permit.snap

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_permit_twice.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_subscribe.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLPositionManager_unsubscribe.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLSwapRouterTest#ExactInput.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLSwapRouterTest#ExactInputSingle.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLSwapRouterTest#ExactOutput.snap

This file was deleted.

1 change: 0 additions & 1 deletion .forge-snapshots/CLSwapRouterTest#ExactOutputSingle.snap

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-471e4ac317858b3419faaee58ade30c0671021e0 # Nightly (2024-10-03)
version: stable
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

use stable as local foundry is stable too


- name: Run tests
run: forge test --isolate -vvv
Expand Down
28 changes: 15 additions & 13 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
src = 'src'
out = 'foundry-out'
solc_version = '0.8.26'
optimizer_runs = 9000
optimizer_runs = 1_000_000
via_ir = true
ffi = true
gas_limit = "3000000000"
Expand All @@ -15,24 +15,26 @@ fs_permissions = [
evm_version = 'cancun'
bytecode_hash = "none"

additional_compiler_profiles = [
{ name = "clPosm", optimizer_runs = 9000 }
]

compilation_restrictions = [
{ paths = "src/pool-cl/CLPositionManager.sol", optimizer_runs = 9000 }
]

[fuzz]
runs = 1000 # change this for higher number of fuzz/invariant locally
runs = 5 # change this for higher number of fuzz runs locally
Copy link
Collaborator Author

@ChefMist ChefMist Jan 26, 2025

Choose a reason for hiding this comment

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

set lower fuzz/invariant runs locally, so dev local forge test is faster by default. they can always override and set higher if required


[invariant]
depth = 15 # revert to 15 as default is 500: https://github.com/foundry-rs/foundry/pull/7957

[profile.ci.fuzz]
runs = 10000
runs = 5 # change this for higher number of invariant runs locally
depth = 5 # default is 500: https://github.com/foundry-rs/foundry/pull/7957

[profile.ci.invariant]
runs = 1000 # The number of calls to make in the invariant tests
call_override = false # Override calls
fail_on_revert = false # Fail the test if the contract reverts
Comment on lines -29 to -30
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

seems like this 2 is already false from foundry https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md

runs = 100 # The number of calls to make in the invariant tests

[profile.ci_main.fuzz]
runs = 100000
runs = 1000
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

lower for now - otherwise ci will fail (timeout) - https://github.com/pancakeswap/pancake-v4-periphery/issues/73

we can visit that issue again if we have time and see whats a suitable number


[profile.ci_main.invariant]
runs = 10000 # The number of calls to make in the invariant tests
call_override = false # Override calls
fail_on_revert = false # Fail the test if the contract reverts
runs = 1000 # The number of calls to make in the invariant tests
2 changes: 1 addition & 1 deletion lib/pancake-v4-core
1 change: 0 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pancake-v4-core/=lib/pancake-v4-core/
ds-test/=lib/pancake-v4-core/lib/forge-std/lib/ds-test/src/
forge-std/=lib/pancake-v4-core/lib/forge-std/src/
forge-gas-snapshot/=lib/pancake-v4-core/lib/forge-gas-snapshot/src/
openzeppelin-contracts/=lib/pancake-v4-core/lib/openzeppelin-contracts/
solmate/=lib/pancake-v4-core/lib/solmate/
permit2/=lib/permit2
3 changes: 3 additions & 0 deletions snapshots/BaseActionsRouterTest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mock10commands": "82785"
}
5 changes: 5 additions & 0 deletions snapshots/BinMigratorFromPancakeswapV2Test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"testMigrateFromV2IncludingInit": "1176442",
"testMigrateFromV2WithoutInit": "1046490",
"testMigrateFromV2WithoutNativeToken": "1087310"
}
6 changes: 6 additions & 0 deletions snapshots/BinMigratorFromPancakeswapV3Test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BinMigratorBytecode size": "15187",
"testMigrateFromV3IncludingInit": "1248658",
"testMigrateFromV3WithoutInit": "1118687",
"testMigrateFromV3WithoutNativeToken": "1153511"
}
5 changes: 5 additions & 0 deletions snapshots/BinMigratorFromUniswapV2Test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"testMigrateFromV2IncludingInit": "1176442",
"testMigrateFromV2WithoutInit": "1046490",
"testMigrateFromV2WithoutNativeToken": "1087310"
}
6 changes: 6 additions & 0 deletions snapshots/BinMigratorFromUniswapV3Test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BinMigratorBytecode size": "15187",
"testMigrateFromV3IncludingInit": "1246640",
"testMigrateFromV3WithoutInit": "1116669",
"testMigrateFromV3WithoutNativeToken": "1151493"
}
3 changes: 3 additions & 0 deletions snapshots/BinPositionManagerTest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"BinPositionManagerBytecode size": "17435"
}
7 changes: 7 additions & 0 deletions snapshots/BinPositionManager_ModifyLiquidityTest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"test_addLiquidity_OutsideActiveId": "292694",
"test_addLiquidity_SingleBin": "532073",
"test_addLiquidity_ThreeBins": "905930",
"test_decreaseLiquidity_threeBins": "184859",
"test_decreaseLiquidity_threeBins_half": "203748"
}
5 changes: 5 additions & 0 deletions snapshots/BinPositionManager_NativeTokenTest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test_addLiquidity": "847340",
"test_addLiquidity_excessEth": "849077",
"test_decreaseLiquidity": "191515"
}
3 changes: 3 additions & 0 deletions snapshots/BinQuoterTest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"BinQuoterBytecode size": "6839"
}
Loading
Loading