`SphereXConfig::constructor` argument `engine` set as `0` in `WildcatArchController::constructor` will prevent key `WildcatArchController` functions from from executing
Audit: 2024-08-wildcat-findings
Severity: HIGH

# Lines of code

https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/WildcatArchController.sol#L61


# Vulnerability details

## Details

In `WildcatArchController::constructor` the `SphereXConfig` is initialiazed by providing its `constructor` arguments as so

```
//src/WildcatArchController
//ln#61-63
//@audit                      admin       operator    engine
constructor() SphereXConfig(msg.sender, address(0), address(0)) {  //@audit SphereXConffig `engine` set as 0 will not allow execution of some functions
    _initializeOwner(msg.sender);
  }

```

The `SphereXConfig::constructor` is 

```
//src/spherex/SpherXConfig
//ln#27-36

constructor(address admin, address operator, address engine) {
    _setAddress(SPHEREX_ADMIN_STORAGE_SLOT, admin);
    emit_SpherexAdminTransferCompleted(address(0), admin);

    _setAddress(SPHEREX_OPERATOR_STORAGE_SLOT, operator);
    emit_ChangedSpherexOperator(address(0), operator);

    _setSphereXEngine(engine);
    emit_ChangedSpherexEngineAddress(address(0), engine);
  }


```

From these you can see both `sphereXOperator` and `sphereXEngine` are set to `address(0) ` on `WildcatArchController` deployment.

The issue is that `WildcatArchController::registerControllerFactory`,`WildcatArchController::registerMarket` and `WildcatArchController::registerController`  calls `SphereXConfig::_addAllowedSenderOnChain` when adding a new `factory`, `market` and `controller` respectively.

The `SphereXConfig::_addAllowedSenderOnChain` checks that `engine` is not `address(0).

```
//src/spherex/SpherXConfig
//ln#167-172

function _addAllowedSenderOnChain(address newSender) internal {
    ISphereXEngine engine = ISphereXEngine(sphereXEngine());
    if (address(engine) != address(0)) {
      engine.addAllowedSenderOnChain(newSender);
      emit_NewAllowedSenderOnchain(newSender);
    }
  }

```

And while `SphereXConfig` has a function to change the engine address -- `SphereXConfig::changeSphereXEngine`, it's restricted to the `sphereXOperator` which was also set as `address(0)` in `WildcatArchController::constructor`. However the `SphereXOperator` can also be set to a desired address with `SphereXConfig::changeSphereXOperator`

```
//src/spherex/SpherXConfig
//ln#131-135

function changeSphereXOperator(address newSphereXOperator) external onlySphereXAdmin {
    address oldSphereXOperator = _getAddress(SPHEREX_OPERATOR_STORAGE_SLOT);
    _setAddress(SPHEREX_OPERATOR_STORAGE_SLOT, newSphereXOperator);
    emit_ChangedSpherexOperator(oldSphereXOperator, newSphereXOperator);
  }

```

But non of these methods are implemented in the `WildcatArchController`, making the loops involved just to call these functions - `WildcatArchController::registerControllerFactory`,`WildcatArchController::registerMarket` and `WildcatArchController::registerController` - when `sphereXEngine` is set as `address(0)` will obstruct a timely registration of `WildcatArchController::ControllerFactory` and `Wild