Skip to content

Commit

Permalink
Fix: ToB-12 (two step ownership) (#1450)
Browse files Browse the repository at this point in the history
* Use `Ownable2StepUpgradeable`

* Update initializers
  • Loading branch information
ChiTimesChi authored Oct 17, 2023
1 parent 889fe28 commit d7e7fef
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-core/contracts/Destination.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ contract Destination is ExecutionHub, DestinationEvents, InterfaceDestination {
/// - msg.sender is set as contract owner
function initialize(bytes32 agentRoot) external initializer {
// Initialize Ownable: msg.sender is set as "owner"
__Ownable_init();
__Ownable2Step_init();
// Initialize ReeentrancyGuard
__ReentrancyGuard_init();
// Set Agent Merkle Root in Light Manager
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-core/contracts/GasOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract GasOracle is MessagingBase, GasOracleEvents, InterfaceGasOracle {
/// - msg.sender is set as contract owner
function initialize() external initializer {
// Initialize Ownable: msg.sender is set as "owner"
__Ownable_init();
__Ownable2Step_init();
}

/// @notice MVP function to set the gas data for the given domain.
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-core/contracts/Origin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ contract Origin is StateHub, OriginEvents, InterfaceOrigin {
/// - State of "empty merkle tree" is saved
function initialize() external initializer {
// Initialize Ownable: msg.sender is set as "owner"
__Ownable_init();
__Ownable2Step_init();
// Initialize "states": state of an "empty merkle tree" is saved
_initializeStates();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-core/contracts/Summit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract Summit is SnapshotHub, SummitEvents, InterfaceSummit {

function initialize() external initializer {
// Initialize Ownable: msg.sender is set as "owner"
__Ownable_init();
__Ownable2Step_init();
_initializeAttestations();
}

Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-core/contracts/base/MessagingBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ pragma solidity 0.8.17;
import {MultiCallable} from "./MultiCallable.sol";
import {Versioned} from "./Version.sol";
// ═════════════════════════════ EXTERNAL IMPORTS ══════════════════════════════
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";

/**
* @notice Base contract for all messaging contracts.
* - Provides context on the local chain's domain.
* - Provides ownership functionality.
* - Will be providing pausing functionality when it is implemented.
*/
abstract contract MessagingBase is MultiCallable, Versioned, OwnableUpgradeable {
abstract contract MessagingBase is MultiCallable, Versioned, Ownable2StepUpgradeable {
// ════════════════════════════════════════════════ IMMUTABLES ═════════════════════════════════════════════════════

/// @notice Domain of the local chain, set once upon contract creation
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-core/contracts/inbox/StatementInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ abstract contract StatementInbox is MessagingBase, StatementInboxEvents, IStatem
agentManager = agentManager_;
origin = origin_;
destination = destination_;
__Ownable_init();
__Ownable2Step_init();
}

// ══════════════════════════════════════════ SUBMIT AGENT STATEMENTS ══════════════════════════════════════════════
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract BondingManager is AgentManager, InterfaceBondingManager {
function initialize(address origin_, address destination_, address inbox_, address summit_) external initializer {
__AgentManager_init(origin_, destination_, inbox_);
summit = summit_;
__Ownable_init();
__Ownable2Step_init();
// Insert a zero address to make indexes for Agents start from 1.
// Zeroed index is supposed to be used as a sentinel value meaning "no agent".
_agents.push(address(0));
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-core/contracts/manager/LightManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract LightManager is AgentManager, InterfaceLightManager {

function initialize(address origin_, address destination_, address inbox_) external initializer {
__AgentManager_init(origin_, destination_, inbox_);
__Ownable_init();
__Ownable2Step_init();
}

// ═══════════════════════════════════════════════ AGENTS LOGIC ════════════════════════════════════════════════════
Expand Down

0 comments on commit d7e7fef

Please sign in to comment.