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

KatanaV3Pool.sol cannot initializeImmutables #49

Closed
howlbot-integration bot opened this issue Nov 4, 2024 · 1 comment
Closed

KatanaV3Pool.sol cannot initializeImmutables #49

howlbot-integration bot opened this issue Nov 4, 2024 · 1 comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-26 edited-by-warden 🤖_04_group AI based duplicate group recommendation sufficient quality report This report is of sufficient quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@howlbot-integration
Copy link

Lines of code

https://github.com/ronin-chain/katana-v3-contracts/blob/03c80179e04f40d96f06c451ea494bb18f2a58fc/src/core/KatanaV3Pool.sol#L122

Vulnerability details

There is an issue of conflict in KatanaV3Pool.sol where factory is set as address(1) but the require statement requires it to be address 0.

  constructor() {
    // disable immutables initialization
    factory = address(1);
  }


  /// @inheritdoc IKatanaV3PoolImmutables
  function initializeImmutables(address factory_, address token0_, address token1_, uint24 fee_, int24 tickSpacing_)
    public
    virtual
    override
  {
    require(factory == address(0), "AII");

The constructor sets factory to address(1), so the initializeImmutables function will always revert.
This makes it impossible to initialize the immutables as intended.

Recommended Mitigation Steps

Just change initializeImmutables to address(1)

   function initializeImmutables(address factory_, address token0_, address token1_, uint24 fee_, int24 tickSpacing_)
       public
       virtual
       override
   {
       require(factory == address(1), "AII"); // Check for address(1) instead
       factory = factory_;

Assessed type

Error

@howlbot-integration howlbot-integration bot added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value 🤖_04_group AI based duplicate group recommendation bug Something isn't working duplicate-26 edited-by-warden sufficient quality report This report is of sufficient quality labels Nov 4, 2024
howlbot-integration bot added a commit that referenced this issue Nov 4, 2024
@c4-judge
Copy link

alex-ppg marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-26 edited-by-warden 🤖_04_group AI based duplicate group recommendation sufficient quality report This report is of sufficient quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

1 participant