The contracts AaveDIVAWrapperCore.sol and WToken.sol handle owner initialization inconsistently. While AaveDIVAWrapperCore uses OpenZeppelin's Ownable2Step contract to initialize the owner, WToken manually sets an _owner variable in its constructor. This inconsistency creates confusion, increases the likelihood of errors, and leads to ambiguity regarding the ownership structure. Additionally, WToken.sol does not align with the OpenZeppelin ownership standard, which could hinder maintainability and interoperability.
Type: Mismanagement of Ownership Initialization and Standard Deviation
Location:
AaveDIVAWrapperCore.sol initializes ownership using OpenZeppelin's Ownable2Step:
WToken.sol manually sets _owner in its constructor:
Problem:
The owner of WToken is the AaveDIVAWrapperCore contract itself:
However, the AaveDIVAWrapperCore relies on OpenZeppelin's ownership mechanisms, while WToken uses a custom _owner variable. This divergence creates inconsistency:
Ownership logic across the system is unclear and difficult to track.
Developers and auditors cannot rely on a uniform pattern.
Future maintainers might misinterpret the ownership logic.
WTokenLocation: WToken.sol:
Problem:
The _owner variable does not use OpenZeppelin's Ownable or Ownable2Step contracts, which are industry standards.
This custom ownership logic lacks key OpenZeppelin features, such as ownership transfer mechanisms (transferOwnership or transferOwnershipWithTwoSteps).
The lack of an ownership transfer function makes ownership immutable, which is a design decision that should be explicitly documented.
Functionality Impact:
No direct security risk is posed, but the inconsistency can lead to developer confusion and implementation errors when extending the system.
Maintainability Impact:
Custom ownership in WToken deviates from OpenZeppelin standards, reducing clarity and interoperability.
Risk of Mismanagement:
If ownership behavior diverges between the contracts, it could lead to unexpected governance or operational issues in the future.
The following tools and techniques were used to identify and analyze the issue:
Static Code Review: Manual inspection of ownership-related logic.
Solidity Compiler (v0.8.26): Verified owner initialization and inheritance mechanisms.
OpenZeppelin Documentation: Compared ownership patterns against established best practices.
WTokenReplace the custom _owner variable in WToken with OpenZeppelin's Ownable contract:
This ensures consistency in ownership management across all contracts.
Clarify that:
The AaveDIVAWrapperCore contract acts as the owner of all WToken instances.
Ownership of WToken is immutable after deployment.
Include this information in the documentation or inline comments for future reference.
WTokenIf ownership of WToken is meant to be immutable, declare the owner as immutable:
Document the decision to use immutable ownership for transparency.
Add unit tests to verify ownership relationships:
Ensure AaveDIVAWrapperCore is the owner of all WToken instances.
Confirm that only the owner can mint/burn tokens in WToken.
WToken Contract Using OpenZeppelin’s OwnableClarity: Unified ownership logic improves code readability and reduces developer confusion.
Interoperability: Adopting OpenZeppelin standards ensures compatibility with other DeFi systems.
Maintainability: Standardized ownership reduces technical debt and simplifies future upgrades.
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.