diff --git a/contracts/.gitignore b/contracts/.gitignore index 07f65a44eb..ddfd43837d 100644 --- a/contracts/.gitignore +++ b/contracts/.gitignore @@ -1,5 +1,4 @@ artifacts -foundry-artifacts cache node_modules solc diff --git a/contracts/.solhintignore b/contracts/.solhintignore index ee9b9cf026..bad1935442 100644 --- a/contracts/.solhintignore +++ b/contracts/.solhintignore @@ -1,6 +1,3 @@ -# 377 warnings -#./src/v0.8/automation - # Ignore frozen Automation code ./src/v0.8/automation/v1_2 ./src/v0.8/automation/interfaces/v1_2 diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile index 026a5f47a4..0ebad8446e 100644 --- a/contracts/GNUmakefile +++ b/contracts/GNUmakefile @@ -88,17 +88,6 @@ wrappers-all: pnpmdep mockery abigen ## Recompiles solidity contracts and their # go_generate contains a call to compile all contracts before generating wrappers go generate ../core/gethwrappers/go_generate.go -# Custom wrapper generation for OCR2VRF as their contracts do not exist in this repo -.PHONY: go-solidity-wrappers-ocr2vrf -go-solidity-wrappers-ocr2vrf: pnpmdep abigen ## Recompiles OCR2VRF solidity contracts and their go wrappers. - ./scripts/native_solc_compile_all_ocr2vrf - # replace the go:generate_disabled directive with the regular go:generate directive - sed -i '' 's/go:generate_disabled/go:generate/g' ../core/gethwrappers/ocr2vrf/go_generate.go - go generate ../core/gethwrappers/ocr2vrf - go generate ../core/internal/mocks - # put the go:generate_disabled directive back - sed -i '' 's/go:generate/go:generate_disabled/g' ../core/gethwrappers/ocr2vrf/go_generate.go - help: @echo "" @echo " .__ .__ .__ .__ __" diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 04462c4d93..71419719d4 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -38,10 +38,8 @@ let config = { paths: { artifacts: './artifacts', cache: './cache', - // Only use sources relevant to CCIP, revert this when merging CCIP into the main repo. sources: './src/v0.8', - // Only test CCIP, revert this when merging CCIP into the main repo. - tests: './test/v0.8/ccip', + tests: './test/v0.8', }, typechain: { outDir: './typechain', diff --git a/contracts/src/v0.8/vendor/Context.sol b/contracts/src/v0.8/vendor/Context.sol deleted file mode 100644 index 7aa3e480bc..0000000000 --- a/contracts/src/v0.8/vendor/Context.sol +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -/** - * @dev Provides information about the current execution context, including the - * sender of the transaction and its data. While these are generally available - * via msg.sender and msg.data, they should not be accessed in such a direct - * manner, since when dealing with meta-transactions the account sending and - * paying for execution may not be the actual sender (as far as an application - * is concerned). - * - * This contract is only required for intermediate, library-like contracts. - */ -abstract contract Context { - function _msgSender() internal view virtual returns (address) { - return msg.sender; - } - - function _msgData() internal view virtual returns (bytes calldata) { - return msg.data; - } -} \ No newline at end of file diff --git a/contracts/src/v0.8/vendor/IERC2771Recipient.sol b/contracts/src/v0.8/vendor/IERC2771Recipient.sol deleted file mode 100644 index 5c8328d8a4..0000000000 --- a/contracts/src/v0.8/vendor/IERC2771Recipient.sol +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.6.0; - -/** - * @title The ERC-2771 Recipient Base Abstract Class - Declarations - * - * @notice A contract must implement this interface in order to support relayed transaction. - * - * @notice It is recommended that your contract inherits from the ERC2771Recipient contract. - */ -abstract contract IERC2771Recipient { - - /** - * :warning: **Warning** :warning: The Forwarder can have a full control over your Recipient. Only trust verified Forwarder. - * @param forwarder The address of the Forwarder contract that is being used. - * @return isTrustedForwarder `true` if the Forwarder is trusted to forward relayed transactions by this Recipient. - */ - function isTrustedForwarder(address forwarder) public virtual view returns(bool); - - /** - * @notice Use this method the contract anywhere instead of msg.sender to support relayed transactions. - * @return sender The real sender of this call. - * For a call that came through the Forwarder the real sender is extracted from the last 20 bytes of the `msg.data`. - * Otherwise simply returns `msg.sender`. - */ - function _msgSender() internal virtual view returns (address); - - /** - * @notice Use this method in the contract instead of `msg.data` when difference matters (hashing, signature, etc.) - * @return data The real `msg.data` of this call. - * For a call that came through the Forwarder, the real sender address was appended as the last 20 bytes - * of the `msg.data` - so this method will strip those 20 bytes off. - * Otherwise (if the call was made directly and not through the forwarder) simply returns `msg.data`. - */ - function _msgData() internal virtual view returns (bytes calldata); -} \ No newline at end of file diff --git a/contracts/src/v0.8/vendor/Pausable.sol b/contracts/src/v0.8/vendor/Pausable.sol deleted file mode 100644 index df5ed2ab63..0000000000 --- a/contracts/src/v0.8/vendor/Pausable.sol +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -import "./Context.sol"; - -/** - * @dev Contract module which allows children to implement an emergency stop - * mechanism that can be triggered by an authorized account. - * - * This module is used through inheritance. It will make available the - * modifiers `whenNotPaused` and `whenPaused`, which can be applied to - * the functions of your contract. Note that they will not be pausable by - * simply including this module, only once the modifiers are put in place. - */ -abstract contract Pausable is Context { - /** - * @dev Emitted when the pause is triggered by `account`. - */ - event Paused(address account); - - /** - * @dev Emitted when the pause is lifted by `account`. - */ - event Unpaused(address account); - - bool private _paused; - - /** - * @dev Initializes the contract in unpaused state. - */ - constructor() { - _paused = false; - } - - /** - * @dev Returns true if the contract is paused, and false otherwise. - */ - function paused() public view virtual returns (bool) { - return _paused; - } - - /** - * @dev Modifier to make a function callable only when the contract is not paused. - * - * Requirements: - * - * - The contract must not be paused. - */ - modifier whenNotPaused() { - require(!paused(), "Pausable: paused"); - _; - } - - /** - * @dev Modifier to make a function callable only when the contract is paused. - * - * Requirements: - * - * - The contract must be paused. - */ - modifier whenPaused() { - require(paused(), "Pausable: not paused"); - _; - } - - /** - * @dev Triggers stopped state. - * - * Requirements: - * - * - The contract must not be paused. - */ - function _pause() internal virtual whenNotPaused { - _paused = true; - emit Paused(_msgSender()); - } - - /** - * @dev Returns to normal state. - * - * Requirements: - * - * - The contract must be paused. - */ - function _unpause() internal virtual whenPaused { - _paused = false; - emit Unpaused(_msgSender()); - } -} \ No newline at end of file diff --git a/contracts/src/v0.8/vendor/nomad-xyz/ExcessivelySafeCall.sol b/contracts/src/v0.8/vendor/nomad-xyz/ExcessivelySafeCall.sol deleted file mode 100644 index e7a9887eba..0000000000 --- a/contracts/src/v0.8/vendor/nomad-xyz/ExcessivelySafeCall.sol +++ /dev/null @@ -1,138 +0,0 @@ -// SPDX-License-Identifier: MIT OR Apache-2.0 -pragma solidity >=0.8.0; - -library ExcessivelySafeCall { - uint256 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. - /// @dev The main difference between this and a solidity low-level call is - /// that we limit the number of bytes that the callee can cause to be - /// copied to caller memory. This prevents stupid things like malicious - /// contracts returning 10,000,000 bytes causing a local OOG when copying - /// to memory. - /// @param _target The address to call - /// @param _gas The amount of gas to forward to the remote contract - /// @param _value The value in wei to send to the remote contract - /// @param _maxCopy The maximum number of bytes of returndata to copy - /// to memory. - /// @param _calldata The data to send to the remote contract - /// @return success and returndata, as `.call()`. Returndata is capped to - /// `_maxCopy` bytes. - function excessivelySafeCall( - address _target, - uint256 _gas, - uint256 _value, - uint16 _maxCopy, - bytes memory _calldata - ) internal returns (bool, bytes memory) { - // set up for assembly call - uint256 _toCopy; - bool _success; - bytes memory _returnData = new bytes(_maxCopy); - // dispatch message to recipient - // by assembly calling "handle" function - // we call via assembly to avoid memcopying a very large returndata - // returned by a malicious contract - assembly { - _success := call( - _gas, // gas - _target, // recipient - _value, // ether value - add(_calldata, 0x20), // inloc - mload(_calldata), // inlen - 0, // outloc - 0 // outlen - ) - // limit our copy to 256 bytes - _toCopy := returndatasize() - if gt(_toCopy, _maxCopy) { - _toCopy := _maxCopy - } - // Store the length of the copied bytes - mstore(_returnData, _toCopy) - // copy the bytes from returndata[0:_toCopy] - returndatacopy(add(_returnData, 0x20), 0, _toCopy) - } - return (_success, _returnData); - } - - /// @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. - /// @dev The main difference between this and a solidity low-level call is - /// that we limit the number of bytes that the callee can cause to be - /// copied to caller memory. This prevents stupid things like malicious - /// contracts returning 10,000,000 bytes causing a local OOG when copying - /// to memory. - /// @param _target The address to call - /// @param _gas The amount of gas to forward to the remote contract - /// @param _maxCopy The maximum number of bytes of returndata to copy - /// to memory. - /// @param _calldata The data to send to the remote contract - /// @return success and returndata, as `.call()`. Returndata is capped to - /// `_maxCopy` bytes. - function excessivelySafeStaticCall( - address _target, - uint256 _gas, - uint16 _maxCopy, - bytes memory _calldata - ) internal view returns (bool, bytes memory) { - // set up for assembly call - uint256 _toCopy; - bool _success; - bytes memory _returnData = new bytes(_maxCopy); - // dispatch message to recipient - // by assembly calling "handle" function - // we call via assembly to avoid memcopying a very large returndata - // returned by a malicious contract - assembly { - _success := staticcall( - _gas, // gas - _target, // recipient - add(_calldata, 0x20), // inloc - mload(_calldata), // inlen - 0, // outloc - 0 // outlen - ) - // limit our copy to 256 bytes - _toCopy := returndatasize() - if gt(_toCopy, _maxCopy) { - _toCopy := _maxCopy - } - // Store the length of the copied bytes - mstore(_returnData, _toCopy) - // copy the bytes from returndata[0:_toCopy] - returndatacopy(add(_returnData, 0x20), 0, _toCopy) - } - 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 { - // 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) - } - } -} \ No newline at end of file