Skip to content

Dual Guardian mechanism#302

Merged
pahor167 merged 39 commits intopahor/genesisGenerationfrom
m-chrzan/dual-guardian
Feb 6, 2025
Merged

Dual Guardian mechanism#302
pahor167 merged 39 commits intopahor/genesisGenerationfrom
m-chrzan/dual-guardian

Conversation

@m-chrzan
Copy link
Copy Markdown

@m-chrzan m-chrzan commented Jan 28, 2025

Description

Introduces CeloSuperchainConfig which:

  • behaves like SuperchainConfig
    • i.e. allows a Guardian role to pause certain parts of an OP system
  • Stores the address of another SuperchainConfig (this is intended to be the one used by the actual Superchain)
  • paused() returns the logical OR of its own paused value and Superchain's paused value
  • A new function, checkAndPauseIfSuperchainPaused(), checks the paused() status while also permissionlessly pausing this contract as long as Superchain is paused.
    • The idea is to use this instead of paused() in contracts that are pausable. They will thus fetch the current paused() status, while also atomically pausing the Celo system, such that if Superchain unpauses, Celo remains paused until manual intervention from the Celo Guardian.

Fixes #299.

TODOs

  • Events
  • NatSpecs
  • Pause at initialize time if Superchain paused
  • Connect all pausable contracts to this
    • Already done for OptimismPortal as a PoC
  • Test the new mechanism in pausable contracts
  • Fix TODOs in code
  • Rebase on top of pahor/genesisGeneration

Questions

  • Naming: just CeloConfig instead?
    • Or something more general (without "Celo") so it's more reusable by other projects in a similar situation. E.g. "DualGuardianConfig".
  • Package structure: do we put new contracts like this together with other OP contracts (in L1/ in this case), or should they go in a separate directory (like celo/, as we had before)?

pahor167 and others added 30 commits February 3, 2025 15:44
@m-chrzan m-chrzan force-pushed the m-chrzan/dual-guardian branch from af0377a to 96fcdb5 Compare February 5, 2025 15:54
@m-chrzan m-chrzan changed the base branch from celo-contracts/v1.8.0-1 to pahor/genesisGeneration February 5, 2025 15:54
@pahor167
Copy link
Copy Markdown

pahor167 commented Feb 5, 2025

Do we know what implications will this change possibly have for us in regards to Superchain membership ?

@pahor167 pahor167 merged commit 780b28f into pahor/genesisGeneration Feb 6, 2025
@pahor167 pahor167 deleted the m-chrzan/dual-guardian branch February 6, 2025 08:51
piersy pushed a commit that referenced this pull request Apr 8, 2025
* feat: AnchorStateRegistry as source of truth

Updates the OptimismPortal to use the AnchorStateRegistry as the
source of truth for the validity of Dispute Game contracts.

* feat: new eth lockbox (#285)

* feat: create new eth lockbox contract with interface

* chore: add it on the deployment scripts (wip)

* feat: create the test base to check if the setup for it is working

* feat: add all eth lockbox tests

* fix: opcm deployment script issue

* fix: lockbox tests

* feat: add no withdrawal tx unlock eth check

* chore: check proper initialization on test

* fix: pre-pr fixes

* chore: run pre-pr

* fix: opcm tests related to eth lockbox

* feat: add admin owner check on authorize portal and lockbox as well

* refactor: add prefix to errors and declare them on contract

* chore add no withdrawal tx comment

* feat: authorize portal in lockbox on the opcm

* chore: add one more check for eth lockbox

* fix: intializable and specs tests

* fix: pre-pr

* feat: integrate portal with lockbox (#291)

* feat: integrate portal with lockbox

* fix: migrate natspec

Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>

* fix: delete natspec

Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>

* fix: natspec nits

* chore: natspec wording

* chore: function order

* chore: remove internals

* feat: add eth lockbox as portal arg on opcm

* feat: add checks on scripts and unit tests

* feat: lock and unlock tests

* feat: add migrate liquidity tests

* fix: other failing portal tests

* chore: run pre-pr

* chore: improve lock and unlock checks on tests

* chore: undo portal version change and run pre-pr

* refactor: enhance expect call checks

* fix: fork test string error

* fix: just test failing tests

* refactor: pao base

* refactor: setup portal and lockbox integration on initialization

* feat: update lockbox setter

* chore: update pao naming on tests

* chore: portal comment

* chore: update version and run pre-pr

* fix: spec

* fix: lockbox storage layout

* fix: pr comments and failing test

* feat: portal upgrade test

* chore: remove portal balance check on chain assertions

* fix: error string on chain assertions

* feat: add test for portal unsafe target

* fix: approval

---------

Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>

* fix: semver lock

* fix: failing tests after merge

* fix: interface import

* chore: add lockbox pao matches final system owner check

* fix: pr comments (#293)

* chore: remove unused function

* chore: add pao validation checks over portal and lockbox

* refactor: use interface as arg type instead of address on functions

* fix: comment max length

* refactor: update lockbox param type as interface

* refactor: use interface as type on migrate liquidity and authorize lockbox functions

* chore: run pre pr

* fix: high fuzz runs failing test using mostly assume not forge address

* refactor: use ioptimis portal instead of ioptimism portal2 everywhere

* chore: undo changes on unrelated files to the pr

* feat: add Super Root specific method to OptimismPortal

Updates the OptimismPortal to include a method that allows users
to prove against Super Roots for interop.

* fix: pr second comments (#295)

* chore: undo initializable v5 test changes

* chore: remove portal already authorized check

* chore: remove portal already authorized check

* refactor: rename pao to proxy admin owner

* fix: pre pr

* fix: test upgrade fails (#296)

* fix: test upgrade fails

* feat: handle fork state on eth lockbox tests

* chore: enhance comments

* chore: run pre-pr

* fix: semgrep

* fix: comments

* chore: address path where is not a fork to get the lockbox

* chore: run pre pr

* fix: pr fixes (#298)

* chore: enhance opcm comment

* fix: same proxy admin owner typo

* feat: add insufficient balance check

* chore: add natspec comments on lockbox migration process

* chore: pre pr

* fix: add lockbox on implementations struct to fix go test (#300)

* feat: AnchorStateRegistry as source of truth

Updates the OptimismPortal to use the AnchorStateRegistry as the
source of truth for the validity of Dispute Game contracts.

* feat: add Super Root specific method to OptimismPortal

Updates the OptimismPortal to include a method that allows users
to prove against Super Roots for interop.

* feat: interop portal OPCM updates

* fix: remove old respectedGameType check from portal test

* fix: deploy new dispute games in OPCM

* feat: add upgrade 15 test path

* feat: integrate into opcm fork tests

* fix: corrected checks for ASR

* fix: rebase tweaks

* fix: OPCM integration

* fix: OPCM stack too deep

* fix: pre pr

* fix: update portal implementation on opcm upgrade

* fix: call upgrade on portal without upgrading any impl

* fix: iopcm interface for older versions already deployed

* refactor: use minimal interface for opcm without lockbox

* fix: import

* chore: undo changes on opcm carried when resolving conflicts (#302)

* fix: include lockbox on reinitialization test and add todos with issue number (#303)

* fix: include lockbox on reinitialization test

* fix: polish nits

* refactor: get eth lockbox on test condition

* chore: add todos pointing to the issue

* fix: add ETHLockbox to op-deployer

* fix: add evm tags to ETHLockboxImpl

* fix: evm tags for ethLockboxProxy too

* fix: remove certain ETHLockbox checks

* fix: properly add ETHLockbox to state

* fix: handle deposit tests and kill L2oo tests

* fix: undo change in user test

* fix: kill more L2OO tests

* fix: bug in withdrawal validity test

* fix: pr review (#309)

* chore: remove unnecessary cast

* refactor: add lockbox on eth migrated event

* chore: rename pa owner to pa owned base

* refactor: add amount on liquidity received and migrated events

* fix: format

* refactor: add amount on liquidity migrated event

* chore: pre-pr

---------

Co-authored-by: agusduha <agusnduha@gmail.com>

* fix: some remaining merge issues

* fix: go linting error

* fix: remove old test skips

* fix: unskip v2 upgrade tests

* fix: skip v2 upgrade tests again

---------

Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>
Co-authored-by: AgusDuha <81362284+agusduha@users.noreply.github.com>
Co-authored-by: agusduha <agusnduha@gmail.com>
pahor167 added a commit that referenced this pull request May 19, 2025
* L2 allocation generation by itself

* Readme added

* update of readme

* AbstractFeeCurrency

* Celo smart contracts

* added deploy of celo contracts to devnet

* working without preInitializeOptimismPortalBalance

* CustomGasToken L1 working

* REVERT LATER - just for testing

* fix of solidity version

* Update interface solidity version

* Pahor/genesis generation working deploy from celo2 (#307)

* working deploy2.s.sol from celo10

* Deployment refactor

* Compilation fix

* removal of deploy_orig

* [Contract Deployment] Split fault proof deployment (#308)

* working deploy2.s.sol from celo10

* Deployment refactor

* Contract Deployment: Split FP initialization

* Minnor format fixes

---------

Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* Celo token permit

* Dual Guardian mechanism (#302)

* working deploy2.s.sol from celo10

* Deployment refactor

* Compilation fix

* removal of deploy_orig

* Setup new contract for Celo-specific guardian role

* Test the actual new contract

* Add getter for global SuperchainConfig

* Make sure global guardian can't directly pause Celo config

* Rename test contracts

* Return combined Superchain and Celo paused status

* Allow pausing of Celo config when Superchain is paused

* Ensure Celo stays paused if Superchain still paused

* Add CeloSuperchainConfig to Specs test

* Exclude CeloSuperchainConfig from Initializable test for now

* Make test view

* Use CeloSuperchainConfig interface

* Check and propagate superchain paused status in one function

* Setup CeloSuperchainConfig in deploy script

* Point OptimismPortal to CeloSuperchainConfig

* Formatting

* Use CeloSuperchainConfig in contracts that used SuperchainConfig

* Fix CrossDomanMessenger test

* Add NatSpecs

* Add unit test NatSpecs

* Add reference comment to deploy script

* Add comments

* Emit event on config update

* Initialize as paused if Superchain paused at init time

* Test Celo and Superchain pauses on OptimismPortal2

* Test Celo and Superchain pauses on OptimismPortal

* Test Celo and Superchain pauses on L1CrossDomainMessenger

* Test Celo and Superchain pauses on L1ERC721Bridge

* Use checkAndPause in L1ERC721Bridge

* Add enum and event to interface

* Use CeloSuperChainConfig in ChainAssertions

* Remove unused script

* Add CeloSuperchainConfig chain assertion

---------

Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* ICeloSuperchainConfig ignored

* Remove debugging function (#313)

* Fix Initializable test (#312)

* Check CeloSuperchainConfig in Initializable test

* Ignore Celo contracts from Initializable test

* Always deal eth to precompiles (#314)

* removal of ethereum-optimism/latitude-1

* lint

* unused import removal

* Snapshots update

* semver lock

* gas tests fixes

* move of semver diff to celo-contracts/v1.8.0

* removal of debug prints

* Test cimg base image for fuzz-golang

* Install parallel

* Update kona-fpp image

* revert of deal EthToPrecompiles

* unit test fix

* CeloSuperchainConfig adjustements (#323)

* Use new namespace in inheriting contract

* Allow unset superchainConfig

* Minor audit fixes (#325)

* interfaces check fix

* lint fixes

* Implement CeloSuperchainConfig standalone, without inheritance (#326)

* Implement CeloSuperchainConfig standalone, without inheritance

* Use CeloSuperchainConfig in DelayedWETH (#329)

* build fix

* Remove usage of stateful pause check (#332)

* Celo readme

* readme fix

* removed virtual tag from paused function (#335)

* Move constants inside contracts (#336)

* Add ProxyAdmin owner verification to deploy/genesis scripts (#345)

* Provide external SuperchainConfig in deploy config (#352)

* Provide an external superchain config and deploy Celo with it

* Add externalSuperchainConfig in go and config template

* Update CeloTokenL1.sol

* Rolled back change by accident

* Fix Celo token (#358)

* Add chain_op_config field to rollup.json (required for testnets)

---------

Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>
Co-authored-by: Martin <marcin.j.chrzanowski@gmail.com>
Co-authored-by: Martin <martin@clabs.co>
Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
Co-authored-by: Martín Volpe <martin.volpe@gmail.com>
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.

2 participants