Skip to content

dkg: remove an empty validator_keys directory - #4834

Open
OisinKyne wants to merge 1 commit into
mainfrom
oisin/dkg-empty-validator-keys
Open

OisinKyne wants to merge 1 commit into
mainfrom
oisin/dkg-empty-validator-keys

Conversation

@OisinKyne

Copy link
Copy Markdown
Contributor

LCDVN and dv-pod now mask .charon/validator_keys from the charon container. If that directory doesn't exist yet, the container runtime creates it as a mount point, often owned by root. A later charon dkg then refuses with "data directory not clean", even though the directory is empty.

checkClearDataDir now removes an empty validator_keys directory and carries on. checkWrites then creates a fresh one owned by the DKG user. A validator_keys directory with any entry, or a validator_keys file, is still refused.

If the removal fails, the error says to remove the directory manually and retry.

Removing a root-owned empty directory works without root, because only write access to the parent .charon is needed. The DKG runs in its own container, where the directory isn't a mount point.

Testing

  • TestCheckClearDataDir:
    • a non-empty validator_keys directory is still refused;
    • an empty one passes and is removed.
  • go test ./dkg/... -short

category: misc
ticket: none

A container runtime creates a missing mount point for a validator_keys
mask, often root owned, which made a later charon dkg fail with
"data directory not clean". Remove it when empty and let the DKG create
its own. A non-empty directory is still refused.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.78%. Comparing base (0483b7f) to head (9d72650).

Files with missing lines Patch % Lines
dkg/disk.go 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4834      +/-   ##
==========================================
+ Coverage   67.73%   67.78%   +0.04%     
==========================================
  Files         255      255              
  Lines       33749    33762      +13     
==========================================
+ Hits        22860    22885      +25     
+ Misses      10888    10876      -12     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@OisinKyne OisinKyne changed the title dkg: remove an empty validator_keys directory instead of refusing dkg: remove an empty validator_keys directory Nov 10, 2026
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.

1 participant