Skip to content

Commit

Permalink
test: Remove exceptions for unlabelled fdg contracts (ethereum-optimi…
Browse files Browse the repository at this point in the history
…sm#12462)

* test: Remove exceptions for unlabelled fdg contracts

* fix: Unused import
  • Loading branch information
maurelian authored Oct 15, 2024
1 parent 34e8e69 commit c8edbe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
7 changes: 0 additions & 7 deletions packages/contracts-bedrock/scripts/Artifacts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ abstract contract Artifacts {

/// @notice Returns the value of the internal `_initialized` storage slot for a given contract.
function loadInitializedSlot(string memory _contractName) public returns (uint8 initialized_) {
// FaultDisputeGame and PermissionedDisputeGame are initializable but cannot be loaded with
// this function yet because they are not properly labeled in the deploy script.
// TODO: Remove this restriction once the deploy script is fixed.
if (LibString.eq(_contractName, "FaultDisputeGame") || LibString.eq(_contractName, "PermissionedDisputeGame")) {
revert UnsupportedInitializableContract(_contractName);
}

address contractAddress;
// Check if the contract name ends with `Proxy` and, if so, get the implementation address
if (LibString.endsWith(_contractName, "Proxy")) {
Expand Down
16 changes: 3 additions & 13 deletions packages/contracts-bedrock/test/vendor/Initializable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";

// Scripts
import { Executables } from "scripts/libraries/Executables.sol";
import { ForgeArtifacts, StorageSlot } from "scripts/libraries/ForgeArtifacts.sol";
import { ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol";
import { Process } from "scripts/libraries/Process.sol";

// Libraries
Expand Down Expand Up @@ -473,19 +473,9 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract memory _contract = contracts[i];
string memory name = _getRealContractName(_contract.name);

// Grab the value of the "initialized" storage slot. Must handle special case for the
// FaultDisputeGame and PermissionedDisputeGame contracts since these have a different
// name for the "initialized" storage slot and are currently not properly labeled in
// the deployment script.
// TODO: Update deployment script to properly label the dispute game contracts.
// Grab the value of the "initialized" storage slot.
uint8 initializedSlotVal;
if (LibString.eq(name, "FaultDisputeGame") || LibString.eq(name, "PermissionedDisputeGame")) {
StorageSlot memory slot = ForgeArtifacts.getInitializedSlot(name);
bytes32 slotVal = vm.load(_contract.target, bytes32(vm.parseUint(slot.slot)));
initializedSlotVal = uint8((uint256(slotVal) >> (slot.offset * 8)) & 0xFF);
} else {
initializedSlotVal = deploy.loadInitializedSlot(name);
}
initializedSlotVal = deploy.loadInitializedSlot(name);

// Assert that the contract is already initialized.
assertTrue(
Expand Down

0 comments on commit c8edbe2

Please sign in to comment.