Corruptible Upgradability Pattern
Storage of Boosted3TokenAuraVault and MetaStable2TokenAuraVault vaults might be corrupted during an upgrade.\\nFollowing are the inheritance of the Boosted3TokenAuraVault and MetaStable2TokenAuraVault vaults.\\nNote: The contracts highlighted in Orange mean that there are no gap slots defined. The contracts highlighted in Green mean that gap slots have been defined\\nInheritance of the MetaStable2TokenAuraVault vault\\n```\\ngraph BT;\\n classDef nogap fill:#f96;\\n classDef hasgap fill:#99cc00;\\n    MetaStable2TokenAuraVault-->MetaStable2TokenVaultMixin:::nogap\\n    MetaStable2TokenVaultMixin:::nogap-->TwoTokenPoolMixin:::nogap\\n    MetaStable2TokenVaultMixin:::nogap-->BalancerOracleMixin:::nogap\\n    TwoTokenPoolMixin:::nogap-->PoolMixin:::nogap\\n    PoolMixin:::nogap-->AuraStakingMixin:::nogap\\n    PoolMixin:::nogap-->BalancerStrategyBase;\\n    BalancerStrategyBase:::hasgap-->BaseStrategyVault:::hasgap\\n    BalancerStrategyBase:::hasgap-->UUPSUpgradeable\\n```\\n\\nInheritance of the Boosted3TokenAuraVault vault\\n```\\ngraph BT;\\n classDef nogap fill:#f96;\\n classDef hasgap fill:#99cc00;\\n    Boosted3TokenAuraVault-->Boosted3TokenPoolMixin:::nogap\\n    Boosted3TokenPoolMixin:::nogap-->PoolMixin:::nogap\\n    PoolMixin:::nogap-->BalancerStrategyBase\\n    PoolMixin:::nogap-->AuraStakingMixin:::nogap\\n    BalancerStrategyBase:::hasgap-->BaseStrategyVault:::hasgap\\n    BalancerStrategyBase:::hasgap-->UUPSUpgradeable\\n```\\n\\nThe Boosted3TokenAuraVault and MetaStable2TokenAuraVault vaults are meant to be upgradeable. However, it inherits contracts that are not upgrade-safe.\\nThe gap storage has been implemented on the `BaseStrategyVault` and `BalancerStrategyBase` contracts inherited by the Boosted3TokenAuraVault and MetaStable2TokenAuraVault vaults.\\n```\\nabstract contract BaseStrategyVault is Initializable, IStrategyVault {\\n    using TokenUtils for IERC20;\\n    using TradeHandler for Trade;\\n    ..SNIP..\\n    // Storage gap for future potential upgrades\\n    uint256[45] private __gap;\\n}\\n```\\n\\n```\\nabstract contract BalancerStrategyBase is BaseStrategyVault, UUPSUpgradeable {\\n    /** Immutables */\\n    uint32 internal immutable SETTLEMENT_PERIOD_IN_SECONDS;\\n    ..SNIP..\\n    // Storage gap for future potential upgrades\\n    uint256[100] private __gap;\\n}\\n```\\n\\nHowever, no gap storage is implemented on the `Boosted3TokenPoolMixin`, `MetaStable2TokenVaultMixin`, `TwoTokenPoolMixin`, `PoolMixin`, `AuraStakingMixin` and `BalancerOracleMixin` contracts inherited by the Boosted3TokenAuraVault and MetaStable2TokenAuraVault vaults.\\nThus, adding new storage variables to any of these inherited contracts can potentially overwrite the beginning of the storage layout of the child contract. causing critical misbehaviors in the system.
Consider defining an appropriate storage gap in each upgradeable parent contract at the end of all the storage variable definitions as follows:\\n```\\nuint256[50] __gap; // gap to reserve storage in the contract for future variable additions\\n```\\n\\nReference\\nA similar issue was found in the past audit report:
Storage of Boosted3TokenAuraVault and MetaStable2TokenAuraVault vaults might be corrupted during upgrading, thus causing the vaults to be broken and assets to be stuck.
```\\ngraph BT;\\n classDef nogap fill:#f96;\\n classDef hasgap fill:#99cc00;\\n    MetaStable2TokenAuraVault-->MetaStable2TokenVaultMixin:::nogap\\n    MetaStable2TokenVaultMixin:::nogap-->TwoTokenPoolMixin:::nogap\\n    MetaStable2TokenVaultMixin:::nogap-->BalancerOracleMixin:::nogap\\n    TwoTokenPoolMixin:::nogap-->PoolMixin:::nogap\\n    PoolMixin:::nogap-->AuraStakingMixin:::nogap\\n    PoolMixin:::nogap-->BalancerStrategyBase;\\n    BalancerStrategyBase:::hasgap-->BaseStrategyVault:::hasgap\\n    BalancerStrategyBase:::hasgap-->UUPSUpgradeable\\n```\\n