Skip to content

Commit

Permalink
Merge pull request #4 from ronin-chain/fix/disable-change-operator-ad…
Browse files Browse the repository at this point in the history
…dress

fix(BridgeManager): disable update operator
  • Loading branch information
nxqbao authored Mar 6, 2024
2 parents 1be539e + dbc7db4 commit d9ae1e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
26 changes: 1 addition & 25 deletions src/extensions/bridge-operator-governance/BridgeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,7 @@ abstract contract BridgeManager is IQuorum, IBridgeManager, BridgeManagerCallbac
* their operator address blank null `address(0)`, consider add authorization check.
*/
function updateBridgeOperator(address newBridgeOperator) external onlyGovernor {
_requireNonZeroAddress(newBridgeOperator);

// Queries the previous bridge operator
mapping(address => BridgeOperatorInfo) storage _gorvernorToBridgeOperatorInfo = _getGovernorToBridgeOperatorInfo();
address currentBridgeOperator = _gorvernorToBridgeOperatorInfo[msg.sender].addr;
if (currentBridgeOperator == newBridgeOperator) {
revert ErrBridgeOperatorAlreadyExisted(newBridgeOperator);
}

// Tries replace the bridge operator
EnumerableSet.AddressSet storage _bridgeOperatorSet = _getBridgeOperatorSet();
bool updated = _bridgeOperatorSet.remove(currentBridgeOperator) && _bridgeOperatorSet.add(newBridgeOperator);
if (!updated) revert ErrBridgeOperatorUpdateFailed(newBridgeOperator);

mapping(address => address) storage _governorOf = _getGovernorOf();
delete _governorOf[currentBridgeOperator];
_governorOf[newBridgeOperator] = msg.sender;
_gorvernorToBridgeOperatorInfo[msg.sender].addr = newBridgeOperator;

_notifyRegisters(
IBridgeManagerCallback.onBridgeOperatorUpdated.selector,
abi.encode(currentBridgeOperator, newBridgeOperator)
);

emit BridgeOperatorUpdated(msg.sender, currentBridgeOperator, newBridgeOperator);
revert("Not supported");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ contract BridgeManagerCRUDTest is BridgeManagerUtils {
uint256 r3,
uint16 numBridgeOperators
) external virtual {
vm.skip(true);
(address[] memory bridgeOperators, address[] memory governors, uint96[] memory voteWeights) = getValidInputs(
r1,
r2,
Expand Down

0 comments on commit d9ae1e3

Please sign in to comment.