|
| 1 | +# Update the protocol parameters of a Mithril network |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +The protocol parameters of a network are currently defined when starting the aggregator of the network. |
| 6 | +During startup, the aggregator will store the parameters in its stores, and will use them **3** epochs later. The protocol parameters are broadcasted by the aggregator to the signers of the network through the `/epoch-settings` route. |
| 7 | + |
| 8 | +## Update parameters of a Mithril network |
| 9 | +The aggregator has the following configuration parameter used to set the protocol parameters: `protocol_parameters` which is a JSON representation of the `ProtocolParameter` type: |
| 10 | +```bash |
| 11 | +pub struct ProtocolParameters { |
| 12 | + /// Quorum parameter |
| 13 | + pub k: u64, |
| 14 | + |
| 15 | + /// Security parameter (number of lotteries) |
| 16 | + pub m: u64, |
| 17 | + |
| 18 | + /// f in phi(w) = 1 - (1 - f)^w, where w is the stake of a participant |
| 19 | + pub phi_f: f64, |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +Each parameter can also be set via an environment variable: |
| 24 | +- `PROTOCOL_PARAMETERS__K` for `k` |
| 25 | +- `PROTOCOL_PARAMETERS__M` for `m` |
| 26 | +- `PROTOCOL_PARAMETERS__PHI_F` for `phi-f` |
| 27 | + |
| 28 | +When setting up a Mithril network with a `terraform` deployment, the protocol parameters are set with a JSON definition. |
| 29 | + |
| 30 | +## Find the workflow used to deploy a Mithril network |
| 31 | + |
| 32 | +Currently, the following [Mithril networks](https://mithril.network/doc/manual/developer-docs/references#mithril-networks) are generally available, and deployed with `terraform`: |
| 33 | +- `testing-preview`: with the workflow [`.github/workflows/ci.yml`](../../github/workflows/ci.yml) |
| 34 | +- `pre-release-preview`: with the workflow [`.github/workflows/pre-release.yml`](../../github/workflows/pre-release.yml) |
| 35 | +- `release-preprod`: with the workflow [`.github/workflows/release.yml`](../../github/workflows/release.yml) |
| 36 | +- `release-mainnet`: with the workflow [`.github/workflows/release.yml`](../../github/workflows/release.yml) |
| 37 | + |
| 38 | +## Update the protocol parameters |
| 39 | + |
| 40 | +Update the following value of the targeted network in the deployment matrix with the new values that need to be used: |
| 41 | +```bash |
| 42 | +mithril_protocol_parameters: | |
| 43 | + { |
| 44 | + k = 5 |
| 45 | + m = 100 |
| 46 | + phi_f = 0.6 |
| 47 | + } |
| 48 | +``` |
| 49 | + |
| 50 | +Which will be replaced eg with: |
| 51 | +```bash |
| 52 | +mithril_protocol_parameters: | |
| 53 | + { |
| 54 | + k = 2422 |
| 55 | + m = 20973 |
| 56 | + phi_f = 0.2 |
| 57 | + } |
| 58 | +``` |
| 59 | + |
| 60 | +The modifications should be created in a dedicated PR, and the result of the **Plan** job of the terraform deployment should be analyzed precisely to make sure that the change has been taken into consideration. |
| 61 | + |
| 62 | +## Deployment of the new protocol parameters |
| 63 | + |
| 64 | +The update of the new protocol parameters will take place as detailed in the following table: |
| 65 | +| Workflow | Deployed at | Effective at |
| 66 | +|------------|------------|------------ |
| 67 | +| [`.github/workflows/ci.yml`](../../github/workflows/ci.yml) | Merge on `main` branch | **3** epochs later |
| 68 | +| [`.github/workflows/pre-release.yml`](../../github/workflows/pre-release.yml) | Pre-release of a distribution | **3** epochs later |
| 69 | +| [`.github/workflows/release.yml`](../../github/workflows/release.yml) | Release of a distribution | **3** epochs later |
| 70 | + |
| 71 | +For more information about the CD, please refer to [Release process and versioning](https://mithril.network/doc/adr/3). |
0 commit comments