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: Add new pool initialization action and validation at PM call #26

Merged
merged 7 commits into from
Nov 18, 2024

Conversation

ChefMist
Copy link
Collaborator

@ChefMist ChefMist commented Nov 15, 2024

This PR does the following:

  • adds pool initialization action (V4_CL_INITIALIZE_POOL and V4_BIN_INITIALIZE_POOL)
  • for position manager call, ensure user's input is not using the blacklisted command which can result in potential loss of user funds

@ChefMist ChefMist changed the title feat: Add new pool initialization action and validation at PM call [Part 1 of 2] feat: Add new pool initialization action and validation at PM call Nov 15, 2024
@ChefMist
Copy link
Collaborator Author

CI fail as expected due to exceed bytecode size. see #27 on the passing PR

error InvalidAction(bytes4 action);
error OnlyMintAllowed();
error OnlyAddLiqudityAllowed();
error BlacklistedAction();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is duplicate with OnlyMintAllowed/OnlyAddLiqudityAllowed?

Copy link
Contributor

@chefburger chefburger left a comment

Choose a reason for hiding this comment

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

lgtm

[Part 2 of 2] feat: Add new pool initialization action and validation at PM call
@ChefMist ChefMist changed the title [Part 1 of 2] feat: Add new pool initialization action and validation at PM call feat: Add new pool initialization action and validation at PM call Nov 18, 2024
uint256 numActions = actions.length;

for (uint256 actionIndex = 0; actionIndex < numActions; actionIndex++) {
uint256 action = uint8(actions[actionIndex]);

Choose a reason for hiding this comment

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

Why casting uint8 here for a uint256 variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actions[actionIndex] returns a bytes1 and we need to explictly convert it to a uint type

@jpopxfile
Copy link

// COMMAND_PLACEHOLDER = 0x15 -> 0x20

Update comment.

@ChefMist ChefMist merged commit 9e5a6f3 into main Nov 18, 2024
2 checks passed
@ChefMist ChefMist deleted the feat/add-action-protect-pm branch November 18, 2024 09:42
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