Skip to content

feat: add support for DKG sidecar target config hash - #130

Merged
OisinKyne merged 11 commits into
mainfrom
feat/add-target-config-hash
Oct 9, 2025
Merged

OisinKyne merged 11 commits into
mainfrom
feat/add-target-config-hash

Conversation

@bussyjd

@bussyjd bussyjd commented Sep 29, 2025 •

Copy link
Copy Markdown
Contributor

Summary

  • Add new Helm value charon.dkgSidecar.targetConfigHash to allow specifying target config hash for DKG cluster selection
  • Exposes TARGET_CONFIG_HASH environment variable to the DKG sidecar init container runtime
  • Optional parameter that is only set when provided
  • Includes comprehensive format validation and test coverage

Changes

1. Core Functionality

  • New Parameter: charon.dkgSidecar.targetConfigHash in values.yaml
  • Environment Variable: TARGET_CONFIG_HASH conditionally set in StatefulSet
  • Format: 32-byte hex hash with 0x prefix (66 characters total)
  • Example: 0x7f0fd29abb11674b4e61000de26bff3600237aab0402427bd1409756665c2115

2. Validation (validate.yaml)

Comprehensive format validation catches errors at template-time:

  • ✅ Must start with 0x prefix
  • ✅ Must be exactly 66 characters (0x + 64 hex digits)
  • ✅ Must contain only valid hexadecimal characters (0-9, a-f, A-F)
  • ✅ Empty string is allowed (optional parameter)

3. Documentation

  • values.yaml: Updated with format requirements and example
  • Example file: values-examples/with-target-config-hash.yaml with usage guide
  • README: Auto-generated with helm-docs showing validation requirements

4. Test Coverage

Validation Tests (Template-time)

  • ✅ Valid hash renders successfully
  • ✅ Missing 0x prefix fails with clear error
  • ✅ Wrong length fails with clear error
  • ✅ Invalid hex characters fails with clear error
  • ✅ Empty/unset is allowed

Helm Tests (Runtime)

New test file: test-target-config-hash-set.yaml

  • Verifies TARGET_CONFIG_HASH env var is set correctly
  • Validates env var matches expected value
  • Checks format: 0x prefix, 66 character length
  • Clear pass/fail output with diagnostics

Updated test: test-dkg-sidecar-fresh-state.yaml

  • Added TARGET_CONFIG_HASH env var to DKG sidecar init container
  • Ensures test environment matches production configuration
  • Conditional on test values

Usage

Basic Deployment with Target Config Hash

helm install my-dv-pod obol/dv-pod \
  --set charon.dkgSidecar.targetConfigHash=0x7f0fd29abb11674b4e61000de26bff3600237aab0402427bd1409756665c2115 \
  --set charon.operatorAddress=0xYourOperatorAddress \
  --set charon.beaconNodeEndpoints[0]=http://beacon-node:5052 \
  -n dv-namespace --create-namespace

Using Example Values File

helm install my-dv-pod obol/dv-pod \
  -f charts/dv-pod/values-examples/with-target-config-hash.yaml \
  -n dv-namespace --create-namespace

Run Tests

helm test <release-name>

Test Plan

Manual Testing

  • Deploy with valid target config hash and verify env var is set
  • Deploy without target config hash and verify no env var is set
  • Verify DKG sidecar processes the TARGET_CONFIG_HASH correctly
  • Test validation rejects invalid formats (missing 0x, wrong length, invalid chars)

Automated Testing

  • Template validation tests for all error scenarios
  • Helm test pod verifies env var injection
  • DKG sidecar integration test includes TARGET_CONFIG_HASH

Breaking Changes

None - this is a new optional parameter with backward-compatible defaults.

Related Issues

Enables DKG sidecar to target specific cluster definitions when multiple invites exist for an operator address.

Add ability to specify target config hash via --set charon.dkgSidecar.targetConfigHash
which exposes TARGET_CONFIG_HASH environment variable to the DKG sidecar runtime.
@bussyjd
bussyjd requested a review from a team as a code owner September 29, 2025 18:49
@bussyjd
bussyjd requested a review from OisinKyne September 29, 2025 18:56
Comment thread charts/dv-pod/README.md Resolved
OisinKyne
OisinKyne previously approved these changes Sep 29, 2025

@OisinKyne OisinKyne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One tweak

Co-authored-by: Oisín Kyne <4981644+OisinKyne@users.noreply.github.com>
Signed-off-by: JeanDaniel Bussy <SilverSurfer972@gmail.com>
@bussyjd
bussyjd requested a review from OisinKyne September 30, 2025 07:48
Replace bitnami/kubectl:1.33.3 (non-existent version) with alpine/k8s:1.31.4.
The bitnami/kubectl image was causing ErrImagePull failures in the ENR generation job.
alpine/k8s provides both kubectl binary and shell required by the init containers.
OisinKyne
OisinKyne previously approved these changes Oct 1, 2025
Comment thread charts/dv-pod/values.yaml Resolved
bussyjd added 3 commits October 9, 2025 13:11
Add comprehensive format validation for charon.dkgSidecar.targetConfigHash:
- Must start with '0x' prefix
- Must be exactly 66 characters (0x + 64 hex digits)
- Must contain only valid hexadecimal characters (0-9, a-f, A-F)

Changes:
- Add validation rules in validate.yaml using hasPrefix, len, and regexMatch
- Update values.yaml documentation with format requirements and example
- Create example values file showing proper usage
- Regenerate README with helm-docs to reflect new documentation

Format: 0x7f0fd29abb11674b4e61000de26bff3600237aab0402427bd1409756665c2115
Represents: 32-byte (256-bit) Keccak256 hash

Validation catches common errors:
- Missing 0x prefix
- Wrong length
- Invalid hex characters
- Empty string is allowed (optional parameter)
Add comprehensive test coverage for charon.dkgSidecar.targetConfigHash:

1. New test file: test-target-config-hash-set.yaml
   - Dedicated test to verify TARGET_CONFIG_HASH env var is set correctly
   - Validates env var matches expected value
   - Checks format: 0x prefix, 66 character length
   - Uses busybox for lightweight verification
   - Only runs when tests.dkgSidecar.targetConfigHash is set

2. Updated test-dkg-sidecar-fresh-state.yaml
   - Added TARGET_CONFIG_HASH env var to DKG sidecar init container
   - Ensures test environment matches production StatefulSet configuration
   - Conditional on tests.dkgSidecar.targetConfigHash value

3. Added test configuration to values.yaml
   - New tests.dkgSidecar.targetConfigHash field
   - Default test hash: 0x7f0fd29abb11674b4e61000de26bff3600237aab0402427bd1409756665c2115
   - Enables both new test and passes hash to existing DKG sidecar tests

Test coverage: Validates runtime behavior of targetConfigHash parameter,
complements existing template-time validation in validate.yaml.
Regenerated README with helm-docs to include new test configuration:
- tests.dkgSidecar.targetConfigHash parameter (line 140)
- Documents it's for testing purposes
- Shows default test hash value
- Enables test-target-config-hash-set.yaml test when set
@OisinKyne
OisinKyne merged commit 0b7add4 into main Oct 9, 2025
3 checks passed
@OisinKyne
OisinKyne deleted the feat/add-target-config-hash branch October 9, 2025 12:38
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.

2 participants