Skip to content

Commit

Permalink
chore: solidity isthmus to interop (ethereum-optimism#12132)
Browse files Browse the repository at this point in the history
* chore: rename isthmus to interop on solidity files

* chore: rename test file

* chore: update contracts versions (ethereum-optimism#66)
  • Loading branch information
0xDiscotech authored and samlaf committed Nov 10, 2024
1 parent f7998a6 commit fc2c32f
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 144 deletions.
8 changes: 4 additions & 4 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GasBenchMark_L1BlockIsthmus_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567)
GasBenchMark_L1BlockIsthmus_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567)
GasBenchMark_L1BlockIsthmus_SetValuesIsthmus:test_setL1BlockValuesIsthmus_benchmark() (gas: 175657)
GasBenchMark_L1BlockIsthmus_SetValuesIsthmus_Warm:test_setL1BlockValuesIsthmus_benchmark() (gas: 5121)
GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567)
GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567)
GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175677)
GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5099)
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369242)
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ contract L2Genesis is Deployer {
/// @notice This predeploy is following the safety invariant #1.
function setL1Block() public {
if (cfg.useInterop()) {
string memory cname = "L1BlockIsthmus";
string memory cname = "L1BlockInterop";
address impl = Predeploys.predeployToCodeNamespace(Predeploys.L1_BLOCK_ATTRIBUTES);
console.log("Setting %s implementation at: %s", cname, impl);
vm.etch(impl, vm.getDeployedCode(string.concat(cname, ".sol:", cname)));
Expand Down
18 changes: 9 additions & 9 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"sourceCodeHash": "0x3fb97859f66c078573753b6ba5ec370449ab03b8eca9e7779fce8db5bb23b7c0"
},
"src/L1/OptimismPortalInterop.sol": {
"initCodeHash": "0x1c8372865dbf38225de4d843ca696a17f0d9e3cacf13c10a3d065ba19bdca05e",
"sourceCodeHash": "0xe6a7794799915f408cb57c73af266670de8a3f02408d3dbc2c97db25d3e42635"
"initCodeHash": "0xfeaa67ccd652bda9103fea507e4357b2bd4e93210b03ff85eb357d7145f1606c",
"sourceCodeHash": "0x6401b81f04093863557ef46192f56793daa0d412618065383ab353b2ed2929d8"
},
"src/L1/ProtocolVersions.sol": {
"initCodeHash": "0x8f033874dd8b36615b2209d553660dcff1ff91ca2bad3ca1de7b441dbfba4842",
Expand All @@ -60,16 +60,16 @@
"sourceCodeHash": "0x06a50ac992175fdb434b13e8461893e83862c23ce399e697e6e8109728ad1a3d"
},
"src/L1/SystemConfigInterop.sol": {
"initCodeHash": "0x1f500e310170769ffc747e08ad1d5b0de4b0f58534001bc4d4d563ec058bb331",
"sourceCodeHash": "0xcb6008cb49a06f87eb5b6cb4651e5e4aafe0b1f33000eccd165226c04f6b63c6"
"initCodeHash": "0x7515e5ed1266412a8c2d27d99aba6266fda2fc9068c20f0b7e6b555ee5073c91",
"sourceCodeHash": "0x441d1e3e8e987f829f55996b5b6c850da8c59ad48f09cf7e0a69a1fa559d42a2"
},
"src/L2/BaseFeeVault.sol": {
"initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b",
"sourceCodeHash": "0x2dc2284cf7c68e743da50e4113e96ffeab435de2390aeba2eab2f1e8ca411ce9"
},
"src/L2/CrossL2Inbox.sol": {
"initCodeHash": "0x0ee27866b4bf864a0b68ab25ea9559d7f2722b0396d02f2e8e089c6a1a5a6a93",
"sourceCodeHash": "0xe6f453049035e0d77e4d7a92904b448bc17e04dd3d99e738b9af20e20986ce64"
"initCodeHash": "0x66b052adce7e9194d054952d67d08b53964120067600358243ec86c85b90877b",
"sourceCodeHash": "0x38e6127ec6be99eb8c38c2c9d6e82761b33dde446bba250dc2c1b84983449e4e"
},
"src/L2/ETHLiquidity.sol": {
"initCodeHash": "0x713c18f95a6a746d0703f475f3ae10c106c9b9ecb64d881a2e61b8969b581371",
Expand All @@ -83,9 +83,9 @@
"initCodeHash": "0xd12353c5bf71c6765cc9292eecf262f216e67f117f4ba6287796a5207dbca00f",
"sourceCodeHash": "0xfe3a9585d9bfca8428e12759cab68a3114374e5c37371cfe08bb1976a9a5a041"
},
"src/L2/L1BlockIsthmus.sol": {
"initCodeHash": "0xb7a7a113056e4ac44824350b79fed5ea423e880223edcf1220e8f8b3172f50c5",
"sourceCodeHash": "0x6be7e7402c4dfc10e1407e070712a3f9f352db45f8a8ab296e8f6bc56a341f47"
"src/L2/L1BlockInterop.sol": {
"initCodeHash": "0x77b3b2151fe14ea36a640469115a5e4de27f7654a9606a9d0701522c6a4ad887",
"sourceCodeHash": "0x7417677643e1df1ae1782513b94c7821097b9529d3f8626c3bcb8b3a9ae0d180"
},
"src/L2/L1FeeVault.sol": {
"initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
},
{
"inputs": [],
"name": "setL1BlockValuesIsthmus",
"name": "setL1BlockValuesInterop",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
Expand Down
8 changes: 4 additions & 4 deletions packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.15;

// Contracts
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol";
import { L1BlockInterop, ConfigType } from "src/L2/L1BlockInterop.sol";

// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
Expand All @@ -23,9 +23,9 @@ contract OptimismPortalInterop is OptimismPortal2 {
OptimismPortal2(_proofMaturityDelaySeconds, _disputeGameFinalityDelaySeconds)
{ }

/// @custom:semver +interop
/// @custom:semver +interop-beta.1
function version() public pure override returns (string memory) {
return string.concat(super.version(), "+interop");
return string.concat(super.version(), "+interop-beta.1");
}

/// @notice Sets static configuration options for the L2 system.
Expand All @@ -48,7 +48,7 @@ contract OptimismPortalInterop is OptimismPortal2 {
uint256(0), // value
uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit
false, // isCreation,
abi.encodeCall(L1BlockIsthmus.setConfig, (_type, _value))
abi.encodeCall(L1BlockInterop.setConfig, (_type, _value))
)
);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/src/L1/SystemConfigInterop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity 0.8.15;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IOptimismPortalInterop as IOptimismPortal } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
import { ConfigType } from "src/L2/L1BlockInterop.sol";

// Libraries
import { Constants } from "src/libraries/Constants.sol";
Expand Down Expand Up @@ -68,9 +68,9 @@ contract SystemConfigInterop is SystemConfig {
Storage.setAddress(DEPENDENCY_MANAGER_SLOT, _dependencyManager);
}

/// @custom:semver +interop
/// @custom:semver +interop-beta.1
function version() public pure override returns (string memory) {
return string.concat(super.version(), "+interop");
return string.concat(super.version(), "+interop-beta.1");
}

/// @notice Internal setter for the gas paying token address, includes validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
import { ConfigType } from "src/L2/L1BlockInterop.sol";

interface IOptimismPortalInterop {
error AlreadyFinalized();
Expand Down
10 changes: 5 additions & 5 deletions packages/contracts-bedrock/src/L2/CrossL2Inbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { ICrossL2Inbox } from "src/L2/interfaces/ICrossL2Inbox.sol";
import { SafeCall } from "src/libraries/SafeCall.sol";
import { IDependencySet } from "src/L2/interfaces/IDependencySet.sol";
import { IL1BlockIsthmus } from "src/L2/interfaces/IL1BlockIsthmus.sol";
import { IL1BlockInterop } from "src/L2/interfaces/IL1BlockInterop.sol";

/// @notice Thrown when the caller is not DEPOSITOR_ACCOUNT when calling `setInteropStart()`
error NotDepositor();
Expand Down Expand Up @@ -65,8 +65,8 @@ contract CrossL2Inbox is ICrossL2Inbox, ISemver, TransientReentrancyAware {
address internal constant DEPOSITOR_ACCOUNT = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001;

/// @notice Semantic version.
/// @custom:semver 1.0.0-beta.7
string public constant version = "1.0.0-beta.7";
/// @custom:semver 1.0.0-beta.8
string public constant version = "1.0.0-beta.8";

/// @notice Emitted when a cross chain message is being executed.
/// @param msgHash Hash of message payload being executed.
Expand Down Expand Up @@ -140,7 +140,7 @@ contract CrossL2Inbox is ICrossL2Inbox, ISemver, TransientReentrancyAware {
reentrantAware
{
// We need to know if this is being called on a depositTx
if (IL1BlockIsthmus(Predeploys.L1_BLOCK_ATTRIBUTES).isDeposit()) revert NoExecutingDeposits();
if (IL1BlockInterop(Predeploys.L1_BLOCK_ATTRIBUTES).isDeposit()) revert NoExecutingDeposits();

// Check the Identifier.
_checkIdentifier(_id);
Expand All @@ -165,7 +165,7 @@ contract CrossL2Inbox is ICrossL2Inbox, ISemver, TransientReentrancyAware {
/// @param _msgHash Hash of the message payload to call target with.
function validateMessage(Identifier calldata _id, bytes32 _msgHash) external {
// We need to know if this is being called on a depositTx
if (IL1BlockIsthmus(Predeploys.L1_BLOCK_ATTRIBUTES).isDeposit()) revert NoExecutingDeposits();
if (IL1BlockInterop(Predeploys.L1_BLOCK_ATTRIBUTES).isDeposit()) revert NoExecutingDeposits();

// Check the Identifier.
_checkIdentifier(_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { StaticConfig } from "src/libraries/StaticConfig.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import "src/libraries/L1BlockErrors.sol";

/// @notice Enum representing different types of configurations that can be set on L1BlockIsthmus.
/// @notice Enum representing different types of configurations that can be set on L1BlockInterop.
/// @custom:value SET_GAS_PAYING_TOKEN Represents the config type for setting the gas paying token.
/// @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.
Expand All @@ -23,9 +23,9 @@ enum ConfigType {

/// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000015
/// @title L1BlockIsthmus
/// @notice Isthmus extenstions of L1Block.
contract L1BlockIsthmus is L1Block {
/// @title L1BlockInterop
/// @notice Interop extenstions of L1Block.
contract L1BlockInterop is L1Block {
using EnumerableSet for EnumerableSet.UintSet;

/// @notice Event emitted when a new dependency is added to the interop dependency set.
Expand All @@ -42,9 +42,9 @@ contract L1BlockIsthmus is L1Block {
/// keccak256(abi.encode(uint256(keccak256("l1Block.identifier.isDeposit")) - 1)) & ~bytes32(uint256(0xff))
uint256 internal constant IS_DEPOSIT_SLOT = 0x921bd3a089295c6e5540e8fba8195448d253efd6f2e3e495b499b627dc36a300;

/// @custom:semver +isthmus
/// @custom:semver +interop
function version() public pure override returns (string memory) {
return string.concat(super.version(), "+isthmus");
return string.concat(super.version(), "+interop");
}

/// @notice Returns whether the call was triggered from a a deposit or not.
Expand All @@ -70,10 +70,10 @@ contract L1BlockIsthmus is L1Block {
return uint8(dependencySet.length());
}

/// @notice Updates the `isDeposit` flag and sets the L1 block values for an Isthmus upgraded chain.
/// @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 setL1BlockValuesIsthmus() external {
function setL1BlockValuesInterop() external {
// Set the isDeposit flag to true.
assembly {
sstore(IS_DEPOSIT_SLOT, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ enum ConfigType {
REMOVE_DEPENDENCY
}

interface IL1BlockIsthmus {
interface IL1BlockInterop {
error AlreadyDependency();
error CantRemovedDependency();
error DependencySetSizeTooLarge();
Expand Down Expand Up @@ -52,7 +52,7 @@ interface IL1BlockIsthmus {
)
external;
function setL1BlockValuesEcotone() external;
function setL1BlockValuesIsthmus() external;
function setL1BlockValuesInterop() external;
function timestamp() external view returns (uint64);
function version() external pure returns (string memory);

Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/src/libraries/Encoding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ library Encoding {
/// @param _blobBaseFee L1 blob base fee.
/// @param _hash L1 blockhash.
/// @param _batcherHash Versioned hash to authenticate batcher by.
function encodeSetL1BlockValuesIsthmus(
function encodeSetL1BlockValuesInterop(
uint32 _baseFeeScalar,
uint32 _blobBaseFeeScalar,
uint64 _sequenceNumber,
Expand All @@ -199,7 +199,7 @@ library Encoding {
pure
returns (bytes memory)
{
bytes4 functionSignature = bytes4(keccak256("setL1BlockValuesIsthmus()"));
bytes4 functionSignature = bytes4(keccak256("setL1BlockValuesInterop()"));
return abi.encodePacked(
functionSignature,
_baseFeeScalar,
Expand Down
38 changes: 19 additions & 19 deletions packages/contracts-bedrock/test/BenchmarkTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
// Libraries
import { Types } from "src/libraries/Types.sol";
import { SafeCall } from "src/libraries/SafeCall.sol";
import { L1BlockIsthmus } from "src/L2/L1BlockIsthmus.sol";
import { L1BlockInterop } from "src/L2/L1BlockInterop.sol";
import { Encoding } from "src/libraries/Encoding.sol";

// Interfaces
Expand Down Expand Up @@ -254,13 +254,13 @@ contract GasBenchMark_L1Block_SetValuesEcotone_Warm is GasBenchMark_L1Block {
}
}

contract GasBenchMark_L1BlockIsthmus is GasBenchMark_L1Block {
L1BlockIsthmus l1BlockIsthmus;
contract GasBenchMark_L1BlockInterop is GasBenchMark_L1Block {
L1BlockInterop l1BlockInterop;

function setUp() public virtual override {
super.setUp();
l1BlockIsthmus = new L1BlockIsthmus();
setValuesCalldata = Encoding.encodeSetL1BlockValuesIsthmus(
l1BlockInterop = new L1BlockInterop();
setValuesCalldata = Encoding.encodeSetL1BlockValuesInterop(
type(uint32).max,
type(uint32).max,
type(uint64).max,
Expand All @@ -274,42 +274,42 @@ contract GasBenchMark_L1BlockIsthmus is GasBenchMark_L1Block {
}
}

contract GasBenchMark_L1BlockIsthmus_SetValuesIsthmus is GasBenchMark_L1BlockIsthmus {
function test_setL1BlockValuesIsthmus_benchmark() external {
SafeCall.call({ _target: address(l1BlockIsthmus), _calldata: setValuesCalldata });
contract GasBenchMark_L1BlockInterop_SetValuesInterop is GasBenchMark_L1BlockInterop {
function test_setL1BlockValuesInterop_benchmark() external {
SafeCall.call({ _target: address(l1BlockInterop), _calldata: setValuesCalldata });
}
}

contract GasBenchMark_L1BlockIsthmus_SetValuesIsthmus_Warm is GasBenchMark_L1BlockIsthmus {
contract GasBenchMark_L1BlockInterop_SetValuesInterop_Warm is GasBenchMark_L1BlockInterop {
function setUp() public virtual override {
SafeCall.call({ _target: address(l1BlockIsthmus), _calldata: setValuesCalldata });
SafeCall.call({ _target: address(l1BlockInterop), _calldata: setValuesCalldata });
}

function test_setL1BlockValuesIsthmus_benchmark() external {
SafeCall.call({ _target: address(l1BlockIsthmus), _calldata: setValuesCalldata });
function test_setL1BlockValuesInterop_benchmark() external {
SafeCall.call({ _target: address(l1BlockInterop), _calldata: setValuesCalldata });
}
}

contract GasBenchMark_L1BlockIsthmus_DepositsComplete is GasBenchMark_L1BlockIsthmus {
contract GasBenchMark_L1BlockInterop_DepositsComplete is GasBenchMark_L1BlockInterop {
function test_depositsComplete_benchmark() external {
SafeCall.call({
_target: address(l1BlockIsthmus),
_calldata: abi.encodeWithSelector(l1BlockIsthmus.depositsComplete.selector)
_target: address(l1BlockInterop),
_calldata: abi.encodeWithSelector(l1BlockInterop.depositsComplete.selector)
});
}
}

contract GasBenchMark_L1BlockIsthmus_DepositsComplete_Warm is GasBenchMark_L1BlockIsthmus {
contract GasBenchMark_L1BlockInterop_DepositsComplete_Warm is GasBenchMark_L1BlockInterop {
function setUp() public virtual override {
super.setUp();
// Set the isDeposit flag to true so then we can benchmark when it is reset.
SafeCall.call({ _target: address(l1BlockIsthmus), _calldata: setValuesCalldata });
SafeCall.call({ _target: address(l1BlockInterop), _calldata: setValuesCalldata });
}

function test_depositsComplete_benchmark() external {
SafeCall.call({
_target: address(l1BlockIsthmus),
_calldata: abi.encodeWithSelector(l1BlockIsthmus.depositsComplete.selector)
_target: address(l1BlockInterop),
_calldata: abi.encodeWithSelector(l1BlockInterop.depositsComplete.selector)
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "src/libraries/PortalErrors.sol";
// Target contract dependencies
import "src/libraries/PortalErrors.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol";
import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol";
import { L1BlockInterop, ConfigType } from "src/L2/L1BlockInterop.sol";

// Interfaces
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
Expand All @@ -35,7 +35,7 @@ contract OptimismPortalInterop_Test is CommonTest {
_mint: 0,
_gasLimit: 200_000,
_isCreation: false,
_data: abi.encodeCall(L1BlockIsthmus.setConfig, (ConfigType.SET_GAS_PAYING_TOKEN, _value))
_data: abi.encodeCall(L1BlockInterop.setConfig, (ConfigType.SET_GAS_PAYING_TOKEN, _value))
});

vm.prank(address(_optimismPortalInterop().systemConfig()));
Expand All @@ -58,7 +58,7 @@ contract OptimismPortalInterop_Test is CommonTest {
_mint: 0,
_gasLimit: 200_000,
_isCreation: false,
_data: abi.encodeCall(L1BlockIsthmus.setConfig, (ConfigType.ADD_DEPENDENCY, _value))
_data: abi.encodeCall(L1BlockInterop.setConfig, (ConfigType.ADD_DEPENDENCY, _value))
});

vm.prank(address(_optimismPortalInterop().systemConfig()));
Expand All @@ -81,7 +81,7 @@ contract OptimismPortalInterop_Test is CommonTest {
_mint: 0,
_gasLimit: 200_000,
_isCreation: false,
_data: abi.encodeCall(L1BlockIsthmus.setConfig, (ConfigType.REMOVE_DEPENDENCY, _value))
_data: abi.encodeCall(L1BlockInterop.setConfig, (ConfigType.REMOVE_DEPENDENCY, _value))
});

vm.prank(address(_optimismPortalInterop().systemConfig()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CommonTest } from "test/setup/CommonTest.sol";

// Contracts
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
import { ConfigType } from "src/L2/L1BlockInterop.sol";

// Libraries
import { Constants } from "src/libraries/Constants.sol";
Expand Down
Loading

0 comments on commit fc2c32f

Please sign in to comment.