# Incorrect deployment/missing contract will break functionality

KeroseneManager's vault list serves two conflicting purposes, so getKeroseneValue always returns zero and kerosene collateral is never counted.

- Payout: Audit contest
- Severity: medium
- Program: DYAD
- Found by: carrotsmuggler
- Disclosed: 2024-06-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-04-dyad-findings/issues/70
- Library page: https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AM-08
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:misconfiguration

**Target:** KeroseneManager / VaultManagerV2 / UnboundedKerosineVault Solidity contracts
**Root cause:** KeroseneManager.vaults is expected by UnboundedKerosineVault to hold only exogenous-collateral vaults (to avoid infinite recursion in assetPrice), but VaultManagerV2.getKeroseneValue uses keroseneManager.isLicensed to gate kerosene-deposit vaults, which are never in that list.
**Steps:**
1. Read UnboundedKerosineVault.assetPrice: it iterates kerosineManager.getVaults() and calls vault.assetPrice(), so a kerosene vault in that list recurses infinitely.
2. Read VaultManagerV2.getKeroseneValue: it iterates vaultsKerosene[id] and only adds value `if (keroseneManager.isLicensed(address(vault)))`.
3. Read KeroseneManager.isLicensed: returns `vaults.contains(vault)`.
4. Check Deploy V2 script: only `kerosineManager.add(address(ethVault))` and `add(address(wstEth))` are called, no kerosene vaults.
5. Conclude getKeroseneValue always returns zero for kerosene vaults, breaking kerosene collateral accounting.
**How found:** Cross-referenced three contracts' expectations of the same KeroseneManager.vaults array and the deployment script, spotting the mutually exclusive requirements (recursion avoidance vs. licensing check).
**Insight:** When one registry array is consumed by multiple contracts, enumerate every consumer's required contents; a list that must exclude X for one caller but include X for another is a design contradiction detectable by reading deployment scripts against call sites.

## Proof of concept (copied exactly from the original report)

**Deploy script adds only backing vaults to KerosineManager**

```
kerosineManager.add(address(ethVault));
kerosineManager.add(address(wstEth));
```

**isLicensed checks only KerosineManager vaults array**

```
function isLicensed(
    address vault
  )
    return vaults.contains(vault);
```

**getKeroseneValue gated by keroseneManager.isLicensed**

```
uint numberOfVaults = vaultsKerosene[id].length();
      for (uint i = 0; i < numberOfVaults; i++) {
        Vault vault = Vault(vaultsKerosene[id].at(i));
        if (keroseneManager.isLicensed(address(vault))) {
```

