Skip to content

Conversation

@zguesmi
Copy link
Member

@zguesmi zguesmi commented Jul 15, 2025

In the bridge contract IexecLayerZeroBridge both Ownable (used by LayerZero) and AccessControlDefaultAdmin are used to manager roles, where the owner and the defaultAdmin are supposed to always be the same account, which is the case at deployment time. However, changing one of them later does not change the other. For example, one could change (for any reason) the owner to a new wallet without changing the defaultAdmin which could lead to losing control of the contract if the old private key is destroyed. The suggested fix is to override the following Ownable functions:

  • owner: should return the defaultAdmin address.
  • onlyOwner: nothing to do
  • renounceOwnership and transferOwnership: should always revert

@zguesmi zguesmi marked this pull request as ready for review July 15, 2025 16:15
@zguesmi zguesmi self-assigned this Jul 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR overrides access control functions in the IexecLayerZeroBridge contract to ensure consistent state management between OwnableUpgradeable and AccessControlDefaultAdminRulesUpgradeable inheritance. The primary purpose is to prevent ownership operations through the Ownable interface and redirect users to use AccessControlDefaultAdminRules instead.

  • Disables renounceOwnership and transferOwnership functions to prevent direct ownership changes
  • Updates owner() function to return the default admin instead of the ownable owner
  • Ensures state consistency by updating the ownable owner when default admin transfers occur

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/interfaces/IIexecLayerZeroBridge.sol Adds OperationNotAllowed error for blocked ownership operations
src/bridges/layerZero/IexecLayerZeroBridge.sol Implements access control overrides and state synchronization logic
test/units/bridges/layerZero/IexecLayerZeroBridge.t.sol Adds comprehensive tests for the new access control behavior

@zguesmi zguesmi requested a review from Amxx July 15, 2025 16:17
@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.78%. Comparing base (8c72922) to head (574eb9b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/bridges/layerZero/IexecLayerZeroBridge.sol 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
+ Coverage   83.65%   83.78%   +0.12%     
==========================================
  Files           4        4              
  Lines         104      111       +7     
  Branches        7        7              
==========================================
+ Hits           87       93       +6     
- Misses         16       17       +1     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Le-Caignec Le-Caignec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zguesmi zguesmi merged commit 90e0be9 into main Jul 16, 2025
5 checks passed
@zguesmi zguesmi deleted the feature/ownable-override branch July 16, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants