diff --git a/.semgrep/rules/sol-rules.yaml b/.semgrep/rules/sol-rules.yaml index 2e97715f699ba..7b3a26317b0e2 100644 --- a/.semgrep/rules/sol-rules.yaml +++ b/.semgrep/rules/sol-rules.yaml @@ -200,7 +200,6 @@ rules: paths: exclude: - packages/contracts-bedrock/src/L1/OPContractsManager.sol - - packages/contracts-bedrock/src/L1/OPContractsManagerInterop.sol - packages/contracts-bedrock/src/legacy/L1ChugSplashProxy.sol - id: sol-style-enforce-require-msg @@ -241,10 +240,6 @@ rules: _disableInitializers(); ... } - paths: - exclude: - - packages/contracts-bedrock/src/L1/SystemConfigInterop.sol - - packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol - id: sol-safety-proper-initializer languages: [solidity] @@ -273,9 +268,6 @@ rules: function initialize(...) public reinitializer(...) { ... } - paths: - exclude: - - packages/contracts-bedrock/src/L1/SystemConfigInterop.sol - id: sol-safety-proper-upgrade-function languages: [solidity] diff --git a/op-deployer/pkg/deployer/integration_test/apply_test.go b/op-deployer/pkg/deployer/integration_test/apply_test.go index 43ab3ded3a22b..8bdcf1d56ae82 100644 --- a/op-deployer/pkg/deployer/integration_test/apply_test.go +++ b/op-deployer/pkg/deployer/integration_test/apply_test.go @@ -401,24 +401,6 @@ func TestProofParamOverrides(t *testing.T) { } } -func TestInteropDeployment(t *testing.T) { - op_e2e.InitParallel(t) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - opts, intent, st := setupGenesisChain(t, defaultL1ChainID) - intent.UseInterop = true - - require.NoError(t, deployer.ApplyPipeline(ctx, opts)) - - chainState := st.Chains[0] - depManagerSlot := common.HexToHash("0x1708e077affb93e89be2665fb0fb72581be66f84dc00d25fed755ae911905b1c") - checkImmutable(t, st.L1StateDump.Data.Accounts, st.ImplementationsDeployment.SystemConfigImplAddress, depManagerSlot) - proxyAdminOwnerHash := common.BytesToHash(intent.Chains[0].Roles.SystemConfigOwner.Bytes()) - checkStorageSlot(t, st.L1StateDump.Data.Accounts, chainState.SystemConfigProxyAddress, depManagerSlot, proxyAdminOwnerHash) -} - func TestAltDADeployment(t *testing.T) { op_e2e.InitParallel(t) diff --git a/op-deployer/pkg/deployer/opcm/implementations.go b/op-deployer/pkg/deployer/opcm/implementations.go index 917754cbd5620..66be66c9beae2 100644 --- a/op-deployer/pkg/deployer/opcm/implementations.go +++ b/op-deployer/pkg/deployer/opcm/implementations.go @@ -81,9 +81,6 @@ func DeployImplementations( defer cleanupOutput() implContract := "DeployImplementations" - if input.UseInterop { - implContract = "DeployImplementationsInterop" - } deployScript, cleanupDeploy, err := script.WithScript[DeployImplementationsScript](host, "DeployImplementations.s.sol", implContract) if err != nil { return output, fmt.Errorf("failed to load %s script: %w", implContract, err) @@ -91,15 +88,12 @@ func DeployImplementations( defer cleanupDeploy() opcmContract := "OPContractsManager" - if err := host.RememberOnLabel("OPContractsManager", "OPContractsManager.sol", opcmContract); err != nil { + if err := host.RememberOnLabel("OPContractsManager", opcmContract+".sol", opcmContract); err != nil { return output, fmt.Errorf("failed to link OPContractsManager label: %w", err) } // So we can see in detail where the SystemConfig interop initializer fails sysConfig := "SystemConfig" - if input.UseInterop { - sysConfig = "SystemConfigInterop" - } if err := host.RememberOnLabel("SystemConfigImpl", sysConfig+".sol", sysConfig); err != nil { return output, fmt.Errorf("failed to link SystemConfig label: %w", err) } diff --git a/op-deployer/pkg/deployer/opcm/manage_dependencies.go b/op-deployer/pkg/deployer/opcm/manage_dependencies.go deleted file mode 100644 index 2a05de55f3e12..0000000000000 --- a/op-deployer/pkg/deployer/opcm/manage_dependencies.go +++ /dev/null @@ -1,21 +0,0 @@ -package opcm - -import ( - "math/big" - - "github.com/ethereum-optimism/optimism/op-chain-ops/script" - "github.com/ethereum/go-ethereum/common" -) - -type ManageDependenciesInput struct { - ChainId *big.Int - SystemConfig common.Address - Remove bool -} - -func ManageDependencies( - host *script.Host, - input ManageDependenciesInput, -) error { - return RunScriptVoid[ManageDependenciesInput](host, input, "ManageDependencies.s.sol", "ManageDependencies") -} diff --git a/op-e2e/interop/interop_test.go b/op-e2e/interop/interop_test.go index b4a5ba08c9412..3dc5da0b51f0e 100644 --- a/op-e2e/interop/interop_test.go +++ b/op-e2e/interop/interop_test.go @@ -144,8 +144,17 @@ func TestInterop_EmitLogs(t *testing.T) { ids := s2.L2IDs() chainA := ids[0] chainB := ids[1] - EmitterA := s2.DeployEmitterContract(chainA, "Alice") - EmitterB := s2.DeployEmitterContract(chainB, "Alice") + + // Deploy emitter to chain A + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + EmitterA := s2.DeployEmitterContract(ctx, chainA, "Alice") + + // Deploy emitter to chain B + ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + EmitterB := s2.DeployEmitterContract(ctx, chainB, "Alice") + payload1 := "SUPER JACKPOT!" numEmits := 10 // emit logs on both chains in parallel @@ -258,25 +267,13 @@ func TestInteropBlockBuilding(t *testing.T) { ids := s2.L2IDs() chainA := ids[0] chainB := ids[1] - // We will initiate on chain A, and execute on chain B - s2.DeployEmitterContract(chainA, "Alice") - - // Add chain A as dependency to chain B, - // such that we can execute a message on B that was initiated on A. - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - depRec := s2.AddDependency(ctx, chainB, s2.ChainID(chainA)) - cancel() - t.Logf("Dependency set in L1 block %d", depRec.BlockNumber) rollupClA := s2.L2RollupClient(chainA, "sequencer") - // Now wait for the dependency to be visible in the L2 (receipt needs to be picked up) - require.Eventually(t, func() bool { - status, err := rollupClA.SyncStatus(context.Background()) - require.NoError(t, err) - return status.CrossUnsafeL2.L1Origin.Number >= depRec.BlockNumber.Uint64() - }, time.Second*30, time.Second, "wait for L1 origin to match dependency L1 block") - t.Log("Dependency information has been processed in L2 block") + // We will initiate on chain A, and execute on chain B + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + s2.DeployEmitterContract(ctx, chainA, "Alice") // emit log on chain A ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second) diff --git a/op-e2e/interop/supersystem.go b/op-e2e/interop/supersystem.go index 1da8484bf1ecb..163829da5516b 100644 --- a/op-e2e/interop/supersystem.go +++ b/op-e2e/interop/supersystem.go @@ -35,7 +35,6 @@ import ( "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/interop/contracts/bindings/emit" "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/interop/contracts/bindings/inbox" "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/interop/contracts/bindings/systemconfig" - "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait" "github.com/ethereum-optimism/optimism/op-e2e/system/helpers" l2os "github.com/ethereum-optimism/optimism/op-proposer/proposer" "github.com/ethereum-optimism/optimism/op-service/client" @@ -94,8 +93,7 @@ type SuperSystem interface { L2OperatorKey(network string, role devkeys.ChainOperatorRole) ecdsa.PrivateKey Address(network string, username string) common.Address Contract(network string, contractName string) interface{} - DeployEmitterContract(network string, username string) common.Address - AddDependency(ctx context.Context, network string, dep *big.Int) *types.Receipt + DeployEmitterContract(ctx context.Context, network string, username string) common.Address ValidateMessage( ctx context.Context, id string, @@ -539,37 +537,10 @@ func (s *interopE2ESystem) ValidateMessage( return bind.WaitMined(ctx, s.L2GethClient(id, "sequencer"), tx) // use the sequencer client to wait for the tx } -func (s *interopE2ESystem) AddDependency(ctx context.Context, id string, dep *big.Int) *types.Receipt { - // There is a note in OPContractsManagerInterop that the proxy-admin is used for now, - // even though it should be a separate dependency-set-manager address. - secret, err := s.hdWallet.Secret(devkeys.ChainOperatorKey{ - ChainID: s.l2s[id].chainID, - Role: devkeys.SystemConfigOwner, - }) - require.NoError(s.t, err) - - auth, err := bind.NewKeyedTransactorWithChainID(secret, s.worldOutput.L1.Genesis.Config.ChainID) - require.NoError(s.t, err) - - balance, err := s.l1GethClient.BalanceAt(ctx, crypto.PubkeyToAddress(secret.PublicKey), nil) - require.NoError(s.t, err) - require.False(s.t, balance.Sign() == 0, "system config owner needs a balance") - - auth.GasLimit = uint64(3000000) - auth.GasPrice = big.NewInt(20000000000) - - contract := s.Contract(id, "systemconfig").(*systemconfig.Systemconfig) - tx, err := contract.SystemconfigTransactor.AddDependency(auth, dep) - require.NoError(s.t, err) - - receipt, err := wait.ForReceiptOK(ctx, s.L1GethClient(), tx.Hash()) - require.NoError(s.t, err) - return receipt -} - // DeployEmitterContract deploys the Emitter contract on the L2 // it uses the sequencer node to deploy the contract func (s *interopE2ESystem) DeployEmitterContract( + ctx context.Context, id string, sender string, ) common.Address { @@ -578,7 +549,9 @@ func (s *interopE2ESystem) DeployEmitterContract( require.NoError(s.t, err) auth.GasLimit = uint64(3000000) auth.GasPrice = big.NewInt(20000000000) - address, _, _, err := emit.DeployEmit(auth, s.L2GethClient(id, "sequencer")) + address, tx, _, err := emit.DeployEmit(auth, s.L2GethClient(id, "sequencer")) + require.NoError(s.t, err) + _, err = bind.WaitMined(ctx, s.L2GethClient(id, "sequencer"), tx) require.NoError(s.t, err) contract, err := emit.NewEmit(address, s.L2GethClient(id, "sequencer")) require.NoError(s.t, err) diff --git a/packages/contracts-bedrock/foundry.toml b/packages/contracts-bedrock/foundry.toml index e256ab97e995d..37ab5ab5032b0 100644 --- a/packages/contracts-bedrock/foundry.toml +++ b/packages/contracts-bedrock/foundry.toml @@ -28,10 +28,8 @@ compilation_restrictions = [ { paths = "src/dispute/SuperFaultDisputeGame.sol", optimizer_runs = 5000 }, { paths = "src/dispute/SuperPermissionedDisputeGame.sol", optimizer_runs = 5000 }, { paths = "src/L1/OPContractsManager.sol", optimizer_runs = 5000 }, - { paths = "src/L1/OPContractsManagerInterop.sol", optimizer_runs = 5000 }, { paths = "src/L1/StandardValidator.sol", optimizer_runs = 5000 }, - { paths = "src/L1/OptimismPortal2.sol", optimizer_runs = 5000 }, - { paths = "src/L1/OptimismPortalInterop.sol", optimizer_runs = 5000 }, + { paths = "src/L1/OptimismPortal2.sol", optimizer_runs = 5000 } ] extra_output = ['devdoc', 'userdoc', 'metadata', 'storageLayout'] @@ -145,10 +143,8 @@ compilation_restrictions = [ { paths = "src/dispute/SuperFaultDisputeGame.sol", optimizer_runs = 0 }, { paths = "src/dispute/SuperPermissionedDisputeGame.sol", optimizer_runs = 0 }, { paths = "src/L1/OPContractsManager.sol", optimizer_runs = 0 }, - { paths = "src/L1/OPContractsManagerInterop.sol", optimizer_runs = 0 }, { paths = "src/L1/StandardValidator.sol", optimizer_runs = 0 }, { paths = "src/L1/OptimismPortal2.sol", optimizer_runs = 0 }, - { paths = "src/L1/OptimismPortalInterop.sol", optimizer_runs = 0 }, ] ################################################################ diff --git a/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol b/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol deleted file mode 100644 index 1b4eb759787cc..0000000000000 --- a/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol +++ /dev/null @@ -1,135 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import { Types } from "src/libraries/Types.sol"; -import { GameType } from "src/dispute/lib/LibUDT.sol"; -import { IDisputeGame } from "interfaces/dispute/IDisputeGame.sol"; -import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol"; -import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol"; -import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol"; -import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; -import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol"; -import { IETHLockbox } from "interfaces/L1/IETHLockbox.sol"; -import { IProxyAdminOwnedBase } from "interfaces/L1/IProxyAdminOwnedBase.sol"; - -interface IOptimismPortalInterop is IProxyAdminOwnedBase { - error ContentLengthMismatch(); - error EmptyItem(); - error InvalidDataRemainder(); - error InvalidHeader(); - error ReinitializableBase_ZeroInitVersion(); - error OptimismPortal_AlreadyFinalized(); - error OptimismPortal_BadTarget(); - error OptimismPortal_CallPaused(); - error OptimismPortal_CalldataTooLarge(); - error OptimismPortal_GasEstimation(); - error OptimismPortal_GasLimitTooLow(); - error OptimismPortal_ImproperDisputeGame(); - error OptimismPortal_InvalidDisputeGame(); - error OptimismPortal_InvalidMerkleProof(); - error OptimismPortal_InvalidOutputRootProof(); - error OptimismPortal_InvalidProofTimestamp(); - error OptimismPortal_InvalidRootClaim(); - error OptimismPortal_NoReentrancy(); - error OptimismPortal_ProofNotOldEnough(); - error OptimismPortal_Unauthorized(); - error OptimismPortal_Unproven(); - error OptimismPortal_InvalidOutputRootIndex(); - error OptimismPortal_InvalidSuperRootProof(); - error OptimismPortal_InvalidOutputRootChainId(); - error OptimismPortal_WrongProofMethod(); - error OptimismPortal_MigratingToSameRegistry(); - error Encoding_EmptySuperRoot(); - error Encoding_InvalidSuperRootVersion(); - error OutOfGas(); - error UnexpectedList(); - error UnexpectedString(); - - event Initialized(uint8 version); - event TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData); - event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success); - event WithdrawalProven(bytes32 indexed withdrawalHash, address indexed from, address indexed to); - event WithdrawalProvenExtension1(bytes32 indexed withdrawalHash, address indexed proofSubmitter); - event ETHMigrated(address indexed lockbox, uint256 ethBalance); - event PortalMigrated(IETHLockbox oldLockbox, IETHLockbox newLockbox, IAnchorStateRegistry oldAnchorStateRegistry, IAnchorStateRegistry newAnchorStateRegistry); - - receive() external payable; - - function anchorStateRegistry() external view returns (IAnchorStateRegistry); - function ethLockbox() external view returns (IETHLockbox); - function checkWithdrawal(bytes32 _withdrawalHash, address _proofSubmitter) external view; - function depositTransaction( - address _to, - uint256 _value, - uint64 _gasLimit, - bool _isCreation, - bytes memory _data - ) - external - payable; - function disputeGameFactory() external view returns (IDisputeGameFactory); - function disputeGameFinalityDelaySeconds() external view returns (uint256); - function donateETH() external payable; - function migrateToSuperRoots(IETHLockbox _newLockbox, IAnchorStateRegistry _newAnchorStateRegistry) external; - function finalizeWithdrawalTransaction(Types.WithdrawalTransaction memory _tx) external; - function finalizeWithdrawalTransactionExternalProof( - Types.WithdrawalTransaction memory _tx, - address _proofSubmitter - ) - external; - function migrateLiquidity() external; - function finalizedWithdrawals(bytes32) external view returns (bool); - function guardian() external view returns (address); - function initialize( - ISystemConfig _systemConfig, - ISuperchainConfig _superchainConfig, - IAnchorStateRegistry _anchorStateRegistry, - IETHLockbox _ethLockbox - ) - external; - function initVersion() external view returns (uint8); - function l2Sender() external view returns (address); - function minimumGasLimit(uint64 _byteCount) external pure returns (uint64); - function numProofSubmitters(bytes32 _withdrawalHash) external view returns (uint256); - function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum); // nosemgrep - function paused() external view returns (bool); - function proofMaturityDelaySeconds() external view returns (uint256); - function proofSubmitters(bytes32, uint256) external view returns (address); - function proveWithdrawalTransaction( - Types.WithdrawalTransaction memory _tx, - uint256 _disputeGameIndex, - Types.OutputRootProof memory _outputRootProof, - bytes[] memory _withdrawalProof - ) - external; - function proveWithdrawalTransaction( - Types.WithdrawalTransaction memory _tx, - IDisputeGame _disputeGameProxy, - uint256 _outputRootIndex, - Types.SuperRootProof memory _superRootProof, - Types.OutputRootProof memory _outputRootProof, - bytes[] memory _withdrawalProof - ) - external; - function provenWithdrawals( - bytes32, - address - ) - external - view - returns (IDisputeGame disputeGameProxy, uint64 timestamp); // nosemgrep - function respectedGameType() external view returns (GameType); - function respectedGameTypeUpdatedAt() external view returns (uint64); - function setConfig(ConfigType _type, bytes memory _value) external; - function superchainConfig() external view returns (ISuperchainConfig); - function superRootsActive() external view returns (bool); - function systemConfig() external view returns (ISystemConfig); - function upgrade( - IAnchorStateRegistry _anchorStateRegistry, - IETHLockbox _ethLockbox - ) - external; - function version() external pure returns (string memory); - - function __constructor__(uint256 _proofMaturityDelaySeconds) external; -} diff --git a/packages/contracts-bedrock/interfaces/L1/ISystemConfigInterop.sol b/packages/contracts-bedrock/interfaces/L1/ISystemConfigInterop.sol deleted file mode 100644 index 6842e0f701392..0000000000000 --- a/packages/contracts-bedrock/interfaces/L1/ISystemConfigInterop.sol +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol"; -import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol"; - -interface ISystemConfigInterop { - error ReinitializableBase_ZeroInitVersion(); - - event ConfigUpdate(uint256 indexed version, ISystemConfig.UpdateType indexed updateType, bytes data); - event Initialized(uint8 version); - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - - function BATCH_INBOX_SLOT() external view returns (bytes32); - function DISPUTE_GAME_FACTORY_SLOT() external view returns (bytes32); - function L1_CROSS_DOMAIN_MESSENGER_SLOT() external view returns (bytes32); - function L1_ERC_721_BRIDGE_SLOT() external view returns (bytes32); - function L1_STANDARD_BRIDGE_SLOT() external view returns (bytes32); - function OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT() external view returns (bytes32); - function OPTIMISM_PORTAL_SLOT() external view returns (bytes32); - function START_BLOCK_SLOT() external view returns (bytes32); - function UNSAFE_BLOCK_SIGNER_SLOT() external view returns (bytes32); - function VERSION() external view returns (uint256); - function basefeeScalar() external view returns (uint32); - function batchInbox() external view returns (address addr_); - function batcherHash() external view returns (bytes32); - function blobbasefeeScalar() external view returns (uint32); - function disputeGameFactory() external view returns (address addr_); - function gasLimit() external view returns (uint64); - function eip1559Denominator() external view returns (uint32); - function eip1559Elasticity() external view returns (uint32); - function l1CrossDomainMessenger() external view returns (address addr_); - function l1ERC721Bridge() external view returns (address addr_); - function l1StandardBridge() external view returns (address addr_); - function l2ChainId() external view returns (uint256); - function maximumGasLimit() external pure returns (uint64); - function minimumGasLimit() external view returns (uint64); - function operatorFeeConstant() external view returns (uint64); - function operatorFeeScalar() external view returns (uint32); - function optimismMintableERC20Factory() external view returns (address addr_); - function optimismPortal() external view returns (address addr_); - function overhead() external view returns (uint256); - function owner() external view returns (address); - function renounceOwnership() external; - function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory); - function scalar() external view returns (uint256); - function setBatcherHash(bytes32 _batcherHash) external; - function setGasConfig(uint256 _overhead, uint256 _scalar) external; - function setGasConfigEcotone(uint32 _basefeeScalar, uint32 _blobbasefeeScalar) external; - function setGasLimit(uint64 _gasLimit) external; - function setUnsafeBlockSigner(address _unsafeBlockSigner) external; - function setEIP1559Params(uint32 _denominator, uint32 _elasticity) external; - function setOperatorFeeScalars(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant) external; - function startBlock() external view returns (uint256 startBlock_); - function transferOwnership(address newOwner) external; // nosemgrep - function unsafeBlockSigner() external view returns (address addr_); - - function addDependency(uint256 _chainId) external; - function removeDependency(uint256 _chainId) external; - function dependencyManager() external view returns (address); - function initialize( - address _owner, - uint32 _basefeeScalar, - uint32 _blobbasefeeScalar, - bytes32 _batcherHash, - uint64 _gasLimit, - address _unsafeBlockSigner, - IResourceMetering.ResourceConfig memory _config, - address _batchInbox, - ISystemConfig.Addresses memory _addresses, - address _dependencyManager, - uint256 _l2ChainId - ) - external; - function initVersion() external view returns (uint8); - function version() external pure returns (string memory); - - function __constructor__() external; -} diff --git a/packages/contracts-bedrock/interfaces/L2/ICrossL2Inbox.sol b/packages/contracts-bedrock/interfaces/L2/ICrossL2Inbox.sol index 8b486cc7073a1..646bb699be67b 100644 --- a/packages/contracts-bedrock/interfaces/L2/ICrossL2Inbox.sol +++ b/packages/contracts-bedrock/interfaces/L2/ICrossL2Inbox.sol @@ -12,17 +12,6 @@ struct Identifier { /// @title ICrossL2Inbox /// @notice Interface for the CrossL2Inbox contract. interface ICrossL2Inbox { - error ReentrantCall(); - - /// @notice Thrown when the caller is not DEPOSITOR_ACCOUNT when calling `setInteropStart()` - error NotDepositor(); - - /// @notice Thrown when attempting to set interop start when it's already set. - error InteropStartAlreadySet(); - - /// @notice Thrown when a non-written transient storage slot is attempted to be read from. - error NotEntered(); - /// @notice Thrown when trying to execute a cross chain message on a deposit transaction. error NoExecutingDeposits(); @@ -30,27 +19,6 @@ interface ICrossL2Inbox { function version() external view returns (string memory); - /// @notice Returns the interop start timestamp. - /// @return interopStart_ interop start timestamp. - function interopStart() external view returns (uint256 interopStart_); - - /// @notice Returns the origin address of the Identifier. - function origin() external view returns (address); - - /// @notice Returns the block number of the Identifier. - function blockNumber() external view returns (uint256); - - /// @notice Returns the log index of the Identifier. - function logIndex() external view returns (uint256); - - /// @notice Returns the timestamp of the Identifier. - function timestamp() external view returns (uint256); - - /// @notice Returns the chain ID of the Identifier. - function chainId() external view returns (uint256); - - function setInteropStart() external; - /// @notice Validates a cross chain message on the destination chain /// and emits an ExecutingMessage event. This function is useful /// for applications that understand the schema of the _message payload and want to diff --git a/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol b/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol index 53cfc890ca0da..689cac0f9d01b 100644 --- a/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol +++ b/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol @@ -1,29 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -enum ConfigType { - ADD_DEPENDENCY, - REMOVE_DEPENDENCY -} - interface IL1BlockInterop { - error AlreadyDependency(); - error CantRemovedDependency(); - error DependencySetSizeTooLarge(); error NotCrossL2Inbox(); - error NotDependency(); error NotDepositor(); - event DependencyAdded(uint256 indexed chainId); - event DependencyRemoved(uint256 indexed chainId); - function DEPOSITOR_ACCOUNT() external pure returns (address addr_); function baseFeeScalar() external view returns (uint32); function basefee() external view returns (uint256); function batcherHash() external view returns (bytes32); function blobBaseFee() external view returns (uint256); function blobBaseFeeScalar() external view returns (uint32); - function dependencySetSize() external view returns (uint8); function depositsComplete() external; function gasPayingToken() external pure returns (address addr_, uint8 decimals_); function gasPayingTokenName() external pure returns (string memory name_); @@ -31,14 +18,12 @@ interface IL1BlockInterop { function hash() external view returns (bytes32); function isCustomGasToken() external pure returns (bool is_); function isDeposit() external view returns (bool isDeposit_); - function isInDependencySet(uint256 _chainId) external view returns (bool); function l1FeeOverhead() external view returns (uint256); function l1FeeScalar() external view returns (uint256); function number() external view returns (uint64); function operatorFeeScalar() external view returns (uint32); function operatorFeeConstant() external view returns (uint64); function sequenceNumber() external view returns (uint64); - function setConfig(ConfigType _type, bytes memory _value) external; function setL1BlockValues( uint64 _number, uint64 _timestamp, diff --git a/packages/contracts-bedrock/interfaces/L2/IL2ToL2CrossDomainMessenger.sol b/packages/contracts-bedrock/interfaces/L2/IL2ToL2CrossDomainMessenger.sol index 58f07a9c92d9c..9bc158d46ca14 100644 --- a/packages/contracts-bedrock/interfaces/L2/IL2ToL2CrossDomainMessenger.sol +++ b/packages/contracts-bedrock/interfaces/L2/IL2ToL2CrossDomainMessenger.sol @@ -27,9 +27,6 @@ interface IL2ToL2CrossDomainMessenger { /// @notice Thrown when attempting to relay a message whose destination chain is not the chain relaying it. error MessageDestinationNotRelayChain(); - /// @notice Thrown when attempting to relay a message whose target is CrossL2Inbox. - error MessageTargetCrossL2Inbox(); - /// @notice Thrown when attempting to relay a message whose target is L2ToL2CrossDomainMessenger. error MessageTargetL2ToL2CrossDomainMessenger(); @@ -39,12 +36,6 @@ interface IL2ToL2CrossDomainMessenger { /// @notice Thrown when a reentrant call is detected. error ReentrantCall(); - /// @notice Thrown when a call to the target contract during message relay fails. - error TargetCallFailed(); - - /// @notice Thrown when attempting to use a chain ID that is not in the dependency set. - error InvalidChainId(); - /// @notice Emitted whenever a message is sent to a destination /// @param destination Chain ID of the destination chain. /// @param target Target contract or wallet address. diff --git a/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol b/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol index e646807b8d158..883252c69ae8f 100644 --- a/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol +++ b/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol @@ -9,6 +9,7 @@ interface ISuperchainWETH is IWETH98, IERC7802, ISemver { error Unauthorized(); error InvalidCrossDomainSender(); error ZeroAddress(); + error Permit2AllowanceIsFixedAtInfinity(); event SendETH(address indexed from, address indexed to, uint256 amount, uint256 destination); diff --git a/packages/contracts-bedrock/scripts/L2Genesis.s.sol b/packages/contracts-bedrock/scripts/L2Genesis.s.sol index 7ab4e9d6efb13..7397388dec2d0 100644 --- a/packages/contracts-bedrock/scripts/L2Genesis.s.sol +++ b/packages/contracts-bedrock/scripts/L2Genesis.s.sol @@ -562,13 +562,13 @@ contract L2Genesis is Deployer { vm.resetNonce(address(eas)); } - /// @notice This predeploy is following the safety invariant #2. + /// @notice This predeploy is following the safety invariant #1. /// This contract has no initializer. function setCrossL2Inbox() internal { _setImplementationCode(Predeploys.CROSS_L2_INBOX); } - /// @notice This predeploy is following the safety invariant #2. + /// @notice This predeploy is following the safety invariant #1. /// This contract has no initializer. function setL2ToL2CrossDomainMessenger() internal { _setImplementationCode(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER); diff --git a/packages/contracts-bedrock/scripts/checks/check-frozen-files.sh b/packages/contracts-bedrock/scripts/checks/check-frozen-files.sh index 435cd301a35ce..21d511854351f 100755 --- a/packages/contracts-bedrock/scripts/checks/check-frozen-files.sh +++ b/packages/contracts-bedrock/scripts/checks/check-frozen-files.sh @@ -54,14 +54,10 @@ ALLOWED_FILES=( "src/L1/L1ERC721Bridge.sol:L1ERC721Bridge" "src/L1/L1StandardBridge.sol:L1StandardBridge" "src/L1/OPContractsManager.sol:OPContractsManager" - "src/L1/OPContractsManagerInterop.sol:OPContractsManagerInterop" - "src/L1/OPPrestateUpdater.sol:OPPrestateUpdater" "src/L1/OptimismPortal2.sol:OptimismPortal2" - "src/L1/OptimismPortalInterop.sol:OptimismPortalInterop" "src/L1/ProtocolVersions.sol:ProtocolVersions" "src/L1/SuperchainConfig.sol:SuperchainConfig" "src/L1/SystemConfig.sol:SystemConfig" - "src/L1/SystemConfigInterop.sol:SystemConfigInterop" "src/L2/BaseFeeVault.sol:BaseFeeVault" "src/L2/CrossL2Inbox.sol:CrossL2Inbox" "src/L2/ETHLiquidity.sol:ETHLiquidity" diff --git a/packages/contracts-bedrock/scripts/checks/interfaces/main.go b/packages/contracts-bedrock/scripts/checks/interfaces/main.go index 0ecc45e19034b..4dbbf9bd31d56 100644 --- a/packages/contracts-bedrock/scripts/checks/interfaces/main.go +++ b/packages/contracts-bedrock/scripts/checks/interfaces/main.go @@ -31,7 +31,7 @@ var excludeContracts = []string{ // TODO: Interfaces that need to be fixed "IInitializable", "IOptimismMintableERC20", "ILegacyMintableERC20", - "KontrolCheatsBase", "ISystemConfigInterop", "IResolvedDelegateProxy", + "KontrolCheatsBase", "IResolvedDelegateProxy", } type ContractDefinition struct { diff --git a/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol b/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol index 0812811993bc3..2b6d4d4597e91 100644 --- a/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol +++ b/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol @@ -7,7 +7,6 @@ import { console2 as console } from "forge-std/console2.sol"; // Scripts import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol"; -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; // Libraries @@ -123,32 +122,6 @@ library ChainAssertions { } } - /// @notice Asserts that the SystemConfigInterop is setup correctly - function checkSystemConfigInterop( - Types.ContractSet memory _contracts, - DeployConfig _cfg, - bool _isProxy - ) - internal - view - { - ISystemConfigInterop config = ISystemConfigInterop(_contracts.SystemConfig); - console.log( - "Running chain assertions on the SystemConfigInterop %s at %s", - _isProxy ? "proxy" : "implementation", - address(config) - ); - - checkSystemConfig(_contracts, _cfg, _isProxy); - if (_isProxy) { - // TODO: this is not being set in the deployment, nor is a config value. - // Update this when it has an entry in hardhat.json - require(config.dependencyManager() == address(0), "CHECK-SCFGI-10"); - } else { - require(config.dependencyManager() == address(0), "CHECK-SCFGI-20"); - } - } - /// @notice Asserts that the L1CrossDomainMessenger is setup correctly function checkL1CrossDomainMessenger(Types.ContractSet memory _contracts, Vm _vm, bool _isProxy) internal view { IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(_contracts.L1CrossDomainMessenger); diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index efefac73aa5a1..10f11cc959451 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -20,7 +20,6 @@ import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from import { DeployImplementationsInput, DeployImplementations, - DeployImplementationsInterop, DeployImplementationsOutput } from "scripts/deploy/DeployImplementations.s.sol"; @@ -297,9 +296,6 @@ contract Deploy is Deployer { // I think this was a bug dii.set(dii.upgradeController.selector, superchainProxyAdmin.owner()); - if (_isInterop) { - di = DeployImplementations(new DeployImplementationsInterop()); - } di.run(dii, dio); // Save the implementation addresses which are needed outside of this function or script. @@ -349,11 +345,7 @@ contract Deploy is Deployer { _mips: IMIPS(address(dio.mipsSingleton())), _superchainProxyAdmin: superchainProxyAdmin }); - if (_isInterop) { - ChainAssertions.checkSystemConfigInterop({ _contracts: impls, _cfg: cfg, _isProxy: false }); - } else { - ChainAssertions.checkSystemConfig({ _contracts: impls, _cfg: cfg, _isProxy: false }); - } + ChainAssertions.checkSystemConfig({ _contracts: impls, _cfg: cfg, _isProxy: false }); } /// @notice Deploy all of the OP Chain specific contracts diff --git a/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol index b1fa022d91f13..1035827375a3a 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol @@ -31,8 +31,6 @@ import { IL1CrossDomainMessenger } from "interfaces/L1/IL1CrossDomainMessenger.s import { IL1ERC721Bridge } from "interfaces/L1/IL1ERC721Bridge.sol"; import { IL1StandardBridge } from "interfaces/L1/IL1StandardBridge.sol"; import { IOptimismMintableERC20Factory } from "interfaces/universal/IOptimismMintableERC20Factory.sol"; -import { IOptimismPortalInterop } from "interfaces/L1/IOptimismPortalInterop.sol"; -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; import { IProxyAdmin } from "interfaces/universal/IProxyAdmin.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { Solarray } from "scripts/libraries/Solarray.sol"; @@ -948,84 +946,3 @@ contract DeployImplementations is Script { dio_ = DeployImplementationsOutput(DeployUtils.toIOAddress(msg.sender, "optimism.DeployImplementationsOutput")); } } - -// Similar to how DeploySuperchain.s.sol contains a lot of comments to thoroughly document the script -// architecture, this comment block documents how to update the deploy scripts to support new features. -// -// Using the base scripts and contracts (DeploySuperchain, DeployImplementations, DeployOPChain, and -// the corresponding OPContractsManager) deploys a standard chain. For nonstandard and in-development -// features we need to modify some or all of those contracts, and we do that via inheritance. Using -// interop as an example, they've made the following changes to L1 contracts: -// - `OptimismPortalInterop is OptimismPortal`: A different portal implementation is used, and -// it's ABI is the same. -// - `SystemConfigInterop is SystemConfig`: A different system config implementation is used, and -// it's initializer has a different signature. This signature is different because there is a -// new input parameter, the `dependencyManager`. -// - Because of the different system config initializer, there is a new input parameter (dependencyManager). -// -// Similar to how inheritance was used to develop the new portal and system config contracts, we use -// inheritance to modify up to all of the deployer contracts. For this interop example, what this -// means is we need: -// - An `OPContractsManagerInterop is OPContractsManager` that knows how to encode the calldata for the -// new system config initializer. -// - A `DeployImplementationsInterop is DeployImplementations` that: -// - Deploys OptimismPortalInterop instead of OptimismPortal. -// - Deploys SystemConfigInterop instead of SystemConfig. -// - Deploys OPContractsManagerInterop instead of OPContractsManager, which contains the updated logic -// for encoding the SystemConfig initializer. -// - Updates the OPCM release setter logic to use the updated initializer. -// - A `DeployOPChainInterop is DeployOPChain` that allows the updated input parameter to be passed. -// -// Most of the complexity in the above flow comes from the the new input for the updated SystemConfig -// initializer. If all function signatures were the same, all we'd have to change is the contract -// implementations that are deployed then set in the OPCM. For now, to simplify things until we -// resolve https://github.com/ethereum-optimism/optimism/issues/11783, we just assume this new role -// is the same as the proxy admin owner. -contract DeployImplementationsInterop is DeployImplementations { - function deployOPCMDeployer(DeployImplementationsOutput _dio) public override { - IOPContractsManagerDeployer impl = IOPContractsManagerDeployer( - DeployUtils.createDeterministic({ - _name: "OPContractsManager.sol:OPContractsManagerDeployerInterop", - _args: DeployUtils.encodeConstructor( - abi.encodeCall(IOPContractsManagerDeployer.__constructor__, (_dio.opcmContractsContainer())) - ), - _salt: _salt - }) - ); - vm.label(address(impl), "OPContractsManagerDeployerImpl"); - _dio.set(_dio.opcmDeployer.selector, address(impl)); - } - - function deployOptimismPortalImpl( - DeployImplementationsInput _dii, - DeployImplementationsOutput _dio - ) - public - override - { - uint256 proofMaturityDelaySeconds = _dii.proofMaturityDelaySeconds(); - IOptimismPortalInterop impl = IOptimismPortalInterop( - DeployUtils.createDeterministic({ - _name: "OptimismPortalInterop", - _args: DeployUtils.encodeConstructor( - abi.encodeCall(IOptimismPortalInterop.__constructor__, (proofMaturityDelaySeconds)) - ), - _salt: _salt - }) - ); - vm.label(address(impl), "OptimismPortalImpl"); - _dio.set(_dio.optimismPortalImpl.selector, address(impl)); - } - - function deploySystemConfigImpl(DeployImplementationsOutput _dio) public override { - ISystemConfigInterop impl = ISystemConfigInterop( - DeployUtils.createDeterministic({ - _name: "SystemConfigInterop", - _args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfigInterop.__constructor__, ())), - _salt: _salt - }) - ); - vm.label(address(impl), "SystemConfigImpl"); - _dio.set(_dio.systemConfigImpl.selector, address(impl)); - } -} diff --git a/packages/contracts-bedrock/scripts/deploy/ManageDependencies.s.sol b/packages/contracts-bedrock/scripts/deploy/ManageDependencies.s.sol deleted file mode 100644 index 1e8bdc2a7c3b7..0000000000000 --- a/packages/contracts-bedrock/scripts/deploy/ManageDependencies.s.sol +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import { Script } from "forge-std/Script.sol"; -import { BaseDeployIO } from "scripts/deploy/BaseDeployIO.sol"; -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; - -contract ManageDependenciesInput is BaseDeployIO { - uint256 internal _chainId; - ISystemConfigInterop _systemConfig; - bool internal _remove; - - // Setter for uint256 type - function set(bytes4 _sel, uint256 _value) public { - if (_sel == this.chainId.selector) _chainId = _value; - else revert("ManageDependenciesInput: unknown selector"); - } - - // Setter for address type - function set(bytes4 _sel, address _addr) public { - require(_addr != address(0), "ManageDependenciesInput: cannot set zero address"); - - if (_sel == this.systemConfig.selector) _systemConfig = ISystemConfigInterop(_addr); - else revert("ManageDependenciesInput: unknown selector"); - } - - // Setter for bool type - function set(bytes4 _sel, bool _value) public { - if (_sel == this.remove.selector) _remove = _value; - else revert("ManageDependenciesInput: unknown selector"); - } - - // Getters - function chainId() public view returns (uint256) { - require(_chainId > 0, "ManageDependenciesInput: not set"); - return _chainId; - } - - function systemConfig() public view returns (ISystemConfigInterop) { - require(address(_systemConfig) != address(0), "ManageDependenciesInput: not set"); - return _systemConfig; - } - - function remove() public view returns (bool) { - return _remove; - } -} - -contract ManageDependencies is Script { - function run(ManageDependenciesInput _input) public { - bool remove = _input.remove(); - uint256 chainId = _input.chainId(); - ISystemConfigInterop systemConfig = _input.systemConfig(); - - // Call the appropriate function based on the remove flag - vm.broadcast(msg.sender); - if (remove) { - systemConfig.removeDependency(chainId); - } else { - systemConfig.addDependency(chainId); - } - } -} diff --git a/packages/contracts-bedrock/snapshots/abi/CrossL2Inbox.json b/packages/contracts-bedrock/snapshots/abi/CrossL2Inbox.json index cb54eeaf11278..b89344e51049e 100644 --- a/packages/contracts-bedrock/snapshots/abi/CrossL2Inbox.json +++ b/packages/contracts-bedrock/snapshots/abi/CrossL2Inbox.json @@ -1,89 +1,4 @@ [ - { - "inputs": [], - "name": "blockNumber", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "chainId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "interopStart", - "outputs": [ - { - "internalType": "uint256", - "name": "interopStart_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "logIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "origin", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "setInteropStart", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "timestamp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -188,29 +103,9 @@ "name": "ExecutingMessage", "type": "event" }, - { - "inputs": [], - "name": "InteropStartAlreadySet", - "type": "error" - }, { "inputs": [], "name": "NoExecutingDeposits", "type": "error" - }, - { - "inputs": [], - "name": "NotDepositor", - "type": "error" - }, - { - "inputs": [], - "name": "NotEntered", - "type": "error" - }, - { - "inputs": [], - "name": "ReentrantCall", - "type": "error" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json b/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json index b3b3d62cb48ae..1a9678f1718ef 100644 --- a/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json +++ b/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json @@ -77,19 +77,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "dependencySetSize", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "depositsComplete", @@ -180,25 +167,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_chainId", - "type": "uint256" - } - ], - "name": "isInDependencySet", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "l1FeeOverhead", @@ -277,24 +245,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "enum ConfigType", - "name": "_type", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "_value", - "type": "bytes" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -390,57 +340,11 @@ "stateMutability": "pure", "type": "function" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - } - ], - "name": "DependencyAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - } - ], - "name": "DependencyRemoved", - "type": "event" - }, - { - "inputs": [], - "name": "AlreadyDependency", - "type": "error" - }, - { - "inputs": [], - "name": "CantRemovedDependency", - "type": "error" - }, - { - "inputs": [], - "name": "DependencySetSizeTooLarge", - "type": "error" - }, { "inputs": [], "name": "NotCrossL2Inbox", "type": "error" }, - { - "inputs": [], - "name": "NotDependency", - "type": "error" - }, { "inputs": [], "name": "NotDepositor", diff --git a/packages/contracts-bedrock/snapshots/abi/L2ToL2CrossDomainMessenger.json b/packages/contracts-bedrock/snapshots/abi/L2ToL2CrossDomainMessenger.json index 3d381ec9ae511..e54b24edf56bc 100644 --- a/packages/contracts-bedrock/snapshots/abi/L2ToL2CrossDomainMessenger.json +++ b/packages/contracts-bedrock/snapshots/abi/L2ToL2CrossDomainMessenger.json @@ -253,11 +253,6 @@ "name": "IdOriginNotL2ToL2CrossDomainMessenger", "type": "error" }, - { - "inputs": [], - "name": "InvalidChainId", - "type": "error" - }, { "inputs": [], "name": "MessageAlreadyRelayed", @@ -273,11 +268,6 @@ "name": "MessageDestinationSameChain", "type": "error" }, - { - "inputs": [], - "name": "MessageTargetCrossL2Inbox", - "type": "error" - }, { "inputs": [], "name": "MessageTargetL2ToL2CrossDomainMessenger", @@ -292,10 +282,5 @@ "inputs": [], "name": "ReentrantCall", "type": "error" - }, - { - "inputs": [], - "name": "TargetCallFailed", - "type": "error" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployerInterop.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployerInterop.json deleted file mode 100644 index b24342213aaed..0000000000000 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployerInterop.json +++ /dev/null @@ -1,512 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract OPContractsManagerContractsContainer", - "name": "_contractsContainer", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_who", - "type": "address" - } - ], - "name": "assertValidContractAddress", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "blueprints", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "addressManager", - "type": "address" - }, - { - "internalType": "address", - "name": "proxy", - "type": "address" - }, - { - "internalType": "address", - "name": "proxyAdmin", - "type": "address" - }, - { - "internalType": "address", - "name": "l1ChugSplashProxy", - "type": "address" - }, - { - "internalType": "address", - "name": "resolvedDelegateProxy", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" - } - ], - "internalType": "struct OPContractsManager.Blueprints", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_l2ChainId", - "type": "uint256" - } - ], - "name": "chainIdToBatchInboxAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "contractsContainer", - "outputs": [ - { - "internalType": "contract OPContractsManagerContractsContainer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "opChainProxyAdminOwner", - "type": "address" - }, - { - "internalType": "address", - "name": "systemConfigOwner", - "type": "address" - }, - { - "internalType": "address", - "name": "batcher", - "type": "address" - }, - { - "internalType": "address", - "name": "unsafeBlockSigner", - "type": "address" - }, - { - "internalType": "address", - "name": "proposer", - "type": "address" - }, - { - "internalType": "address", - "name": "challenger", - "type": "address" - } - ], - "internalType": "struct OPContractsManager.Roles", - "name": "roles", - "type": "tuple" - }, - { - "internalType": "uint32", - "name": "basefeeScalar", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "blobBasefeeScalar", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "l2ChainId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "startingAnchorRoot", - "type": "bytes" - }, - { - "internalType": "string", - "name": "saltMixer", - "type": "string" - }, - { - "internalType": "uint64", - "name": "gasLimit", - "type": "uint64" - }, - { - "internalType": "GameType", - "name": "disputeGameType", - "type": "uint32" - }, - { - "internalType": "Claim", - "name": "disputeAbsolutePrestate", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "disputeMaxGameDepth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "disputeSplitDepth", - "type": "uint256" - }, - { - "internalType": "Duration", - "name": "disputeClockExtension", - "type": "uint64" - }, - { - "internalType": "Duration", - "name": "disputeMaxClockDuration", - "type": "uint64" - } - ], - "internalType": "struct OPContractsManager.DeployInput", - "name": "_input", - "type": "tuple" - }, - { - "internalType": "contract ISuperchainConfig", - "name": "_superchainConfig", - "type": "address" - }, - { - "internalType": "address", - "name": "_deployer", - "type": "address" - } - ], - "name": "deploy", - "outputs": [ - { - "components": [ - { - "internalType": "contract IProxyAdmin", - "name": "opChainProxyAdmin", - "type": "address" - }, - { - "internalType": "contract IAddressManager", - "name": "addressManager", - "type": "address" - }, - { - "internalType": "contract IL1ERC721Bridge", - "name": "l1ERC721BridgeProxy", - "type": "address" - }, - { - "internalType": "contract ISystemConfig", - "name": "systemConfigProxy", - "type": "address" - }, - { - "internalType": "contract IOptimismMintableERC20Factory", - "name": "optimismMintableERC20FactoryProxy", - "type": "address" - }, - { - "internalType": "contract IL1StandardBridge", - "name": "l1StandardBridgeProxy", - "type": "address" - }, - { - "internalType": "contract IL1CrossDomainMessenger", - "name": "l1CrossDomainMessengerProxy", - "type": "address" - }, - { - "internalType": "contract IETHLockbox", - "name": "ethLockboxProxy", - "type": "address" - }, - { - "internalType": "contract IOptimismPortal2", - "name": "optimismPortalProxy", - "type": "address" - }, - { - "internalType": "contract IDisputeGameFactory", - "name": "disputeGameFactoryProxy", - "type": "address" - }, - { - "internalType": "contract IAnchorStateRegistry", - "name": "anchorStateRegistryProxy", - "type": "address" - }, - { - "internalType": "contract IFaultDisputeGame", - "name": "faultDisputeGame", - "type": "address" - }, - { - "internalType": "contract IPermissionedDisputeGame", - "name": "permissionedDisputeGame", - "type": "address" - }, - { - "internalType": "contract IDelayedWETH", - "name": "delayedWETHPermissionedGameProxy", - "type": "address" - }, - { - "internalType": "contract IDelayedWETH", - "name": "delayedWETHPermissionlessGameProxy", - "type": "address" - } - ], - "internalType": "struct OPContractsManager.DeployOutput", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "implementations", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "superchainConfigImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "protocolVersionsImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "l1ERC721BridgeImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismPortalImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "ethLockboxImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "systemConfigImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismMintableERC20FactoryImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "l1CrossDomainMessengerImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "l1StandardBridgeImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "disputeGameFactoryImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "anchorStateRegistryImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "delayedWETHImpl", - "type": "address" - }, - { - "internalType": "address", - "name": "mipsImpl", - "type": "address" - } - ], - "internalType": "struct OPContractsManager.Implementations", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "l2ChainId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "deployer", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "deployOutput", - "type": "bytes" - } - ], - "name": "Deployed", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "who", - "type": "address" - } - ], - "name": "AddressHasNoCode", - "type": "error" - }, - { - "inputs": [], - "name": "BytesArrayTooLong", - "type": "error" - }, - { - "inputs": [], - "name": "DeploymentFailed", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyInitcode", - "type": "error" - }, - { - "inputs": [], - "name": "IdentityPrecompileCallFailed", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidChainId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "role", - "type": "string" - } - ], - "name": "InvalidRoleAddress", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidStartingAnchorRoot", - "type": "error" - }, - { - "inputs": [], - "name": "NotABlueprint", - "type": "error" - }, - { - "inputs": [], - "name": "ReservedBitsSet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "UnexpectedPreambleData", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "UnsupportedERCVersion", - "type": "error" - } -] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json b/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json deleted file mode 100644 index be5f6e027caa1..0000000000000 --- a/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json +++ /dev/null @@ -1,1115 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_proofMaturityDelaySeconds", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "stateMutability": "payable", - "type": "receive" - }, - { - "inputs": [], - "name": "anchorStateRegistry", - "outputs": [ - { - "internalType": "contract IAnchorStateRegistry", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_withdrawalHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_proofSubmitter", - "type": "address" - } - ], - "name": "checkWithdrawal", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "_gasLimit", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "_isCreation", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "depositTransaction", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "disputeGameFactory", - "outputs": [ - { - "internalType": "contract IDisputeGameFactory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "disputeGameFinalityDelaySeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "donateETH", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "ethLockbox", - "outputs": [ - { - "internalType": "contract IETHLockbox", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Types.WithdrawalTransaction", - "name": "_tx", - "type": "tuple" - } - ], - "name": "finalizeWithdrawalTransaction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Types.WithdrawalTransaction", - "name": "_tx", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_proofSubmitter", - "type": "address" - } - ], - "name": "finalizeWithdrawalTransactionExternalProof", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "finalizedWithdrawals", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "guardian", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initVersion", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract ISystemConfig", - "name": "_systemConfig", - "type": "address" - }, - { - "internalType": "contract ISuperchainConfig", - "name": "_superchainConfig", - "type": "address" - }, - { - "internalType": "contract IAnchorStateRegistry", - "name": "_anchorStateRegistry", - "type": "address" - }, - { - "internalType": "contract IETHLockbox", - "name": "_ethLockbox", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "l2Sender", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "migrateLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IETHLockbox", - "name": "_newLockbox", - "type": "address" - }, - { - "internalType": "contract IAnchorStateRegistry", - "name": "_newAnchorStateRegistry", - "type": "address" - } - ], - "name": "migrateToSuperRoots", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "_byteCount", - "type": "uint64" - } - ], - "name": "minimumGasLimit", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_withdrawalHash", - "type": "bytes32" - } - ], - "name": "numProofSubmitters", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "params", - "outputs": [ - { - "internalType": "uint128", - "name": "prevBaseFee", - "type": "uint128" - }, - { - "internalType": "uint64", - "name": "prevBoughtGas", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "prevBlockNum", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proofMaturityDelaySeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "proofSubmitters", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Types.WithdrawalTransaction", - "name": "_tx", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "_disputeGameIndex", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "version", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "stateRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "messagePasserStorageRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "latestBlockhash", - "type": "bytes32" - } - ], - "internalType": "struct Types.OutputRootProof", - "name": "_outputRootProof", - "type": "tuple" - }, - { - "internalType": "bytes[]", - "name": "_withdrawalProof", - "type": "bytes[]" - } - ], - "name": "proveWithdrawalTransaction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Types.WithdrawalTransaction", - "name": "_tx", - "type": "tuple" - }, - { - "internalType": "contract IDisputeGame", - "name": "_disputeGameProxy", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_outputRootIndex", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "bytes1", - "name": "version", - "type": "bytes1" - }, - { - "internalType": "uint64", - "name": "timestamp", - "type": "uint64" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "internalType": "struct Types.OutputRootWithChainId[]", - "name": "outputRoots", - "type": "tuple[]" - } - ], - "internalType": "struct Types.SuperRootProof", - "name": "_superRootProof", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "version", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "stateRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "messagePasserStorageRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "latestBlockhash", - "type": "bytes32" - } - ], - "internalType": "struct Types.OutputRootProof", - "name": "_outputRootProof", - "type": "tuple" - }, - { - "internalType": "bytes[]", - "name": "_withdrawalProof", - "type": "bytes[]" - } - ], - "name": "proveWithdrawalTransaction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "provenWithdrawals", - "outputs": [ - { - "internalType": "contract IDisputeGame", - "name": "disputeGameProxy", - "type": "address" - }, - { - "internalType": "uint64", - "name": "timestamp", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxyAdminOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "respectedGameType", - "outputs": [ - { - "internalType": "GameType", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "respectedGameTypeUpdatedAt", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ConfigType", - "name": "_type", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "_value", - "type": "bytes" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "superRootsActive", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "superchainConfig", - "outputs": [ - { - "internalType": "contract ISuperchainConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "systemConfig", - "outputs": [ - { - "internalType": "contract ISystemConfig", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IAnchorStateRegistry", - "name": "_anchorStateRegistry", - "type": "address" - }, - { - "internalType": "contract IETHLockbox", - "name": "_ethLockbox", - "type": "address" - } - ], - "name": "upgrade", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lockbox", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ethBalance", - "type": "uint256" - } - ], - "name": "ETHMigrated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract IETHLockbox", - "name": "oldLockbox", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IETHLockbox", - "name": "newLockbox", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IAnchorStateRegistry", - "name": "oldAnchorStateRegistry", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IAnchorStateRegistry", - "name": "newAnchorStateRegistry", - "type": "address" - } - ], - "name": "PortalMigrated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "version", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "opaqueData", - "type": "bytes" - } - ], - "name": "TransactionDeposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "withdrawalHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "name": "WithdrawalFinalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "withdrawalHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "WithdrawalProven", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "withdrawalHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "proofSubmitter", - "type": "address" - } - ], - "name": "WithdrawalProvenExtension1", - "type": "event" - }, - { - "inputs": [], - "name": "ContentLengthMismatch", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyItem", - "type": "error" - }, - { - "inputs": [], - "name": "Encoding_EmptySuperRoot", - "type": "error" - }, - { - "inputs": [], - "name": "Encoding_InvalidSuperRootVersion", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidDataRemainder", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidHeader", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_AlreadyFinalized", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_BadTarget", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_CallPaused", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_CalldataTooLarge", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_GasEstimation", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_GasLimitTooLow", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_ImproperDisputeGame", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidDisputeGame", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidMerkleProof", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidOutputRootChainId", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidOutputRootIndex", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidOutputRootProof", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidProofTimestamp", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidRootClaim", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_InvalidSuperRootProof", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_MigratingToSameRegistry", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_NoReentrancy", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_ProofNotOldEnough", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_Unauthorized", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_Unproven", - "type": "error" - }, - { - "inputs": [], - "name": "OptimismPortal_WrongProofMethod", - "type": "error" - }, - { - "inputs": [], - "name": "OutOfGas", - "type": "error" - }, - { - "inputs": [], - "name": "ReinitializableBase_ZeroInitVersion", - "type": "error" - }, - { - "inputs": [], - "name": "UnexpectedList", - "type": "error" - }, - { - "inputs": [], - "name": "UnexpectedString", - "type": "error" - } -] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json b/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json index 24b27063f3423..cdc8ab052f22d 100644 --- a/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json +++ b/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json @@ -519,6 +519,11 @@ "name": "InvalidCrossDomainSender", "type": "error" }, + { + "inputs": [], + "name": "Permit2AllowanceIsFixedAtInfinity", + "type": "error" + }, { "inputs": [], "name": "Unauthorized", diff --git a/packages/contracts-bedrock/snapshots/abi/SystemConfigInterop.json b/packages/contracts-bedrock/snapshots/abi/SystemConfigInterop.json deleted file mode 100644 index c11d382aa528f..0000000000000 --- a/packages/contracts-bedrock/snapshots/abi/SystemConfigInterop.json +++ /dev/null @@ -1,1041 +0,0 @@ -[ - { - "inputs": [], - "name": "BATCH_INBOX_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DISPUTE_GAME_FACTORY_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "L1_CROSS_DOMAIN_MESSENGER_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "L1_ERC_721_BRIDGE_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "L1_STANDARD_BRIDGE_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPTIMISM_PORTAL_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "START_BLOCK_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "UNSAFE_BLOCK_SIGNER_SLOT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "VERSION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_chainId", - "type": "uint256" - } - ], - "name": "addDependency", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "basefeeScalar", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "batchInbox", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "batcherHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "blobbasefeeScalar", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "dependencyManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "disputeGameFactory", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip1559Denominator", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip1559Elasticity", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "gasLimit", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAddresses", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "l1CrossDomainMessenger", - "type": "address" - }, - { - "internalType": "address", - "name": "l1ERC721Bridge", - "type": "address" - }, - { - "internalType": "address", - "name": "l1StandardBridge", - "type": "address" - }, - { - "internalType": "address", - "name": "disputeGameFactory", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismPortal", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismMintableERC20Factory", - "type": "address" - } - ], - "internalType": "struct SystemConfig.Addresses", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initVersion", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "uint32", - "name": "_basefeeScalar", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "_blobbasefeeScalar", - "type": "uint32" - }, - { - "internalType": "bytes32", - "name": "_batcherHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "_gasLimit", - "type": "uint64" - }, - { - "internalType": "address", - "name": "_unsafeBlockSigner", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint32", - "name": "maxResourceLimit", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "elasticityMultiplier", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "baseFeeMaxChangeDenominator", - "type": "uint8" - }, - { - "internalType": "uint32", - "name": "minimumBaseFee", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "systemTxMaxGas", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "maximumBaseFee", - "type": "uint128" - } - ], - "internalType": "struct IResourceMetering.ResourceConfig", - "name": "_config", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_batchInbox", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "l1CrossDomainMessenger", - "type": "address" - }, - { - "internalType": "address", - "name": "l1ERC721Bridge", - "type": "address" - }, - { - "internalType": "address", - "name": "l1StandardBridge", - "type": "address" - }, - { - "internalType": "address", - "name": "disputeGameFactory", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismPortal", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismMintableERC20Factory", - "type": "address" - } - ], - "internalType": "struct SystemConfig.Addresses", - "name": "_addresses", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "_l2ChainId", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "uint32", - "name": "_basefeeScalar", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "_blobbasefeeScalar", - "type": "uint32" - }, - { - "internalType": "bytes32", - "name": "_batcherHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "_gasLimit", - "type": "uint64" - }, - { - "internalType": "address", - "name": "_unsafeBlockSigner", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint32", - "name": "maxResourceLimit", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "elasticityMultiplier", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "baseFeeMaxChangeDenominator", - "type": "uint8" - }, - { - "internalType": "uint32", - "name": "minimumBaseFee", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "systemTxMaxGas", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "maximumBaseFee", - "type": "uint128" - } - ], - "internalType": "struct IResourceMetering.ResourceConfig", - "name": "_config", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_batchInbox", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "l1CrossDomainMessenger", - "type": "address" - }, - { - "internalType": "address", - "name": "l1ERC721Bridge", - "type": "address" - }, - { - "internalType": "address", - "name": "l1StandardBridge", - "type": "address" - }, - { - "internalType": "address", - "name": "disputeGameFactory", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismPortal", - "type": "address" - }, - { - "internalType": "address", - "name": "optimismMintableERC20Factory", - "type": "address" - } - ], - "internalType": "struct SystemConfig.Addresses", - "name": "_addresses", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_dependencyManager", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_l2ChainId", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "l1CrossDomainMessenger", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "l1ERC721Bridge", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "l1StandardBridge", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "l2ChainId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumGasLimit", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "minimumGasLimit", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "operatorFeeConstant", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "operatorFeeScalar", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "optimismMintableERC20Factory", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "optimismPortal", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "overhead", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_chainId", - "type": "uint256" - } - ], - "name": "removeDependency", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "resourceConfig", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "maxResourceLimit", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "elasticityMultiplier", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "baseFeeMaxChangeDenominator", - "type": "uint8" - }, - { - "internalType": "uint32", - "name": "minimumBaseFee", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "systemTxMaxGas", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "maximumBaseFee", - "type": "uint128" - } - ], - "internalType": "struct IResourceMetering.ResourceConfig", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "scalar", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_batcherHash", - "type": "bytes32" - } - ], - "name": "setBatcherHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_denominator", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "_elasticity", - "type": "uint32" - } - ], - "name": "setEIP1559Params", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_overhead", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_scalar", - "type": "uint256" - } - ], - "name": "setGasConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_basefeeScalar", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "_blobbasefeeScalar", - "type": "uint32" - } - ], - "name": "setGasConfigEcotone", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "_gasLimit", - "type": "uint64" - } - ], - "name": "setGasLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_operatorFeeScalar", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "_operatorFeeConstant", - "type": "uint64" - } - ], - "name": "setOperatorFeeScalars", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_unsafeBlockSigner", - "type": "address" - } - ], - "name": "setUnsafeBlockSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "startBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "startBlock_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unsafeBlockSigner", - "outputs": [ - { - "internalType": "address", - "name": "addr_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_l2ChainId", - "type": "uint256" - } - ], - "name": "upgrade", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "version", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "enum SystemConfig.UpdateType", - "name": "updateType", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "ConfigUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "ReinitializableBase_ZeroInitVersion", - "type": "error" - } -] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/semver-lock.json b/packages/contracts-bedrock/snapshots/semver-lock.json index 5272f8721ea80..afb7d99f5f582 100644 --- a/packages/contracts-bedrock/snapshots/semver-lock.json +++ b/packages/contracts-bedrock/snapshots/semver-lock.json @@ -20,17 +20,13 @@ "sourceCodeHash": "0x44797707aea8c63dec049a02d69ea056662a06e5cf320028ab8b388634bf1c67" }, "src/L1/OPContractsManager.sol:OPContractsManager": { - "initCodeHash": "0xbe05d8be3a52f8d3700d9c6a99dde5be57dc85ad4e02eea17a9884db1ffbe760", - "sourceCodeHash": "0xa6e8f1a900ab1e9c50f666668126d764e10737e74aff056342baa36d63f20a48" + "initCodeHash": "0x04ecca6917f73f77cf808097e48bf2fb025393907982438ae6fd9810f0f271b7", + "sourceCodeHash": "0x75ed03f4fbf1039e0f4df0c36de6944f341aa980d1e6d9087f8baceb3b19c851" }, "src/L1/OptimismPortal2.sol:OptimismPortal2": { "initCodeHash": "0xbc7db7b1016025228d99a40db1760290b333bb90563dff5514fd253fd91019ba", "sourceCodeHash": "0x367e0a1c609e3c82db41a8c5e056108cbbae58d61bfeb08707449655485ba8ab" }, - "src/L1/OptimismPortalInterop.sol:OptimismPortalInterop": { - "initCodeHash": "0x1f46f4d541697fb2c3aea36170d27dbc1a5cd5c0adb2bdf195ba6c7b53c1a70b", - "sourceCodeHash": "0x7d578d9ba963da4ef83e445912772b21e4dc011d2f038243202ccae6e15520b4" - }, "src/L1/ProtocolVersions.sol:ProtocolVersions": { "initCodeHash": "0x5a76c8530cb24cf23d3baacc6eefaac226382af13f1e2a35535d2ec2b0573b29", "sourceCodeHash": "0xb3e32b18c95d4940980333e1e99b4dcf42d8a8bfce78139db4dc3fb06e9349d0" @@ -43,21 +39,17 @@ "initCodeHash": "0x471ac69544fdee81d0734b87151297ad4cf91ca1d43a2c95e9e644c0424eed65", "sourceCodeHash": "0x8c3ccb8f3718c00c3f9bf7c866a22d87ea18a87a6e9454c31d1c97638107434c" }, - "src/L1/SystemConfigInterop.sol:SystemConfigInterop": { - "initCodeHash": "0xcdca84b074ddfd6b4e4df1a57d3500c1d48ecf88852af47f6351e9ae24b6fc2a", - "sourceCodeHash": "0x71914fa1408befaef3a06a67404e0ab580d9d945e068ba23063ea6588f0f68a6" - }, "src/L2/BaseFeeVault.sol:BaseFeeVault": { "initCodeHash": "0xc403d4c555d8e69a2699e01d192ae7327136701fa02da10a6d75a584b3c364c9", "sourceCodeHash": "0xfa56426153227e798150f6becc30a33fd20a3c6e0d73c797a3922dd631acbb57" }, "src/L2/CrossL2Inbox.sol:CrossL2Inbox": { - "initCodeHash": "0x2bc4a3765004f9a9e6e5278753bce3c3d53cc95da62efcc0cb10c50d8c806cd4", - "sourceCodeHash": "0x661d7659f09b7f909e8bd5e6c41e8c98f2091036ed2123b7e18a1a74120bd849" + "initCodeHash": "0x1308d4d3ebd857c6df9901fccc1d2ffc10f1d17b0cc1b14f58135f9ea9cad7a3", + "sourceCodeHash": "0xb397f483d1d1e5bd15ab0184e9d994f662393c51e9f6d524bfc45e5f1d935601" }, "src/L2/ETHLiquidity.sol:ETHLiquidity": { - "initCodeHash": "0x776ece4a1bb24d97287806769470327641da240b083898a90943e2844957cc46", - "sourceCodeHash": "0xe5c08ce62327113e4bbaf29f47e5f1ddfad6fbd63c07132eedfba5af5325f331" + "initCodeHash": "0xfcb50f32bbbd7e426f83c5c320ea655b896c026324a5e51983c1b15041ef88ca", + "sourceCodeHash": "0x91e93fa27b6927d61039f5d8d22be9ec780583bcdba90a4c78c6e7945d5a9a81" }, "src/L2/GasPriceOracle.sol:GasPriceOracle": { "initCodeHash": "0x38ef70b2783dd45ad807afcf57972c7df4abaaeb5d16d17cdb451b9e931a9cbb", @@ -68,8 +60,8 @@ "sourceCodeHash": "0xd04d64355dcf55247ac937748518e7f9620ae3f9eabe80fae9a82c0115ed77bc" }, "src/L2/L1BlockInterop.sol:L1BlockInterop": { - "initCodeHash": "0x55d09f00ad284fd7ca4b55c45fb901ed021b83118012be217aec53876ab34c12", - "sourceCodeHash": "0x7dd627c198a583fbe2c7d257f06001e1a2e563c6c7d79ea6ba9ca0d47cd1599b" + "initCodeHash": "0xa19bc53228445924ae016d499e42ad5bcc33f45e7a3b0c51e2f930ffb8dacd7a", + "sourceCodeHash": "0xe959a150ea9ef814b13cdba6b9e9a4bf991e5c1325aa22c49795ce06cc35a8cd" }, "src/L2/L1FeeVault.sol:L1FeeVault": { "initCodeHash": "0x6745b7be3895a5e8d373df0066d931bae29c47672ac46c2f5829bd0052cc6d9e", @@ -96,8 +88,8 @@ "sourceCodeHash": "0xaef8ea36c5b78cd12e0e62811d51db627ccf0dfd2cc5479fb707a10ef0d42048" }, "src/L2/L2ToL2CrossDomainMessenger.sol:L2ToL2CrossDomainMessenger": { - "initCodeHash": "0xc56db8cb569efa0467fd53ab3fa218af3051e54f5517d7fafb7b5831b4350618", - "sourceCodeHash": "0x72062343a044e9c56f4143dcfc71706286eb205902006c2afcf6a4cd90c3e9f8" + "initCodeHash": "0x2a6f9f717ca67d7920af1135a048e6cc3f1f655edc9aa72b6e00f23730319695", + "sourceCodeHash": "0x21590b7204311d006de0044a7c8f1c92e5468276e6db29e13c6103454c39c6d1" }, "src/L2/OperatorFeeVault.sol:OperatorFeeVault": { "initCodeHash": "0x3d8c0d7736e8767f2f797da1c20c5fe30bd7f48a4cf75f376290481ad7c0f91f", @@ -129,15 +121,15 @@ }, "src/L2/SuperchainERC20.sol:SuperchainERC20": { "initCodeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", - "sourceCodeHash": "0x981dca5b09da9038a9dff071b40a880e1b52b20268c6780ef54be3bc98a4f629" + "sourceCodeHash": "0x5fd3259418010699c51e1ecfa4dc6aa707b7debb606b0bdc2176b5b34916e217" }, "src/L2/SuperchainTokenBridge.sol:SuperchainTokenBridge": { "initCodeHash": "0x6b568ed564aede82a3a4cbcdb51282cad0e588a3fe6d91cf76616d3113df3901", "sourceCodeHash": "0xcd2b49cb7cf6d18616ee8bec9183fe5b5b460941875bc0b4158c4d5390ec3b0c" }, "src/L2/SuperchainWETH.sol:SuperchainWETH": { - "initCodeHash": "0x545686820e440d72529c815b7406844272d5ec33b741b2be6ebbe3a3db1ca8ad", - "sourceCodeHash": "0x6145e61cc0a0c95db882a76ecffea15c358c2b574d5157e53b85a69908701613" + "initCodeHash": "0xc865e00858668be0eba7d0062a88aa0554b8f8fdae1db67cd8e1ab04cd014cde", + "sourceCodeHash": "0x05f70cd9358ae4a17ace23f568c7952f8a81099278da6a46a601b8a101280a7e" }, "src/L2/WETH.sol:WETH": { "initCodeHash": "0x38b396fc35d72e8013bad2fe8d7dea5285499406d4c4b62e27c54252e1e0f00a", diff --git a/packages/contracts-bedrock/snapshots/storageLayout/L1BlockInterop.json b/packages/contracts-bedrock/snapshots/storageLayout/L1BlockInterop.json index d7f312e0bf7ad..2c23f06367859 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/L1BlockInterop.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/L1BlockInterop.json @@ -89,12 +89,5 @@ "offset": 8, "slot": "8", "type": "uint32" - }, - { - "bytes": "64", - "label": "dependencySet", - "offset": 0, - "slot": "9", - "type": "struct EnumerableSet.UintSet" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerDeployerInterop.json b/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerDeployerInterop.json deleted file mode 100644 index 0637a088a01e8..0000000000000 --- a/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerDeployerInterop.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/storageLayout/OptimismPortalInterop.json b/packages/contracts-bedrock/snapshots/storageLayout/OptimismPortalInterop.json deleted file mode 100644 index a66c4b71b4d16..0000000000000 --- a/packages/contracts-bedrock/snapshots/storageLayout/OptimismPortalInterop.json +++ /dev/null @@ -1,149 +0,0 @@ -[ - { - "bytes": "1", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "uint8" - }, - { - "bytes": "1", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "bool" - }, - { - "bytes": "32", - "label": "params", - "offset": 0, - "slot": "1", - "type": "struct ResourceMetering.ResourceParams" - }, - { - "bytes": "1536", - "label": "__gap", - "offset": 0, - "slot": "2", - "type": "uint256[48]" - }, - { - "bytes": "20", - "label": "l2Sender", - "offset": 0, - "slot": "50", - "type": "address" - }, - { - "bytes": "32", - "label": "finalizedWithdrawals", - "offset": 0, - "slot": "51", - "type": "mapping(bytes32 => bool)" - }, - { - "bytes": "32", - "label": "spacer_52_0_32", - "offset": 0, - "slot": "52", - "type": "bytes32" - }, - { - "bytes": "1", - "label": "spacer_53_0_1", - "offset": 0, - "slot": "53", - "type": "bool" - }, - { - "bytes": "20", - "label": "superchainConfig", - "offset": 1, - "slot": "53", - "type": "contract ISuperchainConfig" - }, - { - "bytes": "20", - "label": "spacer_54_0_20", - "offset": 0, - "slot": "54", - "type": "address" - }, - { - "bytes": "20", - "label": "systemConfig", - "offset": 0, - "slot": "55", - "type": "contract ISystemConfig" - }, - { - "bytes": "20", - "label": "spacer_56_0_20", - "offset": 0, - "slot": "56", - "type": "address" - }, - { - "bytes": "32", - "label": "provenWithdrawals", - "offset": 0, - "slot": "57", - "type": "mapping(bytes32 => mapping(address => struct OptimismPortal2.ProvenWithdrawal))" - }, - { - "bytes": "32", - "label": "spacer_58_0_32", - "offset": 0, - "slot": "58", - "type": "bytes32" - }, - { - "bytes": "4", - "label": "spacer_59_0_4", - "offset": 0, - "slot": "59", - "type": "GameType" - }, - { - "bytes": "8", - "label": "spacer_59_4_8", - "offset": 4, - "slot": "59", - "type": "uint64" - }, - { - "bytes": "32", - "label": "proofSubmitters", - "offset": 0, - "slot": "60", - "type": "mapping(bytes32 => address[])" - }, - { - "bytes": "32", - "label": "spacer_61_0_32", - "offset": 0, - "slot": "61", - "type": "uint256" - }, - { - "bytes": "20", - "label": "anchorStateRegistry", - "offset": 0, - "slot": "62", - "type": "contract IAnchorStateRegistry" - }, - { - "bytes": "20", - "label": "ethLockbox", - "offset": 0, - "slot": "63", - "type": "contract IETHLockbox" - }, - { - "bytes": "1", - "label": "superRootsActive", - "offset": 20, - "slot": "63", - "type": "bool" - } -] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/storageLayout/SystemConfigInterop.json b/packages/contracts-bedrock/snapshots/storageLayout/SystemConfigInterop.json deleted file mode 100644 index 3d1796e5e4063..0000000000000 --- a/packages/contracts-bedrock/snapshots/storageLayout/SystemConfigInterop.json +++ /dev/null @@ -1,121 +0,0 @@ -[ - { - "bytes": "1", - "label": "_initialized", - "offset": 0, - "slot": "0", - "type": "uint8" - }, - { - "bytes": "1", - "label": "_initializing", - "offset": 1, - "slot": "0", - "type": "bool" - }, - { - "bytes": "1600", - "label": "__gap", - "offset": 0, - "slot": "1", - "type": "uint256[50]" - }, - { - "bytes": "20", - "label": "_owner", - "offset": 0, - "slot": "51", - "type": "address" - }, - { - "bytes": "1568", - "label": "__gap", - "offset": 0, - "slot": "52", - "type": "uint256[49]" - }, - { - "bytes": "32", - "label": "overhead", - "offset": 0, - "slot": "101", - "type": "uint256" - }, - { - "bytes": "32", - "label": "scalar", - "offset": 0, - "slot": "102", - "type": "uint256" - }, - { - "bytes": "32", - "label": "batcherHash", - "offset": 0, - "slot": "103", - "type": "bytes32" - }, - { - "bytes": "8", - "label": "gasLimit", - "offset": 0, - "slot": "104", - "type": "uint64" - }, - { - "bytes": "4", - "label": "basefeeScalar", - "offset": 8, - "slot": "104", - "type": "uint32" - }, - { - "bytes": "4", - "label": "blobbasefeeScalar", - "offset": 12, - "slot": "104", - "type": "uint32" - }, - { - "bytes": "32", - "label": "_resourceConfig", - "offset": 0, - "slot": "105", - "type": "struct IResourceMetering.ResourceConfig" - }, - { - "bytes": "4", - "label": "eip1559Denominator", - "offset": 0, - "slot": "106", - "type": "uint32" - }, - { - "bytes": "4", - "label": "eip1559Elasticity", - "offset": 4, - "slot": "106", - "type": "uint32" - }, - { - "bytes": "4", - "label": "operatorFeeScalar", - "offset": 8, - "slot": "106", - "type": "uint32" - }, - { - "bytes": "8", - "label": "operatorFeeConstant", - "offset": 12, - "slot": "106", - "type": "uint64" - }, - { - "bytes": "32", - "label": "l2ChainId", - "offset": 0, - "slot": "107", - "type": "uint256" - } -] \ No newline at end of file diff --git a/packages/contracts-bedrock/src/L1/OPContractsManager.sol b/packages/contracts-bedrock/src/L1/OPContractsManager.sol index cca2cc3bc0594..556b07cc38342 100644 --- a/packages/contracts-bedrock/src/L1/OPContractsManager.sol +++ b/packages/contracts-bedrock/src/L1/OPContractsManager.sol @@ -29,7 +29,6 @@ import { IL1ERC721Bridge } from "interfaces/L1/IL1ERC721Bridge.sol"; import { IL1StandardBridge } from "interfaces/L1/IL1StandardBridge.sol"; import { IOptimismMintableERC20Factory } from "interfaces/universal/IOptimismMintableERC20Factory.sol"; import { IHasSuperchainConfig } from "interfaces/L1/IHasSuperchainConfig.sol"; -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; import { IETHLockbox } from "interfaces/L1/IETHLockbox.sol"; contract OPContractsManagerContractsContainer { @@ -1178,52 +1177,6 @@ contract OPContractsManagerDeployer is OPContractsManagerBase { } } -contract OPContractsManagerDeployerInterop is OPContractsManagerDeployer { - constructor(OPContractsManagerContractsContainer _contractsContainer) - OPContractsManagerDeployer(_contractsContainer) - { } - - // The `SystemConfigInterop` contract has an extra `address _dependencyManager` argument - // that we must account for. - function encodeSystemConfigInitializer( - OPContractsManager.DeployInput memory _input, - OPContractsManager.DeployOutput memory _output - ) - internal - view - virtual - override - returns (bytes memory) - { - (IResourceMetering.ResourceConfig memory referenceResourceConfig, ISystemConfig.Addresses memory opChainAddrs) = - defaultSystemConfigParams(_input, _output); - - // TODO For now we assume that the dependency manager is the same as system config owner. - // This is currently undefined since it's not part of the standard config, so we may need - // to update where this value is pulled from in the future. To support a different dependency - // manager in this contract without an invasive change of redefining the `Roles` struct, - // we will make the change described in https://github.com/ethereum-optimism/optimism/issues/11783. - address dependencyManager = address(_input.roles.systemConfigOwner); - - return abi.encodeCall( - ISystemConfigInterop.initialize, - ( - _input.roles.systemConfigOwner, - _input.basefeeScalar, - _input.blobBasefeeScalar, - bytes32(uint256(uint160(_input.roles.batcher))), // batcherHash - _input.gasLimit, - _input.roles.unsafeBlockSigner, - referenceResourceConfig, - chainIdToBatchInboxAddress(_input.l2ChainId), - opChainAddrs, - dependencyManager, - _input.l2ChainId - ) - ); - } -} - contract OPContractsManager is ISemver { // -------- Structs -------- @@ -1341,9 +1294,9 @@ contract OPContractsManager is ISemver { // -------- Constants and Variables -------- - /// @custom:semver 1.11.0 + /// @custom:semver 1.11.1 function version() public pure virtual returns (string memory) { - return "1.11.0"; + return "1.11.1"; } OPContractsManagerGameTypeAdder public immutable opcmGameTypeAdder; diff --git a/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol b/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol deleted file mode 100644 index 86ebf1cf2ff26..0000000000000 --- a/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Contracts -import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; - -// Libraries -import { Predeploys } from "src/libraries/Predeploys.sol"; -import { Constants } from "src/libraries/Constants.sol"; - -// Interfaces -import { IL1BlockInterop, ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; - -/// @custom:proxied true -/// @title OptimismPortalInterop -/// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1 -/// and L2. Messages sent directly to the OptimismPortal have no form of replayability. -/// Users are encouraged to use the L1CrossDomainMessenger for a higher-level interface. -contract OptimismPortalInterop is OptimismPortal2 { - /// @param _proofMaturityDelaySeconds The proof maturity delay in seconds. - constructor(uint256 _proofMaturityDelaySeconds) OptimismPortal2(_proofMaturityDelaySeconds) { } - - /// @custom:semver +interop.5 - function version() public pure override returns (string memory) { - return string.concat(super.version(), "+interop.5"); - } - - /// @notice Sets static configuration options for the L2 system. - /// @param _type Type of configuration to set. - /// @param _value Encoded value of the configuration. - function setConfig(ConfigType _type, bytes memory _value) external { - if (msg.sender != address(systemConfig)) revert OptimismPortal_Unauthorized(); - - // Set L2 deposit gas as used without paying burning gas. Ensures that deposits cannot use too much L2 gas. - // This value must be large enough to cover the cost of calling `L1Block.setConfig`. - useGas(SYSTEM_DEPOSIT_GAS_LIMIT); - - // Emit the special deposit transaction directly that sets the config in the L1Block predeploy contract. - emit TransactionDeposited( - Constants.DEPOSITOR_ACCOUNT, - Predeploys.L1_BLOCK_ATTRIBUTES, - DEPOSIT_VERSION, - abi.encodePacked( - uint256(0), // mint - uint256(0), // value - uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit - false, // isCreation, - abi.encodeCall(IL1BlockInterop.setConfig, (_type, _value)) - ) - ); - } -} diff --git a/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol b/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol deleted file mode 100644 index fc4135c088326..0000000000000 --- a/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Contracts -import { SystemConfig } from "src/L1/SystemConfig.sol"; - -// Libraries -import { StaticConfig } from "src/libraries/StaticConfig.sol"; -import { Storage } from "src/libraries/Storage.sol"; - -// Interfaces -import { IOptimismPortalInterop as IOptimismPortal } from "interfaces/L1/IOptimismPortalInterop.sol"; -import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol"; -import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; - -/// @custom:proxied true -/// @title SystemConfigInterop -/// @notice The SystemConfig contract is used to manage configuration of an Optimism network. -/// All configuration is stored on L1 and picked up by L2 as part of the derviation of -/// the L2 chain. -contract SystemConfigInterop is SystemConfig { - /// @notice Storage slot where the dependency manager address is stored - /// @dev Equal to bytes32(uint256(keccak256("systemconfig.dependencymanager")) - 1) - bytes32 internal constant DEPENDENCY_MANAGER_SLOT = - 0x1708e077affb93e89be2665fb0fb72581be66f84dc00d25fed755ae911905b1c; - - /// @notice Initializer. - /// @param _owner Initial owner of the contract. - /// @param _basefeeScalar Initial basefee scalar value. - /// @param _blobbasefeeScalar Initial blobbasefee scalar value. - /// @param _batcherHash Initial batcher hash. - /// @param _gasLimit Initial gas limit. - /// @param _unsafeBlockSigner Initial unsafe block signer address. - /// @param _config Initial ResourceConfig. - /// @param _batchInbox Batch inbox address. An identifier for the op-node to find - /// canonical data. - /// @param _addresses Set of L1 contract addresses. These should be the proxies. - /// @param _dependencyManager The addressed allowed to add/remove from the dependency set - function initialize( - address _owner, - uint32 _basefeeScalar, - uint32 _blobbasefeeScalar, - bytes32 _batcherHash, - uint64 _gasLimit, - address _unsafeBlockSigner, - IResourceMetering.ResourceConfig memory _config, - address _batchInbox, - SystemConfig.Addresses memory _addresses, - address _dependencyManager, - uint256 _l2ChainId - ) - external - { - // This method has an initializer modifier, and will revert if already initialized. - initialize({ - _owner: _owner, - _basefeeScalar: _basefeeScalar, - _blobbasefeeScalar: _blobbasefeeScalar, - _batcherHash: _batcherHash, - _gasLimit: _gasLimit, - _unsafeBlockSigner: _unsafeBlockSigner, - _config: _config, - _batchInbox: _batchInbox, - _addresses: _addresses, - _l2ChainId: _l2ChainId - }); - Storage.setAddress(DEPENDENCY_MANAGER_SLOT, _dependencyManager); - } - - /// @custom:semver +interop.2 - function version() public pure override returns (string memory) { - return string.concat(super.version(), "+interop.2"); - } - - /// @notice Adds a chain to the interop dependency set. Can only be called by the dependency manager. - /// @param _chainId Chain ID of chain to add. - function addDependency(uint256 _chainId) external { - require(msg.sender == dependencyManager(), "SystemConfig: caller is not the dependency manager"); - IOptimismPortal(payable(optimismPortal())).setConfig( - ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId) - ); - } - - /// @notice Removes a chain from the interop dependency set. Can only be called by the dependency manager - /// @param _chainId Chain ID of the chain to remove. - function removeDependency(uint256 _chainId) external { - require(msg.sender == dependencyManager(), "SystemConfig: caller is not the dependency manager"); - IOptimismPortal(payable(optimismPortal())).setConfig( - ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId) - ); - } - - /// @notice getter for the dependency manager address - function dependencyManager() public view returns (address) { - return Storage.getAddress(DEPENDENCY_MANAGER_SLOT); - } -} diff --git a/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol b/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol index 59f082cbe0ecd..39ce43bc73a56 100644 --- a/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol +++ b/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol @@ -3,25 +3,20 @@ pragma solidity 0.8.25; // Libraries import { Predeploys } from "src/libraries/Predeploys.sol"; -import { TransientContext, TransientReentrancyAware } from "src/libraries/TransientContext.sol"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; import { IL1BlockInterop } from "interfaces/L2/IL1BlockInterop.sol"; -/// @notice Thrown when the caller is not DEPOSITOR_ACCOUNT when calling `setInteropStart()` -error NotDepositor(); - -/// @notice Thrown when attempting to set interop start when it's already set. -error InteropStartAlreadySet(); - -/// @notice Thrown when a non-written transient storage slot is attempted to be read from. -error NotEntered(); - /// @notice Thrown when trying to execute a cross chain message on a deposit transaction. error NoExecutingDeposits(); /// @notice The struct for a pointer to a message payload in a remote (or local) chain. +/// @custom:field origin The origin address of the message. +/// @custom:field blockNumber The block number of the message. +/// @custom:field logIndex The log index of the message. +/// @custom:field timestamp The timestamp of the message. +/// @custom:field chainId The origin chain ID of the message. struct Identifier { address origin; uint256 blockNumber; @@ -35,97 +30,16 @@ struct Identifier { /// @title CrossL2Inbox /// @notice The CrossL2Inbox is responsible for executing a cross chain message on the destination /// chain. It is permissionless to execute a cross chain message on behalf of any user. -contract CrossL2Inbox is ISemver, TransientReentrancyAware { - /// @notice Storage slot that the interop start timestamp is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.interopstart")) - 1) - bytes32 internal constant INTEROP_START_SLOT = 0x5c769ee0ee8887661922049dc52480bb60322d765161507707dd9b190af5c149; - - /// @notice Transient storage slot that the origin for an Identifier is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.origin")) - 1) - bytes32 internal constant ORIGIN_SLOT = 0xd2b7c5071ec59eb3ff0017d703a8ea513a7d0da4779b0dbefe845808c300c815; - - /// @notice Transient storage slot that the blockNumber for an Identifier is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.blocknumber")) - 1) - bytes32 internal constant BLOCK_NUMBER_SLOT = 0x5a1da0738b7fdc60047c07bb519beb02aa32a8619de57e6258da1f1c2e020ccc; - - /// @notice Transient storage slot that the logIndex for an Identifier is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.logindex")) - 1) - bytes32 internal constant LOG_INDEX_SLOT = 0xab8acc221aecea88a685fabca5b88bf3823b05f335b7b9f721ca7fe3ffb2c30d; - - /// @notice Transient storage slot that the timestamp for an Identifier is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.timestamp")) - 1) - bytes32 internal constant TIMESTAMP_SLOT = 0x2e148a404a50bb94820b576997fd6450117132387be615e460fa8c5e11777e02; - - /// @notice Transient storage slot that the chainId for an Identifier is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.chainid")) - 1) - bytes32 internal constant CHAINID_SLOT = 0x6e0446e8b5098b8c8193f964f1b567ec3a2bdaeba33d36acb85c1f1d3f92d313; - - /// @notice The address that represents the system caller responsible for L1 attributes - /// transactions. - address internal constant DEPOSITOR_ACCOUNT = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001; - +contract CrossL2Inbox is ISemver { /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.12 - string public constant version = "1.0.0-beta.12"; + /// @custom:semver 1.0.0-beta.13 + string public constant version = "1.0.0-beta.13"; /// @notice Emitted when a cross chain message is being executed. /// @param msgHash Hash of message payload being executed. /// @param id Encoded Identifier of the message. event ExecutingMessage(bytes32 indexed msgHash, Identifier id); - /// @notice Sets the Interop Start Timestamp for this chain. Can only be performed once and when the caller is the - /// DEPOSITOR_ACCOUNT. - function setInteropStart() external { - // Check that caller is the DEPOSITOR_ACCOUNT - if (msg.sender != DEPOSITOR_ACCOUNT) revert NotDepositor(); - - // Check that it has not been set already - if (interopStart() != 0) revert InteropStartAlreadySet(); - - // Set Interop Start to block.timestamp - assembly { - sstore(INTEROP_START_SLOT, timestamp()) - } - } - - /// @notice Returns the interop start timestamp. - /// @return interopStart_ interop start timestamp. - function interopStart() public view returns (uint256 interopStart_) { - assembly { - interopStart_ := sload(INTEROP_START_SLOT) - } - } - - /// @notice Returns the origin address of the Identifier. If not entered, reverts. - /// @return Origin address of the Identifier. - function origin() external view notEntered returns (address) { - return address(uint160(TransientContext.get(ORIGIN_SLOT))); - } - - /// @notice Returns the block number of the Identifier. If not entered, reverts. - /// @return Block number of the Identifier. - function blockNumber() external view notEntered returns (uint256) { - return TransientContext.get(BLOCK_NUMBER_SLOT); - } - - /// @notice Returns the log index of the Identifier. If not entered, reverts. - /// @return Log index of the Identifier. - function logIndex() external view notEntered returns (uint256) { - return TransientContext.get(LOG_INDEX_SLOT); - } - - /// @notice Returns the timestamp of the Identifier. If not entered, reverts. - /// @return Timestamp of the Identifier. - function timestamp() external view notEntered returns (uint256) { - return TransientContext.get(TIMESTAMP_SLOT); - } - - /// @notice Returns the chain ID of the Identifier. If not entered, reverts. - /// @return _chainId The chain ID of the Identifier. - function chainId() external view notEntered returns (uint256) { - return TransientContext.get(CHAINID_SLOT); - } - /// @notice Validates a cross chain message on the destination chain /// and emits an ExecutingMessage event. This function is useful /// for applications that understand the schema of the _message payload and want to @@ -138,14 +52,4 @@ contract CrossL2Inbox is ISemver, TransientReentrancyAware { emit ExecutingMessage(_msgHash, _id); } - - /// @notice Stores the Identifier in transient storage. - /// @param _id Identifier to store. - function _storeIdentifier(Identifier calldata _id) internal { - TransientContext.set(ORIGIN_SLOT, uint160(_id.origin)); - TransientContext.set(BLOCK_NUMBER_SLOT, _id.blockNumber); - TransientContext.set(LOG_INDEX_SLOT, _id.logIndex); - TransientContext.set(TIMESTAMP_SLOT, _id.timestamp); - TransientContext.set(CHAINID_SLOT, _id.chainId); - } } diff --git a/packages/contracts-bedrock/src/L2/ETHLiquidity.sol b/packages/contracts-bedrock/src/L2/ETHLiquidity.sol index 5a8c97f819b8e..6b9128e0a691a 100644 --- a/packages/contracts-bedrock/src/L2/ETHLiquidity.sol +++ b/packages/contracts-bedrock/src/L2/ETHLiquidity.sol @@ -15,7 +15,8 @@ import { ISemver } from "interfaces/universal/ISemver.sol"; /// @custom:predeploy 0x4200000000000000000000000000000000000025 /// @title ETHLiquidity /// @notice The ETHLiquidity contract allows other contracts to access ETH liquidity without -/// needing to modify the EVM to generate new ETH. +/// needing to modify the EVM to generate new ETH. Contract comes "pre-loaded" with +/// uint248.max balance to prevent liquidity shortages. contract ETHLiquidity is ISemver { /// @notice Emitted when an address burns ETH liquidity. event LiquidityBurned(address indexed caller, uint256 value); @@ -24,8 +25,8 @@ contract ETHLiquidity is ISemver { event LiquidityMinted(address indexed caller, uint256 value); /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.6 - string public constant version = "1.0.0-beta.6"; + /// @custom:semver 1.0.0-beta.7 + string public constant version = "1.0.0-beta.7"; /// @notice Allows an address to lock ETH liquidity into this contract. function burn() external payable { diff --git a/packages/contracts-bedrock/src/L2/L1BlockInterop.sol b/packages/contracts-bedrock/src/L2/L1BlockInterop.sol index 19c3130601561..224a5f0a4c018 100644 --- a/packages/contracts-bedrock/src/L2/L1BlockInterop.sol +++ b/packages/contracts-bedrock/src/L2/L1BlockInterop.sol @@ -5,50 +5,29 @@ pragma solidity 0.8.15; import { L1Block } from "src/L2/L1Block.sol"; // Libraries -import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; -import { StaticConfig } from "src/libraries/StaticConfig.sol"; import { Predeploys } from "src/libraries/Predeploys.sol"; -import { - NotDepositor, - NotCrossL2Inbox, - NotDependency, - DependencySetSizeTooLarge, - AlreadyDependency, - CantRemovedDependency -} from "src/libraries/L1BlockErrors.sol"; - -/// @notice Enum representing different types of configurations that can be set on L1BlockInterop. -/// @custom:value ADD_DEPENDENCY Represents the config type for adding a chain to the interop dependency set. -/// @custom:value REMOVE_DEPENDENCY Represents the config type for removing a chain from the interop dependency set. -enum ConfigType { - ADD_DEPENDENCY, - REMOVE_DEPENDENCY -} +import { NotDepositor, NotCrossL2Inbox } from "src/libraries/L1BlockErrors.sol"; /// @custom:proxied true /// @custom:predeploy 0x4200000000000000000000000000000000000015 /// @title L1BlockInterop -/// @notice Interop extenstions of L1Block. +/// @notice Manages deposit contexts within L2 blocks. A deposit context represents a series of +/// deposited transactions within a single block, starting with an L1 attributes transaction +/// and ending after the final deposit. +/// The expected sequence of operations in a deposit context is: +/// 1. L1 attributes transaction opens the deposit context (isDeposit = true) +/// 2. User deposits are executed (if any exist) +/// 3. L1 attributes transaction closes the deposit context (isDeposit = false) +/// Note: During upgrades, additional deposits may follow after this sequence. contract L1BlockInterop is L1Block { - using EnumerableSet for EnumerableSet.UintSet; - - /// @notice Event emitted when a new dependency is added to the interop dependency set. - event DependencyAdded(uint256 indexed chainId); - - /// @notice Event emitted when a dependency is removed from the interop dependency set. - event DependencyRemoved(uint256 indexed chainId); - - /// @notice The interop dependency set, containing the chain IDs in it. - EnumerableSet.UintSet dependencySet; - /// @notice Storage slot that the isDeposit is stored at. /// This is a custom slot that is not part of the standard storage layout. /// keccak256(abi.encode(uint256(keccak256("l1Block.identifier.isDeposit")) - 1)) & ~bytes32(uint256(0xff)) uint256 internal constant IS_DEPOSIT_SLOT = 0x921bd3a089295c6e5540e8fba8195448d253efd6f2e3e495b499b627dc36a300; - /// @custom:semver +interop.6 + /// @custom:semver +interop.7 function version() public pure override returns (string memory) { - return string.concat(super.version(), "+interop.6"); + return string.concat(super.version(), "+interop.7"); } /// @notice Returns whether the call was triggered from a a deposit or not. @@ -60,23 +39,9 @@ contract L1BlockInterop is L1Block { } } - /// @notice Returns true if a chain ID is in the interop dependency set and false otherwise. - /// The chain's chain ID is always considered to be in the dependency set. - /// @param _chainId The chain ID to check. - /// @return True if the chain ID to check is in the interop dependency set. False otherwise. - function isInDependencySet(uint256 _chainId) public view returns (bool) { - return _chainId == block.chainid || dependencySet.contains(_chainId); - } - - /// @notice Returns the size of the interop dependency set. - /// @return The size of the interop dependency set. - function dependencySetSize() external view returns (uint8) { - return uint8(dependencySet.length()); - } - - /// @notice Updates the `isDeposit` flag and sets the L1 block values for an Interop upgraded chain. - /// It updates the L1 block values through the `setL1BlockValuesEcotone` function. - /// It forwards the calldata to the internally-used `setL1BlockValuesEcotone` function. + /// @notice Updates the isDeposit flag and sets the L1 block values for an Interop upgraded chain. + /// It updates the L1 block values through the setL1BlockValuesEcotone function. + /// It forwards the calldata to the internally-used setL1BlockValuesEcotone function. function setL1BlockValuesInterop() external { // Set the isDeposit flag to true. assembly { @@ -86,8 +51,8 @@ contract L1BlockInterop is L1Block { _setL1BlockValuesEcotone(); } - /// @notice Resets the isDeposit flag. - /// Should only be called by the depositor account after the deposits are complete. + /// @notice Resets the isDeposit flag, marking the end of a deposit context. + /// @dev Should only be called by the depositor account after the deposits are complete. function depositsComplete() external { if (msg.sender != DEPOSITOR_ACCOUNT()) revert NotDepositor(); @@ -96,42 +61,4 @@ contract L1BlockInterop is L1Block { sstore(IS_DEPOSIT_SLOT, 0) } } - - /// @notice Sets static configuration options for the L2 system. Can only be called by the special - /// depositor account. - /// @param _type The type of configuration to set. - /// @param _value The encoded value with which to set the configuration. - function setConfig(ConfigType _type, bytes calldata _value) external { - if (msg.sender != DEPOSITOR_ACCOUNT()) revert NotDepositor(); - - if (_type == ConfigType.ADD_DEPENDENCY) { - _addDependency(_value); - } else if (_type == ConfigType.REMOVE_DEPENDENCY) { - _removeDependency(_value); - } - } - - /// @notice Internal method to add a dependency to the interop dependency set. - /// @param _value The encoded value with which to add the dependency. - function _addDependency(bytes calldata _value) internal { - uint256 chainId = StaticConfig.decodeAddDependency(_value); - - if (dependencySet.length() == type(uint8).max) revert DependencySetSizeTooLarge(); - - if (chainId == block.chainid || !dependencySet.add(chainId)) revert AlreadyDependency(); - - emit DependencyAdded(chainId); - } - - /// @notice Internal method to remove a dependency from the interop dependency set. - /// @param _value The encoded value with which to remove the dependency. - function _removeDependency(bytes calldata _value) internal { - uint256 chainId = StaticConfig.decodeRemoveDependency(_value); - - if (chainId == block.chainid) revert CantRemovedDependency(); - - if (!dependencySet.remove(chainId)) revert NotDependency(); - - emit DependencyRemoved(chainId); - } } diff --git a/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol b/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol index fc1f74e99c532..95c23bb3c9572 100644 --- a/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol +++ b/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol @@ -9,7 +9,6 @@ import { TransientReentrancyAware } from "src/libraries/TransientContext.sol"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; -import { IDependencySet } from "interfaces/L2/IDependencySet.sol"; import { ICrossL2Inbox, Identifier } from "interfaces/L2/ICrossL2Inbox.sol"; /// @notice Thrown when a non-written slot in transient storage is attempted to be read from. @@ -27,9 +26,6 @@ error MessageDestinationSameChain(); /// @notice Thrown when attempting to relay a message whose destination chain is not the chain relaying it. error MessageDestinationNotRelayChain(); -/// @notice Thrown when attempting to relay a message whose target is CrossL2Inbox. -error MessageTargetCrossL2Inbox(); - /// @notice Thrown when attempting to relay a message whose target is L2ToL2CrossDomainMessenger. error MessageTargetL2ToL2CrossDomainMessenger(); @@ -39,12 +35,6 @@ error MessageAlreadyRelayed(); /// @notice Thrown when a reentrant call is detected. error ReentrantCall(); -/// @notice Thrown when a call to the target contract during message relay fails. -error TargetCallFailed(); - -/// @notice Thrown when attempting to use a chain ID that is not in the dependency set. -error InvalidChainId(); - /// @custom:proxied true /// @custom:predeploy 0x4200000000000000000000000000000000000023 /// @title L2ToL2CrossDomainMessenger @@ -71,8 +61,8 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { uint16 public constant messageVersion = uint16(0); /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.14 - string public constant version = "1.0.0-beta.14"; + /// @custom:semver 1.0.0-beta.15 + string public constant version = "1.0.0-beta.15"; /// @notice Mapping of message hashes to boolean receipt values. Note that a message will only be present in this /// mapping if it has successfully been relayed on this chain, and can therefore not be relayed again. @@ -86,7 +76,7 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { /// @notice Emitted whenever a message is sent to a destination /// @param destination Chain ID of the destination chain. /// @param target Target contract or wallet address. - /// @param messageNonce Nonce associated with the messsage sent + /// @param messageNonce Nonce associated with the message sent /// @param sender Address initiating this message call /// @param message Message payload to call target with. event SentMessage( @@ -134,9 +124,7 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { /// @return The hash of the message being sent, used to track whether the message has successfully been relayed. function sendMessage(uint256 _destination, address _target, bytes calldata _message) external returns (bytes32) { if (_destination == block.chainid) revert MessageDestinationSameChain(); - if (_target == Predeploys.CROSS_L2_INBOX) revert MessageTargetCrossL2Inbox(); if (_target == Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER) revert MessageTargetL2ToL2CrossDomainMessenger(); - if (!IDependencySet(Predeploys.L1_BLOCK_ATTRIBUTES).isInDependencySet(_destination)) revert InvalidChainId(); uint256 nonce = messageNonce(); emit SentMessage(_destination, _target, nonce, msg.sender, _message); @@ -157,7 +145,7 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { /// via cross chain call from the other messenger OR if the message was already received once and is /// currently being replayed. /// @param _id Identifier of the SentMessage event to be relayed - /// @param _sentMessage Message payload of the `SentMessage` event + /// @param _sentMessage Payload of the `SentMessage` event /// @return returnData_ Return data from the target contract call. function relayMessage( Identifier calldata _id, @@ -168,8 +156,7 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { nonReentrant returns (bytes memory returnData_) { - // Ensure the log came from the messenger. Since the log origin is the CDM, there isn't a scenario where - // this can be invoked from the CrossL2Inbox as the SentMessage log is not calldata for this function + // Ensure the log came from the messenger. if (_id.origin != Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER) { revert IdOriginNotL2ToL2CrossDomainMessenger(); } @@ -183,8 +170,6 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { // Assert invariants on the message if (destination != block.chainid) revert MessageDestinationNotRelayChain(); - if (target == Predeploys.CROSS_L2_INBOX) revert MessageTargetCrossL2Inbox(); - if (target == Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER) revert MessageTargetL2ToL2CrossDomainMessenger(); uint256 source = _id.chainId; bytes32 messageHash = Hashing.hashL2toL2CrossDomainMessage({ @@ -200,16 +185,18 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { revert MessageAlreadyRelayed(); } + successfulMessages[messageHash] = true; _storeMessageMetadata(source, sender); bool success; (success, returnData_) = target.call{ value: msg.value }(message); if (!success) { - revert TargetCallFailed(); + assembly { + revert(add(32, returnData_), mload(returnData_)) + } } - successfulMessages[messageHash] = true; emit RelayedMessage(source, nonce, messageHash); _storeMessageMetadata(0, address(0)); @@ -227,11 +214,23 @@ contract L2ToL2CrossDomainMessenger is ISemver, TransientReentrancyAware { /// @param _sender Address of the sender of the message. function _storeMessageMetadata(uint256 _source, address _sender) internal { assembly { - tstore(CROSS_DOMAIN_MESSAGE_SENDER_SLOT, _sender) tstore(CROSS_DOMAIN_MESSAGE_SOURCE_SLOT, _source) + tstore(CROSS_DOMAIN_MESSAGE_SENDER_SLOT, _sender) } } + /// @notice Decodes the payload of a SentMessage event. + /// @dev The payload format is as follows: + /// encodePacked( + /// encode(event selector, destination, target, nonce), + /// encode(sender, message) + /// ) + /// @param _payload Payload of the SentMessage event. + /// @return destination_ Destination chain ID. + /// @return target_ Target contract of the message. + /// @return nonce_ Nonce associated with the messsage sent. + /// @return sender_ Address initiating this message call. + /// @return message_ Message payload to call target with. function _decodeSentMessagePayload(bytes calldata _payload) internal pure diff --git a/packages/contracts-bedrock/src/L2/SuperchainERC20.sol b/packages/contracts-bedrock/src/L2/SuperchainERC20.sol index 061c2d867b685..b4e47874fb0c8 100644 --- a/packages/contracts-bedrock/src/L2/SuperchainERC20.sol +++ b/packages/contracts-bedrock/src/L2/SuperchainERC20.sol @@ -14,13 +14,16 @@ import { ISemver } from "interfaces/universal/ISemver.sol"; import { IERC7802, IERC165 } from "interfaces/L2/IERC7802.sol"; /// @title SuperchainERC20 -/// @notice A standard ERC20 extension implementing IERC7802 for unified cross-chain fungibility across -/// the Superchain. Allows the SuperchainTokenBridge to mint and burn tokens as needed. +/// @notice A standard ERC20 extension implementing IERC7802 for unified cross-chain fungibility +/// across the Superchain. Gives the SuperchainTokenBridge mint and burn permissions. +/// @dev This contract inherits from Solady@v0.0.245 ERC20. Carefully review Solady's, +/// documentation including all warnings, comments and natSpec, before extending or +/// interacting with this contract. abstract contract SuperchainERC20 is ERC20, IERC7802, ISemver { /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.8 + /// @custom:semver 1.0.0-beta.9 function version() external view virtual returns (string memory) { - return "1.0.0-beta.8"; + return "1.0.0-beta.9"; } /// @notice Allows the SuperchainTokenBridge to mint tokens. diff --git a/packages/contracts-bedrock/src/L2/SuperchainWETH.sol b/packages/contracts-bedrock/src/L2/SuperchainWETH.sol index 989d6d55ca25a..69f92857ee9fe 100644 --- a/packages/contracts-bedrock/src/L2/SuperchainWETH.sol +++ b/packages/contracts-bedrock/src/L2/SuperchainWETH.sol @@ -20,13 +20,16 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @custom:proxied true /// @custom:predeploy 0x4200000000000000000000000000000000000024 /// @title SuperchainWETH -/// @notice SuperchainWETH is a version of WETH that can be freely transfrered between chains +/// @notice SuperchainWETH is a version of WETH that can be freely transferred between chains /// within the superchain. SuperchainWETH can be converted into native ETH on chains that /// do not use a custom gas token. contract SuperchainWETH is WETH98, IERC7802, ISemver { /// @notice Thrown when attempting to relay a message and the cross domain message sender is not SuperchainWETH. error InvalidCrossDomainSender(); + /// @notice Thrown when trying to approve Permit2 with a non-infinite allowance. + error Permit2AllowanceIsFixedAtInfinity(); + /// @notice Emitted when ETH is sent from one chain to another. /// @param from Address of the sender. /// @param to Address of the recipient. @@ -42,8 +45,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source); /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.14 - string public constant version = "1.0.0-beta.14"; + /// @custom:semver 1.0.0-beta.15 + string public constant version = "1.0.0-beta.15"; /// @inheritdoc WETH98 function allowance(address owner, address spender) public view override returns (uint256) { @@ -67,6 +70,12 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { emit Transfer(_from, address(0), _amount); } + /// @inheritdoc WETH98 + function approve(address guy, uint256 wad) public virtual override returns (bool) { + if (guy == Preinstalls.Permit2 && wad != type(uint256).max) revert Permit2AllowanceIsFixedAtInfinity(); + return super.approve(guy, wad); + } + /// @notice Allows the SuperchainTokenBridge to mint tokens. /// @param _to Address to mint tokens to. /// @param _amount Amount of tokens to mint. diff --git a/packages/contracts-bedrock/src/libraries/L1BlockErrors.sol b/packages/contracts-bedrock/src/libraries/L1BlockErrors.sol index 44e156e158c06..088b286e357e2 100644 --- a/packages/contracts-bedrock/src/libraries/L1BlockErrors.sol +++ b/packages/contracts-bedrock/src/libraries/L1BlockErrors.sol @@ -6,15 +6,3 @@ error NotDepositor(); /// @notice Error when a non-cross L2 Inbox sender tries to call the `isDeposit()` method. error NotCrossL2Inbox(); - -/// @notice Error when a chain ID is not in the interop dependency set. -error NotDependency(); - -/// @notice Error when the interop dependency set size is too large. -error DependencySetSizeTooLarge(); - -/// @notice Error when a chain ID already in the interop dependency set is attempted to be added. -error AlreadyDependency(); - -/// @notice Error when the chain's chain ID is attempted to be removed from the interop dependency set. -error CantRemovedDependency(); diff --git a/packages/contracts-bedrock/src/universal/WETH98.sol b/packages/contracts-bedrock/src/universal/WETH98.sol index c2909e6fa6f70..6c066ca7ff06f 100644 --- a/packages/contracts-bedrock/src/universal/WETH98.sol +++ b/packages/contracts-bedrock/src/universal/WETH98.sol @@ -21,6 +21,7 @@ pragma solidity 0.8.15; /// @title WETH98 /// @notice WETH98 is a version of WETH9 upgraded for Solidity 0.8.x. +/// Some functions were changed to virtual to allow for overriding in other WETH implementations. contract WETH98 { /// @notice Returns the number of decimals the token uses. /// @return The number of decimals the token uses. @@ -113,7 +114,7 @@ contract WETH98 { /// @param guy The address that is approved to transfer the WETH. /// @param wad The amount that is approved to transfer. /// @return True if the approval was successful. - function approve(address guy, uint256 wad) external returns (bool) { + function approve(address guy, uint256 wad) public virtual returns (bool) { _allowance[msg.sender][guy] = wad; emit Approval(msg.sender, guy, wad); return true; diff --git a/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol b/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol deleted file mode 100644 index 3a8c9973e62dc..0000000000000 --- a/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Testing -import { CommonTest } from "test/setup/CommonTest.sol"; - -// Libraries -import { Constants } from "src/libraries/Constants.sol"; -import { Predeploys } from "src/libraries/Predeploys.sol"; - -// Interfaces -import { IL1BlockInterop, ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; -import { IOptimismPortalInterop } from "interfaces/L1/IOptimismPortalInterop.sol"; - -contract OptimismPortalInterop_Test is CommonTest { - /// @notice Marked virtual to be overridden in - /// test/kontrol/deployment/DeploymentSummary.t.sol - function setUp() public virtual override { - super.enableInterop(); - super.setUp(); - } - - /// @notice Tests that the version function returns a valid string. We avoid testing the - /// specific value of the string as it changes frequently. - function test_version_succeeds() external view { - assert(bytes(_optimismPortalInterop().version()).length > 0); - } - - /// @dev Tests that the config for adding a dependency can be set. - function testFuzz_setConfig_addDependency_succeeds(bytes calldata _value) public { - vm.expectEmit(address(optimismPortal2)); - emitTransactionDeposited({ - _from: Constants.DEPOSITOR_ACCOUNT, - _to: Predeploys.L1_BLOCK_ATTRIBUTES, - _value: 0, - _mint: 0, - _gasLimit: 200_000, - _isCreation: false, - _data: abi.encodeCall(IL1BlockInterop.setConfig, (ConfigType.ADD_DEPENDENCY, _value)) - }); - - vm.prank(address(_optimismPortalInterop().systemConfig())); - _optimismPortalInterop().setConfig(ConfigType.ADD_DEPENDENCY, _value); - } - - /// @dev Tests that setting the add dependency config as not the system config reverts. - function testFuzz_setConfig_addDependencyButNotSystemConfig_reverts(bytes calldata _value) public { - vm.expectRevert(IOptimismPortalInterop.OptimismPortal_Unauthorized.selector); - _optimismPortalInterop().setConfig(ConfigType.ADD_DEPENDENCY, _value); - } - - /// @dev Tests that the config for removing a dependency can be set. - function testFuzz_setConfig_removeDependency_succeeds(bytes calldata _value) public { - vm.expectEmit(address(optimismPortal2)); - emitTransactionDeposited({ - _from: Constants.DEPOSITOR_ACCOUNT, - _to: Predeploys.L1_BLOCK_ATTRIBUTES, - _value: 0, - _mint: 0, - _gasLimit: 200_000, - _isCreation: false, - _data: abi.encodeCall(IL1BlockInterop.setConfig, (ConfigType.REMOVE_DEPENDENCY, _value)) - }); - - vm.prank(address(_optimismPortalInterop().systemConfig())); - _optimismPortalInterop().setConfig(ConfigType.REMOVE_DEPENDENCY, _value); - } - - /// @dev Tests that setting the remove dependency config as not the system config reverts. - function testFuzz_setConfig_removeDependencyButNotSystemConfig_reverts(bytes calldata _value) public { - vm.expectRevert(IOptimismPortalInterop.OptimismPortal_Unauthorized.selector); - _optimismPortalInterop().setConfig(ConfigType.REMOVE_DEPENDENCY, _value); - } - - /// @dev Returns the OptimismPortalInterop instance. - function _optimismPortalInterop() internal view returns (IOptimismPortalInterop) { - return IOptimismPortalInterop(payable(address(optimismPortal2))); - } -} diff --git a/packages/contracts-bedrock/test/L1/SystemConfigInterop.t.sol b/packages/contracts-bedrock/test/L1/SystemConfigInterop.t.sol deleted file mode 100644 index 2f953ef7413f4..0000000000000 --- a/packages/contracts-bedrock/test/L1/SystemConfigInterop.t.sol +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Testing -import { CommonTest } from "test/setup/CommonTest.sol"; - -// Libraries -import { StaticConfig } from "src/libraries/StaticConfig.sol"; - -// Interfaces -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; -import { IOptimismPortalInterop } from "interfaces/L1/IOptimismPortalInterop.sol"; -import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; - -contract SystemConfigInterop_Test is CommonTest { - /// @notice Marked virtual to be overridden in - /// test/kontrol/deployment/DeploymentSummary.t.sol - function setUp() public virtual override { - super.enableInterop(); - super.setUp(); - } - - /// @notice Tests that the version function returns a valid string. We avoid testing the - /// specific value of the string as it changes frequently. - function test_version_succeeds() external view { - assert(bytes(_systemConfigInterop().version()).length > 0); - } - - /// @dev Tests that a dependency can be added. - function testFuzz_addDependency_succeeds(uint256 _chainId) public { - vm.expectCall( - address(optimismPortal2), - abi.encodeCall( - IOptimismPortalInterop.setConfig, - (ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)) - ) - ); - - vm.prank(_systemConfigInterop().dependencyManager()); - _systemConfigInterop().addDependency(_chainId); - } - - /// @dev Tests that adding a dependency as not the dependency manager reverts. - function testFuzz_addDependency_notDependencyManager_reverts(uint256 _chainId) public { - require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test: 100"); - vm.expectRevert("SystemConfig: caller is not the dependency manager"); - vm.prank(alice); - _systemConfigInterop().addDependency(_chainId); - } - - /// @dev Tests that a dependency can be removed. - function testFuzz_removeDependency_succeeds(uint256 _chainId) public { - vm.expectCall( - address(optimismPortal2), - abi.encodeCall( - IOptimismPortalInterop.setConfig, - (ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId)) - ) - ); - - vm.prank(_systemConfigInterop().dependencyManager()); - _systemConfigInterop().removeDependency(_chainId); - } - - /// @dev Tests that removing a dependency as not the dependency manager reverts. - function testFuzz_removeDependency_notDependencyManager_reverts(uint256 _chainId) public { - require(alice != _systemConfigInterop().dependencyManager(), "SystemConfigInterop_Test: 100"); - vm.expectRevert("SystemConfig: caller is not the dependency manager"); - vm.prank(alice); - _systemConfigInterop().removeDependency(_chainId); - } - - /// @dev Returns the SystemConfigInterop instance. - function _systemConfigInterop() internal view returns (ISystemConfigInterop) { - return ISystemConfigInterop(address(systemConfig)); - } -} diff --git a/packages/contracts-bedrock/test/L2/CrossL2Inbox.t.sol b/packages/contracts-bedrock/test/L2/CrossL2Inbox.t.sol index 6950162546795..492eeab8613ad 100644 --- a/packages/contracts-bedrock/test/L2/CrossL2Inbox.t.sol +++ b/packages/contracts-bedrock/test/L2/CrossL2Inbox.t.sol @@ -1,153 +1,36 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.25; +pragma solidity 0.8.15; // Testing utilities -import { Test } from "forge-std/Test.sol"; +import { CommonTest } from "test/setup/CommonTest.sol"; // Libraries import { Predeploys } from "src/libraries/Predeploys.sol"; -import { TransientContext } from "src/libraries/TransientContext.sol"; // Target contracts -import { - CrossL2Inbox, - Identifier, - NotEntered, - NoExecutingDeposits, - NotDepositor, - InteropStartAlreadySet -} from "src/L2/CrossL2Inbox.sol"; +import { ICrossL2Inbox, Identifier } from "interfaces/L2/ICrossL2Inbox.sol"; import { IL1BlockInterop } from "interfaces/L2/IL1BlockInterop.sol"; -/// @title CrossL2InboxWithModifiableTransientStorage -/// @dev CrossL2Inbox contract with methods to modify the transient storage. -/// This is used to test the transient storage of CrossL2Inbox. -contract CrossL2InboxWithModifiableTransientStorage is CrossL2Inbox { - /// @dev Increments call depth in transient storage. - function increment() external { - TransientContext.increment(); - } - - /// @dev Sets origin in transient storage. - /// @param _origin Origin to set. - function setOrigin(address _origin) external { - TransientContext.set(ORIGIN_SLOT, uint160(_origin)); - } - - /// @dev Sets block number in transient storage. - /// @param _blockNumber Block number to set. - function setBlockNumber(uint256 _blockNumber) external { - TransientContext.set(BLOCK_NUMBER_SLOT, _blockNumber); - } - - /// @dev Sets log index in transient storage. - /// @param _logIndex Log index to set. - function setLogIndex(uint256 _logIndex) external { - TransientContext.set(LOG_INDEX_SLOT, _logIndex); - } - - /// @dev Sets timestamp in transient storage. - /// @param _timestamp Timestamp to set. - function setTimestamp(uint256 _timestamp) external { - TransientContext.set(TIMESTAMP_SLOT, _timestamp); - } - - /// @dev Sets chain ID in transient storage. - /// @param _chainId Chain ID to set. - function setChainId(uint256 _chainId) external { - TransientContext.set(CHAINID_SLOT, _chainId); - } -} - /// @title CrossL2InboxTest /// @dev Contract for testing the CrossL2Inbox contract. -contract CrossL2InboxTest is Test { - /// @dev Selector for the `isInDependencySet` method of the L1Block contract. - bytes4 constant L1BlockIsInDependencySetSelector = bytes4(keccak256("isInDependencySet(uint256)")); +contract CrossL2InboxTest is CommonTest { + error NoExecutingDeposits(); - /// @dev Storage slot that the interop start timestamp is stored at. - /// Equal to bytes32(uint256(keccak256("crossl2inbox.interopstart")) - 1) - bytes32 internal constant INTEROP_START_SLOT = bytes32(uint256(keccak256("crossl2inbox.interopstart")) - 1); + event ExecutingMessage(bytes32 indexed msgHash, Identifier id); /// @dev CrossL2Inbox contract instance. - CrossL2Inbox crossL2Inbox; - - // interop start timestamp - uint256 interopStartTime = 420; - - /// @dev The address that represents the system caller responsible for L1 attributes - /// transactions. - address internal constant DEPOSITOR_ACCOUNT = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001; + ICrossL2Inbox crossL2Inbox; /// @dev Sets up the test suite. - function setUp() public { - // Deploy the L2ToL2CrossDomainMessenger contract - vm.etch(Predeploys.CROSS_L2_INBOX, address(new CrossL2InboxWithModifiableTransientStorage()).code); - crossL2Inbox = CrossL2Inbox(Predeploys.CROSS_L2_INBOX); - } - - modifier setInteropStart() { - // Set interop start - vm.store(address(crossL2Inbox), INTEROP_START_SLOT, bytes32(interopStartTime)); - - // Set timestamp to be after interop start - vm.warp(interopStartTime + 1 hours); - - _; - } - - /// @dev Tests that the setInteropStart function updates the INTEROP_START_SLOT storage slot correctly - function testFuzz_setInteropStart_succeeds(uint256 time) external { - // Jump to time. - vm.warp(time); - - // Impersonate the depositor account. - vm.prank(DEPOSITOR_ACCOUNT); + function setUp() public virtual override { + super.enableInterop(); + super.setUp(); - // Set interop start. - crossL2Inbox.setInteropStart(); - - // Check that the storage slot was set correctly and the public getter function returns the right value. - assertEq(crossL2Inbox.interopStart(), time); - assertEq(uint256(vm.load(address(crossL2Inbox), INTEROP_START_SLOT)), time); - } - - /// @dev Tests that the setInteropStart function reverts when the caller is not the DEPOSITOR_ACCOUNT. - function test_setInteropStart_notDepositorAccount_reverts() external { - // Expect revert with OnlyDepositorAccount selector - vm.expectRevert(NotDepositor.selector); - - // Call setInteropStart function - crossL2Inbox.setInteropStart(); + crossL2Inbox = ICrossL2Inbox(Predeploys.CROSS_L2_INBOX); } - /// @dev Tests that the setInteropStart function reverts if called when already set - function test_setInteropStart_interopStartAlreadySet_reverts() external { - // Impersonate the depositor account. - vm.startPrank(DEPOSITOR_ACCOUNT); - - // Call setInteropStart function - crossL2Inbox.setInteropStart(); - - // Expect revert with InteropStartAlreadySet selector if called a second time - vm.expectRevert(InteropStartAlreadySet.selector); - - // Call setInteropStart function again - crossL2Inbox.setInteropStart(); - } - - function testFuzz_validateMessage_succeeds(Identifier memory _id, bytes32 _messageHash) external setInteropStart { - // Ensure that the id's timestamp is valid (less than or equal to the current block timestamp and greater than - // interop start time) - _id.timestamp = bound(_id.timestamp, interopStartTime + 1, block.timestamp); - - // Ensure that the chain ID is in the dependency set - vm.mockCall({ - callee: Predeploys.L1_BLOCK_ATTRIBUTES, - data: abi.encodeCall(IL1BlockInterop.isInDependencySet, (_id.chainId)), - returnData: abi.encode(true) - }); - + /// Tests that validateMessage succeeds for a non-deposit transaction. + function testFuzz_validateMessage_succeeds(Identifier memory _id, bytes32 _messageHash) external { // Ensure is not a deposit transaction vm.mockCall({ callee: Predeploys.L1_BLOCK_ATTRIBUTES, @@ -157,12 +40,13 @@ contract CrossL2InboxTest is Test { // Look for the emit ExecutingMessage event vm.expectEmit(Predeploys.CROSS_L2_INBOX); - emit CrossL2Inbox.ExecutingMessage(_messageHash, _id); + emit ExecutingMessage(_messageHash, _id); // Call the validateMessage function crossL2Inbox.validateMessage(_id, _messageHash); } + /// Tests that validateMessage reverts for a deposit transaction. function testFuzz_validateMessage_isDeposit_reverts(Identifier calldata _id, bytes32 _messageHash) external { // Ensure it is a deposit transaction vm.mockCall({ @@ -177,94 +61,4 @@ contract CrossL2InboxTest is Test { // Call the validateMessage function crossL2Inbox.validateMessage(_id, _messageHash); } - - /// @dev Tests that the `origin` function returns the correct value. - function testFuzz_origin_succeeds(address _origin) external { - // Increment the call depth to prevent NotEntered revert - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).increment(); - // Set origin in the transient storage - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).setOrigin(_origin); - // Check that the `origin` function returns the correct value - assertEq(crossL2Inbox.origin(), _origin); - } - - /// @dev Tests that the `origin` function reverts when not entered. - function test_origin_notEntered_reverts() external { - // Expect a revert with the NotEntered selector - vm.expectRevert(NotEntered.selector); - // Call the `origin` function - crossL2Inbox.origin(); - } - - /// @dev Tests that the `blockNumber` function returns the correct value. - function testFuzz_blockNumber_succeeds(uint256 _blockNumber) external { - // Increment the call depth to prevent NotEntered revert - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).increment(); - // Set blockNumber in the transient storage - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).setBlockNumber(_blockNumber); - // Check that the `blockNumber` function returns the correct value - assertEq(crossL2Inbox.blockNumber(), _blockNumber); - } - - /// @dev Tests that the `blockNumber` function reverts when not entered. - function test_blockNumber_notEntered_reverts() external { - // Expect a revert with the NotEntered selector - vm.expectRevert(NotEntered.selector); - // Call the `blockNumber` function - crossL2Inbox.blockNumber(); - } - - /// @dev Tests that the `logIndex` function returns the correct value. - function testFuzz_logIndex_succeeds(uint256 _logIndex) external { - // Increment the call depth to prevent NotEntered revert - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).increment(); - // Set logIndex in the transient storage - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).setLogIndex(_logIndex); - // Check that the `logIndex` function returns the correct value - assertEq(crossL2Inbox.logIndex(), _logIndex); - } - - /// @dev Tests that the `logIndex` function reverts when not entered. - function test_logIndex_notEntered_reverts() external { - // Expect a revert with the NotEntered selector - vm.expectRevert(NotEntered.selector); - // Call the `logIndex` function - crossL2Inbox.logIndex(); - } - - /// @dev Tests that the `timestamp` function returns the correct value. - function testFuzz_timestamp_succeeds(uint256 _timestamp) external { - // Increment the call depth to prevent NotEntered revert - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).increment(); - // Set timestamp in the transient storage - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).setTimestamp(_timestamp); - // Check that the `timestamp` function returns the correct value - assertEq(crossL2Inbox.timestamp(), _timestamp); - } - - /// @dev Tests that the `timestamp` function reverts when not entered. - function test_timestamp_notEntered_reverts() external { - // Expect a revert with the NotEntered selector - vm.expectRevert(NotEntered.selector); - // Call the `timestamp` function - crossL2Inbox.timestamp(); - } - - /// @dev Tests that the `chainId` function returns the correct value. - function testFuzz_chainId_succeeds(uint256 _chainId) external { - // Increment the call depth to prevent NotEntered revert - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).increment(); - // Set chainId in the transient storage - CrossL2InboxWithModifiableTransientStorage(Predeploys.CROSS_L2_INBOX).setChainId(_chainId); - // Check that the `chainId` function returns the correct value - assertEq(crossL2Inbox.chainId(), _chainId); - } - - /// @dev Tests that the `chainId` function reverts when not entered. - function test_chainId_notEntered_reverts() external { - // Expect a revert with the NotEntered selector - vm.expectRevert(NotEntered.selector); - // Call the `chainId` function - crossL2Inbox.chainId(); - } } diff --git a/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol b/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol index bae3601b5105e..83ec5461c3ef8 100644 --- a/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol +++ b/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol @@ -100,8 +100,9 @@ contract ETHLiquidity_Test is CommonTest { // Assume _amount = bound(_amount, 0, type(uint248).max - 1); - // Arrange - // Nothing to arrange. + // Get balances before + uint256 superchainWethBalanceBefore = superchainWeth.balanceOf(address(ethLiquidity)); + uint256 ethLiquidityBalanceBefore = address(ethLiquidity).balance; // Act vm.expectEmit(address(ethLiquidity)); @@ -110,9 +111,9 @@ contract ETHLiquidity_Test is CommonTest { ethLiquidity.mint(_amount); // Assert - assertEq(address(superchainWeth).balance, _amount); - assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE - _amount); - assertEq(superchainWeth.balanceOf(address(ethLiquidity)), 0); + assertEq(address(superchainWeth).balance, superchainWethBalanceBefore + _amount); + assertEq(address(ethLiquidity).balance, ethLiquidityBalanceBefore - _amount); + assertEq(superchainWeth.balanceOf(address(ethLiquidity)), superchainWethBalanceBefore); } /// @notice Tests that the mint function always reverts when called by an unauthorized caller. diff --git a/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol b/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol index c569f42025f36..7bce56ded9282 100644 --- a/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol +++ b/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol @@ -5,18 +5,13 @@ pragma solidity 0.8.15; import { CommonTest } from "test/setup/CommonTest.sol"; // Libraries -import { StaticConfig } from "src/libraries/StaticConfig.sol"; import { Predeploys } from "src/libraries/Predeploys.sol"; import "src/libraries/L1BlockErrors.sol"; // Interfaces -import { IL1BlockInterop, ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; +import { IL1BlockInterop } from "interfaces/L2/IL1BlockInterop.sol"; contract L1BlockInteropTest is CommonTest { - event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol); - event DependencyAdded(uint256 indexed chainId); - event DependencyRemoved(uint256 indexed chainId); - modifier prankDepositor() { vm.startPrank(_l1BlockInterop().DEPOSITOR_ACCOUNT()); _; @@ -30,133 +25,6 @@ contract L1BlockInteropTest is CommonTest { super.setUp(); } - /// @dev Tests that an arbitrary chain ID can be added to the dependency set. - function testFuzz_isInDependencySet_succeeds(uint256 _chainId) public prankDepositor { - vm.assume(_chainId != block.chainid); - - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)); - - assertTrue(_l1BlockInterop().isInDependencySet(_chainId)); - } - - /// @dev Tests that `isInDependencySet` returns true when the chain's chain ID is passed as the input. - function test_isInDependencySet_chainChainId_succeeds() public view { - assertTrue(_l1BlockInterop().isInDependencySet(block.chainid)); - } - - /// @dev Tests that `isInDependencySet` reverts when the input chain ID is not in the dependency set - /// and is not the chain's chain ID. - function testFuzz_isInDependencySet_notDependency_reverts(uint256 _chainId) public view { - vm.assume(_chainId != block.chainid); - - // Check that the chain ID is not in the dependency set - assertFalse(_l1BlockInterop().isInDependencySet(_chainId)); - } - - /// @dev Tests that `isInDependencySet` returns false when the dependency set is empty. - function testFuzz_isInDependencySet_dependencySetEmpty_succeeds(uint256 _chainId) public view { - vm.assume(_chainId != block.chainid); - - assertEq(_l1BlockInterop().dependencySetSize(), 0); - - assertFalse(_l1BlockInterop().isInDependencySet(_chainId)); - } - - /// @dev Tests that the dependency set size is correct when adding an arbitrary number of chain IDs. - function testFuzz_dependencySetSize_succeeds(uint8 _dependencySetSize) public prankDepositor { - uint256 uniqueCount = 0; - - for (uint256 i = 0; i < _dependencySetSize; i++) { - if (i == block.chainid) continue; - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(i)); - uniqueCount++; - } - - assertEq(_l1BlockInterop().dependencySetSize(), uniqueCount); - } - - /// @dev Tests that the dependency set size is correct when the dependency set is empty. - function test_dependencySetSize_dependencySetEmpty_succeeds() public view { - assertEq(_l1BlockInterop().dependencySetSize(), 0); - } - - /// @dev Tests that the config for adding a dependency can be set. - function testFuzz_setConfig_addDependency_succeeds(uint256 _chainId) public prankDepositor { - vm.assume(_chainId != block.chainid); - - vm.expectEmit(address(l1Block)); - emit DependencyAdded(_chainId); - - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)); - } - - /// @dev Tests that adding a dependency reverts if it's the chain's chain id - function test_setConfig_addDependencyButChainChainId_reverts() public prankDepositor { - vm.expectRevert(AlreadyDependency.selector); - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(block.chainid)); - } - - /// @dev Tests that adding a dependency already in the set reverts - function test_setConfig_addDependencyButAlreadyDependency_reverts(uint256 _chainId) public prankDepositor { - vm.assume(_chainId != block.chainid); - - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)); - - vm.expectRevert(AlreadyDependency.selector); - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)); - } - - /// @dev Tests that setting the add dependency config as not the depositor reverts. - function testFuzz_setConfig_addDependencyButNotDepositor_reverts(uint256 _chainId) public { - vm.expectRevert(NotDepositor.selector); - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)); - } - - /// @dev Tests that setting the add dependency config when the dependency set size is too large reverts. - function test_setConfig_addDependencyButDependencySetSizeTooLarge_reverts() public prankDepositor { - for (uint256 i = 0; i < type(uint8).max; i++) { - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(i)); - } - - assertEq(_l1BlockInterop().dependencySetSize(), type(uint8).max); - - vm.expectRevert(DependencySetSizeTooLarge.selector); - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(1)); - } - - /// @dev Tests that the config for removing a dependency can be set. - function testFuzz_setConfig_removeDependency_succeeds(uint256 _chainId) public prankDepositor { - vm.assume(_chainId != block.chainid); - - // Add the chain ID to the dependency set before removing it - _l1BlockInterop().setConfig(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)); - - vm.expectEmit(address(l1Block)); - emit DependencyRemoved(_chainId); - - _l1BlockInterop().setConfig(ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId)); - } - - /// @dev Tests that setting the remove dependency config as not the depositor reverts. - function testFuzz_setConfig_removeDependencyButNotDepositor_reverts(uint256 _chainId) public { - vm.expectRevert(NotDepositor.selector); - _l1BlockInterop().setConfig(ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId)); - } - - /// @dev Tests that setting the remove dependency config for the chain's chain ID reverts. - function test_setConfig_removeDependencyButChainChainId_reverts() public prankDepositor { - vm.expectRevert(CantRemovedDependency.selector); - _l1BlockInterop().setConfig(ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(block.chainid)); - } - - /// @dev Tests that setting the remove dependency config for a chain ID that is not in the dependency set reverts. - function testFuzz_setConfig_removeDependencyButNotDependency_reverts(uint256 _chainId) public prankDepositor { - vm.assume(_chainId != block.chainid); - - vm.expectRevert(NotDependency.selector); - _l1BlockInterop().setConfig(ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId)); - } - /// @dev Returns the L1BlockInterop instance. function _l1BlockInterop() internal view returns (IL1BlockInterop) { return IL1BlockInterop(address(l1Block)); diff --git a/packages/contracts-bedrock/test/L2/L2ToL2CrossDomainMessenger.t.sol b/packages/contracts-bedrock/test/L2/L2ToL2CrossDomainMessenger.t.sol index 5cfcc3a8da446..b07fe408387e2 100644 --- a/packages/contracts-bedrock/test/L2/L2ToL2CrossDomainMessenger.t.sol +++ b/packages/contracts-bedrock/test/L2/L2ToL2CrossDomainMessenger.t.sol @@ -17,13 +17,9 @@ import { IdOriginNotL2ToL2CrossDomainMessenger, EventPayloadNotSentMessage, MessageDestinationNotRelayChain, - MessageTargetCrossL2Inbox, MessageTargetL2ToL2CrossDomainMessenger, MessageAlreadyRelayed, - ReentrantCall, - TargetCallFailed, - IDependencySet, - InvalidChainId + ReentrantCall } from "src/L2/L2ToL2CrossDomainMessenger.sol"; // Interfaces @@ -91,13 +87,6 @@ contract L2ToL2CrossDomainMessengerTest is Test { // Ensure that the target contract is not CrossL2Inbox or L2ToL2CrossDomainMessenger vm.assume(_target != Predeploys.CROSS_L2_INBOX && _target != Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER); - // Mock the call over the `isInDependencySet` function to return true - vm.mockCall( - Predeploys.L1_BLOCK_ATTRIBUTES, - abi.encodeCall(IDependencySet.isInDependencySet, (_destination)), - abi.encode(true) - ); - // Get the current message nonce uint256 messageNonce = l2ToL2CrossDomainMessenger.messageNonce(); @@ -169,22 +158,6 @@ contract L2ToL2CrossDomainMessengerTest is Test { l2ToL2CrossDomainMessenger.sendMessage({ _destination: block.chainid, _target: _target, _message: _message }); } - /// @dev Tests that the `sendMessage` function reverts when the target is CrossL2Inbox. - function testFuzz_sendMessage_targetCrossL2Inbox_reverts(uint256 _destination, bytes calldata _message) external { - // Ensure the destination is not the same as the source, otherwise the function will revert regardless of target - vm.assume(_destination != block.chainid); - - // Expect a revert with the MessageTargetCrossL2Inbox selector - vm.expectRevert(MessageTargetCrossL2Inbox.selector); - - // Call `senderMessage` with the CrossL2Inbox as the target to provoke revert - l2ToL2CrossDomainMessenger.sendMessage({ - _destination: _destination, - _target: Predeploys.CROSS_L2_INBOX, - _message: _message - }); - } - /// @dev Tests that the `sendMessage` function reverts when the target is L2ToL2CrossDomainMessenger. function testFuzz_sendMessage_targetL2ToL2CrossDomainMessenger_reverts( uint256 _destination, @@ -206,34 +179,6 @@ contract L2ToL2CrossDomainMessengerTest is Test { }); } - /// @notice Tests the `sendMessage` function reverts when the `destination` is not in the dependency set. - function testFuzz_sendMessage_notInDependencySet_reverts( - uint256 _destination, - address _target, - bytes calldata _message - ) - external - { - // Ensure the destination is not the same as the source, otherwise the function will revert - vm.assume(_destination != block.chainid); - - // Ensure that the target contract is not CrossL2Inbox or L2ToL2CrossDomainMessenger - vm.assume(_target != Predeploys.CROSS_L2_INBOX && _target != Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER); - - // Mock the call over the `isInDependencySet` function to return false - vm.mockCall( - Predeploys.L1_BLOCK_ATTRIBUTES, - abi.encodeCall(IDependencySet.isInDependencySet, (_destination)), - abi.encode(false) - ); - - // Expect a revert with the InvalidChainId selector - vm.expectRevert(InvalidChainId.selector); - - // Call `sendMessage` with a destination that is not in the dependency set to provoke revert - l2ToL2CrossDomainMessenger.sendMessage(_destination, _target, _message); - } - /// @dev Tests that the `relayMessage` function succeeds and emits the correct RelayedMessage event. function testFuzz_relayMessage_succeeds( uint256 _source, @@ -517,8 +462,8 @@ contract L2ToL2CrossDomainMessengerTest is Test { returnData: "" }); - // Expect a revert with the TargetCallFailed selector - vm.expectRevert(TargetCallFailed.selector); + // Expect the target call to revert + vm.expectRevert(1); hoax(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _value); l2ToL2CrossDomainMessenger.relayMessage{ value: _value }(id, sentMessage); @@ -604,86 +549,6 @@ contract L2ToL2CrossDomainMessengerTest is Test { l2ToL2CrossDomainMessenger.relayMessage{ value: _value }(id, sentMessage); } - /// @dev Tests that the `relayMessage` function reverts when the message target is CrossL2Inbox. - function testFuzz_relayMessage_targetCrossL2Inbox_reverts( - uint256 _source, - uint256 _nonce, - address _sender, - bytes calldata _message, - uint256 _value, - uint256 _blockNum, - uint256 _logIndex, - uint256 _time - ) - external - { - // Expect a revert with the MessageTargetCrossL2Inbox selector - vm.expectRevert(MessageTargetCrossL2Inbox.selector); - - // Call `relayMessage` with CrossL2Inbox as the target to provoke revert. The current chain is the destination - // to prevent revert due to invalid destination - Identifier memory id = - Identifier(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _blockNum, _logIndex, _time, _source); - bytes memory sentMessage = abi.encodePacked( - abi.encode( - L2ToL2CrossDomainMessenger.SentMessage.selector, block.chainid, Predeploys.CROSS_L2_INBOX, _nonce - ), // topics - abi.encode(_sender, _message) // data - ); - - // Ensure the CrossL2Inbox validates this message - vm.mockCall({ - callee: Predeploys.CROSS_L2_INBOX, - data: abi.encodeCall(ICrossL2Inbox.validateMessage, (id, keccak256(sentMessage))), - returnData: "" - }); - - // Call - hoax(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _value); - l2ToL2CrossDomainMessenger.relayMessage{ value: _value }(id, sentMessage); - } - - /// @dev Tests that the `relayMessage` function reverts when the message target is L2ToL2CrossDomainMessenger. - function testFuzz_relayMessage_targetL2ToL2CrossDomainMessenger_reverts( - uint256 _source, - uint256 _nonce, - address _sender, - bytes calldata _message, - uint256 _value, - uint256 _blockNum, - uint256 _logIndex, - uint256 _time - ) - external - { - // Expect a revert with the MessageTargetL2ToL2CrossDomainMessenger selector - vm.expectRevert(MessageTargetL2ToL2CrossDomainMessenger.selector); - - // Call `relayMessage` with L2ToL2CrossDomainMessenger as the target to provoke revert. The current chain is the - // destination to prevent revert due to invalid destination - Identifier memory id = - Identifier(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _blockNum, _logIndex, _time, _source); - bytes memory sentMessage = abi.encodePacked( - abi.encode( - L2ToL2CrossDomainMessenger.SentMessage.selector, - block.chainid, - Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, - _nonce - ), // topics - abi.encode(_sender, _message) // data - ); - - // Ensure the CrossL2Inbox validates this message - vm.mockCall({ - callee: Predeploys.CROSS_L2_INBOX, - data: abi.encodeCall(ICrossL2Inbox.validateMessage, (id, keccak256(sentMessage))), - returnData: "" - }); - - hoax(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _value); - l2ToL2CrossDomainMessenger.relayMessage{ value: _value }(id, sentMessage); - } - /// @dev Tests that the `relayMessage` function reverts when the message has already been relayed. function testFuzz_relayMessage_alreadyRelayed_reverts( uint256 _source, @@ -754,9 +619,7 @@ contract L2ToL2CrossDomainMessengerTest is Test { address _target, bytes calldata _message, uint256 _value, - uint256 _blockNum, - uint256 _logIndex, - uint256 _time + bytes calldata _revertData ) external { @@ -767,10 +630,12 @@ contract L2ToL2CrossDomainMessengerTest is Test { if (_value > 0) assumePayable(_target); // Ensure that the target contract reverts - vm.mockCallRevert({ callee: _target, msgValue: _value, data: _message, revertData: abi.encode(false) }); + vm.mockCallRevert({ callee: _target, msgValue: _value, data: _message, revertData: _revertData }); + + // Construct the identifier -- using some hardcoded values for the block number, log index, and time to avoid + // stack too deep errors. + Identifier memory id = Identifier(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, 1, 1, 1, _source); - Identifier memory id = - Identifier(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _blockNum, _logIndex, _time, _source); bytes memory sentMessage = abi.encodePacked( abi.encode(L2ToL2CrossDomainMessenger.SentMessage.selector, block.chainid, _target, _nonce), // topics abi.encode(_sender, _message) // data @@ -783,8 +648,8 @@ contract L2ToL2CrossDomainMessengerTest is Test { returnData: "" }); - // Expect a revert with the TargetCallFailed selector - vm.expectRevert(TargetCallFailed.selector); + // Expect the target call to revert with the proper return data. + vm.expectRevert(_revertData); hoax(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, _value); l2ToL2CrossDomainMessenger.relayMessage{ value: _value }(id, sentMessage); } diff --git a/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol b/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol index e122e79794ae1..610b052430d0d 100644 --- a/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol +++ b/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol @@ -19,25 +19,22 @@ import { IL2ToL2CrossDomainMessenger } from "interfaces/L2/IL2ToL2CrossDomainMes /// @title SuperchainWETH_Test /// @notice Contract for testing the SuperchainWETH contract. contract SuperchainWETH_Test is CommonTest { - /// @notice Emitted when a transfer is made. event Transfer(address indexed src, address indexed dst, uint256 wad); - /// @notice Emitted when a deposit is made. event Deposit(address indexed dst, uint256 wad); - /// @notice Emitted when a withdrawal is made. event Withdrawal(address indexed src, uint256 wad); - /// @notice Emitted when a crosschain transfer mints tokens. event CrosschainMint(address indexed to, uint256 amount, address indexed sender); - /// @notice Emitted when a crosschain transfer burns tokens. event CrosschainBurn(address indexed from, uint256 amount, address indexed sender); event SendETH(address indexed from, address indexed to, uint256 amount, uint256 destination); event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source); + event Approval(address indexed src, address indexed guy, uint256 wad); + address internal constant ZERO_ADDRESS = address(0); /// @notice Test setup. @@ -296,6 +293,36 @@ contract SuperchainWETH_Test is CommonTest { assertEq(_allowance, _wad); } + /// @notice Tests that the `approve` function reverts when the spender is Permit2 and the allowance is not infinite. + function testFuzz_approve_permit2NonInfiniteAllowance_reverts(uint256 _wad) public { + vm.assume(_wad != type(uint256).max); + vm.expectRevert(ISuperchainWETH.Permit2AllowanceIsFixedAtInfinity.selector); + superchainWeth.approve(Preinstalls.Permit2, _wad); + } + + /// @notice Tests that the `approve` function succeeds when the spender is Permit2 and the allowance is infinite. + function testFuzz_approve_permit2InfiniteAllowance_succeeds(address _src) public { + vm.expectEmit(address(superchainWeth)); + emit Approval(_src, Preinstalls.Permit2, type(uint256).max); + + vm.prank(_src); + superchainWeth.approve(Preinstalls.Permit2, type(uint256).max); + assertEq(superchainWeth.allowance(_src, Preinstalls.Permit2), type(uint256).max); + } + + /// @notice Tests that the `approve` function succeeds correctly updating the allowance. + function testFuzz_approve_succeeds(address _src, address _guy, uint256 _wad) public { + if (_guy == Preinstalls.Permit2) _wad = type(uint256).max; + + vm.expectEmit(address(superchainWeth)); + emit Approval(_src, _guy, _wad); + + vm.prank(_src); + superchainWeth.approve(_guy, _wad); + + assertEq(superchainWeth.allowance(_src, _guy), _wad); + } + /// @notice Tests that `transferFrom` works when the caller (spender) is Permit2, without any explicit approval. /// @param _src The funds owner. /// @param _dst The address of the recipient. diff --git a/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol b/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol index 07d577e642239..895aa9e082266 100644 --- a/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol +++ b/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol @@ -30,7 +30,6 @@ import { IETHLockbox } from "interfaces/L1/IETHLockbox.sol"; import { DeployImplementationsInput, DeployImplementations, - DeployImplementationsInterop, DeployImplementationsOutput } from "scripts/deploy/DeployImplementations.s.sol"; @@ -259,7 +258,6 @@ contract DeployImplementations_Test is Test { // By deploying the `DeployImplementations` contract with this virtual function, we provide a // hook that child contracts can override to return a different implementation of the contract. - // This lets us test e.g. the `DeployImplementationsInterop` contract without duplicating test code. function createDeployImplementationsContract() internal virtual returns (DeployImplementations) { return new DeployImplementations(); } @@ -459,9 +457,3 @@ contract DeployImplementations_Test is Test { deployImplementations.run(dii, dio); } } - -contract DeployImplementationsInterop_Test is DeployImplementations_Test { - function createDeployImplementationsContract() internal override returns (DeployImplementations) { - return new DeployImplementationsInterop(); - } -} diff --git a/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol b/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol index 48d8046873390..73959dbb0e5c3 100644 --- a/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol +++ b/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol @@ -7,7 +7,6 @@ import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from import { DeployImplementationsInput, DeployImplementations, - DeployImplementationsInterop, DeployImplementationsOutput } from "scripts/deploy/DeployImplementations.s.sol"; import { DeployOPChainInput, DeployOPChain, DeployOPChainOutput } from "scripts/deploy/DeployOPChain.s.sol"; @@ -522,9 +521,3 @@ contract DeployOPChain_Test is DeployOPChain_TestBase { doi.set(doi.disputeMaxClockDuration.selector, disputeMaxClockDuration); } } - -contract DeployOPChain_Test_Interop is DeployOPChain_Test { - function createDeployImplementationsContract() internal override returns (DeployImplementations) { - return new DeployImplementationsInterop(); - } -} diff --git a/packages/contracts-bedrock/test/opcm/ManageDependencies.t.sol b/packages/contracts-bedrock/test/opcm/ManageDependencies.t.sol deleted file mode 100644 index aeac3e23a0b1f..0000000000000 --- a/packages/contracts-bedrock/test/opcm/ManageDependencies.t.sol +++ /dev/null @@ -1,95 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import { Test } from "forge-std/Test.sol"; -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; -import { ManageDependencies, ManageDependenciesInput } from "scripts/deploy/ManageDependencies.s.sol"; - -contract ManageDependencies_Test is Test { - ManageDependencies script; - ManageDependenciesInput input; - address mockSystemConfig; - uint256 testChainId; - - event DependencyAdded(uint256 indexed chainId); - event DependencyRemoved(uint256 indexed chainId); - - function setUp() public { - script = new ManageDependencies(); - input = new ManageDependenciesInput(); - mockSystemConfig = makeAddr("systemConfig"); - testChainId = 123; - - vm.etch(mockSystemConfig, hex"01"); - } - - function test_run_add_succeeds() public { - input.set(input.systemConfig.selector, mockSystemConfig); - input.set(input.chainId.selector, testChainId); - input.set(input.remove.selector, false); - - // Expect the addDependency call - vm.mockCall(mockSystemConfig, abi.encodeCall(ISystemConfigInterop.addDependency, testChainId), bytes("")); - script.run(input); - } - - function test_run_remove_succeeds() public { - input.set(input.systemConfig.selector, mockSystemConfig); - input.set(input.chainId.selector, testChainId); - input.set(input.remove.selector, true); - - vm.mockCall(mockSystemConfig, abi.encodeCall(ISystemConfigInterop.removeDependency, testChainId), bytes("")); - script.run(input); - } -} - -contract ManageDependenciesInput_Test is Test { - ManageDependenciesInput input; - - function setUp() public { - input = new ManageDependenciesInput(); - } - - function test_getters_whenNotSet_reverts() public { - vm.expectRevert("ManageDependenciesInput: not set"); - input.chainId(); - - vm.expectRevert("ManageDependenciesInput: not set"); - input.systemConfig(); - - // remove() doesn't revert when not set, returns false - assertFalse(input.remove()); - } - - function test_set_succeeds() public { - address systemConfig = makeAddr("systemConfig"); - uint256 chainId = 123; - bool remove = true; - - vm.etch(systemConfig, hex"01"); - - input.set(input.systemConfig.selector, systemConfig); - input.set(input.chainId.selector, chainId); - input.set(input.remove.selector, remove); - - assertEq(address(input.systemConfig()), systemConfig); - assertEq(input.chainId(), chainId); - assertTrue(input.remove()); - } - - function test_set_withZeroAddress_reverts() public { - vm.expectRevert("ManageDependenciesInput: cannot set zero address"); - input.set(input.systemConfig.selector, address(0)); - } - - function test_set_withInvalidSelector_reverts() public { - vm.expectRevert("ManageDependenciesInput: unknown selector"); - input.set(bytes4(0xdeadbeef), makeAddr("test")); - - vm.expectRevert("ManageDependenciesInput: unknown selector"); - input.set(bytes4(0xdeadbeef), uint256(1)); - - vm.expectRevert("ManageDependenciesInput: unknown selector"); - input.set(bytes4(0xdeadbeef), true); - } -} diff --git a/packages/contracts-bedrock/test/safe/DeputyGuardianModule.t.sol b/packages/contracts-bedrock/test/safe/DeputyGuardianModule.t.sol index cdecf1110fa74..c1b4ad6fcabba 100644 --- a/packages/contracts-bedrock/test/safe/DeputyGuardianModule.t.sol +++ b/packages/contracts-bedrock/test/safe/DeputyGuardianModule.t.sol @@ -14,7 +14,6 @@ import "src/dispute/lib/Types.sol"; // Interfaces import { IDisputeGame } from "interfaces/dispute/IDisputeGame.sol"; -import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; contract DeputyGuardianModule_TestInit is CommonTest, SafeTestTools { @@ -315,10 +314,12 @@ contract DeputyGuardianModule_NoPortalCollisions_Test is DeputyGuardianModule_Te /// @dev tests that no function selectors in the L1 contracts collide with the OptimismPortal2 functions called by /// the DeputyGuardianModule. function test_noPortalCollisions_succeeds() external { - string[] memory excludes = new string[](5); - excludes[0] = "src/dispute/lib/*"; - excludes[1] = "src/dispute/AnchorStateRegistry.sol"; - excludes[2] = "interfaces/dispute/IAnchorStateRegistry.sol"; + string[] memory excludes = new string[](3); + uint256 excludeCounter; + excludes[excludeCounter++] = "src/dispute/lib/*"; + excludes[excludeCounter++] = "src/dispute/AnchorStateRegistry.sol"; + excludes[excludeCounter++] = "interfaces/dispute/IAnchorStateRegistry.sol"; + Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis("src/{L1,dispute,universal}", excludes); for (uint256 i; i < abis.length; i++) { for (uint256 j; j < abis[i].entries.length; j++) { diff --git a/packages/contracts-bedrock/test/universal/Specs.t.sol b/packages/contracts-bedrock/test/universal/Specs.t.sol index 5b157dea22246..7bf4c2c8b41f7 100644 --- a/packages/contracts-bedrock/test/universal/Specs.t.sol +++ b/packages/contracts-bedrock/test/universal/Specs.t.sol @@ -10,10 +10,8 @@ import { ForgeArtifacts, Abi, AbiEntry } from "scripts/libraries/ForgeArtifacts. // Interfaces import { IOPContractsManager } from "interfaces/L1/IOPContractsManager.sol"; -import { IOptimismPortal2 } from "interfaces/L1/IOptimismPortal2.sol"; -import { IOptimismPortalInterop } from "interfaces/L1/IOptimismPortalInterop.sol"; +import { IOptimismPortal2 as IOptimismPortal } from "interfaces/L1/IOptimismPortal2.sol"; import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol"; -import { ISystemConfigInterop } from "interfaces/L1/ISystemConfigInterop.sol"; import { IDataAvailabilityChallenge } from "interfaces/L1/IDataAvailabilityChallenge.sol"; import { IProtocolVersions } from "interfaces/L1/IProtocolVersions.sol"; @@ -40,8 +38,7 @@ contract Specification_Test is CommonTest { DISPUTEGAMEFACTORYOWNER, DELAYEDWETHOWNER, COUNCILSAFE, - COUNCILSAFEOWNER, - DEPENDENCYMANAGER + COUNCILSAFEOWNER } /// @notice Represents the specification of a function. @@ -208,69 +205,6 @@ contract Specification_Test is CommonTest { _addSpec({ _name: "L1StandardBridge", _sel: _getSel("superchainConfig()") }); _addSpec({ _name: "L1StandardBridge", _sel: _getSel("version()") }); - // OptimismPortalInterop - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("anchorStateRegistry()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("checkWithdrawal(bytes32,address)") }); - _addSpec({ - _name: "OptimismPortalInterop", - _sel: _getSel("depositTransaction(address,uint256,uint64,bool,bytes)") - }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("donateETH()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("migrateToSuperRoots(address,address)") }); - _addSpec({ - _name: "OptimismPortalInterop", - _sel: IOptimismPortalInterop.finalizeWithdrawalTransaction.selector, - _pausable: true - }); - _addSpec({ - _name: "OptimismPortalInterop", - _sel: IOptimismPortalInterop.finalizeWithdrawalTransactionExternalProof.selector, - _pausable: true - }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("finalizedWithdrawals(bytes32)") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("guardian()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("initialize(address,address,address,address)") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("l2Sender()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("minimumGasLimit(uint64)") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("params()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("paused()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("initVersion()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("superRootsActive()") }); - _addSpec({ - _name: "OptimismPortalInterop", - _sel: _getSel( - "proveWithdrawalTransaction((uint256,address,address,uint256,uint256,bytes),uint256,(bytes32,bytes32,bytes32,bytes32),bytes[])" - ), - _pausable: true - }); - _addSpec({ - _name: "OptimismPortalInterop", - _sel: _getSel( - "proveWithdrawalTransaction((uint256,address,address,uint256,uint256,bytes),address,uint256,(bytes1,uint64,(uint256,bytes32)[]),(bytes32,bytes32,bytes32,bytes32),bytes[])" - ), - _pausable: true - }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("provenWithdrawals(bytes32,address)") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("superchainConfig()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("systemConfig()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("version()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("disputeGameFactory()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("respectedGameType()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("proofMaturityDelaySeconds()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("disputeGameFinalityDelaySeconds()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("respectedGameTypeUpdatedAt()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("proofSubmitters(bytes32,uint256)") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("numProofSubmitters(bytes32)") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("ethLockbox()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("migrateLiquidity()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("proxyAdminOwner()") }); - _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("upgrade(address,address)") }); - _addSpec({ - _name: "OptimismPortalInterop", - _sel: IOptimismPortalInterop.setConfig.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - // OptimismPortal2 _addSpec({ _name: "OptimismPortal2", _sel: _getSel("anchorStateRegistry()") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("checkWithdrawal(bytes32,address)") }); @@ -279,12 +213,12 @@ contract Specification_Test is CommonTest { _addSpec({ _name: "OptimismPortal2", _sel: _getSel("migrateToSuperRoots(address,address)") }); _addSpec({ _name: "OptimismPortal2", - _sel: IOptimismPortal2.finalizeWithdrawalTransaction.selector, + _sel: IOptimismPortal.finalizeWithdrawalTransaction.selector, _pausable: true }); _addSpec({ _name: "OptimismPortal2", - _sel: IOptimismPortal2.finalizeWithdrawalTransactionExternalProof.selector, + _sel: IOptimismPortal.finalizeWithdrawalTransactionExternalProof.selector, _pausable: true }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("finalizedWithdrawals(bytes32)") }); @@ -441,95 +375,6 @@ contract Specification_Test is CommonTest { _addSpec({ _name: "SystemConfig", _sel: _getSel("upgrade(uint256)") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("initVersion()") }); - // SystemConfigInterop - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("UNSAFE_BLOCK_SIGNER_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("START_BLOCK_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("VERSION()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("batcherHash()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("gasLimit()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("eip1559Denominator()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("eip1559Elasticity()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("operatorFeeScalar()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("operatorFeeConstant()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.initialize.selector }); - _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.initialize.selector }); - _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.minimumGasLimit.selector }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("overhead()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("owner()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("renounceOwnership()"), _auth: Role.SYSTEMCONFIGOWNER }); - _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.resourceConfig.selector }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("scalar()") }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: ISystemConfigInterop.setBatcherHash.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: ISystemConfigInterop.setGasConfig.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: ISystemConfigInterop.setGasLimit.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: ISystemConfigInterop.setEIP1559Params.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: ISystemConfigInterop.setOperatorFeeScalars.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: ISystemConfigInterop.setUnsafeBlockSigner.selector, - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: _getSel("transferOwnership(address)"), - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.unsafeBlockSigner.selector }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("version()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1CrossDomainMessenger()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1ERC721Bridge()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1StandardBridge()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("optimismPortal()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("optimismMintableERC20Factory()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("batchInbox()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("startBlock()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("L1_CROSS_DOMAIN_MESSENGER_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("L1_ERC_721_BRIDGE_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("L1_STANDARD_BRIDGE_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("OPTIMISM_PORTAL_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("BATCH_INBOX_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("DISPUTE_GAME_FACTORY_SLOT()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("disputeGameFactory()") }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: _getSel("setGasConfigEcotone(uint32,uint32)"), - _auth: Role.SYSTEMCONFIGOWNER - }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("basefeeScalar()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("blobbasefeeScalar()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("maximumGasLimit()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("addDependency(uint256)"), _auth: Role.DEPENDENCYMANAGER }); - _addSpec({ - _name: "SystemConfigInterop", - _sel: _getSel("removeDependency(uint256)"), - _auth: Role.DEPENDENCYMANAGER - }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("dependencyManager()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("getAddresses()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l2ChainId()") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("upgrade(uint256)") }); - _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("initVersion()") }); // ProxyAdmin _addSpec({ _name: "ProxyAdmin", _sel: _getSel("addressManager()") }); _addSpec({ diff --git a/packages/contracts-bedrock/test/vendor/Initializable.t.sol b/packages/contracts-bedrock/test/vendor/Initializable.t.sol index fc02910cac9ee..0d3ec2b5e79d5 100644 --- a/packages/contracts-bedrock/test/vendor/Initializable.t.sol +++ b/packages/contracts-bedrock/test/vendor/Initializable.t.sol @@ -357,30 +357,25 @@ contract Initializer_Test is CommonTest { /// 3. The `initialize()` function of each contract cannot be called again. function test_cannotReinitialize_succeeds() public { // Collect exclusions. - string[] memory excludes = new string[](11); - // TODO: Neither of these contracts are labeled properly in the deployment script. Both are - // currently being labeled as their non-interop versions. Remove these exclusions once - // the deployment script is fixed. - excludes[0] = "src/L1/SystemConfigInterop.sol"; - excludes[1] = "src/L1/OptimismPortalInterop.sol"; + uint256 j; + string[] memory excludes = new string[](8); // Contract is currently not being deployed as part of the standard deployment script. - excludes[2] = "src/L2/OptimismSuperchainERC20.sol"; + excludes[j++] = "src/L2/OptimismSuperchainERC20.sol"; // Periphery contracts don't get deployed as part of the standard deployment script. - excludes[3] = "src/periphery/*"; + excludes[j++] = "src/periphery/*"; // TODO: Deployment script is currently "broken" in the sense that it doesn't properly // label the FaultDisputeGame, PermissionedDisputeGame, SuperFaultDisputeGame, and // SuperPermissionedDisputeGame // contracts and instead simply deploys them anonymously. Means that functions like "getInitializedSlot" // don't work properly. Remove these exclusions once the deployment script is fixed. - excludes[4] = "src/dispute/FaultDisputeGame.sol"; - excludes[5] = "src/dispute/SuperFaultDisputeGame.sol"; - excludes[6] = "src/dispute/PermissionedDisputeGame.sol"; - excludes[7] = "src/dispute/SuperPermissionedDisputeGame.sol"; + excludes[j++] = "src/dispute/FaultDisputeGame.sol"; + excludes[j++] = "src/dispute/SuperFaultDisputeGame.sol"; + excludes[j++] = "src/dispute/PermissionedDisputeGame.sol"; + excludes[j++] = "src/dispute/SuperPermissionedDisputeGame.sol"; // TODO: Eventually remove this exclusion. Same reason as above dispute contracts. - excludes[8] = "src/L1/OPContractsManager.sol"; - excludes[9] = "src/L1/OPContractsManagerInterop.sol"; + excludes[j++] = "src/L1/OPContractsManager.sol"; // L2 contract initialization is tested in Predeploys.t.sol - excludes[10] = "src/L2/*"; + excludes[j++] = "src/L2/*"; // Get all contract names in the src directory, minus the excluded contracts. string[] memory contractNames = ForgeArtifacts.getContractNames("src/*", excludes);