The MarketMakingEngine
contract inherits multiple branches (UpgradeBranch
, LookupBranch
, CreditDelegationBranch
, etc.), which may contain storage variables. Additionally, it extends RootProxy
, which also likely manages storage slots. If these contracts do not properly align storage layouts, storage collision can occur, leading to data corruption and unpredictable contract behavior.
Affected Contract: MarketMakingEngine.sol
Root Cause: Unaligned storage variables across multiple inherited contracts
Impact: Potential state corruption, leading to loss of funds or unintended behavior
Solidity uses slot-based storage allocation, meaning contracts that extend multiple parents must align storage layouts.
If RootProxy
and the inherited branches (UpgradeBranch
, LookupBranch
, etc.) introduce new state variables without storage gaps, they can overwrite each other's storage slots.
This can cause critical contract state corruption, leading to malfunctioning logic, loss of funds, or security vulnerabilities.
Corruption of stored variables, which can result in:
Loss of governance control
Unrecoverable funds if balances are corrupted
Malfunctioning upgrade logic in UpgradeBranch
Unexpected contract behavior
Bricked contracts, if corrupted variables cause a revert loop
Unintended access control changes, leading to potential contract takeovers
Solidity Storage Layout Checker
Hardhat & Foundry (for dynamic simulation)
simulate storage corruption using Hardhat. The test :
Deploy MarketMakingEngine.sol
Attempt to store a variable in a parent contract
Check if another variable gets overwritten due to misalignment
Use Storage Gaps
Add a storage gap in each inherited contract to prevent slot collisions:
Verify Storage Layout Before Upgrades
Use Hardhat’s storageLayout
plugin to compare storage across contract versions.
Use EIP-1967 Proxy Standard
Follow EIP-1967 to explicitly separate logic & data storage using reserved storage slots.
Ensure RootProxy
only stores immutable state and delegates logic to implementations.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.