Skip to content

Commit

Permalink
Code-length check on controller and market deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenceday committed Nov 6, 2023
1 parent 0cb9228 commit 3b33a2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/WildcatMarketController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ contract WildcatMarketController is IWildcatMarketControllerEventsAndErrors {

bytes32 salt = _deriveSalt(asset, namePrefix, symbolPrefix);
market = LibStoredInitCode.calculateCreate2Address(ownCreate2Prefix, salt, marketInitCodeHash);
if (market.codehash != bytes32(0)) {
if (market.code.length != 0) {
revert MarketAlreadyDeployed();
}
LibStoredInitCode.create2WithStoredInitCode(marketInitCodeStorage, salt);
Expand Down
8 changes: 1 addition & 7 deletions src/WildcatMarketControllerFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,7 @@ contract WildcatMarketControllerFactory {
controllerInitCodeHash
);

uint256 controllerCodeSize;

assembly {
controllerCodeSize := extcodesize(controller)
}

if (controllerCodeSize > 0) {
if (controller.code.length != 0) {
revert ControllerAlreadyDeployed();
}
LibStoredInitCode.create2WithStoredInitCode(controllerInitCodeStorage, salt);
Expand Down

0 comments on commit 3b33a2f

Please sign in to comment.