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 Immunefi Report #31869 #174

Merged
merged 6 commits into from
Jun 3, 2024
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@msgport/ormp",
"version": "2.0.0",
"version": "2.1.0",
"description": "Oracle and Relayer based Message Protocol",
"repository": "https://github.com/msgport/ORMP",
"author": "Msgport dev",
Expand Down
9 changes: 3 additions & 6 deletions src/ORMP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract ORMP is ReentrancyGuard, Channel {
constructor(address dao) Channel(dao) {}

function version() public pure returns (string memory) {
return "2.0.0";
return "2.1.0";
}

/// @dev Send a cross-chain message over the endpoint.
Expand Down Expand Up @@ -92,6 +92,7 @@ contract ORMP is ReentrancyGuard, Channel {
emit MessageAssigned(msgHash, uc.oracle, uc.relayer, oracleFee, relayerFee, params);

// refund
require(msg.value >= relayerFee + oracleFee, "!fee");
if (msg.value > relayerFee + oracleFee) {
uint256 refundFee = msg.value - (relayerFee + oracleFee);
_sendValue(refund, refundFee);
Expand Down Expand Up @@ -141,7 +142,6 @@ contract ORMP is ReentrancyGuard, Channel {
/// @return dispatchResult Result of the message dispatch.
function recv(Message calldata message, bytes calldata proof)
external
payable
recvNonReentrant
returns (bool dispatchResult)
{
Expand All @@ -158,10 +158,7 @@ contract ORMP is ReentrancyGuard, Channel {
require(gasAvailable - gasAvailable / 64 > message.gasLimit, "!gas");
// Deliver the message to user application contract address.
(dispatchResult,) = message.to.excessivelySafeCall(
message.gasLimit,
msg.value,
0,
abi.encodePacked(message.encoded, msgHash, message.fromChainId, message.from)
message.gasLimit, 0, 0, abi.encodePacked(message.encoded, msgHash, message.fromChainId, message.from)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/eco/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract Oracle is Verifier {
receive() external payable {}

function version() public pure returns (string memory) {
return "2.0.0";
return "2.1.0";
}

/// @dev Only could be called by owner.
Expand Down
2 changes: 1 addition & 1 deletion src/eco/Relayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract Relayer {
}

function version() public pure returns (string memory) {
return "2.0.0";
return "2.1.0";
}

receive() external payable {}
Expand Down
9 changes: 3 additions & 6 deletions tron/ORMP.f.sol
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ contract ORMP is ReentrancyGuard, Channel {
constructor(address dao) Channel(dao) {}

function version() public pure returns (string memory) {
return "2.0.0";
return "2.1.0";
}

/// @dev Send a cross-chain message over the endpoint.
Expand Down Expand Up @@ -471,6 +471,7 @@ contract ORMP is ReentrancyGuard, Channel {
emit MessageAssigned(msgHash, uc.oracle, uc.relayer, oracleFee, relayerFee, params);

// refund
require(msg.value >= relayerFee + oracleFee, "!fee");
if (msg.value > relayerFee + oracleFee) {
uint256 refundFee = msg.value - (relayerFee + oracleFee);
_sendValue(refund, refundFee);
Expand Down Expand Up @@ -520,7 +521,6 @@ contract ORMP is ReentrancyGuard, Channel {
/// @return dispatchResult Result of the message dispatch.
function recv(Message calldata message, bytes calldata proof)
external
payable
recvNonReentrant
returns (bool dispatchResult)
{
Expand All @@ -537,10 +537,7 @@ contract ORMP is ReentrancyGuard, Channel {
require(gasAvailable - gasAvailable / 64 > message.gasLimit, "!gas");
// Deliver the message to user application contract address.
(dispatchResult,) = message.to.excessivelySafeCall(
message.gasLimit,
msg.value,
0,
abi.encodePacked(message.encoded, msgHash, message.fromChainId, message.from)
message.gasLimit, 0, 0, abi.encodePacked(message.encoded, msgHash, message.fromChainId, message.from)
);
}

Expand Down
2 changes: 1 addition & 1 deletion tron/Oracle.f.sol
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ contract Oracle is Verifier {
receive() external payable {}

function version() public pure returns (string memory) {
return "2.0.0";
return "2.1.0";
}

/// @dev Only could be called by owner.
Expand Down
2 changes: 1 addition & 1 deletion tron/Relayer.f.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract Relayer {
}

function version() public pure returns (string memory) {
return "2.0.0";
return "2.1.0";
}

receive() external payable {}
Expand Down
Loading