Skip to content

Commit cecd695

Browse files
committed
Fixed replace-operator flow
1 parent 09a3b90 commit cecd695

5 files changed

Lines changed: 257 additions & 119 deletions

File tree

.claude/skills/replace-operator/SKILL.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ user-invokable: true
66

77
# Replace Operator
88

9-
Replace a single operator in a Charon cluster with a new one. Remaining operators run a `charon alpha edit replace-operator` ceremony (P2P via relay), then share the new cluster-lock with the new operator.
9+
Replace a single operator in a Charon cluster with a new one. All participating operators (remaining + new) run a `charon alpha edit replace-operator` ceremony together (P2P via relay). The new operator must receive the current cluster-lock.json before the ceremony begins.
1010

1111
## Prerequisites
1212

1313
Read `scripts/edit/replace-operator/README.md` for full details if needed.
1414

1515
Common prerequisites:
1616
1. `.env` file exists with `NETWORK` and `VC` variables set
17-
2. Docker is running
17+
2. `.charon` directory with `cluster-lock.json` and `charon-enr-private-key`
18+
3. Docker is running
19+
4. `jq` installed
1820

1921
## Role Selection
2022

@@ -43,13 +45,13 @@ Ask the user: **"Are you a remaining operator (performing the replacement) or th
4345
[--dry-run]
4446
```
4547

46-
After completion, the script will print commands to start containers manually. Remind the user to **share the new cluster-lock.json with the new operator** and to **wait ~2 epochs before starting** containers.
48+
After completion, the script will print commands to start containers manually. Remind the user to **wait ~2 epochs before starting** containers.
4749

4850
### If New Operator
4951

5052
**Script**: `scripts/edit/replace-operator/new-operator.sh`
5153

52-
This is a **two-step process**:
54+
This is a **three-step process**:
5355

5456
#### Step 1: Generate ENR
5557

@@ -61,15 +63,29 @@ Ask if the user needs to generate an ENR:
6163

6264
This creates `.charon/charon-enr-private-key` and displays the ENR. Tell the user to **share this ENR with the remaining operators**.
6365

64-
#### Step 2: Install Cluster Lock
66+
#### Step 2: Run the Ceremony
6567

66-
After receiving the new `cluster-lock.json` from remaining operators:
68+
After receiving the current `cluster-lock.json` from remaining operators (BEFORE the ceremony):
6769
- `--cluster-lock`: Path to the received `cluster-lock.json`
70+
- `--old-enr`: ENR of the operator being replaced
6871
- Whether to use `--dry-run` first
6972

7073
```bash
7174
./scripts/edit/replace-operator/new-operator.sh \
7275
--cluster-lock ./received-cluster-lock.json \
76+
--old-enr "enr:-..." \
77+
[--dry-run]
78+
```
79+
80+
The new operator runs this **at the same time** as the remaining operators run their ceremony. All operators must participate together.
81+
82+
#### Step 3: Install New Cluster Lock
83+
84+
After the ceremony completes, install the new cluster-lock:
85+
86+
```bash
87+
./scripts/edit/replace-operator/new-operator.sh \
88+
--install-lock ./output/cluster-lock.json \
7389
[--dry-run]
7490
```
7591

scripts/edit/replace-operator/README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ These scripts help operators replace a single operator in an existing distribute
1414
1515
There are two scripts for the two roles involved:
1616

17-
- **`remaining-operator.sh`** - For operators staying in the cluster (runs the ceremony)
17+
- **`remaining-operator.sh`** - For operators staying in the cluster
1818
- **`new-operator.sh`** - For the new operator joining the cluster
1919

20+
**Important**: All participating operators (remaining + new) run the `charon alpha edit replace-operator` ceremony together. The new operator must receive the current `cluster-lock.json` BEFORE the ceremony begins.
21+
2022
## Prerequisites
2123

2224
- `.env` file with `NETWORK` and `VC` variables set
@@ -34,6 +36,8 @@ Automates the complete workflow for operators staying in the cluster:
3436
--old-enr "enr:-..."
3537
```
3638

39+
**Before running**: Share your current `cluster-lock.json` with the new operator so they can participate in the ceremony.
40+
3741
### Options
3842

3943
| Option | Required | Description |
@@ -56,25 +60,35 @@ Automates the complete workflow for operators staying in the cluster:
5660

5761
## For New Operators
5862

59-
Two-step workflow for the new operator joining the cluster.
63+
Three-step workflow for the new operator joining the cluster.
6064

6165
**Step 1:** Generate ENR and share with remaining operators:
6266

6367
```bash
6468
./scripts/edit/replace-operator/new-operator.sh --generate-enr
6569
```
6670

67-
**Step 2:** After receiving cluster-lock from remaining operators:
71+
**Step 2:** After receiving `cluster-lock.json` from remaining operators (BEFORE the ceremony), run the ceremony together with all other operators:
72+
73+
```bash
74+
./scripts/edit/replace-operator/new-operator.sh \
75+
--cluster-lock ./received-cluster-lock.json \
76+
--old-enr "enr:-..."
77+
```
78+
79+
**Step 3:** After the ceremony completes, install the new cluster-lock:
6880

6981
```bash
70-
./scripts/edit/replace-operator/new-operator.sh --cluster-lock ./received-cluster-lock.json
82+
./scripts/edit/replace-operator/new-operator.sh --install-lock ./output/cluster-lock.json
7183
```
7284

7385
### Options
7486

7587
| Option | Required | Description |
7688
|--------|----------|-------------|
77-
| `--cluster-lock <path>` | No | Path to new cluster-lock.json |
89+
| `--cluster-lock <path>` | No | Path to cluster-lock.json (for ceremony) |
90+
| `--old-enr <enr>` | No | ENR of the operator being replaced (for ceremony) |
91+
| `--install-lock <path>` | No | Install the new cluster-lock after ceremony |
7892
| `--generate-enr` | No | Generate new ENR private key |
7993
| `--dry-run` | No | Preview without executing |
8094
| `-h, --help` | No | Show help message |

0 commit comments

Comments
 (0)