Skip to content

Comments

Cluster edit and asdb management scripts#422

Open
pinebit wants to merge 24 commits intomainfrom
pinebit/script-replace-operator
Open

Cluster edit and asdb management scripts#422
pinebit wants to merge 24 commits intomainfrom
pinebit/script-replace-operator

Conversation

@pinebit
Copy link
Contributor

@pinebit pinebit commented Feb 11, 2026

Cluster Edit Scripts

  • All edit operations (script/edit/)
  • Anti-Slashing Database Scripts (scripts/edit/vc/)
  • Corresponding Claude Skills

Testing

  • Added ./scripts/edit/test/e2e_test.sh that runs complete E2E test using docker compose, by running real Lodestar VC, checking ASDB export/import and all edit commands in a sequence.

@pinebit pinebit changed the title Scripts for replace-operator and asdb management Cluster edit and asdb management scripts Feb 17, 2026
exit 1
fi

if [ ! -f .charon/cluster-lock.json ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we add the option to specify custom directory for those in the edit commands? We currently support it for run, dkg, etc.

But I suppose those scripts are made only for the general use case?

Copy link
Contributor Author

@pinebit pinebit Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done via WORK_DIR env var, this is not documented though (it was added for testing mocking)..


# VC container must be stopped before export (Lodestar locks the database while running)
if [ "$DRY_RUN" = false ]; then
if docker compose ps "$VC" 2>/dev/null | grep -q Up; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This greps the first line, but... there might be some warnings that are first. i.e.: I get the following

➜  charon-distributed-validator-node git:(main) docker compose ps vc-teku
WARN[0000] The "MEVBOOST_RELAYS" variable is not set. Defaulting to a blank string. 
NAME                                          IMAGE                    COMMAND                  SERVICE   CREATED          STATUS          PORTS
charon-distributed-validator-node-vc-teku-1   consensys/teku:25.11.0   "/opt/teku/bin/teku …"   vc-teku   23 seconds ago   Up 22 seconds   5051/tcp, 8008/tcp, 9000/tcp, 9000/udp

➜  charon-distributed-validator-node git:(main) docker compose ps vc-teku | grep -q Up
WARN[0000] The "MEVBOOST_RELAYS" variable is not set. Defaulting to a blank string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good finding, thank you, I will improve this.

docker run --rm $DOCKER_FLAGS \
-v "$REPO_ROOT/.charon:/opt/charon/.charon" \
-v "$REPO_ROOT/$OUTPUT_DIR:/opt/charon/output" \
"obolnetwork/charon:${CHARON_VERSION:-v1.9.0-rc3}" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we put v1.9.0 here and merge this PR after v1.9.0 is merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think I will wait for 1.9.0, then update the tag and merge.

# Verify ceremony output
if [ -f "$OUTPUT_DIR/cluster-lock.json" ]; then
log_info "Ceremony completed successfully!"
NEW_VALIDATORS=$(jq '.distributed_validators | length' "$OUTPUT_DIR/cluster-lock.json" 2>/dev/null || echo "?")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the new lock contain only new validators? It's all validators, right?

Same for operators below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment belongs to add-operators script, not add-validators. But in any case, the new lock contains ALL validators.

- .env file with NETWORK and VC variables set
- For --generate-enr: Docker installed
- For ceremony: .charon/charon-enr-private-key must exist
- For ceremony: Cluster-lock.json received from existing operators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- For ceremony: Cluster-lock.json received from existing operators
- For ceremony: cluster-lock.json received from existing operators

log_info "ENR private key generated"
fi

if [ -f .charon/charon-enr-private-key ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have an else for this condition as well? There should always be .charon/charon-enr-private-key, otherwise something went wrong?

Copy link
Contributor Author

@pinebit pinebit Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the private key is a prerequisite to all edits. Otherwise the ceremony would just fail. I will see what else to improve here.

log_error "Invalid --num-validators: must be a positive integer"
exit 1
fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we validate that the other 2 fields are 0x<HEX>? And the length of all 3 is the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is delegated to the charon command, which does much precise testing. Here, it is more checking for "presence".

# Remove operator with custom threshold
./scripts/edit/remove-operators/remaining-operator.sh \
--operator-enrs-to-remove "enr:-..." \
--new-threshold 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to the scripts.
Thinking about it more now, probably it would've made sense to allow that in add and replace operators commands as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In replace, we only replace single operator by design, the threshold remains unchanged anyway.
In add-operators, we cannot increase threshold because of how re-DKG crypto math works. We can probably reduce the threshold while adding operators, but this looks an odd wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants