Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ChainAssertions for deploySuperchain contracts #12271

Merged
merged 2 commits into from
Oct 2, 2024
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
12 changes: 9 additions & 3 deletions packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ library ChainAssertions {
function checkSuperchainConfig(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isPaused
bool _isPaused,
bool _isProxy
)
internal
view
Expand All @@ -433,8 +434,13 @@ library ChainAssertions {
// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(superchainConfig), _slot: 0, _offset: 0 });

require(superchainConfig.guardian() == _cfg.superchainConfigGuardian());
require(superchainConfig.paused() == _isPaused);
if (_isProxy) {
require(superchainConfig.guardian() == _cfg.superchainConfigGuardian());
require(superchainConfig.paused() == _isPaused);
} else {
require(superchainConfig.guardian() == address(0));
maurelian marked this conversation as resolved.
Show resolved Hide resolved
require(superchainConfig.paused() == false);
maurelian marked this conversation as resolved.
Show resolved Hide resolved
}
}

/// @dev Asserts that for a given contract the value of a storage slot at an offset is 1.
Expand Down
18 changes: 12 additions & 6 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,18 @@ contract Deploy is Deployer {
save("ProtocolVersionsProxy", address(dso.protocolVersionsProxy()));
save("ProtocolVersions", address(dso.protocolVersionsImpl()));

// Run chain assertions.
// Run assertions for ProtocolVersions and SuperchainConfig proxy contracts.
ChainAssertions.checkProtocolVersions({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isProxy: true });
ChainAssertions.checkSuperchainConfig({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isPaused: false });
// TODO: Add assertions for SuperchainConfig and ProtocolVersions impl contracts.
// TODO: Add assertions for SuperchainProxyAdmin.
// First run assertions for the ProtocolVersions and SuperchainConfig proxy contracts.
Types.ContractSet memory contracts = _proxiesUnstrict();
ChainAssertions.checkProtocolVersions({ _contracts: contracts, _cfg: cfg, _isProxy: true });
ChainAssertions.checkSuperchainConfig({ _contracts: contracts, _cfg: cfg, _isProxy: true, _isPaused: false });

// Then replace the ProtocolVersions proxy with the implementation address and run assertions on it.
contracts.ProtocolVersions = mustGetAddress("ProtocolVersions");
ChainAssertions.checkProtocolVersions({ _contracts: contracts, _cfg: cfg, _isProxy: false });

// Finally replace the SuperchainConfig proxy with the implementation address and run assertions on it.
contracts.SuperchainConfig = mustGetAddress("SuperchainConfig");
ChainAssertions.checkSuperchainConfig({ _contracts: contracts, _cfg: cfg, _isPaused: false, _isProxy: false });
}

/// @notice Deploy all of the OP Chain specific contracts
Expand Down