Commit e6ef3a90 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

feat: MCP L1 (#9058)

* contracts-bedrock: improve documentation for CrossDomainMessenger, L1CrossDomainMessenger, L2CrossDomainMessenger

* contracts-bedrock: update semver-lock

* contracts-bedrock: fix comments in CrossDomainMessenger

* contracts-bedrock: change type of legacy getter for L1CrossDomainMessenger PORTAL

* contracts-bedrock: add tests for L1CrossDomainMessenger

* contracts-bedrock: add tests for L2CrossDomainMessenger

* op-bindings: make for L1CrossDomainMessenger

* contracts-bedrock: update snapshots

* contracts-bedrock: update semver-lock

* contracts-bedrock: reorder isProxy in ChainAssertions for L1CrossDomainMessenger

* contracts-bedrock: use predeploys in Deploy script for L1CrossDomainMessenger

* op-bindings: make for L1CrossDomainMessenger

* contracts-bedrock: update semver-lock

* contracts-bedrock: update snapshots

* contracts-bedrock: drop unnecessary parameter in L1CrossDomainMessenger initialize

* contracts-bedrock: change type of otherMessenger in CrossDomainMessenger

* contracts-bedrock: drop constructor arg for L1CrossDomainMessenger, L2CrossDomainMessenger

* contracts-bedrock: fix test for L1CrossDomainMessenger

* op-bindings: make for CrossdomainMessenger, L1CrossdomainMessenger, L2CrossdomainMessenger

* op-chain-ops: check fetched addresses from L1CrossDomainMessenger against DeployConfig

* contracts-bedrock: drop redundant tests for L1CrossDomainMessenger

* contracts-bedrock: drop redundant test for L2CrossDomainMessenger

* contracts-bedrock: fix documentation for L2CrossDomainMessenger

* contracts-bedrock: update slither report

* contracts-bedrock: update snapshots

* contracts-bedrock: update semver-lock

* contracts-bedrock: fix rebase

* op-chain-ops: drop unnecessary parameter in L1CrossDomainMessenger L1 upgrade

* contracts-bedrock: move check out of config existence clause in L1 upgrade script for L1CrossDomainMessenger

* contracts-bedrock: move immutables to storage in OptimismPortal

* contracts-bedrock: update Deploy script to support changes to OptimismPortal

OptimismPortal had its immutables moved to storage

* contracts-bedrock: update tests to support changes to OptimismPortal

OptimismPortal had its immutables moved to storage

* contracts-bedrock: fix Deploy script's function for OptimismPortal

Since values are set at initialization and not at deployment, ChainAssertions.checkOptimismPortal reverts if called at this point with the dependent contracts. Instead, this call should be done immediately after initialization (as is already done in the Deploy script).

* op-chain-ops: update upgrade script for OptimismPortal

OptimismPortal had its immutable variables moved to storage

* contracts-bedrock: fix OptimismPortal spec in Authorization.t.sol

Addresses the fact that OptimismPortal's spec for initialize should include the parameters for the variables moved from immutables into storage

* contracts-bedrock: bump semver for OptimismPortal, improve comments

* contracts-bedrock: set L2OutputOracle upgradeToAndCall initialize version back to 2 in tests

* contracts-bedrock: extend constructor test for OptimismPortal

* contracts-bedrock: set initialize version back to 2 in OptimismPortal's test_upgradeToAndCall_upgrading_succeeds

* contracts-bedrock: add more requirements in OptimismPortal deploy script

* contracts-bedrock: represent contracts with addresses in initializeOptimismPortal of deploy script

* contracts-bedrock: improve labeling of variables in l1.go for OptimismPortal

* contracts-bedrock: reintroduce ChainAssertions for deployment of OptimismPortal

this is possible thanks to introducing a flag for ChainAssertions to know whether the contract in question has been already initialized or not

* op-bindings: make OptimismPortal bindings

* contracts-bedrock: update semver-lock for changes to OptimismPortal

* contracts-bedrock: update slither report

* op-bindings: make OptimismPortal

abigen version was changed to 1.10.16-stable

* contracts-bedrock: make snapshots

* contracts-bedrock: add test for constructor of OptimismPortal

* contracts-bedrock: improve dev comments in OptimismPortal tests

* contracts-bedrock: drop isInitialized in ChainAssertions for OptimismPortal

now isProxy is used directly

* contracts-bedrock: minor improvement in test for OptimismPortal

* contracts-bedrock: tests for OptimismPortal updated to use non-legacy getters

* contracts-bedrock: leverage impl in constructor test for OptimismPortal

* contracts-bedrock: update semver for OptimismPortal

additionally improve documentation in file

* contracts-bedrock: update semver-lock

* contracts-bedrock: update slither report

* op-bindings: make for OptimismPortal

* contracts-bedrock: improve documentation in OptimismPortal

* contracts-bedrock: update slither report

* contracts-bedrock: update semver-lock

* contracts-bedrock: reorder isProxy in ChainAssertions for OptimismPortal

* contracts-bedrock: replace dead address by DEFAULT_L2_SENDER from constants in tests

* contracts-bedrock: drop redundant test for OptimismPortal

already covered in Initialize.t.sol

* contracts-bedrock: update slither report

* contracts-bedrock: update semver-lock

* contracts-bedrock: drop redundant test for OptimismPortal

this is covered in a different PR refactoring Initializable.t.sol

* contracts-bedrock: fix Initializable.t.sol

* op-chain-ops: check fetched addresses from OptimismPortal against DeployConfig

* contracts-bedrock: drop redundant line in OptimismPortal

* contracts-bedrock: update semver-lock

* contracts-bedrock: update slither-report

* op-bindings: make

* contracts-bedrock: update slither report

* contracts-bedrock: move immutables to storage in StandardBridge

* contracts-bedrock: update L1StandardBridge to support changes to StandardBridge

* contracts-bedrock: update L2StandardBridge to support changes to StandardBridge

* contracts-bedrock: update Deploy script to support changes to StandardBridge, L1StandardBridge, L2StandardBridge

StandardBridge, L1StandardBridge, L2StandardBridge had its immutables moved to storage

* contracts-bedrock: add TODO comment to L1StandardBridge

* contracts-bedrock: update tests to support changes to StandardBridge

StandardBridge had its immutables moved to storage

* contracts-bedrock: update tests to support changes to L1StandardBridge

L1StandardBridge had its immutables moved to storage

* contracts-bedrock: fix Deploy script for L1StandardBridge

Since values are set at initialization and not at deployment, ChainAssertions.checkL1StandardBridge reverts if called at this point with the dependent contracts. Instead, this call should be done immediately after initialization (as is already done in the Deploy script). Additional bug fixes are included, including the removal of unnecessary require checks originally obtained from the legacy PR (#6573)

* contracts-bedrock: fix test for L1StandardBridge

test_initialize_fix_succeeds is removed, which was originally obtained (out of context) from the legacy PR (#6573)

* op-chain-ops: update upgrade script for L1StandardBridge

L1StandardBridge had its immutable variables moved to storage

* contracts-bedrock: fix L1StandardBridge spec in Authorization.t.sol

Addresses the fact that L1StandardBridge spec for initialize should include the parameters for the variables moved from immutables into storage

* contracts-bedrock: remove requires from __StandardBridge_init in StandardBridge

necessary for defining messenger address as address(0) in constructor of L1StandardBridge, for example

* contracts-bedrock: make L2StandardBridge backwards compatible with immutable L2 deploy script

This is done by reintroducing a parameter for the address of the other bridge in the constructor of L2StandardBridge

* contracts-bedrock: update Initializable.t.sol with parameters for L2StandardBridge

* op-chain-ops: introduce storage values for L2StandardBridge

corresponding to the immutable variables moved into storage in the contract

* contracts-bedrock: improve comments for StandardBridge

* contracts-bedrock: bump semver for L2StandardBridge, improve comments

* contracts-bedrock: bump semver of L1StandardBridge, improve comments

additionally, the messenger's address is set to address(0) at initialization

* contracts-bedrock: reintroduce ChainAssertions for L1StandardBridge at deploy

* op-chain-ops: improve labeling of vars in upgrade script for L1StandardBridge

* contracts-bedrock: update semver-lock

* op-bindings: make for StandardBridge, L1StandardBridge, L2StandardBridge

* contracts-bedrock: make snapshots for L1StandardBridge, L2StandardBridge

* op-bindings: make for L1StandardBridge, L2StandardBridge

* op-chain-ops: fix otherBridge in L1StandardBridge upgrade script

* contracts-bedrock: replace isInitialized by isProxy in ChainAssertions for L1StandardBridge

* contracts-bedrock: add constructor test for L1StandardBridge

* contracts-bedrock: extend initialize test for L2StandardBridge

* contracts-bedrock: improve documentation for StandardBridge

* contracts-bedrock: shorten gap in StandardBridge

to preserve existing storage layout

* contracts-bedrock: update snapshots for L1StandardBridge, L2StandardBridge

* op-bindings: make for StandardBridge, L1StandardBridge, L2StandardBridge

* contracts-bedrock: update semver-lock

* op-chain-ops: reorder storage values

maintain consistency with previous order

* contracts-bedrock: add tests for L1StandardBridge

* contracts-bedrock: add tests for L2StandardBridge

* contracts-bedrock: change !isProxy isProxy order in ChainAssertions for L1StandardBridge

* contracts-bedrock: use predeploys in Deploy script for L1StandardBridge

* contracts-bedrock: use predeploys to obtain otherBridge in L1StandardBridge

* contracts-bedrock: use predeploys to obtain otherBridge in L2StandardBridge

* op-bindings: make for L1StandardBridge, L2StandardBridge

* contracts-bedrock: drop redundant test (already in Initialize)

L1 proxy is already tested for in intiailize, but L1 impl not

* contracts-bedrock: update semver-lock

* contracts-bedrock: update snapshots

* op-chain-ops: check fetched addresses from L1StandardBridge against DeployConfig

* contracts-bedrock: drop redundant test for L1StandardBridge

* contracts-bedrock: drop redundant test for L2StandardBridge

* contracts-bedrock: kwargs syntax update in StandardBridge

* contracts-bedrock: restore empty test contract for L1StandardBridge

* op-chain-ops: fix after rebase

* op-chain-ops: fix l1 initialize for L1StandardBridge

* op-chain-ops: move check out of clause for L1 upgrade path L1StandardBridge

* contracts-bedrock: fix constructor

* contracts-bedrock: update snapshots

* op-bindings: make

* op-chain-ops: fix immutables

* op-chain-ops: fix rebase wrt immutables of L2StandardBridge

* op-chain-ops: fix by dropping duplicate import in L1 upgrade

* contracts-bedrock: update Deployer's loadInitializedSlot

if contract is a proxy, it now gets the implementation address using either EIP1967Helper or AddressManager (for ResolvedDelegateProxy)

* contracts-bedrock: define constants in EIP1967Helper and drop Constants import

this allows us to not have to update the version of Arithmetic, ResourceMetering, and Burn, which would otherwise clash with Deployer.sol

* contracts-bedrock: use interface for AddressManager instead of updating version directly

* contracts-bedrock: move immutables to storage in ERC721Bridge

* contracts-bedrock: update L1ERC721Bridge to support changes to ERC721Bridge

* contracts-bedrock: update L2ERC721Bridge to support changes to ERC721Bridge

* contracts-bedrock: update Deploy script to support changes to L1ERC721Bridge

L1ERC721Bridge had its immutables moved to storage

* contracts-bedrock: remove requirements in __ERC721Bridge_init

This is needed because a call to __ERC721Bridge_init is triggered by the constructors of L1ERC721Bridge and L2ERC721Bridge. However, since the variables required to be non-null by __ERC721Bridge_init are set to null values in those constructors, this will call revert and the set-ups of L1ERC721Bridge and L2ERC721Bridge will fail. This commit fixes that issue.

* contracts-bedrock: fix Deploy script for L1ERC721Bridge

Since values are set at initialization and not at deployment, ChainAssertions.checkL1ERC721Bridge reverts if called at this point with the dependent contracts. Instead, this call should be done immediately after initialization (as is already done in the Deploy script).

* op-chain-ops: update upgrade script for L1ERC721Bridge

L1ERC721Bridge had its immutable variables moved to storage

* contracts-bedrock: fix L1ERC721Bridge spec in Authorization.t.sol

Addresses the fact that L1ERC721Bridge spec for initialize should include the parameters for the variables moved from immutables into storage

* contracts-bedrock: update semver for L1ERC721Bridge, L2ERC721Bridge

* op-chain-ops: redefine L2ERC721Bridge immutable config

immutable variables were removed

* op-chain-ops: introduce storage values for L2ERC721Bridge

corresponding to the immutable variables moved into storage in the contract

* op-chain-ops: relabel variables in L1ERC721Bridge upgrade script

* contracts-bedrock: fix annotation in ERC721Bridge

* contracts-bedrock: reintroduce ChainAssertions for L1ERC721Bridge at deploy time

* contracts-bedrock: reintroduce parameter to L2ERC721Bridge constructor

this makes the changes backwards compatible with existing deploy scripts

* op-chain-ops: fix bug, missing parameter for L2ERC721Bridge deploy

* contracts-bedrock: make snapshots for L1ERC721Bridge, L2ERC721Bridge

* contracts-bedrock: update semver-lock

* contracts-bedrock: move repeated code in ChainAssertions's checkL1ERC721Bridge

repeated code is moved outside the if-else block

* contracts-bedrock: replace isInitialized by isProxy in ChainAssertions for L1ERC721Bridge

* op-chain-ops: fix bug in L1ERC721Bridge upgrade script

* contracts-bedrock: update gap in ERC721Bridge

done to maintain existing storage layout

* contracts-bedrock: update snapshots for L1ERC721Bridge, L2ERC721Bridge

* contracts-bedrock: update semver-lock

* op-bindings: make for L1ERC721Bridge, L2ERC721Bridge

* contracts-bedrock: update semver-lock

* contracts-bedrock: change !isProxy isProxy order in ChainAssertions for L1ERC721Bridge

* contracts-bedrock: add tests for L1ERC721Bridge

* contracts-bedrock: add tests for L2ERC721Bridge

* contracts-bedrock: fix test for L1ERC721Bridge

* op-chain-ops: reorder setting of storage variables in config

makes the order consistent with previous order for immutables

* contracts-bedrock: use address from predeploys in Deploy script for L1ERC721Bridge

* contracts-bedrock: add require and tests for ERC721Bridge

* contracts-bedrock: update semver-lock

* op-bindings: make for L1ERC721Bridge, L2ERC721Bridge

* contracts-bedrock: set otherBridge to null address in constructor of L1ERC721Bridge

* contracts-bedrock: hardcode messenger in L2ERC721Bridge to Predeploys

* contracts-bedrock: drop require for bridge to be null in ERC721Bridge

* op-bindings: make for L1ERC721Bridge, L2ERC721Bridge

* contracts-bedrock: update semver-lock

* contracts-bedrock: change type of otherBridge in ERC721Bridge

* contracts-bedrock: drop constructor arg, use Predeploy in L1ERC721Bridge

* op-bindings: make

* contracts-bedrock: drop redundant tests

* contracts-bedrock: fix rebase

* op-chain-ops: check fetched addresses from OptimismPortal against DeployConfig

* contracts-bedrock: update semver-lock

* contracts-bedrock: make snapshots

* op-chain-ops: drop unnecessary parameter for l1ERC721BridgeABI in L1 upgrades

* op-chain-ops: move check out of restrictive clause in L1 upgrade for L1ERC721Bridge

* contracts-bedrock: fix after rebase Initializable

* op-chain-ops: fix op-upgrade

* contracts-bedrock: introduce addresses of L1 system contracts

* contracts-bedrock: update Deploy script for changes to SystemConfig

* contracts-bedrock: update Initializable test for changes to SystemConfig

* contracts-bedrock: update invariant test for changes to SystemConfig

* contracts-bedrock: update test_initialize_values_succeeds for SystemConfig test

* contracts-bedrock: add new tests for SystemConfig

* contracts-bedrock: update ChainAssertions for SystemConfig

* contracts-bedrock: add salt to deployment of SystemConfig

* contracts-bedrock: update Specs.t.sol with new methods on SystemConfig

* op-bindings: make for SystemConfig

* contracts-bedrock: update snapshots

* contracts-bedrock: update invariant docs

* contracts-bedrock: improve support for startBlock in systemConfig

* contracts-bedrock: reorder isProxy in ChainAssertions for SystemConfig

* op-chain-ops: check fetched addresses from SystemConfig against DeployConfig

* contracts-bedrock: update default startBlock number for SystemConfig

* contracts-bedrock: update tests for SystemConfig

* op-chain-ops: improve comparison over a non-null config for SystemConfig

* contracts-bedrock: set start block in constructor and not initialize for SystemConfig

* contracts-bedrock: drop parameter from SystemConfig initialize

* contracts-bedrock: add new tests for SystemConfig startBlock

* contracts-bedrock: update snapshots

* contracts-bedrock: update invariant docs

* op-bindings: make

* op-chain-ops: drop unnecessary import in l1 upgrade

* contracts-bedrock: fix SystemConfig tests

* contracts-bedrock: use START_BLOCK_SLOT for startBlock var in SystemConfig

* contracts-bedrock: fix test

* contracts-bedrock: update snapshots

* op-bindings: make

* op-chain-ops: fix SystemConfig upgrade

* contracts-bedrock: drop public StartBlock setter function in SystemConfig

* contracts-bedrock: update semver-lock

* contracts-bedrock: update snapshots

* op-bindings: make

* op-chain-ops: lint

* contracts-bedrock: update OptimismPortal version

* contracts-bedrock: improve ChainAssertions for OptimismPortal

* contracts-bedrock: reorder variable definition in L1CrossDomainMessenger

this is so the definition of the variable ´version´ happens after all other variables have been defined (more consistent with general pattern)

* contracts-bedrock: bump semver of L1CrossDomainMessenger

* contracts-bedrock: bump semver of L2CrossDomainMessenger

* contracts-bedrock: improve test code for L1ERC721Bridge

* contracts-bedrock: restore Arithmetic.sol solc version

* contracts-bedrock: update START_BLOCK_SLOT in SystemConfig constructor

* contracts-bedrock: bump semver of SystemConfig

* contracts-bedrock: update semver-lock

* op-bindings: make

* contracts-bedrock: drop unnecessary import in L2ERC721Bridge.t.sol

* op-chain-ops: upgrades sets startBlock from config

* contracts-bedrock: add spacing to ERC721Bridge

* contracts-bedrock: add spacing to OptimismMintableERC20Factory

* contracts-bedrock: update snapshots

* contracts-bedrock: fix forge-std version following rebase

* contracts-bedrock: update gas-snapshot

* contracts-bedrock: update semver-lock

* op-bindings: make

* contracts-bedrock: change type of spacer_0_2_20 to bytes30

* contracts-bedrock: regenerate

* op-bindings: build

* contracts-bedrock: fix validate-spacers.ts

* contracts-bedrock: fix validate-spacers.ts

* op-chain-ops: extended pause op-upgrade

* indexer: pad deposit tx to fix out-of-gas error

---------
Co-authored-by: default avatarDiego <105765223+0xfuturistic@users.noreply.github.com>
parent 84801c90
...@@ -517,7 +517,9 @@ func TestClientBridgeFunctions(t *testing.T) { ...@@ -517,7 +517,9 @@ func TestClientBridgeFunctions(t *testing.T) {
l1Opts, err := bind.NewKeyedTransactorWithChainID(actor.priv, testSuite.OpCfg.L1ChainIDBig()) l1Opts, err := bind.NewKeyedTransactorWithChainID(actor.priv, testSuite.OpCfg.L1ChainIDBig())
require.NoError(t, err) require.NoError(t, err)
l1Opts.Value = l2Opts.Value l1Opts.Value = l2Opts.Value
depositTx, err := optimismPortal.Receive(l1Opts) depositTx, err := transactions.PadGasEstimate(l1Opts, 1.1, func(opts *bind.TransactOpts) (*types.Transaction, error) {
return optimismPortal.Receive(opts)
})
require.NoError(t, err) require.NoError(t, err)
depositReceipt, err := wait.ForReceiptOK(context.Background(), testSuite.L1Client, depositTx.Hash()) depositReceipt, err := wait.ForReceiptOK(context.Background(), testSuite.L1Client, depositTx.Hash())
require.NoError(t, err) require.NoError(t, err)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const CrossDomainMessengerStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1001,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"_initialized\",\"offset\":20,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1002,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"_initializing\",\"offset\":21,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1003,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_1_0_1600\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":1004,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_51_0_20\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":1005,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_52_0_1568\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1006,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_101_0_1\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_bool\"},{\"astId\":1007,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_102_0_1568\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1008,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_151_0_32\",\"offset\":0,\"slot\":\"151\",\"type\":\"t_uint256\"},{\"astId\":1009,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_152_0_1568\",\"offset\":0,\"slot\":\"152\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1010,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_201_0_32\",\"offset\":0,\"slot\":\"201\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1011,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_202_0_32\",\"offset\":0,\"slot\":\"202\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1012,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"successfulMessages\",\"offset\":0,\"slot\":\"203\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1013,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"xDomainMsgSender\",\"offset\":0,\"slot\":\"204\",\"type\":\"t_address\"},{\"astId\":1014,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"msgNonce\",\"offset\":0,\"slot\":\"205\",\"type\":\"t_uint240\"},{\"astId\":1015,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"failedMessages\",\"offset\":0,\"slot\":\"206\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1016,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"207\",\"type\":\"t_array(t_uint256)44_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)44_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[44]\",\"numberOfBytes\":\"1408\",\"base\":\"t_uint256\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\",\"base\":\"t_uint256\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint240\":{\"encoding\":\"inplace\",\"label\":\"uint240\",\"numberOfBytes\":\"30\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}" const CrossDomainMessengerStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1001,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"_initialized\",\"offset\":20,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1002,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"_initializing\",\"offset\":21,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1003,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_1_0_1600\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":1004,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_51_0_20\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":1005,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_52_0_1568\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1006,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_101_0_1\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_bool\"},{\"astId\":1007,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_102_0_1568\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1008,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_151_0_32\",\"offset\":0,\"slot\":\"151\",\"type\":\"t_uint256\"},{\"astId\":1009,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_152_0_1568\",\"offset\":0,\"slot\":\"152\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1010,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_201_0_32\",\"offset\":0,\"slot\":\"201\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1011,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"spacer_202_0_32\",\"offset\":0,\"slot\":\"202\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1012,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"successfulMessages\",\"offset\":0,\"slot\":\"203\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1013,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"xDomainMsgSender\",\"offset\":0,\"slot\":\"204\",\"type\":\"t_address\"},{\"astId\":1014,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"msgNonce\",\"offset\":0,\"slot\":\"205\",\"type\":\"t_uint240\"},{\"astId\":1015,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"failedMessages\",\"offset\":0,\"slot\":\"206\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":1016,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"otherMessenger\",\"offset\":0,\"slot\":\"207\",\"type\":\"t_contract(CrossDomainMessenger)1018\"},{\"astId\":1017,\"contract\":\"src/universal/CrossDomainMessenger.sol:CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"208\",\"type\":\"t_array(t_uint256)43_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)43_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[43]\",\"numberOfBytes\":\"1376\",\"base\":\"t_uint256\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\",\"base\":\"t_uint256\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_contract(CrossDomainMessenger)1018\":{\"encoding\":\"inplace\",\"label\":\"contract CrossDomainMessenger\",\"numberOfBytes\":\"20\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint240\":{\"encoding\":\"inplace\",\"label\":\"uint240\",\"numberOfBytes\":\"30\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var CrossDomainMessengerStorageLayout = new(solc.StorageLayout) var CrossDomainMessengerStorageLayout = new(solc.StorageLayout)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1001,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1002,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_0_2_20\",\"offset\":2,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1003,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":1004,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":1005,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_uint256)47_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)47_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[47]\",\"numberOfBytes\":\"1504\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}" const StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1001,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1002,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_0_2_30\",\"offset\":2,\"slot\":\"0\",\"type\":\"t_bytes30\"},{\"astId\":1003,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":1004,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":1005,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"messenger\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_contract(CrossDomainMessenger)1008\"},{\"astId\":1006,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"otherBridge\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_contract(StandardBridge)1009\"},{\"astId\":1007,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_array(t_uint256)45_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)45_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[45]\",\"numberOfBytes\":\"1440\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes30\":{\"encoding\":\"inplace\",\"label\":\"bytes30\",\"numberOfBytes\":\"30\"},\"t_contract(CrossDomainMessenger)1008\":{\"encoding\":\"inplace\",\"label\":\"contract CrossDomainMessenger\",\"numberOfBytes\":\"20\"},\"t_contract(StandardBridge)1009\":{\"encoding\":\"inplace\",\"label\":\"contract StandardBridge\",\"numberOfBytes\":\"20\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var StandardBridgeStorageLayout = new(solc.StorageLayout) var StandardBridgeStorageLayout = new(solc.StorageLayout)
......
This diff is collapsed.
This diff is collapsed.
# op-upgrade-extended-pause
One off CLI tooling for the extended pause upgrade
# op-upgrade-mcp
One off CLI tooling for the mcp upgrade
...@@ -761,19 +761,11 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables ...@@ -761,19 +761,11 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables
} }
cfg := immutables.PredeploysImmutableConfig{ cfg := immutables.PredeploysImmutableConfig{
L2ToL1MessagePasser: struct{}{}, L2ToL1MessagePasser: struct{}{},
DeployerWhitelist: struct{}{}, DeployerWhitelist: struct{}{},
WETH9: struct{}{}, WETH9: struct{}{},
L2CrossDomainMessenger: struct{ OtherMessenger common.Address }{ L2CrossDomainMessenger: struct{}{},
OtherMessenger: config.L1CrossDomainMessengerProxy, L2StandardBridge: struct{}{},
},
L2StandardBridge: struct {
OtherBridge common.Address
Messenger common.Address
}{
OtherBridge: config.L1StandardBridgeProxy,
Messenger: predeploys.L2CrossDomainMessengerAddr,
},
SequencerFeeVault: struct { SequencerFeeVault: struct {
Recipient common.Address Recipient common.Address
MinWithdrawalAmount *big.Int MinWithdrawalAmount *big.Int
...@@ -788,13 +780,7 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables ...@@ -788,13 +780,7 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables
L1Block: struct{}{}, L1Block: struct{}{},
GovernanceToken: struct{}{}, GovernanceToken: struct{}{},
LegacyMessagePasser: struct{}{}, LegacyMessagePasser: struct{}{},
L2ERC721Bridge: struct { L2ERC721Bridge: struct{}{},
OtherBridge common.Address
Messenger common.Address
}{
OtherBridge: config.L1ERC721BridgeProxy,
Messenger: predeploys.L2CrossDomainMessengerAddr,
},
OptimismMintableERC721Factory: struct { OptimismMintableERC721Factory: struct {
Bridge common.Address Bridge common.Address
RemoteChainId *big.Int RemoteChainId *big.Int
...@@ -802,12 +788,8 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables ...@@ -802,12 +788,8 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables
Bridge: predeploys.L2ERC721BridgeAddr, Bridge: predeploys.L2ERC721BridgeAddr,
RemoteChainId: new(big.Int).SetUint64(config.L1ChainID), RemoteChainId: new(big.Int).SetUint64(config.L1ChainID),
}, },
OptimismMintableERC20Factory: struct { OptimismMintableERC20Factory: struct{}{},
Bridge common.Address ProxyAdmin: struct{}{},
}{
Bridge: predeploys.L2StandardBridgeAddr,
},
ProxyAdmin: struct{}{},
BaseFeeVault: struct { BaseFeeVault: struct {
Recipient common.Address Recipient common.Address
MinWithdrawalAmount *big.Int MinWithdrawalAmount *big.Int
...@@ -861,14 +843,24 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage ...@@ -861,14 +843,24 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage
"_initializing": false, "_initializing": false,
"xDomainMsgSender": "0x000000000000000000000000000000000000dEaD", "xDomainMsgSender": "0x000000000000000000000000000000000000dEaD",
"msgNonce": 0, "msgNonce": 0,
"otherMessenger": config.L1CrossDomainMessengerProxy,
} }
storage["L2StandardBridge"] = state.StorageValues{ storage["L2StandardBridge"] = state.StorageValues{
"_initialized": 1, "_initialized": 1,
"_initializing": false, "_initializing": false,
"otherBridge": config.L1StandardBridgeProxy,
"messenger": predeploys.L2CrossDomainMessengerAddr,
} }
storage["L2ERC721Bridge"] = state.StorageValues{ storage["L2ERC721Bridge"] = state.StorageValues{
"_initialized": 1, "_initialized": 1,
"_initializing": false, "_initializing": false,
"otherBridge": config.L1ERC721BridgeProxy,
"messenger": predeploys.L2CrossDomainMessengerAddr,
}
storage["OptimismMintableERC20Factory"] = state.StorageValues{
"_initialized": 1,
"_initializing": false,
"bridge": predeploys.L2StandardBridgeAddr,
} }
storage["L1Block"] = state.StorageValues{ storage["L1Block"] = state.StorageValues{
"number": block.Number(), "number": block.Number(),
......
...@@ -12,7 +12,6 @@ import ( ...@@ -12,7 +12,6 @@ import (
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer" "github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
) )
...@@ -24,30 +23,20 @@ type PredeploysImmutableConfig struct { ...@@ -24,30 +23,20 @@ type PredeploysImmutableConfig struct {
L2ToL1MessagePasser struct{} L2ToL1MessagePasser struct{}
DeployerWhitelist struct{} DeployerWhitelist struct{}
WETH9 struct{} WETH9 struct{}
L2CrossDomainMessenger struct { L2CrossDomainMessenger struct{}
OtherMessenger common.Address L2StandardBridge struct{}
} SequencerFeeVault struct {
L2StandardBridge struct {
OtherBridge common.Address
Messenger common.Address
}
SequencerFeeVault struct {
Recipient common.Address Recipient common.Address
MinWithdrawalAmount *big.Int MinWithdrawalAmount *big.Int
WithdrawalNetwork uint8 WithdrawalNetwork uint8
} }
OptimismMintableERC20Factory struct { OptimismMintableERC20Factory struct{}
Bridge common.Address L1BlockNumber struct{}
} GasPriceOracle struct{}
L1BlockNumber struct{} L1Block struct{}
GasPriceOracle struct{} GovernanceToken struct{}
L1Block struct{} LegacyMessagePasser struct{}
GovernanceToken struct{} L2ERC721Bridge struct{}
LegacyMessagePasser struct{}
L2ERC721Bridge struct {
OtherBridge common.Address
Messenger common.Address
}
OptimismMintableERC721Factory struct { OptimismMintableERC721Factory struct {
Bridge common.Address Bridge common.Address
RemoteChainId *big.Int RemoteChainId *big.Int
...@@ -204,17 +193,9 @@ func l2ImmutableDeployer(backend *backends.SimulatedBackend, opts *bind.Transact ...@@ -204,17 +193,9 @@ func l2ImmutableDeployer(backend *backends.SimulatedBackend, opts *bind.Transact
switch deployment.Name { switch deployment.Name {
case "L2CrossDomainMessenger": case "L2CrossDomainMessenger":
otherMessenger, ok := deployment.Args[0].(common.Address) _, tx, _, err = bindings.DeployL2CrossDomainMessenger(opts, backend)
if !ok {
return nil, fmt.Errorf("invalid type for otherMessenger")
}
_, tx, _, err = bindings.DeployL2CrossDomainMessenger(opts, backend, otherMessenger)
case "L2StandardBridge": case "L2StandardBridge":
otherBridge, ok := deployment.Args[0].(common.Address) _, tx, _, err = bindings.DeployL2StandardBridge(opts, backend)
if !ok {
return nil, fmt.Errorf("invalid type for otherBridge")
}
_, tx, _, err = bindings.DeployL2StandardBridge(opts, backend, otherBridge)
case "SequencerFeeVault": case "SequencerFeeVault":
recipient, minimumWithdrawalAmount, withdrawalNetwork, err = prepareFeeVaultArguments(deployment) recipient, minimumWithdrawalAmount, withdrawalNetwork, err = prepareFeeVaultArguments(deployment)
if err != nil { if err != nil {
...@@ -234,21 +215,9 @@ func l2ImmutableDeployer(backend *backends.SimulatedBackend, opts *bind.Transact ...@@ -234,21 +215,9 @@ func l2ImmutableDeployer(backend *backends.SimulatedBackend, opts *bind.Transact
} }
_, tx, _, err = bindings.DeployL1FeeVault(opts, backend, recipient, minimumWithdrawalAmount, withdrawalNetwork) _, tx, _, err = bindings.DeployL1FeeVault(opts, backend, recipient, minimumWithdrawalAmount, withdrawalNetwork)
case "OptimismMintableERC20Factory": case "OptimismMintableERC20Factory":
bridge, ok := deployment.Args[0].(common.Address) _, tx, _, err = bindings.DeployOptimismMintableERC20Factory(opts, backend)
if !ok {
return nil, fmt.Errorf("invalid type for bridge")
}
// Sanity check that the argument is correct
if bridge != predeploys.L2StandardBridgeAddr {
return nil, fmt.Errorf("invalid bridge address")
}
_, tx, _, err = bindings.DeployOptimismMintableERC20Factory(opts, backend, bridge)
case "L2ERC721Bridge": case "L2ERC721Bridge":
otherBridge, ok := deployment.Args[0].(common.Address) _, tx, _, err = bindings.DeployL2ERC721Bridge(opts, backend)
if !ok {
return nil, fmt.Errorf("invalid type for otherBridge")
}
_, tx, _, err = bindings.DeployL2ERC721Bridge(opts, backend, otherBridge)
case "OptimismMintableERC721Factory": case "OptimismMintableERC721Factory":
bridge, ok := deployment.Args[0].(common.Address) bridge, ok := deployment.Args[0].(common.Address)
if !ok { if !ok {
......
This diff is collapsed.
This diff is collapsed.
...@@ -39,17 +39,7 @@ func setupL2OutputOracle() (common.Address, *bind.TransactOpts, *backends.Simula ...@@ -39,17 +39,7 @@ func setupL2OutputOracle() (common.Address, *bind.TransactOpts, *backends.Simula
if err != nil { if err != nil {
return common.Address{}, nil, nil, nil, err return common.Address{}, nil, nil, nil, err
} }
_, _, contract, err := bindings.DeployL2OutputOracle(opts, backend)
_, _, contract, err := bindings.DeployL2OutputOracle(
opts,
backend,
big.NewInt(10),
big.NewInt(2),
big.NewInt(0),
big.NewInt(0),
from,
common.Address{0xdd},
big.NewInt(100))
if err != nil { if err != nil {
return common.Address{}, nil, nil, nil, err return common.Address{}, nil, nil, nil, err
} }
......
...@@ -46,21 +46,18 @@ describe('helpers', () => { ...@@ -46,21 +46,18 @@ describe('helpers', () => {
signer signer
) )
const L2OutputOracleImplementation = await Factory__L2OutputOracle.deploy( const L2OutputOracleImplementation = await Factory__L2OutputOracle.deploy()
deployConfig.l2OutputOracleSubmissionInterval,
deployConfig.l2BlockTime,
deployConfig.l2OutputOracleStartingBlockNumber,
deployConfig.l2OutputOracleStartingTimestamp,
deployConfig.l2OutputOracleProposer,
deployConfig.l2OutputOracleChallenger,
deployConfig.finalizationPeriodSeconds
)
await Proxy.upgradeToAndCall( await Proxy.upgradeToAndCall(
L2OutputOracleImplementation.address, L2OutputOracleImplementation.address,
L2OutputOracleImplementation.interface.encodeFunctionData('initialize', [ L2OutputOracleImplementation.interface.encodeFunctionData('initialize', [
deployConfig.l2OutputOracleSubmissionInterval,
deployConfig.l2BlockTime,
deployConfig.l2OutputOracleStartingBlockNumber, deployConfig.l2OutputOracleStartingBlockNumber,
deployConfig.l2OutputOracleStartingTimestamp, deployConfig.l2OutputOracleStartingTimestamp,
deployConfig.l2OutputOracleProposer,
deployConfig.l2OutputOracleChallenger,
deployConfig.finalizationPeriodSeconds,
]) ])
) )
......
This diff is collapsed.
# `SystemConfig` Invariants # `SystemConfig` Invariants
## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound. ## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound.
**Test:** [`SystemConfig.t.sol#L68`](../test/invariants/SystemConfig.t.sol#L68) **Test:** [`SystemConfig.t.sol#L69`](../test/invariants/SystemConfig.t.sol#L69)
...@@ -43,7 +43,7 @@ const parseVariableInfo = ( ...@@ -43,7 +43,7 @@ const parseVariableInfo = (
} else if (variable.type.startsWith('t_bytes_')) { } else if (variable.type.startsWith('t_bytes_')) {
variableLength = 32 variableLength = 32
} else if (variable.type.startsWith('t_bytes')) { } else if (variable.type.startsWith('t_bytes')) {
variableLength = variable.type.match(/uint([0-9]+)/)?.[1] variableLength = parseInt(variable.type.match(/bytes([0-9]+)/)?.[1], 10)
} else if (variable.type.startsWith('t_address')) { } else if (variable.type.startsWith('t_address')) {
variableLength = 20 variableLength = 20
} else if (variable.type.startsWith('t_bool')) { } else if (variable.type.startsWith('t_bool')) {
......
This diff is collapsed.
[ [
{ {
"inputs": [ "inputs": [],
{
"internalType": "contract OptimismPortal",
"name": "_portal",
"type": "address"
}
],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "constructor" "type": "constructor"
}, },
...@@ -67,7 +61,7 @@ ...@@ -67,7 +61,7 @@
"name": "OTHER_MESSENGER", "name": "OTHER_MESSENGER",
"outputs": [ "outputs": [
{ {
"internalType": "address", "internalType": "contract CrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -189,6 +183,11 @@ ...@@ -189,6 +183,11 @@
"internalType": "contract SuperchainConfig", "internalType": "contract SuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
},
{
"internalType": "contract OptimismPortal",
"name": "_portal",
"type": "address"
} }
], ],
"name": "initialize", "name": "initialize",
...@@ -209,6 +208,19 @@ ...@@ -209,6 +208,19 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "otherMessenger",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "paused", "name": "paused",
...@@ -227,7 +239,7 @@ ...@@ -227,7 +239,7 @@
"name": "portal", "name": "portal",
"outputs": [ "outputs": [
{ {
"internalType": "address", "internalType": "contract OptimismPortal",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
[ [
{ {
"inputs": [ "inputs": [],
{
"internalType": "address payable",
"name": "_messenger",
"type": "address"
}
],
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "constructor" "type": "constructor"
}, },
...@@ -422,6 +416,11 @@ ...@@ -422,6 +416,11 @@
}, },
{ {
"inputs": [ "inputs": [
{
"internalType": "contract CrossDomainMessenger",
"name": "_messenger",
"type": "address"
},
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract SuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
......
...@@ -112,10 +112,17 @@ ...@@ -112,10 +112,17 @@
"type": "mapping(bytes32 => bool)" "type": "mapping(bytes32 => bool)"
}, },
{ {
"bytes": "1408", "bytes": "20",
"label": "__gap", "label": "otherMessenger",
"offset": 0, "offset": 0,
"slot": "207", "slot": "207",
"type": "uint256[44]" "type": "contract CrossDomainMessenger"
},
{
"bytes": "1376",
"label": "__gap",
"offset": 0,
"slot": "208",
"type": "uint256[43]"
} }
] ]
\ No newline at end of file
...@@ -15,26 +15,26 @@ import { Constants } from "src/libraries/Constants.sol"; ...@@ -15,26 +15,26 @@ import { Constants } from "src/libraries/Constants.sol";
/// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower /// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower
/// level message passing contracts. /// level message passing contracts.
contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @custom:semver 1.9.0 /// @custom:semver 2.0.0
string public constant version = "1.9.0"; string public constant version = "2.0.0";
/// @notice Constructs the L2CrossDomainMessenger contract. /// @notice Constructs the L2CrossDomainMessenger contract.
/// @param _l1CrossDomainMessenger Address of the L1CrossDomainMessenger contract. constructor() CrossDomainMessenger() {
constructor(address _l1CrossDomainMessenger) CrossDomainMessenger(_l1CrossDomainMessenger) { initialize({ _l1CrossDomainMessenger: CrossDomainMessenger(address(0)) });
initialize();
} }
/// @notice Initializer. /// @notice Initializer.
function initialize() public initializer { /// @param _l1CrossDomainMessenger L1CrossDomainMessenger contract on the other network.
__CrossDomainMessenger_init(); function initialize(CrossDomainMessenger _l1CrossDomainMessenger) public initializer {
__CrossDomainMessenger_init({ _otherMessenger: _l1CrossDomainMessenger });
} }
/// @notice Getter for the remote messenger.
/// Public getter is legacy and will be removed in the future. Use `otherMessenger()` instead.
/// @return L1CrossDomainMessenger contract.
/// @custom:legacy /// @custom:legacy
/// @notice Legacy getter for the remote messenger. function l1CrossDomainMessenger() public view returns (CrossDomainMessenger) {
/// Use otherMessenger going forward. return otherMessenger;
/// @return Address of the L1CrossDomainMessenger contract.
function l1CrossDomainMessenger() public view returns (address) {
return OTHER_MESSENGER;
} }
/// @inheritdoc CrossDomainMessenger /// @inheritdoc CrossDomainMessenger
...@@ -46,7 +46,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -46,7 +46,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @inheritdoc CrossDomainMessenger /// @inheritdoc CrossDomainMessenger
function _isOtherMessenger() internal view override returns (bool) { function _isOtherMessenger() internal view override returns (bool) {
return AddressAliasHelper.undoL1ToL2Alias(msg.sender) == OTHER_MESSENGER; return AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(otherMessenger);
} }
/// @inheritdoc CrossDomainMessenger /// @inheritdoc CrossDomainMessenger
......
...@@ -10,8 +10,10 @@ import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; ...@@ -10,8 +10,10 @@ import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Hashing } from "src/libraries/Hashing.sol"; import { Hashing } from "src/libraries/Hashing.sol";
import { Encoding } from "src/libraries/Encoding.sol"; import { Encoding } from "src/libraries/Encoding.sol";
import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies // Target contract dependencies
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
...@@ -22,6 +24,25 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer { ...@@ -22,6 +24,25 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev The storage slot of the l2Sender /// @dev The storage slot of the l2Sender
uint256 constant senderSlotIndex = 50; uint256 constant senderSlotIndex = 50;
/// @dev Tests that the implementation is initialized correctly.
function test_constructor_succeeds() external {
L1CrossDomainMessenger impl = L1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessenger"));
assertEq(address(impl.superchainConfig()), address(0));
assertEq(address(impl.PORTAL()), address(0));
assertEq(address(impl.portal()), address(0));
assertEq(address(impl.OTHER_MESSENGER()), Predeploys.L2_CROSS_DOMAIN_MESSENGER);
assertEq(address(impl.otherMessenger()), Predeploys.L2_CROSS_DOMAIN_MESSENGER);
}
/// @dev Tests that the proxy is initialized correctly.
function test_initialize_succeeds() external {
assertEq(address(l1CrossDomainMessenger.superchainConfig()), address(superchainConfig));
assertEq(address(l1CrossDomainMessenger.PORTAL()), address(optimismPortal));
assertEq(address(l1CrossDomainMessenger.portal()), address(optimismPortal));
assertEq(address(l1CrossDomainMessenger.OTHER_MESSENGER()), Predeploys.L2_CROSS_DOMAIN_MESSENGER);
assertEq(address(l1CrossDomainMessenger.otherMessenger()), Predeploys.L2_CROSS_DOMAIN_MESSENGER);
}
/// @dev Tests that the version can be decoded from the message nonce. /// @dev Tests that the version can be decoded from the message nonce.
function test_messageVersion_succeeds() external { function test_messageVersion_succeeds() external {
(, uint16 version) = Encoding.decodeVersionedNonce(l1CrossDomainMessenger.messageNonce()); (, uint16 version) = Encoding.decodeVersionedNonce(l1CrossDomainMessenger.messageNonce());
...@@ -628,7 +649,7 @@ contract L1CrossDomainMessenger_ReinitReentryTest is Bridge_Initializer { ...@@ -628,7 +649,7 @@ contract L1CrossDomainMessenger_ReinitReentryTest is Bridge_Initializer {
vm.store(address(l1CrossDomainMessenger), 0, bytes32(uint256(0))); vm.store(address(l1CrossDomainMessenger), 0, bytes32(uint256(0)));
// call the initializer function // call the initializer function
l1CrossDomainMessenger.initialize(SuperchainConfig(superchainConfig)); l1CrossDomainMessenger.initialize(SuperchainConfig(superchainConfig), OptimismPortal(optimismPortal));
// attempt to re-replay the withdrawal // attempt to re-replay the withdrawal
vm.expectEmit(address(l1CrossDomainMessenger)); vm.expectEmit(address(l1CrossDomainMessenger));
......
...@@ -11,6 +11,7 @@ import { Encoding } from "src/libraries/Encoding.sol"; ...@@ -11,6 +11,7 @@ import { Encoding } from "src/libraries/Encoding.sol";
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
// Target contract dependencies // Target contract dependencies
import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol"; import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
...@@ -18,6 +19,21 @@ contract L2CrossDomainMessenger_Test is Bridge_Initializer { ...@@ -18,6 +19,21 @@ contract L2CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev Receiver address for testing /// @dev Receiver address for testing
address recipient = address(0xabbaacdc); address recipient = address(0xabbaacdc);
/// @dev Tests that the implementation is initialized correctly.
function test_constructor_succeeds() external {
L2CrossDomainMessenger impl = L2CrossDomainMessenger(deploy.mustGetAddress("L2CrossDomainMessenger"));
assertEq(address(impl.OTHER_MESSENGER()), address(l1CrossDomainMessenger));
assertEq(address(impl.otherMessenger()), address(l1CrossDomainMessenger));
assertEq(address(impl.l1CrossDomainMessenger()), address(l1CrossDomainMessenger));
}
/// @dev Tests that the proxy is initialized correctly.
function test_initialize_succeeds() external {
assertEq(address(l2CrossDomainMessenger.OTHER_MESSENGER()), address(l1CrossDomainMessenger));
assertEq(address(l2CrossDomainMessenger.otherMessenger()), address(l1CrossDomainMessenger));
assertEq(address(l2CrossDomainMessenger.l1CrossDomainMessenger()), address(l1CrossDomainMessenger));
}
/// @dev Tests that `messageNonce` can be decoded correctly. /// @dev Tests that `messageNonce` can be decoded correctly.
function test_messageVersion_succeeds() external { function test_messageVersion_succeeds() external {
(, uint16 version) = Encoding.decodeVersionedNonce(l2CrossDomainMessenger.messageNonce()); (, uint16 version) = Encoding.decodeVersionedNonce(l2CrossDomainMessenger.messageNonce());
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; ...@@ -10,7 +10,7 @@ import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @notice Simple wrapper around the StandardBridge contract that exposes /// @notice Simple wrapper around the StandardBridge contract that exposes
/// internal functions so they can be more easily tested directly. /// internal functions so they can be more easily tested directly.
contract StandardBridgeTester is StandardBridge { contract StandardBridgeTester is StandardBridge {
constructor(address payable _messenger, address payable _otherBridge) StandardBridge(_messenger, _otherBridge) { } constructor() StandardBridge() { }
function isOptimismMintableERC20(address _token) external view returns (bool) { function isOptimismMintableERC20(address _token) external view returns (bool) {
return _isOptimismMintableERC20(_token); return _isOptimismMintableERC20(_token);
...@@ -60,7 +60,7 @@ contract StandardBridge_Stateless_Test is CommonTest { ...@@ -60,7 +60,7 @@ contract StandardBridge_Stateless_Test is CommonTest {
function setUp() public override { function setUp() public override {
super.setUp(); super.setUp();
bridge = new StandardBridgeTester({ _messenger: payable(address(0)), _otherBridge: payable(address(0)) }); bridge = new StandardBridgeTester();
mintable = new OptimismMintableERC20({ mintable = new OptimismMintableERC20({
_bridge: address(0), _bridge: address(0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment