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
17 changes: 17 additions & 0 deletions packages/contracts-bedrock/test/L1/SystemConfig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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());
}
}
23 changes: 23 additions & 0 deletions packages/contracts-bedrock/test/L2/L1Block.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
20 changes: 20 additions & 0 deletions packages/contracts-bedrock/test/L2/L1BlockCGT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions packages/contracts-bedrock/test/L2/L2ToL1MessagePasser.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 11 additions & 0 deletions packages/contracts-bedrock/test/L2/L2ToL1MessagePasserCGT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/test/scripts/L2Genesis.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down