Skip to content

Commit

Permalink
Code clean (#164)
Browse files Browse the repository at this point in the history
* Clean

* Clean
  • Loading branch information
hujw77 authored May 14, 2024
1 parent c5879dd commit 5f5a1a4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 48 deletions.
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)
}
}
}

0 comments on commit 5f5a1a4

Please sign in to comment.