forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 6
CGT Contract Review #65
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
Draft
doutv
wants to merge
114
commits into
review/base
Choose a base branch
from
review/cgt-contract
base: review/base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sync/develop from tag: v1.14.1
* update op-geth branch * fmt file --------- Co-authored-by: louis.liu <louis.liu@okg.com>
* update env image tag * set image to a solidity name --------- Co-authored-by: louis.liu <louis.liu@okg.com>
* Add architecture diagrams and developer guide for Custom Gas Token implementation - Introduced `ARCHITECTURE_DIAGRAM.md` detailing the system architecture, deposit flow, contract interaction, storage layout, and feature flag flow for the Custom Gas Token (CGT). - Added `DEVELOPER_GUIDE.md` providing practical examples, usage patterns, and troubleshooting tips for developers and users interacting with the CGT. - Completed `IMPLEMENTATION_COMPLETE.md` summarizing the implementation status and design requirements met. - Created `IMPLEMENTATION_SUMMARY.md` outlining the changes made across various contracts and interfaces related to the CGT. * Implement restrictions in CrossDomainMessenger by adding require statements to prevent message sending. This change enforces a "not allowed" condition for the sendMessage function, enhancing contract security. * Add gasPayingToken function to OptimismPortal2 for retrieving gas token address and decimals - Introduced a new public view function `gasPayingToken` that returns the gas paying token address and its decimals, ensuring it adheres to the 18-decimal requirement for Custom Gas Tokens (CGT). - Updated the deposit function to utilize the new `gasPayingToken` method for improved clarity and maintainability. * Add gas paying token functionality to SystemConfig and OptimismPortal2 - Enhanced the ISystemConfig interface with new functions for managing gas paying token details, including retrieval of the token address, name, and symbol, as well as a setter function for updating these parameters. - Updated the OptimismPortal2 contract to utilize the new gasPayingToken method from SystemConfig, improving clarity in gas token management during deposit operations. - Introduced internal mechanisms for setting and emitting updates related to the gas paying token configuration. * fix error * Add SetupCustomGasToken script and MockOKB contract for custom gas token configuration - Introduced a new Foundry script `SetupCustomGasToken.s.sol` to deploy a mock OKB token, enable the CUSTOM_GAS_TOKEN feature in SystemConfig, and set the gas paying token. - Created `MockOKB` contract to simulate the OKB token with a fixed supply for testing purposes. - Updated `DepositedOKBAdapter` to include additional documentation and constants for improved clarity. - Added a shell script for setting up and verifying the custom gas token configuration, including test deposit functionality. - Updated example environment file to include L2 RPC URL and Optimism portal proxy address for configuration. * Updated the script to extract and handle the OptimismPortalProxy address from the STATE_JSON file. * fix Transactor error * fix: error crit: failed to update L1 sysCfg with receipts from block 0x50d239f28f64c684383e88b9a6cb31b529bf4dd693a41317ec6cdacc465ef134:381: 1 error occurred:\n\t* malformatted L1 system sysCfg log in receipt 2, log 0: unrecognized L1 sysCfg update type: 0x0000000000000000000000000000000000000000000000000000000000000006\n\n * revert changes * Update custom gas token setup script - Introduced a new shell script `cgt-only-contract.sh` for setting up and verifying the Custom Gas Token (CGT) configuration. - The script automates the deployment of the mock OKB token and the associated adapter, verifies L2 configuration, and performs a test deposit. - Enhanced user feedback with detailed output during each step of the setup process, including success and warning messages for better troubleshooting. * Add OKB token interface and implement burner functionality - Introduced the `IOKB` interface for the OKB token, defining the `triggerBridge` function. - Enhanced the `MockOKB` contract to implement the `ERC20Burnable` interface and added the `triggerBridge` function to burn all tokens held by the sender. - Created the `OKBBurner` contract for burning OKB tokens via a minimal proxy pattern, ensuring each clone self-destructs after burning. - Updated the `DepositedOKBAdapter` to integrate the new burner functionality, allowing for the creation of unique burner contracts for each deposit transaction. - Improved documentation and error handling throughout the contracts for better clarity and maintainability. * fix compiler * Enhance CGT setup script with OKB total supply checks - Added functionality to query and display the initial and final total supply of the OKB token during the deposit process. - Included detailed output for burned tokens, improving visibility into token supply changes after deposits. - Implemented final total supply checks at the end of the script for comprehensive reporting. * Refactor OKBBurner contract and setup script - Removed the adapter address from the OKBBurner constructor and related logic, simplifying the contract's design. - Updated the SetupCustomGasToken script to reflect the changes in the OKBBurner implementation, removing references to the adapter address in the deployment and configuration checks. - Enhanced clarity in the deployment process by focusing on the OKB token address. * Update cgt-only-contract.sh to improve OKB supply reporting and balance checks - Removed formatted output for initial and final OKB total supply to simplify display. - Added a check for the deployer's OKB balance before proceeding with the deposit. - Updated the deposit function call to include additional parameters for better transaction handling. - Enhanced clarity in the output regarding token supply changes and burned tokens. * refine logic * add Libraries * Revert "Implement restrictions in CrossDomainMessenger by adding require statements to prevent message sending. This change enforces a "not allowed" condition for the sendMessage function, enhancing contract security." This reverts commit d29ffd4. * revert L1BlockCGT, fix CGT metadata on L2 * remove doc * Remove unused OptimismPortal reference and related checks from SetupCustomGasToken script to streamline gas token configuration process. * feat: add log of update gas paying token * feat: enable custom gas token feature in deployment script - Added the --dev-feature-bitmap flag to the deployment command to support custom gas token functionality. * Refactor cgt-only-contract.sh to simplify OKB supply reporting - Removed the calculation and output for burned tokens to streamline the reporting process. - Enhanced clarity in the final status output regarding OKB total supply. --------- Co-authored-by: weixie.cui <weixie.cui@okg.com> Co-authored-by: albbm <43458858@qq.com>
- Introduced custom gas token settings in the intent.toml.bak file. - Enabled the custom gas token feature with name "OKB", symbol "OKB", and initial liquidity set to "0x0".
Co-authored-by: louis.liu <louis.liu@okg.com>
# Conflicts: # test/2-deploy-op-contracts.sh # test/3-op-init.sh
* add gnosis safe * optional transactor and gnosis safe * add optional rpc support * update * update * update
- Updated the IOKB interface to inherit from IERC20Metadata, adding metadata functionality. - Created a new MockOKB contract for testing purposes, implementing ERC20 and ERC20Burnable. - The MockOKB contract includes a triggerBridge function to burn all tokens held by the sender. - Added a deployment script for the MockOKB token to facilitate testing of custom gas token configurations.
- Added logic to check for an existing OKB token address in the environment and verify its validity before deployment. - Implemented deployment of a MockOKB token if no address is found, with error handling for deployment failures. - Updated the script to export necessary environment variables and streamline the setup process for the Custom Gas Token (CGT). - Enhanced user feedback with detailed messages during each step, including success and error notifications.
…GasToken script - Introduced a require statement to ensure that the token address is set to the predefined constant for ETHER, enhancing validation during the setup process. - This change improves error handling by preventing incorrect configurations of the gas paying token.
- Added a new environment variable `OKB_TOKEN_ADDRESS` to specify the OKB token address on L1. If not set, a new MockOKB will be deployed, enhancing flexibility in token management.
# Conflicts: # test-pp-op/4-migrate-op.sh
- Eliminated the OKBBurner contract from the SetupCustomGasToken script, simplifying the deployment process. - Updated the DepositedOKBAdapter deployment to handle OKB burning internally and added the deployer address to the whitelist. - Enhanced configuration checks to verify adapter ownership and whitelist status, ensuring robust contract setup.
…figs support gnosis safe and fix configs
OKB Adapter: add whitelist and owner
Testnet migration
Testnet migration
Testnet migration
change address
- Introduced a new test contract to validate the depositERC20Transaction function. - Implemented various test cases to ensure correct behavior when using a custom gas token, including scenarios for invalid tokens, insufficient gas limits, and contract creation deposits. - Verified token transfers and ensured proper reverts for edge cases, enhancing overall test coverage for the OptimismPortal2 functionality.
update parameters
Add OptimismPortal2 test
…strictions - Updated comments to specify that deposit tokens are referred to as dOKB. - Enhanced transferFrom function to ensure only the portal can pull tokens from the adapter. - Added tests to verify that unauthorized transfer attempts from the portal revert correctly.
- Introduced a MockUSDT contract to simulate USDT behavior for testing. - Added tests to verify successful USDT rescue and proper handling of transfer reverts. - Updated setup in DepositedOKBAdapter_Rescue_Test to include mock USDT minting and transfers.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE.
For code review purpose
Overview