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

feat: internal feedback #66

Closed
wants to merge 17 commits into from
Closed

feat: internal feedback #66

wants to merge 17 commits into from

Conversation

ChefMist
Copy link
Collaborator

@ChefMist ChefMist commented Jan 23, 2025

This PR does the following based on internal feedback

  • s41: tried to use compilation restriction so we can increase optimizer_runs, in the end we can just increase without that. so have bumped up optimizer_runs (which reduces gas)

  • s43: add comment to code based on natspec format

  • s46: add code hash (similar to v4-core) for posm and migrator which user will interact with

  • s48: use directive with global eg. using Planner for Plan global; so we don't have to type using Planner for Plan

  • s50: use internal constant to make it obvious (and follow other files convention)

Pre-requisite

Current built failing as GasSnapshot not found (already removed in v4-core), so this PR will pass once the below 3 items are done

@ChefMist ChefMist changed the title feat: internal feedback [Part 1 of 2] feat: internal feedback Jan 23, 2025
@@ -15,6 +15,15 @@ fs_permissions = [
evm_version = 'cancun'
bytecode_hash = "none"

# more info about compiler_profiles and restrictions here https://github.com/foundry-rs/foundry/pull/8668
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems useful 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Saw u deleted it in the end. Curious would we even have a bigger optimizer_runs if we keep it ?

Copy link
Collaborator Author

@ChefMist ChefMist Jan 25, 2025

Choose a reason for hiding this comment

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

my bad -- added back in https://github.com/pancakeswap/pancake-v4-periphery/pull/66/commits/9df3f60086f382fa95ca78cb5e889e1766477aeb

the bytecode size test for CLPositionManager was wrong, i used manager which was CLPoolManager. after updating to CLPositionManager, it became 28kb (larger than 24kb limit)

so added back s41 to compile 9000 runs for CLPositionManager and the rest having 1_000_000 runs

snapSize("BinMigratorBytecodeSize", address(migrator));

// forge coverage will run with '--ir-minimum' which set optimizer run to min
// thus we do not want to revert for forge coverage case
Copy link
Contributor

@chefburger chefburger Jan 24, 2025

Choose a reason for hiding this comment

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

Only forge test will run with FOUNDRY_PROFILE, is it ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

function test_initcodeHash() public {
vm.snapshotValue(
"BinPositionManager initcode hash (without constructor params, as uint256)",
uint256(keccak256(type(BinPositionManager).creationCode))
Copy link
Contributor

Choose a reason for hiding this comment

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

can i ask if this initCodeHash for create3 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will remove these test -- ur right, seems like for our create3 which is creationCode + param, it will be hard to match probably.. maybe will investigate seperately if we want to achieve this (if required)

chef-omelette
chef-omelette previously approved these changes Jan 24, 2025
Copy link
Contributor

@chef-omelette chef-omelette left a comment

Choose a reason for hiding this comment

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

LGTM

…ive snapshot (#67)

* s52: remove gasSnapshot and use native snapshot

* feat: remove _getContractName and use testName directly

* forge test after merge
@ChefMist ChefMist changed the title [Part 1 of 2] feat: internal feedback feat: internal feedback Jan 25, 2025
@ChefMist
Copy link
Collaborator Author

closing this PR. splitting into multiple PR for easier to review

@ChefMist ChefMist closed this Jan 27, 2025
@ChefMist ChefMist deleted the feat/internal-feeback branch January 27, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants