Skip to content
Request an audit

‹ All findings

BasicVaultFactory::createVault() inconsistent already existing vault check

Low/InfoMitosis·Three Sigma · Cross-chain liquidity layer 1 · 25th June, 20243S-Mitosis-N03

Description

BasicVaultFactory::createVault() reverts with a vault already created error whenever $.vaultIds[vault] != 0 && $.vaults[$.vaultIds[vault]] != vault.

This is problematic because the vault with id == 0 will not revert due to this error (but still reverts later as the creation will fail) and $.vaults[$.vaultIds[vault]] is always vault, as it is impossible to have mismatching vaults and vault ids.

Recommendation

Vault ids could start at 1 instead so index 0 is never confused with not having been created. This way it is enough checking the vault to id mapping.

Status

Addressed in #7c8ca62.