CertiK reviewed Wormhole (pyth2wormhole - Governance) on 13 Dec 2022: 13 findings, 0 critical; 4 marked fixed, 9 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 1 | 0 | 1 |
| Medium | 0 | 0 | 0 |
| Low | 8 | 0 | 3 |
The function `make_none()` is used to remove a position, which is needed when completely closing a position. By design, it will swap the last valid position with the position to be removed. ```rust=51 pub fn make_none(&mut self, i: usize, next_index: &mut u8) -> Result<()> { *next_index -= 1; self.positions[i] = self.positions[*next_index as usize]; None::<Option<Position>>.try_write(&mut self.positions[i]) } ``` The function first decreases `next_index` by 1, so it now points to the last created position. Then the function overwrites the position at index `i` with the information of the last position, and then changes position `i` to a `None` value. This eliminates position `i`, but the value of `next_index` does not point towards an empty position. A consequence of this is that if a new position was created, then this new position will overwrite the last created position due to the updated value of `next_index`, causing the user to completely lose a position.
In the function `update_woter_weight`, both actions `CastVote` and `CreateProposal` will compare the proposal `max_voting_time` with `config.epoch_duration`. It currently checks to ensure the `max_voting_time` is at least larger than one epoch. ```rust=406 if config.epoch_duration > max_voting_time.into() { return Err(error!(ErrorCode::ProposalTooLong)); } ``` However, the error code for the `max_voting_time` when it is less than one epoch will be `ErrorCode::ProposalTooLong`. If the max voting time is meant to be larger than one epoch, the error code should be "proposal too short" instead. Otherwise, if the max voting time is meant to be shorter than an epoch, the condition should be reversed.
When context for `UpdateMaxVoterWeight` has the `init_if_needed` condition for the `max_voter_record` account. Since the function `update_max_voter_weight()` fixes all fields of `max_voter_record`, there is no reason to use this function twice.
The position index `i`, converted from user input `index`, is not sanitized before accessing the positions in `stake_account_positions`.
The report names a repository or files. Open the report to see its scope.
1,044 projects reviewed · 1,393 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us