Skip to content

Conversation

@tynes
Copy link
Contributor

@tynes tynes commented Sep 10, 2025

Description

Based on top of #17320

Enables OP Stack chains to use an asset other than ETH as their native fee currency by introducing a minimal, flexible, and standardizable Custom Gas Token (CGT) architecture. To do so, it introduces new predeploys (NativeAssetLiquidity and LiquidityController) that decouple native asset management from core bridging operations while using a single isCustomGasToken() flag that disables ETH transfer flows in all bridging methods. The two new pre-deploys manage the native asset supply.

Tests

Core contracts:

  • OptimismPortal and L1Block: Tests for isCustomGasToken() flag blocking ETH deposits/withdrawals
  • NativeAssetLiquidity: Tests deposit/withdraw access control and functionality
  • LiquidityController: Tests minter authorization, mint/burn operations, and metadata functions

Metadata


Contributors

@tynes tynes requested review from a team as code owners September 10, 2025 04:01
@tynes tynes requested review from blmalone and teddyknox September 10, 2025 04:01
@codecov
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.97%. Comparing base (e489612) to head (f033db8).
⚠️ Report is 235 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #17412      +/-   ##
===========================================
+ Coverage    73.33%   80.97%   +7.64%     
===========================================
  Files          172      121      -51     
  Lines        10954     6239    -4715     
===========================================
- Hits          8033     5052    -2981     
+ Misses        2777     1187    -1590     
+ Partials       144        0     -144     
Flag Coverage Δ
cannon-go-tests-64 ?
contracts-bedrock-tests 80.97% <100.00%> (+1.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...es/contracts-bedrock/src/L1/OPContractsManager.sol 96.29% <100.00%> (+0.25%) ⬆️
...kages/contracts-bedrock/src/L1/OptimismPortal2.sol 98.50% <100.00%> (+81.04%) ⬆️
packages/contracts-bedrock/src/L1/SystemConfig.sol 94.92% <100.00%> (+0.80%) ⬆️
packages/contracts-bedrock/src/L2/L1Block.sol 97.56% <100.00%> (+4.87%) ⬆️
packages/contracts-bedrock/src/L2/L1BlockCGT.sol 100.00% <100.00%> (ø)
...s/contracts-bedrock/src/L2/L2ToL1MessagePasser.sol 86.66% <100.00%> (+2.05%) ⬆️
...ontracts-bedrock/src/L2/L2ToL1MessagePasserCGT.sol 100.00% <100.00%> (ø)
...s/contracts-bedrock/src/L2/LiquidityController.sol 100.00% <100.00%> (ø)
.../contracts-bedrock/src/L2/NativeAssetLiquidity.sol 100.00% <100.00%> (ø)
...es/contracts-bedrock/src/libraries/DevFeatures.sol 100.00% <ø> (ø)
... and 1 more

... and 56 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tynes
Copy link
Contributor Author

tynes commented Sep 10, 2025

Looks like I am getting a bunch of failures due to version mismatches. It works when not running in a forked environment, so I am guessing it is something to do with u16a not being deployed and upgraded to yet?

Run tests:

FOUNDRY_PROFILE=lite forge test --mc OPContractsManagerStandardValidator_PermissionedDisputeGame_Test

Example failure:

[FAIL: assertion failed: PDDG-40 != PORTAL-10,PDDG-40] test_validate_permissionedDisputeGameInvalidAbsolutePrestate_succeeds() (gas: 715767)

}

func setCustomGasToken(intent *Intent) {
intent.Chains[0].CustomGasToken = &CustomGasToken{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should make sure the native asset liquidity amount is set properly everywhere it needs to be

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated here: 9bb50bd

hexshire and others added 18 commits September 13, 2025 15:07
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 L1BlockCGT

* feat: add L2ToL1MessagePasserCGT

* chore: remove test exclution in test validation
* 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]>
Updates the implementation to use the new feature flagging system
Use the legacy config name so that less needs to change for legacy CGT
chains
Remove leftover merge conflict
Add a specific test for CGT in the intent
* 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]>
* 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]>
simon-something and others added 4 commits September 25, 2025 19:02
* 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>
…7642)

* refactor: auth minter helper tests (#618)

* fix: bound _mint correctly in depositTransaction test function (#619)
@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Oct 11, 2025
@opgitgovernance
Copy link
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@zjg555543 zjg555543 mentioned this pull request Oct 13, 2025
@hexshire hexshire mentioned this pull request Oct 29, 2025
@drinkcoffee
Copy link

@tynes , should this PR be still open?

@agusduha
Copy link
Contributor

This PR follows in #18076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-stale Status: Will be closed unless there is activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.