From 89ca568e38a8907787fcb0221eee20fa19f0abd7 Mon Sep 17 00:00:00 2001 From: shaito Date: Tue, 10 Dec 2024 12:27:30 -0300 Subject: [PATCH] fix: m-05 modifier in virtual function --- package.json | 3 ++- solidity/contracts/Module.sol | 10 +++++++++- solidity/test/mocks/contracts/MockFinalityModule.sol | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 07a15ed..970c528 100644 --- a/package.json +++ b/package.json @@ -48,5 +48,6 @@ "solhint-plugin-defi-wonderland": "1.1.2", "sort-package-json": "2.4.1", "standard-version": "9.5.0" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/solidity/contracts/Module.sol b/solidity/contracts/Module.sol index 306bcd3..aad44f1 100644 --- a/solidity/contracts/Module.sol +++ b/solidity/contracts/Module.sol @@ -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) {} diff --git a/solidity/test/mocks/contracts/MockFinalityModule.sol b/solidity/test/mocks/contracts/MockFinalityModule.sol index 0a503d7..38a5f3b 100644 --- a/solidity/test/mocks/contracts/MockFinalityModule.sol +++ b/solidity/test/mocks/contracts/MockFinalityModule.sol @@ -8,11 +8,11 @@ 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); }