Skip to content

Commit

Permalink
Add permissioned game output assertions (#12093)
Browse files Browse the repository at this point in the history
* test: Add permissioned game output assertions

* test: reorder DeployOpChainTest_Base for clarity

* Update packages/contracts-bedrock/test/DeployOPChain.t.sol

Co-authored-by: Matt Solomon <matt@mattsolomon.dev>

---------

Co-authored-by: Matt Solomon <matt@mattsolomon.dev>
  • Loading branch information
maurelian and mds1 authored Sep 24, 2024
1 parent 1ee7ea1 commit 5b9b3b8
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions packages/contracts-bedrock/test/DeployOPChain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -361,30 +361,27 @@ contract DeployOPChain_TestBase is Test {
})
);

// Initialize deploy scripts.
// Configure and deploy Superchain contracts
DeploySuperchain deploySuperchain = new DeploySuperchain();
(DeploySuperchainInput dsi, DeploySuperchainOutput dso) = deploySuperchain.etchIOContracts();

dsi.set(dsi.proxyAdminOwner.selector, proxyAdminOwner);
dsi.set(dsi.protocolVersionsOwner.selector, protocolVersionsOwner);
dsi.set(dsi.guardian.selector, guardian);
dsi.set(dsi.paused.selector, paused);
dsi.set(dsi.requiredProtocolVersion.selector, requiredProtocolVersion);
dsi.set(dsi.recommendedProtocolVersion.selector, recommendedProtocolVersion);

DeployImplementations deployImplementations = createDeployImplementationsContract();
(DeployImplementationsInput dii, DeployImplementationsOutput dio) = deployImplementations.etchIOContracts();

deployOPChain = new DeployOPChain();
(doi, doo) = deployOPChain.etchIOContracts();

// Deploy the superchain contracts.
deploySuperchain.run(dsi, dso);

// Populate the inputs for DeployImplementations based on the output of DeploySuperchain.
superchainConfigProxy = dso.superchainConfigProxy();
protocolVersionsProxy = dso.protocolVersionsProxy();

// Deploy the implementations.
// Configure and deploy Implementation contracts
DeployImplementations deployImplementations = createDeployImplementationsContract();
(DeployImplementationsInput dii, DeployImplementationsOutput dio) = deployImplementations.etchIOContracts();

dii.set(dii.withdrawalDelaySeconds.selector, withdrawalDelaySeconds);
dii.set(dii.minProposalSizeBytes.selector, minProposalSizeBytes);
dii.set(dii.challengePeriodSeconds.selector, challengePeriodSeconds);
Expand All @@ -400,7 +397,11 @@ contract DeployOPChain_TestBase is Test {
dii.set(dii.standardVersionsToml.selector, standardVersionsToml);
deployImplementations.run(dii, dio);

// Set the OPStackManager input for DeployOPChain.
// Deploy DeployOpChain, but defer populating the input values to the test suites inheriting this contract.
deployOPChain = new DeployOPChain();
(doi, doo) = deployOPChain.etchIOContracts();

// Set the OPStackManager address as input to DeployOPChain.
opsm = dio.opsmProxy();
}

Expand Down Expand Up @@ -478,8 +479,12 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
address batcherActual = address(uint160(uint256(doo.systemConfigProxy().batcherHash())));
assertEq(batcherActual, batcher, "2300");
assertEq(address(doo.systemConfigProxy().unsafeBlockSigner()), unsafeBlockSigner, "2400");
// assertEq(address(...proposer()), proposer, "2500"); // TODO once we deploy dispute games.
// assertEq(address(...challenger()), challenger, "2600"); // TODO once we deploy dispute games.
assertEq(address(doo.permissionedDisputeGame().proposer()), proposer, "2500");
assertEq(address(doo.permissionedDisputeGame().challenger()), challenger, "2600");

// TODO once we deploy the Permissionless Dispute Game
// assertEq(address(doo.faultDisputeGame().proposer()), proposer, "2700");
// assertEq(address(doo.faultDisputeGame().challenger()), challenger, "2800");

// Most architecture assertions are handled within the OP Stack Manager itself and therefore
// we only assert on the things that are not visible onchain.
Expand Down

0 comments on commit 5b9b3b8

Please sign in to comment.