-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: custom gas token rebase #17484
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
Merged
agusduha
merged 5 commits into
sc-feat/custom-gas-token-rebase
from
sc-feat/custom-gas-token-rebase-fix
Sep 17, 2025
Merged
fix: custom gas token rebase #17484
agusduha
merged 5 commits into
sc-feat/custom-gas-token-rebase
from
sc-feat/custom-gas-token-rebase-fix
Sep 17, 2025
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
* fix: upgrade contract name * feat: add nativeAssetLiquidityAmount to config json files * fix: add correct nativeAssetLiquidityAmount in op-deployer * fix: add correct nativeAssetLiquidityAmount in op-e2e and fix withCustomGasToken argument on op-devstack * fix: restore OptimismPortal2CGT * fix: all comments * fix: comments * fix: governace * fix: remove aux * fix: remove aux * fix: deploy cgt * fix: revert cgt deploy config * fix: deploy config * chore: run linter * fix: remove unnecessary GetNativeAssetLiquidityAmount --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## sc-feat/custom-gas-token-rebase #17484 +/- ##
==================================================================
Coverage ? 95.50%
==================================================================
Files ? 116
Lines ? 5160
Branches ? 0
==================================================================
Hits ? 4928
Misses ? 232
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
bitwiseguy
approved these changes
Sep 16, 2025
smartcontracts
approved these changes
Sep 17, 2025
JosepBove
approved these changes
Sep 17, 2025
louisliu2048
added a commit
to okx/optimism
that referenced
this pull request
Oct 26, 2025
* feat(cgt): custom gas token Signed-off-by: Hex <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: AgusDuha <[email protected]> * feat: add gasPayingTokenName and gasPayingTokenSymbol on json config files * fix: contracts semver * fix: remove system config bool * test: add OptimismPortal2CGT tests * chore(cgt): set cgt flag l1block & fixes * fix(linter): resolve goimports formatting issue * feat: add separate l2 contracts for cgt (ethereum-optimism#530) * feat: add L1BlockCGT * feat: add L2ToL1MessagePasserCGT * chore: remove test exclution in test validation * test(cgt): fix failing tests (ethereum-optimism#529) * test(cgt): fix failing tests * test(cgt): fix portal version * test(cgt): skip tests on forked mode * fix: predeploys test cgt mismatch * test(cgt): minor fixes --------- Co-authored-by: niha <[email protected]> * fix(cgt): revert weth * cgt: feature flag integration Updates the implementation to use the new feature flagging system * config: make backwards compatible Use the legacy config name so that less needs to change for legacy CGT chains * fix: build issue Remove leftover merge conflict * fix: better backwards compatibility * build: fix * lint: fix * snapshots: update * op-deployer: apply test with CGT Add a specific test for CGT in the intent * contracts-bedrock: fix versioning * lint: fix * deployer: remove standard values * contracts: semver lock * contracts-bedrock: fix semver + abis * cgt: solidity test cleanup * solidity: fmt * tests: remove dead imports * tests: fixup * cgt: configurable liquidity amount * feat: configurable native asset liquidity balance Fix the build for this feature * cleanup: merge L1Block logic so that we inherit Keeps it simple because development on Jovian is happening and we will inherit any Jovian modifications automatically * snapshots: update * cgt: inherit logic for L2ToL1MessagePasser Generally simplifies the code * semver-lock: update * lint: fix * lint: fixup * interfaces: fix * fixes: smol * deploy-config: sane default * lint: fix * linting: fix * lint: fix * semgrep: fix * lint: fix * tests: fix * tests: fix fuzz * fix: custom gas token rebase (ethereum-optimism#17484) * fix: import in OptimismPortal2CGT test and pre-pr * fix(cgt): add missing native asset amount (ethereum-optimism#543) * fix: upgrade contract name * feat: add nativeAssetLiquidityAmount to config json files * fix: add correct nativeAssetLiquidityAmount in op-deployer * fix: add correct nativeAssetLiquidityAmount in op-e2e and fix withCustomGasToken argument on op-devstack * fix: restore OptimismPortal2CGT * fix: all comments * fix: comments * fix: governace * fix: remove aux * fix: remove aux * fix: deploy cgt * fix: revert cgt deploy config * fix: deploy config * chore: run linter * fix: remove unnecessary GetNativeAssetLiquidityAmount --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]> * fix: l2 genesis pipeline (ethereum-optimism#554) * fix: add nativeAssetLiquidityAmount in e2e apply test (ethereum-optimism#555) * fix: failing test --------- Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: hexshire <[email protected]> Co-authored-by: Hex <[email protected]> * fix: semver lock * fix: CGT review fixes (ethereum-optimism#17534) * fix: json default zero * feat(cgt): add native asset liquidity amount test & omitempty on cgt struct * test: check native asset liquidity amount is correctly configured * feat: add omitempty to name and symbol on cgt intent struct * fix: check value in cgt * feat(cgt): add cgt dev feature * feat: add cgt dev feature * refactor: set custom gas token (ethereum-optimism#563) * feat: add cgt devFeatures and remove useCustomGasToken from DeployOPChainInput --------- Co-authored-by: Hex <[email protected]> * fix: ir informational * fix: informational * fix: legacy tag * feat(cgt): add setNativeAssetLiquidityAmount & L2Genesis max amount check * feat: add setNativeAssetLiquidityAmount & L2Genesis max amount check * test: fix bound param in liquidity controller * fix: remove unused import * refactor: move max amount check inside setNativeAssetLiquidity * refactor: make chainIntent.CustomGasToken a non-pointer (ethereum-optimism#574) * refactor: make chainIntent.CustomGasToken a non-pointer * test: fix custom gas token text (ethereum-optimism#576) --------- Co-authored-by: Hex <[email protected]> * fix: undo tests Co-authored-by: hexshire <[email protected]> * fix: cgt portal (ethereum-optimism#577) * fix: semver * fix: cgt tests coverage (ethereum-optimism#582) * fix: l2genesis expectRevert amount test * test: improve l1block coverage * test: improve l1blockcgt coverage * test: add isCustomGasToken tests on SystemConfig * test: improve L2ToL1MessagePasserCGT coverage * test: improve L2ToL1MessagePasser coverage * fix: naming pre-pr * fix(cgt): change L2ToL1MessagePasser & OPContractsManager semver (ethereum-optimism#584) * fix: change L2ToL1MessagePasser semver * fix: change L2ToL1MessagePasser & OPContractsManager semver * fix: cgt feature tests (ethereum-optimism#585) * fix: cgt feature tests * fix: deposits with amount 0 when cgt enabled * Revert "fix: deposits with amount 0 when cgt enabled" This reverts commit 8bee464. * fix: cgt portal (ethereum-optimism#587) * fix: ci fixes (ethereum-optimism#588) --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Hex <[email protected]> Co-authored-by: hexshire <[email protected]> * fix: semver * fix: opcm version * fix: tests * feat(op-acceptance-tests): add acceptance tests for native CGT across L1/L2 (ethereum-optimism#17451) - Gate suite via L1Block.isCustomGasToken(); assert name/symbol non-empty - L2: value transfer pays CGT token (typed amounts via op-service/eth) - L2: XDM rejects callvalue; L2StandardBridge legacy withdraw reverts - L1: Portal receive/deposit rejects ETH; introspect SystemConfig addr - L1: assert SystemConfig.isCustomGasToken() is true * fix: custom gas token rebase review comments (ethereum-optimism#17577) * chore: use w3 library * fix: msg error * refactor(cgt): rename amount & add geq 0 check (ethereum-optimism#600) * feat: add NativeAssetLiquidityAmount sign check * refactor: rename NativeAssetLiquidityAmount to InitialLiquidity * refactor(cgt): rename json nativeAssetLiquidityAmount to initialLiquidity (ethereum-optimism#601) * refactor: rename json nativeAssetLiquidityAmount to initialLiquidity * fix: only add initialLiquidity to cgt intent struct --------- Co-authored-by: Hex <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: niha <[email protected]> * fix: cgt review (ethereum-optimism#17612) * refactor: replace enableCustomGasToken with cgt devfeature * feat: remove fund in NativeAssetLiquidity (ethereum-optimism#605) * fix(cgt): remove OptimismPortal2 test from exclusions (ethereum-optimism#606) * fix: remove OptimismPortal2 test from exclusions * fix: remove virtual and restore constructor in portal test * refactor: use low level call to receive test * refactor(cgt): migrate L1Block and L2ToL1MessagePasser cgt tests (ethereum-optimism#608) * refactor: migrate L1Block cgt tests * refactor: migrate L2ToL1MessagePasser cgt tests * fix: comments (ethereum-optimism#607) * fix: comments * fix: custom error * fix: errors and tests * fix: errors and tests * fix: cgt tests (ethereum-optimism#610) * fix: comments * fix: custom error * fix: errors and tests * fix: errors and tests * fix: tests * fix: tests * fix: weth * fix: cgt tests (ethereum-optimism#611) * fix: comments * fix: custom error * fix: errors and tests * fix: errors and tests * fix: tests * fix: tests * fix: weth * fix: remove types * fix: coverage tests (ethereum-optimism#612) * fix: separate setUp function tests (ethereum-optimism#613) --------- Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> * test: custom gas token invariants (ethereum-optimism#17489) * test(inv): setup and total sup inv * test(inv): accounting invariants * chore: doc * fix: import in OptimismPortal2CGT test and pre-pr * fix(cgt): add missing native asset amount (ethereum-optimism#543) * fix: upgrade contract name * feat: add nativeAssetLiquidityAmount to config json files * fix: add correct nativeAssetLiquidityAmount in op-deployer * fix: add correct nativeAssetLiquidityAmount in op-e2e and fix withCustomGasToken argument on op-devstack * fix: restore OptimismPortal2CGT * fix: all comments * fix: comments * fix: governace * fix: remove aux * fix: remove aux * fix: deploy cgt * fix: revert cgt deploy config * fix: deploy config * chore: run linter * fix: remove unnecessary GetNativeAssetLiquidityAmount --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]> * fix: l2 genesis pipeline (ethereum-optimism#554) * fix: add nativeAssetLiquidityAmount in e2e apply test (ethereum-optimism#555) * fix: failing test * chore: doc Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * chore: remove unused imports * chore: fix semgrep * chore: change error name --------- Co-authored-by: drgorillamd <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]> Co-authored-by: AgusDuha <[email protected]> Co-authored-by: Hex <[email protected]> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * refactor: use skipIfDevFeatureDisabled for cgt predeploys test (ethereum-optimism#614) (ethereum-optimism#17621) Co-authored-by: niha <[email protected]> * fix: tests * fix: auth minter helper & bound _mint in depositTransaction tests (ethereum-optimism#17642) * refactor: auth minter helper tests (ethereum-optimism#618) * fix: bound _mint correctly in depositTransaction test function (ethereum-optimism#619) * fix contract reference error * block bridge function (#49) * update image tag info * revert the change name of var DeployV2DisputeGamesDevFlag * rm unused code * Add CGT (#52) * 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 <[email protected]> Co-authored-by: albbm <[email protected]> * feat: add custom gas token configuration for OKB (#55) - 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". * consolidate test scripts * refactor * resolve conflicts * fix build op contracts * fix op_stack image build * use dev for op-geth * fix setGasToken * remove SystemConfig UpdateType GAS_PAYING_TOKEN event * refactoring * fix typo * fix sysconfig * refactoring * Update MockOKB contract to mint a total supply of 660,000 (#60) * add patch * fix: build image sequence * feat: add cdk image env * feat: set ARCH to default value using docker cmd * update testnet genesisGasParameters and readme * use gopath for install go bin * Optimize dockerfile build time (#63) * Update Dockerfile and .dockerignore for improved build process - Modified .dockerignore to include necessary directories and exclude generated files, enhancing build efficiency. - Updated Dockerfile to skip test files during the forge build process, streamlining the build and reducing unnecessary overhead. * Optimize opstack Dockerfile build time - Modified Dockerfile to use a new target `build-go-no-submodules`, allowing for builds without submodules, improving flexibility. - Updated .dockerignore to include the Makefile, ensuring it is not ignored during the Docker build process. * Update .dockerignore to exclude .env file from Docker builds * update op-geth to the latest * add cgt_enable (#66) * add cgt_enable * update contracts dockerfile * skip test forge build * simplify contract * Update testnet readme steps * put migration into separate file * merge with pre-release * refactor * sync op-geth * fix(test): add --legacy flag to Safe contract deployment * update testnet readme for regenesis * consolidate test scripts (#59) * consolidate test scripts * refactor * resolve conflicts * fix build op contracts * fix op_stack image build * use dev for op-geth * fix setGasToken * remove SystemConfig UpdateType GAS_PAYING_TOKEN event * refactoring * fix typo * fix sysconfig * refactoring * add patch * fix: build image sequence * feat: add cdk image env * feat: set ARCH to default value using docker cmd * update testnet genesisGasParameters and readme * use gopath for install go bin * add cgt_enable (#66) * add cgt_enable * update contracts dockerfile * skip test forge build * simplify contract * Update testnet readme steps * put migration into separate file * merge with pre-release * refactor * sync op-geth * update testnet readme for regenesis --------- Co-authored-by: jason.huang <[email protected]> Co-authored-by: weixie.cui <[email protected]> Co-authored-by: Vui-Chee <[email protected]> * support gnosis safe and fix configs * refactor geth_cmd * no verify for redeploy testnet, temparay * custom dockerfile to build op-geth-migrate * Update testnet migration readme * add pp proxy * rm testnet.env * rm testnetenv * change address * update parameters * change fee receipt address * update op-geth * support parallel build images (#80) Co-authored-by: louis.liu <[email protected]> * Update CGT Contracts (#79) * Update MockOKB contract to mint a total supply of 660,000 * Separate MockOKB and setupCGT into 2 scripts - 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. * Enhance cgt-only-contract.sh for improved OKB token handling - 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. * Add require statement for gas token address validation in SetupCustomGasToken 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. * Update example.env to include OKB token address configuration - 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. * Refactor Custom Gas Token setup and verification scripts - Integrated the setup of the Custom Gas Token (CGT) into the `2-deploy-op-contracts.sh` script, enhancing the deployment process. - Created a new script `setup-cgt-function.sh` to encapsulate the CGT setup logic, improving modularity and maintainability. - Added a new test script `test-cgt.sh` for verifying CGT configuration and performing test deposits, ensuring comprehensive testing of the setup. - Removed the obsolete `cgt-only-contract.sh` script to streamline the codebase and eliminate redundancy. * Remove SystemConfig UpdateType GAS_PAYING_TOKEN event. gasPayingToken only set once, no need update event. * Update Dockerfile and .dockerignore for improved build process - Modified .dockerignore to include necessary directories and exclude generated files, enhancing build efficiency. - Updated Dockerfile to skip test files during the forge build process, streamlining the build and reducing unnecessary overhead. * refine okbAdapter contract * Optimize opstack Dockerfile build time - Modified Dockerfile to use a new target `build-go-no-submodules`, allowing for builds without submodules, improving flexibility. - Updated .dockerignore to include the Makefile, ensuring it is not ignored during the Docker build process. * Refactor output handling in setup_cgt function - Updated the `setup_cgt` function in `setup-cgt-function.sh` to pipe the output of the forge script commands to `tee`, allowing for real-time logging to the terminal. - Removed redundant echo statements for the output, streamlining the script and improving readability. * Update console log output in SetupCustomGasToken script - Changed the console log message for gasPayingToken to improve clarity, ensuring it reflects the function call format for better readability during execution. * Update environment configuration in test script - Backed up the existing .env file and replaced it with example.env to ensure the correct environment settings are used during testing. - Ensured the test script continues to execute the preparation of tests without interruption. * Remove duplicate balanceOf function from IOKB interface * fix script * Revert "Merge branch 'dev' into pre-release" This reverts commit b0c412e, reversing changes made to 97a978d. * forge fmt * Optimize dockerfile build time (#63) * Update Dockerfile and .dockerignore for improved build process - Modified .dockerignore to include necessary directories and exclude generated files, enhancing build efficiency. - Updated Dockerfile to skip test files during the forge build process, streamlining the build and reducing unnecessary overhead. * Optimize opstack Dockerfile build time - Modified Dockerfile to use a new target `build-go-no-submodules`, allowing for builds without submodules, improving flexibility. - Updated .dockerignore to include the Makefile, ensuring it is not ignored during the Docker build process. * Update .dockerignore to exclude .env file from Docker builds * Add read access for test configuration directory in foundry.toml Add L1 And L2 bridge test * Refactor DepositedOKBAdapter and introduce ERC20Rescuer contract - Removed the OKBBurner implementation and its related functionality from DepositedOKBAdapter, simplifying the contract. - Added a new ERC20Rescuer contract to handle the rescue of ERC20 tokens, enhancing token management. - Updated DepositedOKBAdapter to utilize the new rescuer address for transferring any mistakenly sent OKB tokens. - Cleaned up unnecessary events and errors related to the burner functionality, improving code clarity and maintainability. * Add new error for invalid gas token in IOptimismPortal2 interface * Enhance DepositedOKBAdapter with Whitelist Functionality and Owner Control - Introduced Ownable inheritance to manage ownership and access control. - Added a whitelist mechanism allowing only approved addresses to deposit OKB. - Implemented batch functions for adding and removing addresses from the whitelist. - Updated deposit logic to enforce whitelisting and added error handling for zero addresses. - Removed the ERC20Rescuer contract, consolidating rescue functionality within DepositedOKBAdapter. - Cleaned up unnecessary errors and improved overall contract clarity and maintainability. * Enhance DepositedOKBAdapter with Transfer Failure Handling - Introduced a new error for transfer failures to improve error handling. - Updated the constructor to transfer ownership to the specified owner after minting. - Modified transfer functions to check for successful token transfers, reverting on failure. - Improved overall contract robustness and clarity by handling potential transfer issues. * Refactor transfer error handling in DepositedOKBAdapter - Simplified the TransferNotAllowed error by removing parameters, enhancing clarity. - Updated transfer functions to always revert with the new error format, ensuring consistent error handling. - Improved code maintainability by reducing complexity in transfer logic. * Add comprehensive tests for DepositedOKBAdapter functionality - Introduced a new test suite for DepositedOKBAdapter, covering constructor validation, whitelist management, deposit functionality, transfer restrictions, and ERC20 rescue operations. - Implemented mock contracts for testing, including MockOKB and MockOptimismPortal2, to simulate interactions and validate behavior. - Enhanced test coverage to ensure robust error handling and correct functionality across various scenarios, including deposits by whitelisted users and handling of edge cases. - Improved overall test structure for better maintainability and clarity. * Update Dockerfile to use latest op-contracts image * Refactor SetupCustomGasToken script to remove OKBBurner implementation - 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. * Add tests for depositERC20Transaction in OptimismPortal2 - 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. * forge fmt * add OKB mainnet address * Refactor DepositedOKBAdapter to clarify token minting and transfer restrictions - 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. * fix lint --------- Co-authored-by: albbm <[email protected]> * update op-geth to the latest version * Pre release for mainnet (#83) * update * update * update * update * update * Update m1 script * Fix conditional check for .env file * Update deploy contracts script `OKB_TOKEN_ADDRESS` * Push m1 updates * Update M2 to follow M1 * Step 3 updates * update * update * Change tarfile name in m1 and m2 scripts * Update m3 script * update * update * update * update * update * update * update * Reorder image vars * Omit .env as m2 runs in host * Changes to m3 * Update m1 to load m2 and m3 scripts * Update m2 * Drop m2 script * Push new m2 * update * update * update * update * Update README with new m1/m2 scripts * Omit date suffix from backup dir name * update * Update mount path for run container * update * update * To check block need to specify block number before * update * increase retry * refactor * increase timeout * update * update * Drop sleeps * update --------- Co-authored-by: Vui-Chee <[email protected]> Co-authored-by: cliff.yang <[email protected]> * Allow CGT feature to be enabled on Mainnet by commenting out the production check in OPContractsManager.sol (#97) * Update CGT config for mainnet (#98) * set deployer as systemConfigOwner first, after setup cgt finish, transfer ownership * Add OKB adapter owner address to SetupCustomGasToken script - Introduced `okbAdapterOwnerAddress` to the SetupCustomGasToken contract. - Updated deployment logic to use `okbAdapterOwnerAddress` instead of `deployerAddress`. - Modified environment configuration to include `OKB_ADAPTER_OWNER_ADDRESS` in local.env. * Enhance SetupCustomGasToken script to transfer adapter ownership - Updated the deployment logic to set the deployer as the initial owner of the DepositedOKBAdapter. - Added a new function to transfer adapter ownership to a designated owner address after deployment. - Modified the environment configuration to include `OKB_ADAPTER_OWNER_ADDRESS` for deployment. * Simplified Ownership Pattern: Deploying the adapter directly with the final owner (okbAdapterOwnerAddress) instead of deploying with deployer and then transferring - more efficient and cleaner deployment pattern. (#106) No whitelist * pre-release-v3 (#95) * update * update * update * update * update * Update m1 script * Fix conditional check for .env file * Update deploy contracts script `OKB_TOKEN_ADDRESS` * Push m1 updates * Update M2 to follow M1 * Step 3 updates * update * update * Change tarfile name in m1 and m2 scripts * Update m3 script * update * update * update * update * update * update * update * Reorder image vars * Omit .env as m2 runs in host * Changes to m3 * Update m1 to load m2 and m3 scripts * Update m2 * Drop m2 script * Push new m2 * update * update * update * update * Update README with new m1/m2 scripts * Omit date suffix from backup dir name * update * Update mount path for run container * update * update * To check block need to specify block number before * update * increase retry * refactor * increase timeout * update * update * Drop sleeps * update * before/after configs check * Set `EXPECTED_L1_CHAIN_ID` for fakemainnet * Fix print configuration issues * Fix timestamp not showing * update * recover * set deployer as systemConfigOwner first, after setup cgt finish, transfer ownership * Add OKB adapter owner address to SetupCustomGasToken script - Introduced `okbAdapterOwnerAddress` to the SetupCustomGasToken contract. - Updated deployment logic to use `okbAdapterOwnerAddress` instead of `deployerAddress`. - Modified environment configuration to include `OKB_ADAPTER_OWNER_ADDRESS` in local.env. * update * Enhance SetupCustomGasToken script to transfer adapter ownership - Updated the deployment logic to set the deployer as the initial owner of the DepositedOKBAdapter. - Added a new function to transfer adapter ownership to a designated owner address after deployment. - Modified the environment configuration to include `OKB_ADAPTER_OWNER_ADDRESS` for deployment. * update * Update `l2GenesisBlockBaseFeePerGas` in fakemainnet intent * Fix duplicate eip1559Denominator values * updates to m2 * Remove logs for these fields * Drop previous builds before building image * prompt delete backup dir if exists * Print sth if delete * Print `SystemConfigProxy` after regenesis * update * Match rollup.json `eip1559DenominatorCanyon` after migration... * Report removal of upload dir * Reduce verbosity and log upload filename * Tidy last log at shutdown --------- Co-authored-by: Vui-Chee <[email protected]> Co-authored-by: cliff.yang <[email protected]> Co-authored-by: Vui-Chee <[email protected]> Co-authored-by: jason.huang <[email protected]> * update op-geth version * Pre release v4 (#107) * update * Drop debug * Restore L2 num + hash after migrate * Revert to allow deploy contracts to succeed * Omit debug from build script * Pull out game factory adress from .env * update * update --------- Co-authored-by: Vui-Chee <[email protected]> * Update test cgt cross chain script (#109) * Simplified Ownership Pattern: Deploying the adapter directly with the final owner (okbAdapterOwnerAddress) instead of deploying with deployer and then transferring - more efficient and cleaner deployment pattern. No whitelist * Add OKB adapter owner address to environment and update CGT setup script - Introduced `DEPLOYER_ADDRESS` and `OKB_ADAPTER_OWNER_ADDRESS` in `example.env` for better configuration. - Updated `setup-cgt-function.sh` to export the new adapter owner address. - Enhanced `test-cgt.sh` to verify the deployer as the adapter owner and streamline the setup process. * Updated comments to reflect the new order of operations in the script. * Enhance test-cgt.sh to dynamically set L2 recipient and display deposit details - Added retrieval of SYSTEM_CONFIG_PROXY_ADDRESS from state.json. - Updated deposit logic to use DEPLOYER_ADDRESS as the L2 recipient. - Included initial balance display for the L2 recipient before deposit. * Remove deprecated `cgt-only-contract.sh` script as it is no longer needed for the Custom Gas Token setup process. * Real script: test-pp-op/test-cgt.sh (the canonical version) Symlink: test/test-cgt.sh → ../test-pp-op/test-cgt.sh * move test-cgt to test/ * update op-geth version * Remove deprecated L2_RPC_URL from example.env to streamline configuration. (#114) * update seq window size (#118) * add more error info in Transactor.sol (#121) * Pre-release v6 (#122) * Copy migrate log * Execute verification from working dir * Copy verify script for upload * Last check to verify checksum of copied data * Use SOURCE_PATH and report success * indent * Add set_init_bond.sh * Add set initBond logic * use env params * fix set-init-bond wrong path * Use `diff` over `md5sum` * update * Simplify diff check * save mainnet intent toml * Adjust proposer and challenger addresses * Update intent mainnet * update systemConfigOwner * update --------- Co-authored-by: JimmyShi22 <[email protected]> Co-authored-by: Barry <[email protected]> --------- Signed-off-by: Hex <[email protected]> Co-authored-by: Hex <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: AgusDuha <[email protected]> Co-authored-by: Mark Tyneway <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: hexshire <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: Stefano Charissis <[email protected]> Co-authored-by: Simon Something /DrGoNoGo <[email protected]> Co-authored-by: drgorillamd <[email protected]> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Co-authored-by: louis.liu <[email protected]> Co-authored-by: 怪兽 <[email protected]> Co-authored-by: Backdoor <[email protected]> Co-authored-by: weixie.cui <[email protected]> Co-authored-by: albbm <[email protected]> Co-authored-by: cliff.yang <[email protected]> Co-authored-by: cliff.li <[email protected]> Co-authored-by: Vui-Chee <[email protected]> Co-authored-by: KyrinCode <[email protected]> Co-authored-by: Barry <[email protected]> Co-authored-by: Vui-Chee <[email protected]> Co-authored-by: jimmyshi <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 24, 2025
* feat(cgt): custom gas token Signed-off-by: Hex <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: AgusDuha <[email protected]> * feat: add gasPayingTokenName and gasPayingTokenSymbol on json config files * fix: contracts semver * fix: remove system config bool * test: add OptimismPortal2CGT tests * chore(cgt): set cgt flag l1block & fixes * fix(linter): resolve goimports formatting issue * feat: add separate l2 contracts for cgt (#530) * feat: add L1BlockCGT * feat: add L2ToL1MessagePasserCGT * chore: remove test exclution in test validation * test(cgt): fix failing tests (#529) * test(cgt): fix failing tests * test(cgt): fix portal version * test(cgt): skip tests on forked mode * fix: predeploys test cgt mismatch * test(cgt): minor fixes --------- Co-authored-by: niha <[email protected]> * fix(cgt): revert weth * cgt: feature flag integration Updates the implementation to use the new feature flagging system * config: make backwards compatible Use the legacy config name so that less needs to change for legacy CGT chains * fix: build issue Remove leftover merge conflict * fix: better backwards compatibility * build: fix * lint: fix * snapshots: update * op-deployer: apply test with CGT Add a specific test for CGT in the intent * contracts-bedrock: fix versioning * lint: fix * deployer: remove standard values * contracts: semver lock * contracts-bedrock: fix semver + abis * cgt: solidity test cleanup * solidity: fmt * tests: remove dead imports * tests: fixup * cgt: configurable liquidity amount * feat: configurable native asset liquidity balance Fix the build for this feature * cleanup: merge L1Block logic so that we inherit Keeps it simple because development on Jovian is happening and we will inherit any Jovian modifications automatically * snapshots: update * cgt: inherit logic for L2ToL1MessagePasser Generally simplifies the code * semver-lock: update * lint: fix * lint: fixup * interfaces: fix * fixes: smol * deploy-config: sane default * lint: fix * linting: fix * lint: fix * semgrep: fix * lint: fix * tests: fix * tests: fix fuzz * fix: custom gas token rebase (#17484) * fix: import in OptimismPortal2CGT test and pre-pr * fix(cgt): add missing native asset amount (#543) * fix: upgrade contract name * feat: add nativeAssetLiquidityAmount to config json files * fix: add correct nativeAssetLiquidityAmount in op-deployer * fix: add correct nativeAssetLiquidityAmount in op-e2e and fix withCustomGasToken argument on op-devstack * fix: restore OptimismPortal2CGT * fix: all comments * fix: comments * fix: governace * fix: remove aux * fix: remove aux * fix: deploy cgt * fix: revert cgt deploy config * fix: deploy config * chore: run linter * fix: remove unnecessary GetNativeAssetLiquidityAmount --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]> * fix: l2 genesis pipeline (#554) * fix: add nativeAssetLiquidityAmount in e2e apply test (#555) * fix: failing test --------- Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: hexshire <[email protected]> Co-authored-by: Hex <[email protected]> * fix: semver lock * fix: CGT review fixes (#17534) * fix: json default zero * feat(cgt): add native asset liquidity amount test & omitempty on cgt struct * test: check native asset liquidity amount is correctly configured * feat: add omitempty to name and symbol on cgt intent struct * fix: check value in cgt * feat(cgt): add cgt dev feature * feat: add cgt dev feature * refactor: set custom gas token (#563) * feat: add cgt devFeatures and remove useCustomGasToken from DeployOPChainInput --------- Co-authored-by: Hex <[email protected]> * fix: ir informational * fix: informational * fix: legacy tag * feat(cgt): add setNativeAssetLiquidityAmount & L2Genesis max amount check * feat: add setNativeAssetLiquidityAmount & L2Genesis max amount check * test: fix bound param in liquidity controller * fix: remove unused import * refactor: move max amount check inside setNativeAssetLiquidity * refactor: make chainIntent.CustomGasToken a non-pointer (#574) * refactor: make chainIntent.CustomGasToken a non-pointer * test: fix custom gas token text (#576) --------- Co-authored-by: Hex <[email protected]> * fix: undo tests Co-authored-by: hexshire <[email protected]> * fix: cgt portal (#577) * fix: semver * fix: cgt tests coverage (#582) * fix: l2genesis expectRevert amount test * test: improve l1block coverage * test: improve l1blockcgt coverage * test: add isCustomGasToken tests on SystemConfig * test: improve L2ToL1MessagePasserCGT coverage * test: improve L2ToL1MessagePasser coverage * fix: naming pre-pr * fix(cgt): change L2ToL1MessagePasser & OPContractsManager semver (#584) * fix: change L2ToL1MessagePasser semver * fix: change L2ToL1MessagePasser & OPContractsManager semver * fix: cgt feature tests (#585) * fix: cgt feature tests * fix: deposits with amount 0 when cgt enabled * Revert "fix: deposits with amount 0 when cgt enabled" This reverts commit 8bee464. * fix: cgt portal (#587) * fix: ci fixes (#588) --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Hex <[email protected]> Co-authored-by: hexshire <[email protected]> * fix: semver * fix: opcm version * fix: tests * feat(op-acceptance-tests): add acceptance tests for native CGT across L1/L2 (#17451) - Gate suite via L1Block.isCustomGasToken(); assert name/symbol non-empty - L2: value transfer pays CGT token (typed amounts via op-service/eth) - L2: XDM rejects callvalue; L2StandardBridge legacy withdraw reverts - L1: Portal receive/deposit rejects ETH; introspect SystemConfig addr - L1: assert SystemConfig.isCustomGasToken() is true * fix: custom gas token rebase review comments (#17577) * chore: use w3 library * fix: msg error * refactor(cgt): rename amount & add geq 0 check (#600) * feat: add NativeAssetLiquidityAmount sign check * refactor: rename NativeAssetLiquidityAmount to InitialLiquidity * refactor(cgt): rename json nativeAssetLiquidityAmount to initialLiquidity (#601) * refactor: rename json nativeAssetLiquidityAmount to initialLiquidity * fix: only add initialLiquidity to cgt intent struct --------- Co-authored-by: Hex <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: niha <[email protected]> * fix: cgt review (#17612) * refactor: replace enableCustomGasToken with cgt devfeature * feat: remove fund in NativeAssetLiquidity (#605) * fix(cgt): remove OptimismPortal2 test from exclusions (#606) * fix: remove OptimismPortal2 test from exclusions * fix: remove virtual and restore constructor in portal test * refactor: use low level call to receive test * refactor(cgt): migrate L1Block and L2ToL1MessagePasser cgt tests (#608) * refactor: migrate L1Block cgt tests * refactor: migrate L2ToL1MessagePasser cgt tests * fix: comments (#607) * fix: comments * fix: custom error * fix: errors and tests * fix: errors and tests * fix: cgt tests (#610) * fix: comments * fix: custom error * fix: errors and tests * fix: errors and tests * fix: tests * fix: tests * fix: weth * fix: cgt tests (#611) * fix: comments * fix: custom error * fix: errors and tests * fix: errors and tests * fix: tests * fix: tests * fix: weth * fix: remove types * fix: coverage tests (#612) * fix: separate setUp function tests (#613) --------- Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> * test: custom gas token invariants (#17489) * test(inv): setup and total sup inv * test(inv): accounting invariants * chore: doc * fix: import in OptimismPortal2CGT test and pre-pr * fix(cgt): add missing native asset amount (#543) * fix: upgrade contract name * feat: add nativeAssetLiquidityAmount to config json files * fix: add correct nativeAssetLiquidityAmount in op-deployer * fix: add correct nativeAssetLiquidityAmount in op-e2e and fix withCustomGasToken argument on op-devstack * fix: restore OptimismPortal2CGT * fix: all comments * fix: comments * fix: governace * fix: remove aux * fix: remove aux * fix: deploy cgt * fix: revert cgt deploy config * fix: deploy config * chore: run linter * fix: remove unnecessary GetNativeAssetLiquidityAmount --------- Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]> * fix: l2 genesis pipeline (#554) * fix: add nativeAssetLiquidityAmount in e2e apply test (#555) * fix: failing test * chore: doc Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * chore: remove unused imports * chore: fix semgrep * chore: change error name --------- Co-authored-by: drgorillamd <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: hexshire <[email protected]> Co-authored-by: AgusDuha <[email protected]> Co-authored-by: Hex <[email protected]> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * refactor: use skipIfDevFeatureDisabled for cgt predeploys test (#614) (#17621) Co-authored-by: niha <[email protected]> * fix: tests * fix: auth minter helper & bound _mint in depositTransaction tests (#17642) * refactor: auth minter helper tests (#618) * fix: bound _mint correctly in depositTransaction test function (#619) * chore: run pre-pr * chore: address ci errors * chore: fix go tests * chore: run checks * test(wip): fix failing tests * chore: run pre-pr * fix: cgt flag tests * test: skip fee split invriant when CGT enabled * test: fix l2 genesis override test (#673) * feat: add ownable liquidity (#671) * feat: add ownable liquidity * feat: remove enable and add default liquidity * feat: pre pr fixed * fix: initializer * fix: comments * fix: comments * fix: pre-pr * fix: override * fix: tests * fix: cursor issues * fix: cursor bug bot * fix: cursor bot * fix: remove override * fix: comment * feat: add checks * fix: tests * fix: nil in cgt config --------- Co-authored-by: agusduha <[email protected]> * fix: semver * test: fix cgt fork tests (#676) * test: fix cgt fork tests * fix: remove dev flag in L1 tests * fix: go linter (#679) * fix: go linter * fix: with custom gas token func * test: fix go fuzz (#680) * fix: cgt config jsons (#681) * fix: zero owner and sepolia address (#685) * feat: predeploys (#684) * fix: predeploys * fix: predeploys * fix: L2 genesis * test: fix cgt with revenue sharing tests (#691) * fix: semver * fix: cgt liquidity controller natspec (#694) * fix: remove dev feature flag from opcm (#695) * fix: remove dev feature flag from opcm * fix: lint --------- Signed-off-by: Hex <[email protected]> Co-authored-by: niha <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: AgusDuha <[email protected]> Co-authored-by: Mark Tyneway <[email protected]> Co-authored-by: Ashitaka <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: Stefano Charissis <[email protected]> Co-authored-by: Simon Something /DrGoNoGo <[email protected]> Co-authored-by: drgorillamd <[email protected]> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
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.
Description
Fix CI checks in #17412