Skip to content

feat: add custom gas token migration #313

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Joxess
Copy link
Contributor

@Joxess Joxess commented Aug 1, 2025

Description

This document proposes a migration solution for OP Stack chains that use the old implementation to the new one proposed in #305.

tynes added a commit to ethereum-optimism/optimism that referenced this pull request Aug 13, 2025
This is WIP so far but meant to show how it can work. The big todo is to
rename the feature flag with the name of the hardfork that the CGT
upgrade is included in. This does leak knowledge of CGT into the client
software so that it can optionally deploy the CGT predeploys.
It is expected that the CGT predeploys will be in the genesis if
the hardfork is active at genesis only on CGT chains.

Relevant links:
- ethereum-optimism/design-docs#305
- ethereum-optimism/design-docs#313
- defi-wonderland#478
Comment on lines +43 to +50
- In `SystemConfig`:
- Removal of the `GasPayingToken` library.
- This removes the `gasPayingToken`, `gasPayingTokenName`, and `gasPayingTokenSymbol`.
- `isCustomGasToken()` boolean is introduced at initialization, as a replacement for `setGasPayingToken`.
- In `OptimismPortal`:
- Removal of the `depositERC20Transaction` and `gasPayingToken` dependencies.
- Import `isCustomGasToken` to block `msg.value` > 0 during deposits, to block ETH sends.
- Migrate funds into a new bridge.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this change 645a27d here too.

Comment on lines +63 to +64
- `FeeVaults`:
- Upgraded to allow withdrawals into an L2 address and turn off L1 withdrawals.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update with this new approach to only add config checks on deployment. If misconfigured, withdrawals would revert because of L2ToL1MessagePasser blocking condition.


- In `SystemConfig`:
- Removal of the `GasPayingToken` library.
- This removes the `gasPayingToken`, `gasPayingTokenName`, and `gasPayingTokenSymbol`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: also need to remove GAS_PAYING_TOKEN_DECIMALS

@tynes
Copy link
Contributor

tynes commented Aug 19, 2025

The OP Stack is getting a more flexible custom gas token design. To ensure simplicity and broad compatibility, the L1 custom gas token bridge enshrines 18 decimal places as the standard.

Most software in the Ethereum ecosystem assumes that the native asset uses 18 decimals. Aligning with this convention reduces complexity and avoids unexpected behavior.

If your custom gas token uses a different number of decimals, you will need an adapter to scale values to and from 18 decimals, ensuring accurate conversions and preventing precision loss. The custom gas token design is flexible, making it straightforward to plug in a new adapter if 18 decimals is not suitable for your use case.

👉 If your project requires support for tokens with non-18 decimals, please reach out, we’d love to work with you on designing the right adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants