decrPosition09293696 will not work due to incorrect function signature
The Solidity wrapper function decrPosition09293696 is missing the pool address parameter that the underlying Rust function requires, so any call to it will fail. This makes the decrease position functionality inaccessible through the wrapper.
Submitted by ZanyBonzy, also found by shaflow2 and oakcobalt
Impact
decrPosition09293696 will not work, breaking SeawaterAMM.sol’s functionality to decrease position.
Proof of Concept
SeaWaterAMM.sol holds the decrPosition09293696 which allows for refreshing a position’s fees and takes liqiudity from it.
The function takes in various parameters but is missing the pool address parameter.
function decrPosition09293696(
uint256 /* id */,
uint256 /* amount0Min */,
uint256 /* amount1Min */,
uint256 /* amount0Max */,
uint256 /* amount1Max */
) external returns (uint256, uint256) {
directDelegate(_getExecutorUpdatePosition());
}
As can be seen from the decr_position_09293696 function, the pool address must be declared from which liquidity can be taken from its positions.
pub fn decr_position_09293696(
&mut self,
pool: Address, //@audit
id: U256,
amount_0_min: U256,
amount_1_min: U256,
amount_0_max: U256,
amount_1_max: U256,
) -> Result<(U256, U256), Revert> {
//...
}
}
Calls to the function will always fail, as a result, accessing the decrPosition09293696 function through SeawaterAMM.sol will always fail.
Recommended Mitigation Steps
Introduce the pool address parameter:
function decrPosition09293696(
+ address /* pool */,
uint256 /* id */,
uint256 /* amount0Min */,
uint256 /* amount1Min */,
uint256 /* amount0Max */,
uint256 /* amount1Max */
) external returns (uint256, uint256) {
directDelegate(_getExecutorUpdatePosition());
}
Assessed type
Context
af-afk (Superposition) confirmed
The Warden has correctly identified that the function definitions of the Solidity and Stylus contracts differ, resulting in the relevant functionality of the system being inaccessible.
I believe a medium-risk rating is appropriate for this vulnerability given that it is possible to interact with positions via the adjust position function and thus the functionality is simply inaccessible via the decrease position pathway rather than being inaccessible completely.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The Solidity function signature is missing the pool address parameter that the Rust function expects, causing a mismatch.
Impact
The decrease position functionality is inaccessible through the Solidity wrapper, but positions can still be adjusted via another function, so the impact is limited.
What the attacker needed
None
The fix
The function should be fixed by adding the missing pool address parameter to the Solidity function signature.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a smart contract bug where two parts of the system expect different inputs. The Solidity function that users call does not include the pool address, but the Rust function it calls requires it. So when someone tries to decrease their position, the call fails because the inputs do not match.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.