Open hats-bug-reporter[bot] opened 1 month ago
More notes: we have this implementation in emitting events in stake
, send_batch_unlock_request
functions as well. However, in those functions self.data.total_shares_virtual
is updated before emitting, but in the compound function, not updated and emits an old balance.
Addressed in kintsu-contracts@409154
Github username: @0xmahdirostami Twitter username: 0xmahdirostami Submission hash (on-chain): 0xa7b802180377584a8120bb8c77be2c40527d175d5e5cc4f57a2bbeb49806028a Severity: low
Description: Description The
vault::compound
function emits an event with an incorrect value for virtual shares. The current implementation directly usesself.data.total_shares_virtual
instead of calculating the virtual shares at the current time.Impact Incorrect event data can mislead users or systems relying on event logs for accurate information regarding virtual shares.
Revised Code File (Optional) Calculate the virtual shares at the current time before emitting the event.
Revised Code
Explanation
Calculate Virtual Shares:
self.data.get_virtual_shares_at_time(now)
.Emit Correct Event Data:
virtual_shares
in the event data to ensure the emitted event contains the correct value for virtual shares.This change ensures that the
Compounded
event accurately reflects the state of virtual shares at the time of compounding.