Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contracts: import messengers (ethereum-optimism#393)
* chore: copy L1 and L2 Messengers from Monorepo * test: Add Messenger test files Monorepo test cases are copied in as comments from the monorepo ts tests. * chore: Add OZ upgradable contracts New remappings were also added in order to avoid excessively long import statements. * chore: Importe OZ and OP contracts as node_modules Necessary because hardhat does not support remappings!?! y u no? * refactor: Remove replayMessage() We no longer need this function as it was only necessary when the CTC a maximum gas limit per epoch concept. In order to remove the function I had to copy in the L1xDM interface rather than import from the node_modules. * chore: Remove unused files The ts test file is made redundant by an itest in the itest package. The sol test file was not being used for anything * refactor: Remove Address Manager and Resolver Instead the CTC and SCC are state variables * refactor: Replace CTC with OptimismPortal * refactor: Remove SCC We don't need to replace it with the L2OutputOracle in the L1xDM, because the verification is now done in the OptimismPortal itself. * forge install: forge-std * forge install: ds-test * refactor: Move boilerplate test code into CommonTest * test: Add sendMessage and pause tests for L1xDM * test: L1CrossDomainMessenger sendMessage and pause * refactor: replace L2ToL1MessagePasser with Withdrawer contract Also adds a lib with constant values for new bedrock predeploys. * chore: Make functions external, and reorder for CEI For whatever reason a bunch of functions on the messengers were public, when they could have been external. I fixed that, and removed the slither annotations. Where possible (in the sendMessage functions), I also reordered the events and calls to respect Checks-Effects-Interactions. There was no risk previously, but this removes any question, and quiets slither. * refactor: Reorganize ts helpers Move helpers/index into utils.ts, and add other files which are exported in the new index.ts. * test: Add mock proof generation script and helpers * test: Add L1xDM relayMessageSucceeds tests * test: Add proof generation scripts and helpers * refactor: Add l2Sender check in L2xDM * refactor: Copy in the L1 and L2 standard bridge At this point they are simply verbatim. * refactor: Bridges - fix import paths * refactor: Token Bridge - replace messengers with Portal Also remove the CrossDomainEnabled lib. refactor: Token Bridge - replace messengers with Portal Also remove the CrossDomainEnabled lib. * style: Address/remove some slither disable comments style: Address/remove some slither disable comments * refactor: extract l2Sender check into a modifier * refactor: Support deposits of ETH in L2 Bridge This copies in the IL2ERC20Bridge interface so that payable can be added. In the case that the L2 token address matches OVM_ETH, the value of the call will be forwarded. * interface: add IWithdrawer.sol * contracts: add comments to L1 contracts * contracts: use unchecked * contracts: fix imports in common test * test: L1CrossDomainMessenger * test: L2CrossDomainMessenger * contracts: fix typo * tests: bridge tests * contracts: remove extra message assignment * contracts: update gas snapshot * forge install: solmate * contracts: remove usage of OVM_ETH All `OVM_ETH` will be migrated to `ETH` with the upgrade to bedrock. We do not want to allow for the creation of new `OVM_ETH` by depositing `ETH` into the bridge and have it create `OVM_ETH` on L2. * contracts: add in L2StandardERC20 * contracts: add in token factory The token factory will deploy tokens on L2 that correspond to tokens on L1. This allows for easy deposits through the bridge. * contracts: test rlp lib for computing contract addrs This library lets you compute the contract address based on the deployment account and nonce. h/t @t11s * contracts: test infra for bridge * contracts: add note to self * contracts: fix compiler warnings * contracts: update snapshot * contracts: add IDepositFeed * contracts: type cast uint256 to uint64 in messenger * test: fix merge * contracts: modify paths to compile with hardhat * hardhat: update config * contracts: fix build * forge tests: first yarn install * contracts: lint * contracts: update snapshot Co-authored-by: Maurelian <maurelian@protonmail.ch>
- Loading branch information