Skip to content

Commit 14f565e

Browse files
committed
feat: address comments
1 parent 5a0a725 commit 14f565e

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

solidity/contracts/CommonAccessController.sol

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ import {IAccessModule} from '../interfaces/modules/accessControl/IAccessModule.s
66

77
abstract contract CommonAccessController is IAccessController {
88
/**
9-
* @notice Modifier to check if the caller has access to the user
10-
* @dev The return value of this function must always be `true`,
11-
* otherwise it would revert.
9+
* @notice Check whether the caller is authorized for the given parameters.
1210
* @param _accessModule The access module
1311
* @param _typehash The typehash
14-
* @param _params The params passed to the typehash
12+
* @param _typehashParams The params passed to the typehash
1513
* @param _accessControl The access control struct
1614
*/
1715
function _hasAccess(
1816
address _accessModule,
1917
bytes32 _typehash,
20-
bytes memory _params,
18+
bytes memory _typehashParams,
2119
AccessControl memory _accessControl
22-
) internal returns (bool _granted) {
20+
) internal {
2321
// todo: if _accessModule == address(0) we should skip this check.
24-
_granted = msg.sender == _accessControl.user
22+
bool _granted = msg.sender == _accessControl.user
2523
|| (
2624
_accessModule != address(0)
2725
&& IAccessModule(_accessModule).hasAccess(
@@ -30,7 +28,7 @@ abstract contract CommonAccessController is IAccessController {
3028
sender: msg.sender,
3129
accessControl: _accessControl,
3230
typehash: _typehash,
33-
params: _params
31+
typehashParams: _typehashParams
3432
})
3533
)
3634
)

solidity/contracts/Oracle.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ contract Oracle is IOracle, OracleAccessController, OracleTypehash {
353353
IDisputeModule(_request.disputeModule).finalizeRequest(_request, _response, _accessControl.user);
354354
IResponseModule(_request.responseModule).finalizeRequest(_request, _response, _accessControl.user);
355355
IRequestModule(_request.requestModule).finalizeRequest(_request, _response, _accessControl.user);
356-
IAccessModule(_request.accessModule).finalizeRequest(_request, _response, _accessControl.user);
356+
357+
if (_request.accessModule != address(0)) {
358+
IAccessModule(_request.accessModule).finalizeRequest(_request, _response, _accessControl.user);
359+
}
357360

358361
emit OracleRequestFinalized(_requestId, _responseId);
359362
}

solidity/contracts/OracleAccessController.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ abstract contract OracleAccessController is IOracleAccessController, CommonAcces
1414
bytes memory _params,
1515
AccessControl memory _accessControl
1616
) {
17-
// we do not care about `_hasAccess` return value, check function's @notice
1817
_hasAccess(_accessModule, _typehash, _params, _accessControl);
1918
_;
2019
}

solidity/interfaces/modules/accessControl/IAccessModule.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ interface IAccessModule is IModule {
2525
address sender;
2626
IAccessController.AccessControl accessControl;
2727
bytes32 typehash;
28-
bytes params;
28+
bytes typehashParams;
2929
}
3030

3131
/*///////////////////////////////////////////////////////////////
3232
LOGIC
3333
//////////////////////////////////////////////////////////////*/
3434
/**
35-
* @notice Checks if the caller has access to the user
35+
* @notice Check whether the caller is authorized for the given parameters.
3636
* @param _data The data for access control validation
3737
* @return _hasAccess True if the caller has access to the user
3838
*/

solidity/test/mocks/contracts/MockAccessModule.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ contract MockAccessModule is Module, IMockAccessModule {
1919

2020
function moduleName() external view returns (string memory _moduleName) {}
2121

22-
function hasAccess(bytes memory _data) external view override returns (bool _hasAccess) {
22+
function hasAccess(bytes memory _data) external view returns (bool _hasAccess) {
2323
IAccessModule.AccessControlParameters memory _accessControlData = decodeAccesControlData(_data);
2424
_hasAccess = callerHasAccess[_accessControlData.sender];
2525
}

solidity/test/unit/AccessController.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ contract AccessController_Unit_HasAccess is BaseTest {
6161
sender: caller,
6262
accessControl: _accessControl,
6363
typehash: _typehash,
64-
params: _params
64+
typehashParams: _params
6565
});
6666

6767
// Expect the hasAccess function to not be called
@@ -101,7 +101,7 @@ contract AccessController_Unit_HasAccess is BaseTest {
101101
sender: caller,
102102
accessControl: _accessControl,
103103
typehash: _typehash,
104-
params: _params
104+
typehashParams: _params
105105
});
106106

107107
// Expect the hasAccess function to be called

0 commit comments

Comments
 (0)