config: blank *-content flag falls through to *-file (strict-PQ staking key fix)#138
Closed
woobin-satschel wants to merge 1 commit into
Closed
Conversation
pemBytesOrFile short-circuited when a *-content flag was set but empty (v.IsSet true, value ""), returning empty bytes instead of consulting the corresponding *-file path. For strict-PQ staking keys (--staking-mldsa-key-file-content / --staking-mldsa-key-file) this silently degraded a validator to a classical ECDSA NodeID: StakingMLDSAPub stayed empty, IsStrictPQ() was false, and the node booted with no error. The genesis validator set then never matched the live NodeIDs and the P-chain produced 0 blocks -- the strict-PQ activation outage (the #48 failure class). Treat a set-but-empty content flag identically to an absent one and fall through to the *-file path. The same helper backs the ML-KEM handshake keys, so both paths are fixed. Restore the regression guard TestLoadStakingMLDSA_EmptyContentFallsThroughToPath (fails on main, passes here) alongside the other loadStakingMLDSA cases. Verified: CGO_ENABLED=0 go test ./config/
Member
|
Superseded by #139, opened directly on luxfi/node (same fix + restored regression test). Closing this fork-based PR and removing the fork. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
config.pemBytesOrFile(config/config.go) short-circuits when a*-contentflag is set but empty:v.IsSet(contentKey)is true, the value is"", and it returns empty bytes instead of falling through to the corresponding*-filepath.For strict-PQ staking keys (
--staking-mldsa-key-file-content/--staking-mldsa-key-file), a deploy whose env var or template rendered the-contentflag to""alongside a valid-filepath silently degraded the validator to a classical ECDSA NodeID —StakingMLDSAPubstayed empty,IsStrictPQ()was false, and the node booted with no error. The genesis validator set then never matched the live NodeIDs, so the P-chain produced 0 blocks: the strict-PQ activation outage (the #48 failure class).This is a
configconcern, deliberately out of scope for #137 (schemeGate + pre-dedup handshake + classical-compat), which covered the consensus/chain-creation layers.Fix
Treat a set-but-empty
*-contentflag identically to an absent one and fall through to the*-filepath, so a blank content flag and a missing one behave the same. The same helper backs the ML-KEM handshake keys, so both key paths are covered.Test
Restores
config/staking_mldsa_test.go, including the regression guardTestLoadStakingMLDSA_EmptyContentFallsThroughToPathplus the surroundingloadStakingMLDSAcases (path form, content form, classical-compat, and priv-only-is-fatal). The guard fails onmain(privis nil — the silent degradation) and passes with this change.Verification
(cgo is broken in this tree — build/test with
CGO_ENABLED=0.)