Skip to content

Commit

Permalink
evm: Readd some public views that might be useful
Browse files Browse the repository at this point in the history
  • Loading branch information
djb15 committed Feb 24, 2024
1 parent 4892de1 commit ae661fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 5 additions & 5 deletions evm/src/Manager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ contract Manager is
recipientChain,
endpointInstructions[registeredEndpointIndex],
managerMessage,
_getSibling(recipientChain)
getSibling(recipientChain)
);
}
}

function isMessageApproved(bytes32 digest) public view returns (bool) {
uint8 threshold = getThreshold();
return _messageAttestations(digest) >= threshold && threshold > 0;
return messageAttestations(digest) >= threshold && threshold > 0;
}

function _setEndpointAttestedToMessage(bytes32 digest, uint8 index) internal {
Expand Down Expand Up @@ -562,7 +562,7 @@ contract Manager is

/// @dev Verify that the sibling address saved for `sourceChainId` matches the `siblingAddress`.
function _verifySibling(uint16 sourceChainId, bytes32 siblingAddress) internal view {
if (_getSibling(sourceChainId) != siblingAddress) {
if (getSibling(sourceChainId) != siblingAddress) {
revert InvalidSibling(sourceChainId, siblingAddress);
}
}
Expand Down Expand Up @@ -702,7 +702,7 @@ contract Manager is
return _getMessageAttestationsStorage()[digest].executed;
}

function _getSibling(uint16 chainId_) internal view returns (bytes32) {
function getSibling(uint16 chainId_) public view returns (bytes32) {
return _getSiblingsStorage()[chainId_];
}

Expand Down Expand Up @@ -755,7 +755,7 @@ contract Manager is
}

// @dev Count the number of attestations from enabled endpoints for a given message.
function _messageAttestations(bytes32 digest) internal view returns (uint8 count) {
function messageAttestations(bytes32 digest) public view returns (uint8 count) {
return countSetBits(_getMessageAttestations(digest));
}

Expand Down
2 changes: 2 additions & 0 deletions evm/src/interfaces/IManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ interface IManager {
bytes memory encodedInstructions
) external payable returns (uint64 msgId);

function getSibling(uint16 chainId_) external view returns (bytes32);

function setSibling(uint16 siblingChainId, bytes32 siblingContract) external;

/// @notice Check if a message has been approved. The message should have at least
Expand Down
4 changes: 0 additions & 4 deletions evm/test/mocks/MockManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ contract MockManagerContract is Manager {
}
}

function messageAttestations(bytes32 digest) public view returns (uint8 count) {
return _messageAttestations(digest);
}

function getOutboundLimitParams() public pure returns (RateLimitParams memory) {
return _getOutboundLimitParams();
}
Expand Down

0 comments on commit ae661fa

Please sign in to comment.