Skip to content

Commit

Permalink
fix: no need to split initializer functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
blmalone committed Sep 13, 2024
1 parent ab6cd6a commit 17993c0
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions packages/contracts-bedrock/src/L1/OPStackManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,34 +185,18 @@ contract OPStackManager is ISemver, Initializable {
}

function initialize(InitializerInputs memory _initializerInputs) public initializer {
initializePart1(_initializerInputs.blueprints);
initializePart2(_initializerInputs.release, _initializerInputs.isLatest, _initializerInputs.setters);
}

// Step 1: Initialize blueprint contracts
function initializePart1(Blueprints memory _blueprints) internal {
assertValidContractAddress(_blueprints.addressManager);
assertValidContractAddress(_blueprints.proxy);
assertValidContractAddress(_blueprints.proxyAdmin);
assertValidContractAddress(_blueprints.l1ChugSplashProxy);
assertValidContractAddress(_blueprints.resolvedDelegateProxy);
blueprint = _blueprints;
}
if (_initializerInputs.isLatest) latestRelease = _initializerInputs.release;

// Step 2: Initialize implementations for a release version
function initializePart2(string memory _release, bool _isLatest, ImplementationSetter[] memory _setters) internal {
if (_isLatest) {
latestRelease = _release;
}

for (uint256 i = 0; i < _setters.length; i++) {
ImplementationSetter memory setter = _setters[i];
Implementation storage impl = implementations[_release][setter.name];
for (uint256 i = 0; i < _initializerInputs.setters.length; i++) {
ImplementationSetter memory setter = _initializerInputs.setters[i];
Implementation storage impl = implementations[_initializerInputs.release][setter.name];
if (impl.logic != address(0)) revert AlreadyReleased();

impl.initializer = setter.info.initializer;
impl.logic = setter.info.logic;
}

blueprint = _initializerInputs.blueprints;
}

function setRelease(SetRelease memory _setRelease) external {
Expand Down

0 comments on commit 17993c0

Please sign in to comment.