# 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](/developer-guides/creating-a-safety-module/define-safety-module-configuration.md#config-update-delay) has elapsed and within the [config update grace period](/developer-guides/creating-a-safety-module/define-safety-module-configuration.md#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](/developer-guides/creating-a-safety-module/define-safety-module-configuration.md)).&#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](/developer-guides/shared-safety-module-functionality.md) for more details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://csm-docs.cozy.finance/developer-guides/manage-a-safety-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
