diff --git a/.changeset/few-boxes-pull.md b/.changeset/few-boxes-pull.md new file mode 100644 index 0000000000000..e624325f7e6ca --- /dev/null +++ b/.changeset/few-boxes-pull.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Remove unused gas testing utils diff --git a/packages/contracts/contracts/libraries/bridge/Lib_CrossDomainUtils.sol b/packages/contracts/contracts/libraries/bridge/Lib_CrossDomainUtils.sol index 7e7ea7807705f..62c788d084a81 100644 --- a/packages/contracts/contracts/libraries/bridge/Lib_CrossDomainUtils.sol +++ b/packages/contracts/contracts/libraries/bridge/Lib_CrossDomainUtils.sol @@ -1,9 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; -/* Library Imports */ -import { Lib_RLPReader } from "../rlp/Lib_RLPReader.sol"; - /** * @title Lib_CrossDomainUtils */ diff --git a/packages/contracts/contracts/test-helpers/Helper_GasMeasurer.sol b/packages/contracts/contracts/test-helpers/Helper_GasMeasurer.sol deleted file mode 100644 index ad1ca3025f80e..0000000000000 --- a/packages/contracts/contracts/test-helpers/Helper_GasMeasurer.sol +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; - -contract Helper_GasMeasurer { - function measureCallGas(address _target, bytes memory _data) public returns (uint256) { - uint256 gasBefore; - uint256 gasAfter; - - uint256 calldataStart; - uint256 calldataLength; - assembly { - calldataStart := add(_data, 0x20) - calldataLength := mload(_data) - } - - bool success; - assembly { - gasBefore := gas() - success := call(gas(), _target, 0, calldataStart, calldataLength, 0, 0) - gasAfter := gas() - } - require(success, "Call failed, but calls we want to measure gas for should succeed!"); - - return gasBefore - gasAfter; - } -} diff --git a/packages/contracts/docs/Initializable.md b/packages/contracts/docs/Initializable.md index bc953adafc465..ed0238c0c2397 100644 --- a/packages/contracts/docs/Initializable.md +++ b/packages/contracts/docs/Initializable.md @@ -6,7 +6,7 @@ -*This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.* +*This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. [CAUTION] ==== Avoid leaving a contract uninitialized. An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: [.hljs-theme-light.nopadding] ```* diff --git a/packages/contracts/test/helpers/gas/gas.ts b/packages/contracts/test/helpers/gas/gas.ts deleted file mode 100644 index 157ad8adb2deb..0000000000000 --- a/packages/contracts/test/helpers/gas/gas.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ethers } from 'hardhat' -import { Contract, Signer } from 'ethers' - -export class GasMeasurement { - GasMeasurementContract: Contract - - public async init(wallet: Signer) { - this.GasMeasurementContract = await ( - await (await ethers.getContractFactory('Helper_GasMeasurer')).deploy() - ).connect(wallet) - } - - public async getGasCost( - targetContract: Contract, - methodName: string, - methodArgs: Array = [] - ): Promise { - const gasCost: number = - await this.GasMeasurementContract.callStatic.measureCallGas( - targetContract.address, - targetContract.interface.encodeFunctionData(methodName, methodArgs) - ) - - return gasCost - } -} diff --git a/packages/contracts/test/helpers/gas/index.ts b/packages/contracts/test/helpers/gas/index.ts deleted file mode 100644 index 1a5eaa6e16e35..0000000000000 --- a/packages/contracts/test/helpers/gas/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './gas' diff --git a/packages/contracts/test/helpers/index.ts b/packages/contracts/test/helpers/index.ts index 7b6617a6c6f56..f36d57b484c2b 100644 --- a/packages/contracts/test/helpers/index.ts +++ b/packages/contracts/test/helpers/index.ts @@ -5,4 +5,3 @@ export * from './utils' export * from './codec' export * from './test-runner' export * from './trie' -export * from './gas'