Skip to content

Commit

Permalink
refactor(arbitrary_message): mv onMessage within BasicForeignAMB and …
Browse files Browse the repository at this point in the history
…BasicHomeAMB
  • Loading branch information
allemanfredi committed Jun 13, 2024
1 parent b1cec49 commit 3c38e12
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
13 changes: 0 additions & 13 deletions contracts/upgradeable_contracts/BasicBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,6 @@ contract BasicBridge is
emit GasPriceChanged(_gasPrice);
}

function onMessage(
uint256 messageId,
uint256 chainId,
address sender,
uint256 threshold,
address[] adapters,
bytes data
) external returns (bytes) {
_validateHashiMessage(chainId, threshold, sender, adapters);
(bytes32 msgId, ) = ArbitraryMessage.unpackData(data);
_setHashiApprovalForMessage(msgId, true);
}

function _setHashiApprovalForMessage(bytes32 msgId, bool status) internal {
boolStorage[keccak256(abi.encodePacked("messagesApprovedByHashi", msgId))] = status;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pragma solidity 0.4.24;

import "../../libraries/Message.sol";
import "../../libraries/ArbitraryMessage.sol";
import "./BasicAMB.sol";
import "./MessageDelivery.sol";
import "../MessageRelay.sol";
Expand Down Expand Up @@ -111,6 +112,19 @@ contract BasicForeignAMB is BasicAMB, MessageRelay, MessageDelivery {
processMessage(sender, executor, msgId, gasLimit, dataType, chainIds[0], data);
}

function onMessage(
uint256 messageId,

Check warning on line 116 in contracts/upgradeable_contracts/arbitrary_message/BasicForeignAMB.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "messageId" is unused
uint256 chainId,
address sender,
uint256 threshold,
address[] adapters,
bytes data
) external returns (bytes) {
_validateHashiMessage(chainId, threshold, sender, adapters);
(bytes32 msgId, ) = ArbitraryMessage.unpackData(data);
_setHashiApprovalForMessage(msgId, true);
}

/**
* @dev Validates message execution status. Reverts if message is was executed in safe mode and reverted.
* @param _status message execution status.
Expand Down
14 changes: 14 additions & 0 deletions contracts/upgradeable_contracts/arbitrary_message/BasicHomeAMB.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pragma solidity 0.4.24;

import "../../libraries/Message.sol";
import "../../libraries/ArbitraryMessage.sol";
import "./BasicAMB.sol";
import "./MessageDelivery.sol";

Expand Down Expand Up @@ -43,6 +44,19 @@ contract BasicHomeAMB is BasicAMB, MessageDelivery {
}
}

function onMessage(
uint256 messageId,

Check warning on line 48 in contracts/upgradeable_contracts/arbitrary_message/BasicHomeAMB.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "messageId" is unused
uint256 chainId,
address sender,
uint256 threshold,
address[] adapters,
bytes data
) external returns (bytes) {
_validateHashiMessage(chainId, threshold, sender, adapters);
(bytes32 msgId, ) = ArbitraryMessage.unpackData(data);
_setHashiApprovalForMessage(msgId, true);
}

/**
* @dev Requests message relay to the opposite network, message is sent to the manual lane.
* @param _contract executor address on the other side.
Expand Down

0 comments on commit 3c38e12

Please sign in to comment.