From 18526af91228a41b539caf34e260dc7db2bb51ff Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 26 Oct 2023 14:00:30 +0800 Subject: [PATCH] fix #59 --- src/user/Application.sol | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/user/Application.sol b/src/user/Application.sol index 50d1635..069b1df 100644 --- a/src/user/Application.sol +++ b/src/user/Application.sol @@ -32,8 +32,9 @@ abstract contract Application { IEndpoint(TRUSTED_ORMP).setAppConfig(oracle, relayer); } - function isTrustedORMP(address ormp) public view returns (bool) { - return TRUSTED_ORMP == ormp; + modifier onlyORMP() { + require(TRUSTED_ORMP == msg.sender, "!ormp"); + _; } function _messageId() internal pure returns (bytes32 _msgDataMessageId) { @@ -50,8 +51,8 @@ abstract contract Application { } } - function _xmsgSender() internal view returns (address payable _from) { - require(msg.data.length >= 20 && isTrustedORMP(msg.sender), "!xmsgSender"); + function _xmsgSender() internal pure returns (address payable _from) { + require(msg.data.length >= 20, "!xmsgSender"); assembly { _from := shr(96, calldataload(sub(calldatasize(), 20))) }