Open hats-bug-reporter[bot] opened 1 year ago
We need to use memory, because syncPositionFee
is used in osTokenPositions
that is view
and used to get your position latest state
We need to use memory, because
syncPositionFee
is used inosTokenPositions
that isview
and used to get your position latest state
If we take a look at the usage of _syncPositionFee
it is used in mintOSToken, this line of code
then the position is updated in last logic in mintOSToken to ensure the fee is updated in this line of code
it is used in burnOSToken in this line of code
then the position is updated in the last logic in mingOSToken to ensure the fee is updated in this line of code
even the function _syncPosition is used in the view function,
it is used in the function _checkOsTokenPosition as well in this line of code
but this line of code is never called
_positions[msg.sender] = position;
so the sync Position fee does not really sync the position fee
Github username: -- Submission hash (on-chain): 0x53819d9a186e4f089e497b06644b7d946345a3b9d0a463cb6e4547c0c8c12a37 Severity: high
Description: Description\
_checkOsTokenPosition does not really update position
Attack Scenario\
https://github.com/stakewise/v3-core/blob/c82fc57d013a19967576f683c5e41900cbdd0e67/contracts/vaults/modules/VaultOsToken.sol#L149
_checkOsTokenPosition(msg.sender) this is calling
this is calling
but note we are using memory
we does not use storage and we does not call
after calling _syncPositionFee
so the position is never updated
Attachments
described above, this leads to accounting error and failed to update the position state of individual correctly
add
after sync position