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

Code clean #164

Merged
merged 2 commits into from
May 14, 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
22 changes: 0 additions & 22 deletions src/interfaces/IFeedOracle.sol

This file was deleted.

4 changes: 1 addition & 3 deletions src/interfaces/IORMP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ interface IORMP {
/// @param message Verified receive message info.
/// @param proof Message proof of this message.
/// @return dispatchResult Result of the message dispatch.
function recv(Message calldata message, bytes calldata proof) external returns (bool dispatchResult);

function prove() external view returns (bytes32[32] memory);
function recv(Message calldata message, bytes calldata proof) external payable returns (bool dispatchResult);

/// @dev Fetch user application config.
/// @notice If user application has not configured, then the default config is used.
Expand Down
23 changes: 0 additions & 23 deletions src/security/ExcessivelySafeCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pragma solidity 0.8.17;
// Inspired: https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/util/ExcessivelySafeCall.sol

library ExcessivelySafeCall {
uint256 private constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

/// @notice Use when you _really_ really _really_ don't trust the called
/// contract. This prevents the called contract from causing reversion of
/// the caller in as many ways as we can.
Expand Down Expand Up @@ -104,25 +102,4 @@ library ExcessivelySafeCall {
}
return (_success, _returnData);
}

/// @notice Swaps function selectors in encoded contract calls
/// @dev Allows reuse of encoded calldata for functions with identical
/// argument types but different names. It simply swaps out the first 4 bytes
/// for the new selector. This function modifies memory in place, and should
/// only be used with caution.
/// @param _newSelector The new 4-byte selector
/// @param _buf The encoded contract args
function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {
require(_buf.length >= 4);
uint256 _mask = LOW_28_MASK;
assembly ("memory-safe") {
// load the first word of
let _word := mload(add(_buf, 0x20))
// mask out the top 4 bytes
// /x
_word := and(_word, _mask)
_word := or(_newSelector, _word)
mstore(add(_buf, 0x20), _word)
}
}
}
Loading