fix(nitro-verifier): add Unknown sentinel to VerificationResult for fail-closed default#243
Merged
leopoldjoy merged 1 commit intomainfrom Apr 8, 2026
Merged
Conversation
…ail-closed default Add Unknown as index 0 in the VerificationResult enum so that uninitialized enum variables default to a failure state rather than Success. This follows the defensive design principle that the zero/default value should be the most restrictive state, preventing any future code path from accidentally treating an uninitialized verification result as a successful attestation.
Collaborator
✅ Heimdall Review Status
|
jackchuma
approved these changes
Apr 8, 2026
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.
Summary
Unknownas index 0 in theVerificationResultenum so that uninitialized enum variables default to a failure state instead ofSuccessDetails
In Solidity, the default value for any uninitialized enum is
0. Previously,Successwas at index 0, meaning an uninitializedVerificationResultwould silently equal "success" — a classic fail-open anti-pattern in security-sensitive code.While no live vulnerability exists today (all current code paths fully initialize the result before checking it), the enum ordering is fragile against future modifications. For example:
VerifierJournalallocated vianew VerifierJournal[](n)would haveresultdefault toSuccessbefore assignment!= VerificationResult.SuccesschecksThe new enum ordering:
No call-site changes are needed — all existing checks use the pattern
journal.result != VerificationResult.Success, which naturally treatsUnknownas a failure.Testing
NitroEnclaveVerifierTesttests passTEEProverRegistryTesttests pass--forceNote
This is an ABI-breaking change for the
VerificationResultenum (numeric values shift by +1). Off-chain systems that produce or consumeVerificationResultvalues (e.g., ZK prover programs) will need coordinated updates.