Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions packages/contracts-bedrock/interfaces/L2/IL1Block.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ pragma solidity ^0.8.0;

interface IL1Block {
function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
function number() external view returns (uint64);
function timestamp() external view returns (uint64);
function basefee() external view returns (uint256);
function hash() external view returns (bytes32);
function sequenceNumber() external view returns (uint64);
function blobBaseFeeScalar() external view returns (uint32);
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 gasPayingToken() external pure returns (address addr_, uint8 decimals_);
function gasPayingTokenName() external pure returns (string memory name_);
function gasPayingTokenSymbol() external pure returns (string memory symbol_);
function hash() external view returns (bytes32);
function isCustomGasToken() external pure returns (bool is_);
function l1FeeOverhead() external view returns (uint256);
function l1FeeScalar() external view returns (uint256);
function blobBaseFee() external view returns (uint256);
function operatorFeeConstant() external view returns (uint64);
function number() external view returns (uint64);
function operatorFeeScalar() external view returns (uint32);
function version() external pure returns (string memory);
function isCustomGasToken() external view returns (bool isCustom_);
function gasPayingTokenName() external view returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_);
function operatorFeeConstant() external view returns (uint64);
function sequenceNumber() external view returns (uint64);
function setL1BlockValues(
uint64 _number,
uint64 _timestamp,
Expand All @@ -33,7 +32,8 @@ interface IL1Block {
external;
function setL1BlockValuesEcotone() external;
function setL1BlockValuesIsthmus() external;
function setCustomGasToken() external;
function timestamp() external view returns (uint64);
function version() external pure returns (string memory);

function __constructor__() external;
}
39 changes: 39 additions & 0 deletions packages/contracts-bedrock/interfaces/L2/IL1BlockCGT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IL1BlockCGT {
function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
function number() external view returns (uint64);
function timestamp() external view returns (uint64);
function basefee() external view returns (uint256);
function hash() external view returns (bytes32);
function sequenceNumber() external view returns (uint64);
function blobBaseFeeScalar() external view returns (uint32);
function baseFeeScalar() external view returns (uint32);
function batcherHash() external view returns (bytes32);
function l1FeeOverhead() external view returns (uint256);
function l1FeeScalar() external view returns (uint256);
function blobBaseFee() external view returns (uint256);
function operatorFeeConstant() external view returns (uint64);
function operatorFeeScalar() external view returns (uint32);
function version() external pure returns (string memory);
function isCustomGasToken() external view returns (bool isCustom_);
function gasPayingTokenName() external view returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_);
function setL1BlockValues(
uint64 _number,
uint64 _timestamp,
uint256 _basefee,
bytes32 _hash,
uint64 _sequenceNumber,
bytes32 _batcherHash,
uint256 _l1FeeOverhead,
uint256 _l1FeeScalar
)
external;
function setL1BlockValuesEcotone() external;
function setL1BlockValuesIsthmus() external;
function setCustomGasToken() external;

function __constructor__() external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
pragma solidity ^0.8.0;

interface IL2ToL1MessagePasser {
error L2ToL1MessagePasser_NotAllowedOnCGTMode();

event MessagePassed(
uint256 indexed nonce,
address indexed sender,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IL2ToL1MessagePasserCGT {
error L2ToL1MessagePasserCGT_NotAllowedOnCGTMode();

event MessagePassed(
uint256 indexed nonce,
address indexed sender,
address indexed target,
uint256 value,
uint256 gasLimit,
bytes data,
bytes32 withdrawalHash
);
event WithdrawerBalanceBurnt(uint256 indexed amount);

receive() external payable;

function MESSAGE_VERSION() external view returns (uint16);
function burn() external;
function initiateWithdrawal(address _target, uint256 _gasLimit, bytes memory _data) external payable;
function messageNonce() external view returns (uint256);
function sentMessages(bytes32) external view returns (bool);
function version() external view returns (string memory);

function __constructor__() external;
}
26 changes: 20 additions & 6 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { IL2CrossDomainMessenger } from "interfaces/L2/IL2CrossDomainMessenger.s
import { IGasPriceOracle } from "interfaces/L2/IGasPriceOracle.sol";
import { IL1Block } from "interfaces/L2/IL1Block.sol";
import { ILiquidityController } from "interfaces/L2/ILiquidityController.sol";
import { IL1BlockCGT } from "interfaces/L2/IL1BlockCGT.sol";

/// @title L2Genesis
/// @notice Generates the genesis state for the L2 network.
Expand Down Expand Up @@ -225,7 +226,7 @@ contract L2Genesis is Script {
setL1BlockNumber(); // 13
setL2ERC721Bridge(_input.l1ERC721BridgeProxy); // 14
setL1Block(_input.isCustomGasToken); // 15
setL2ToL1MessagePasser(); // 16
setL2ToL1MessagePasser(_input.isCustomGasToken); // 16
setOptimismMintableERC721Factory(_input); // 17
setProxyAdmin(_input); // 18
setBaseFeeVault(_input); // 19
Expand Down Expand Up @@ -261,8 +262,14 @@ contract L2Genesis is Script {
vm.store(impl, _ownerSlot, bytes32(uint256(uint160(_input.opChainProxyAdminOwner))));
}

function setL2ToL1MessagePasser() internal {
_setImplementationCode(Predeploys.L2_TO_L1_MESSAGE_PASSER);
function setL2ToL1MessagePasser(bool _isCustomGasToken) internal {
if (_isCustomGasToken) {
string memory cname = "L2ToL1MessagePasserCGT";
address impl = Predeploys.predeployToCodeNamespace(Predeploys.L2_TO_L1_MESSAGE_PASSER);
vm.etch(impl, vm.getDeployedCode(string.concat(cname, ".sol:", cname)));
} else {
_setImplementationCode(Predeploys.L2_TO_L1_MESSAGE_PASSER);
}
}

/// @notice This predeploy is following the safety invariant #1.
Expand Down Expand Up @@ -362,11 +369,18 @@ contract L2Genesis is Script {

/// @notice This predeploy is following the safety invariant #1.
function setL1Block(bool _isCustomGasToken) internal {
_setImplementationCode(Predeploys.L1_BLOCK_ATTRIBUTES);
if (_isCustomGasToken) {
vm.startPrank(IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).setCustomGasToken();
// Set the implementation code for L1BlockCGT
string memory cname = "L1BlockCGT";
address impl = Predeploys.predeployToCodeNamespace(Predeploys.L1_BLOCK_ATTRIBUTES);
vm.etch(impl, vm.getDeployedCode(string.concat(cname, ".sol:", cname)));

// Set the custom gas token flag
vm.startPrank(IL1BlockCGT(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
IL1BlockCGT(Predeploys.L1_BLOCK_ATTRIBUTES).setCustomGasToken();
vm.stopPrank();
} else {
_setImplementationCode(Predeploys.L1_BLOCK_ATTRIBUTES);
}
}

Expand Down
28 changes: 13 additions & 15 deletions packages/contracts-bedrock/scripts/checks/test-validation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,19 @@ var excludedPaths = []string{
// Resolving these naming inconsistencies is outside the script's scope, but they are
// documented here to avoid false validation failures while maintaining the validation rules
// for standard contract tests.
"test/invariants/", // Invariant testing framework - no direct src counterpart
"test/opcm/", // OP Chain Manager tests - may have different structure
"test/scripts/", // Script tests - test deployment/utility scripts, not contracts
"test/integration/", // Integration tests - test multiple contracts together
"test/cannon/MIPS64Memory.t.sol", // Tests external MIPS implementation
"test/dispute/lib/LibClock.t.sol", // Tests library utilities
"test/dispute/lib/LibGameId.t.sol", // Tests library utilities
"test/setup/DeployVariations.t.sol", // Tests deployment variations
"test/universal/BenchmarkTest.t.sol", // Performance benchmarking tests
"test/universal/ExtendedPause.t.sol", // Tests extended functionality
"test/vendor/Initializable.t.sol", // Tests external vendor code
"test/vendor/InitializableOZv5.t.sol", // Tests external vendor code
"test/L2/L1BlockCGT.t.sol", // Tests L1Block with custom gas token
"test/L2/L2ToL1MessagePasserCGT.t.sol", // Tests L2ToL1MessagePasser with custom gas token
"test/L1/OptimismPortal2CGT.t.sol", // Tests OptimismPortal2 with custom gas token
"test/invariants/", // Invariant testing framework - no direct src counterpart
"test/opcm/", // OP Chain Manager tests - may have different structure
"test/scripts/", // Script tests - test deployment/utility scripts, not contracts
"test/integration/", // Integration tests - test multiple contracts together
"test/cannon/MIPS64Memory.t.sol", // Tests external MIPS implementation
"test/dispute/lib/LibClock.t.sol", // Tests library utilities
"test/dispute/lib/LibGameId.t.sol", // Tests library utilities
"test/setup/DeployVariations.t.sol", // Tests deployment variations
"test/universal/BenchmarkTest.t.sol", // Performance benchmarking tests
"test/universal/ExtendedPause.t.sol", // Tests extended functionality
"test/vendor/Initializable.t.sol", // Tests external vendor code
"test/vendor/InitializableOZv5.t.sol", // Tests external vendor code
"test/L1/OptimismPortal2CGT.t.sol", // Tests OptimismPortal2 with custom gas token

// PATHS EXCLUDED FROM CONTRACT NAME FILE PATH VALIDATION:
// These paths are excluded because they don't follow the standard naming convention where the
Expand Down
33 changes: 22 additions & 11 deletions packages/contracts-bedrock/snapshots/abi/L1Block.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "gasPayingToken",
"outputs": [
{
"internalType": "address",
"name": "addr_",
"type": "address"
},
{
"internalType": "uint8",
"name": "decimals_",
"type": "uint8"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "gasPayingTokenName",
Expand All @@ -87,7 +105,7 @@
"type": "string"
}
],
"stateMutability": "view",
"stateMutability": "pure",
"type": "function"
},
{
Expand All @@ -100,7 +118,7 @@
"type": "string"
}
],
"stateMutability": "view",
"stateMutability": "pure",
"type": "function"
},
{
Expand All @@ -122,11 +140,11 @@
"outputs": [
{
"internalType": "bool",
"name": "isCustom_",
"name": "is_",
"type": "bool"
}
],
"stateMutability": "view",
"stateMutability": "pure",
"type": "function"
},
{
Expand Down Expand Up @@ -207,13 +225,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "setCustomGasToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
Loading