Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(BridgeManager): disable update operator #4

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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