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: m-05 modifier in virtual function #61

Open
wants to merge 1 commit into
base: fix/oz-audit
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
"solhint-plugin-defi-wonderland": "1.1.2",
"sort-package-json": "2.4.1",
"standard-version": "9.5.0"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
10 changes: 9 additions & 1 deletion solidity/contracts/Module.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ abstract contract Module is Validator, IModule {
IOracle.Request calldata _request,
IOracle.Response calldata _response,
address _finalizer
) external virtual onlyOracle {}
) external onlyOracle {
_finalizeRequest(_request, _response, _finalizer);
}

function _finalizeRequest(
IOracle.Request calldata _request,
IOracle.Response calldata _response,
address _finalizer
) internal virtual {}

/// @inheritdoc IModule
function validateParameters(bytes calldata _encodedParameters) external view virtual returns (bool _valid) {}
Expand Down
4 changes: 2 additions & 2 deletions solidity/test/mocks/contracts/MockFinalityModule.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IModule, Module} from '../../../contracts/Module.sol';

Check warning on line 4 in solidity/test/mocks/contracts/MockFinalityModule.sol

View workflow job for this annotation

GitHub Actions / Run Linters (20.x)

imported name IModule is not used
import {IOracle} from '../../../interfaces/IOracle.sol';
import {IMockFinalityModule} from '../interfaces/IMockFinalityModule.sol';

contract MockFinalityModule is Module, IMockFinalityModule {
constructor(IOracle _oracle) Module(_oracle) {}

function finalizeRequest(
function _finalizeRequest(
IOracle.Request calldata _request,
IOracle.Response calldata, /* _response */
address /* _finalizer */
) external override(IModule, Module) onlyOracle {
) internal override onlyOracle {
RequestParameters memory _params = abi.decode(_request.finalityModuleData, (RequestParameters));
_params.target.call(_params.data);
}
Expand Down
Loading