# Manage a Safety Module

As the `owner` of a Safety Module, it is possible to update the configuration in order to:

* Add new reserve pools
* Add/remove controllers that are allowed to be used to trigger the Safety Module
* Update delays

Configuration updates follows a two-step process:

1. Configuration updates are queued with `SafetyModule.updateConfigs`:

   <pre class="language-solidity"><code class="lang-solidity"><strong>/// @notice Parameters for configuration updates.
   </strong>struct ConfigUpdateCalldataParams {
     // The new reserve pool configs.
     ReservePoolConfig[] reservePoolConfigs;
     // The new controller configs.
     ControllerConfig[] controllerConfigUpdates;
     // The new delays config.
     Delays delaysConfig;
   }

   /// @notice Signal an update to the safety module configs. Existing queued updates are overwritten.
   /// @param configUpdates_ The new configs. Includes:
   /// - reservePoolConfigs: The array of new reserve pool configs, sorted by associated ID. The array may also
   /// include config for new reserve pools.
   /// - controllerConfigUpdates: The array of controller config updates. It only needs to include config for updates to
   /// existing controllers or new controllers.
   /// - delaysConfig: The new delays config.
   function updateConfigs(ConfigUpdateCalldataParams calldata configUpdates_) external;
     onlySharedSafetyModuleIfSetElseOwner;
   </code></pre>
2. Configuration updates can be applied after the [config update delay](https://csm-docs.cozy.finance/creating-a-safety-module/define-safety-module-configuration#config-update-delay) has elapsed and within the [config update grace period](https://csm-docs.cozy.finance/creating-a-safety-module/define-safety-module-configuration#config-update-grace-period) with `SafetyModule.finalizeUpdateConfigs`:

   ```solidity
   /// @notice Execute queued updates to the safety module configs.
   /// @param configUpdates_ The new configs. Includes:
   /// - reservePoolConfigs: The array of new reserve pool configs, sorted by associated ID. The array may also
   /// include config for new reserve pools.
   /// - controllerConfigUpdates: The array of controller config updates. It only needs to include config for updates to
   /// existing controllers or new controllers.
   /// - delaysConfig: The new delays config.
   function finalizeUpdateConfigs(ConfigUpdateCalldataParams calldata configUpdates_) external;
   ```

The reserve pool configs for the update must obey the general requirements for creating a Safety Module (see [Define Safety Module Configuration](https://csm-docs.cozy.finance/developer-guides/creating-a-safety-module/define-safety-module-configuration)).&#x20;

Also, it is not possible to remove reserve pools, so existing reserve pools must be included at the start of the `ReservePoolConfig[]` sorted by the associated reserve pool IDs. Any new reserve pools come after the existing reserve pools and the reserve pool IDs assigned to them respect the order of the array.

**Note:** If a configuration update is queued but not finalized before a Safety Module enters the `TRIGGERED` state, the queued update is cleared and may be re-queued when the Safety Module returns to either the `ACTIVE` or `PAUSED` states.

**Note:** When a Safety Module is part of a Shared Safety Module, the `sharedSafetyModule` is the address authorized to do configuration updates, not the `owner`. See [here](https://csm-docs.cozy.finance/developer-guides/shared-safety-module-functionality) for more details.
