Skip to content

Commit

Permalink
fix: apply consistent mapping order inside HorizonStaking.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBoi9001 committed Oct 3, 2024
1 parent f2a5498 commit 63c373e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/horizon/contracts/staking/HorizonStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
*/
modifier onlyAuthorized(address serviceProvider, address verifier) {
require(
_isAuthorized(msg.sender, serviceProvider, verifier),
HorizonStakingNotAuthorized(msg.sender, serviceProvider, verifier)
_isAuthorized(serviceProvider, msg.sender, verifier),
HorizonStakingNotAuthorized(serviceProvider, msg.sender, verifier)
);
_;
}
Expand Down Expand Up @@ -513,11 +513,11 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
* @notice See {IHorizonStakingMain-isAuthorized}.
*/
function isAuthorized(
address operator,
address serviceProvider,
address operator,
address verifier
) external view override returns (bool) {
return _isAuthorized(operator, serviceProvider, verifier);
return _isAuthorized(serviceProvider, operator, verifier);
}

/*
Expand Down Expand Up @@ -959,7 +959,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
if (_verifier == SUBGRAPH_DATA_SERVICE_ADDRESS) {
_legacyOperatorAuth[msg.sender][_operator] = _allowed;
} else {
_operatorAuth[msg.sender][_verifier][_operator] = _allowed;
_operatorAuth[msg.sender][_operator][_verifier] = _allowed;
}
emit OperatorSet(msg.sender, _operator, _verifier, _allowed);
}
Expand All @@ -969,14 +969,14 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
* @dev Note that this function handles the special case where the verifier is the subgraph data service,
* where the operator settings are stored in the legacy mapping.
*/
function _isAuthorized(address _operator, address _serviceProvider, address _verifier) private view returns (bool) {
function _isAuthorized(address _serviceProvider, address _operator, address _verifier) private view returns (bool) {
if (_operator == _serviceProvider) {
return true;
}
if (_verifier == SUBGRAPH_DATA_SERVICE_ADDRESS) {
return _legacyOperatorAuth[_serviceProvider][_operator];
} else {
return _operatorAuth[_serviceProvider][_verifier][_operator];
return _operatorAuth[_serviceProvider][_operator][_verifier];
}
}
}

0 comments on commit 63c373e

Please sign in to comment.