Skip to content

Add --custom-spec-support flag for non-mainnet SSZ presets#176

Open
AntiD2ta wants to merge 2 commits into
masterfrom
gnosis-custom-spec-support
Open

Add --custom-spec-support flag for non-mainnet SSZ presets#176
AntiD2ta wants to merge 2 commits into
masterfrom
gnosis-custom-spec-support

Conversation

@AntiD2ta

@AntiD2ta AntiD2ta commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Adds a --custom-spec-support persistent flag (default false) that switches the go-eth2-client HTTP consensus client from the built-in static SSZ decoder to a dynamic SSZ decoder, enabling ethdo to handle non-mainnet presets such as the Gnosis chain.

The dynamic decoder is slower than the static one, so the flag defaults to off and engages only when explicitly set. It is currently honoured by the validator exit command.

No unit tests were added: the changes are config plumbing over an external-I/O-only connection path, for which the appropriate layer is an RPC integration test against a live beacon node (not present in this repo).

Gnosis validators were exited using this code successfully. This works as an integration test confirming --custom-spec-support decodes a real Gnosis beacon state.

AntiD2ta added 2 commits June 26, 2026 12:27
Build the go-eth2-client HTTP client with WithCustomSpecSupport when the new
--custom-spec-support persistent flag is set, switching from the static
mainnet fastssz decoder to dynamic-ssz. Without it, decoding a non-mainnet
preset beacon state (e.g. Gnosis) fails with:

  invalid ssz encoding. first variable element offset indexes into fixed value data

because the static mainnet-preset decoder misreads the variable-length
offsets of a Gnosis-preset BeaconState. This blocks
"validator exit --prepare-offline" against a Gnosis node, which fetches the
full beacon state via SSZ.

Threads the flag through ConnectOpts and connectToBeaconNode, and wires it
into the validator exit command's ConnectToBeaconNode call, mirroring the
existing --allow-insecure-connections plumbing.
- Reword the --custom-spec-support help string to match the register of
  neighboring flag descriptions and disclose that it is currently honoured
  only by the 'validator exit' command.
- Add a doc comment to the exported ConnectOpts type.
- Replace the adjacent positional booleans in connectToBeaconNode with a
  named-field beaconNodeConnection struct so the three call sites are
  self-documenting; the mainnet fallback's forced allowInsecure is now
  explicit at the call site.

Behaviour-preserving cleanup; no functional change to the feature.
@AntiD2ta AntiD2ta self-assigned this Jun 26, 2026
@AntiD2ta AntiD2ta marked this pull request as ready for review June 26, 2026 14:03
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