diff --git a/packages/contracts-bedrock/test/L1/SystemConfig.t.sol b/packages/contracts-bedrock/test/L1/SystemConfig.t.sol index 91a4e2eed16..f7428c3bf56 100644 --- a/packages/contracts-bedrock/test/L1/SystemConfig.t.sol +++ b/packages/contracts-bedrock/test/L1/SystemConfig.t.sol @@ -11,6 +11,7 @@ import { ForgeArtifacts, StorageSlot } from "scripts/libraries/ForgeArtifacts.so import { Constants } from "src/libraries/Constants.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { Features } from "src/libraries/Features.sol"; +import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol"; @@ -843,3 +844,19 @@ contract SystemConfig_SetMinBaseFee_Test is SystemConfig_TestInit { assertEq(systemConfig.minBaseFee(), newMinBaseFee); } } + +/// @title SystemConfig_IsCustomGasToken_Test +/// @notice Test contract for SystemConfig `isCustomGasToken` function. +contract SystemConfig_IsCustomGasToken_Test is SystemConfig_TestInit { + /// @notice Tests that `isCustomGasToken` returns the correct value. + function test_isCustomGasToken_enabled_succeeds() external { + skipIfDevFeatureDisabled(DevFeatures.CUSTOM_GAS_TOKEN); + assertTrue(systemConfig.isCustomGasToken()); + } + + /// @notice Tests that `isCustomGasToken` returns the correct value. + function test_isCustomGasToken_disabled_succeeds() external { + skipIfDevFeatureEnabled(DevFeatures.CUSTOM_GAS_TOKEN); + assertFalse(systemConfig.isCustomGasToken()); + } +} diff --git a/packages/contracts-bedrock/test/L2/L1Block.t.sol b/packages/contracts-bedrock/test/L2/L1Block.t.sol index 166f0982baa..80c347a9f77 100644 --- a/packages/contracts-bedrock/test/L2/L1Block.t.sol +++ b/packages/contracts-bedrock/test/L2/L1Block.t.sol @@ -6,6 +6,7 @@ import { CommonTest } from "test/setup/CommonTest.sol"; // Libraries import { Encoding } from "src/libraries/Encoding.sol"; +import { Constants } from "src/libraries/Constants.sol"; import "src/libraries/L1BlockErrors.sol"; /// @title L1Block_ TestInit @@ -20,6 +21,28 @@ contract L1Block_TestInit is CommonTest { } } +/// @title L1Block_Version_Test +/// @notice Test contract for L1Block `version` function. +contract L1Block_Version_Test is L1Block_TestInit { + /// @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(l1Block.version()).length > 0); + } +} + +/// @title L1Block_GasPayingToken_Test +/// @notice Tests the `gasPayingToken` function of the `L1Block` contract. +contract L1Block_GasPayingToken_Test is L1Block_TestInit { + /// @notice Tests that the `gasPayingToken` function returns the correct token address and + /// decimals. + function test_gasPayingToken_succeeds() external view { + (address token, uint8 decimals) = l1Block.gasPayingToken(); + assertEq(token, Constants.ETHER); + assertEq(uint256(decimals), uint256(18)); + } +} + /// @title L1Block_GasPayingTokenName_Test /// @notice Tests the `gasPayingTokenName` function of the `L1Block` contract. contract L1Block_GasPayingTokenName_Test is L1Block_TestInit { diff --git a/packages/contracts-bedrock/test/L2/L1BlockCGT.t.sol b/packages/contracts-bedrock/test/L2/L1BlockCGT.t.sol index 7cb11a04c54..cd9e3e61853 100644 --- a/packages/contracts-bedrock/test/L2/L1BlockCGT.t.sol +++ b/packages/contracts-bedrock/test/L2/L1BlockCGT.t.sol @@ -31,6 +31,26 @@ contract L1BlockCGT_TestInit is CommonTest { } } +/// @title L1BlockCGT_Version_Test +/// @notice Test contract for L1BlockCGT `version` function. +contract L1BlockCGT_Version_Test is L1BlockCGT_TestInit { + /// @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(l1BlockCGT.version()).length > 0); + } +} + +/// @title L1BlockCGT_GasPayingToken_Test +/// @notice Tests the `gasPayingToken` function of the `L1BlockCGT` contract. +contract L1BlockCGT_GasPayingToken_Test is L1BlockCGT_TestInit { + /// @notice Tests that the `gasPayingToken` function reverts. + function test_gasPayingToken_deprecated_reverts() external { + vm.expectRevert("L1BlockCGT: deprecated"); + l1BlockCGT.gasPayingToken(); + } +} + /// @title L1BlockCGT_GasPayingTokenName_Test /// @notice Tests the `gasPayingTokenName` function of the `L1Block` contract with custom gas /// token enabled. diff --git a/packages/contracts-bedrock/test/L2/L2ToL1MessagePasser.t.sol b/packages/contracts-bedrock/test/L2/L2ToL1MessagePasser.t.sol index 8ce02b6aad7..b96c0316619 100644 --- a/packages/contracts-bedrock/test/L2/L2ToL1MessagePasser.t.sol +++ b/packages/contracts-bedrock/test/L2/L2ToL1MessagePasser.t.sol @@ -8,6 +8,16 @@ import { CommonTest } from "test/setup/CommonTest.sol"; import { Types } from "src/libraries/Types.sol"; import { Hashing } from "src/libraries/Hashing.sol"; +/// @title L2ToL1MessagePasser_Version_Test +/// @notice Tests the `version` function of the `L2ToL1MessagePasser` contract. +contract L2ToL1MessagePasser_Version_Test is CommonTest { + /// @notice Tests that the `version` function returns the correct string. We avoid testing the + /// specific value of the string as it changes frequently. + function test_version_succeeds() external view { + assert(bytes(l2ToL1MessagePasser.version()).length > 0); + } +} + /// @title L2ToL1MessagePasser_InitiateWithdrawal_Test /// @notice Tests the `initiateWithdrawal` function of the `L2ToL1MessagePasser` contract. contract L2ToL1MessagePasser_InitiateWithdrawal_Test is CommonTest { diff --git a/packages/contracts-bedrock/test/L2/L2ToL1MessagePasserCGT.t.sol b/packages/contracts-bedrock/test/L2/L2ToL1MessagePasserCGT.t.sol index 17ff93b7779..4b52ce85760 100644 --- a/packages/contracts-bedrock/test/L2/L2ToL1MessagePasserCGT.t.sol +++ b/packages/contracts-bedrock/test/L2/L2ToL1MessagePasserCGT.t.sol @@ -21,6 +21,17 @@ contract L2ToL1MessagePasserCGT_TestInit is CommonTest { } } +/// @title L2ToL1MessagePasserCGT_Version_Test +/// @notice Tests the `version` function of the `L2ToL1MessagePasser` contract with custom gas token +/// enabled. +contract L2ToL1MessagePasserCGT_Version_Test is L2ToL1MessagePasserCGT_TestInit { + /// @notice Tests that the `version` function returns the correct string. We avoid testing the + /// specific value of the string as it changes frequently. + function test_version_succeeds() external view { + assert(bytes(l2ToL1MessagePasser.version()).length > 0); + } +} + /// @title L2ToL1MessagePasserCGT_InitiateWithdrawal_Test /// @notice Tests the `initiateWithdrawal` function of the `L2ToL1MessagePasser` contract with /// custom gas token enabled. diff --git a/packages/contracts-bedrock/test/scripts/L2Genesis.t.sol b/packages/contracts-bedrock/test/scripts/L2Genesis.t.sol index 8fa2e2cae2c..dbdadf3f820 100644 --- a/packages/contracts-bedrock/test/scripts/L2Genesis.t.sol +++ b/packages/contracts-bedrock/test/scripts/L2Genesis.t.sol @@ -249,7 +249,7 @@ contract L2Genesis_Run_Test is L2Genesis_TestInit { // Expect revert when nativeAssetLiquidityAmount is greater than type(uint248).max input.nativeAssetLiquidityAmount += 1; - vm.expectRevert("Native asset liquidity amount must be less than or equal to type(uint248).max"); + vm.expectRevert("L2Genesis: native asset liquidity amount must be less than or equal to type(uint248).max"); genesis.run(input); // Reset nativeAssetLiquidityAmount input to type(uint248).max input.nativeAssetLiquidityAmount = type(uint248).max;