Fix/oracle hardening 991 994 - #1067
Merged
Merged
Conversation
Partial-success results with confidence below a configurable threshold (ORACLE_MIN_CONFIDENCE_THRESHOLD, default 0.75) were previously enqueued for on-chain submission regardless of signal strength. OracleService now rejects low-confidence primary/fallback results the same way it already rejects total provider outages: it refuses to enqueue, logs an oracle.low_confidence_fail_closed event, and increments oracleFailClosedTotal. Adds unit tests and env-validation docs.
timeout-utils previously clamped out-of-range timeouts to MIN/MAX with only a console.warn, letting production silently run with a different effective timeout than configured. validateTimeout() now throws in NODE_ENV=production instead of clamping (dev/test keep the clamp). FallbackAdapter now defaults to a named FALLBACK_PROVIDER_TIMEOUT_POLICY_MS constant matching docs/architecture.md instead of the generic default, and validates both its configured and per-request timeouts through the same fail-fast path. Adds tests and a fix writeup under docs/fixes/.
Adds explicit signature envelope versioning to SignedResolutionReport (version 2 = domain+network separated per Vatix-Protocol#978, version 1/undefined = legacy domain-only). verifyResolutionReport now throws LegacySignatureRejectedError for legacy signatures when NODE_ENV=production instead of silently verifying them with the weaker (passphrase-less) canonical form, closing the cross-network replay gap. Outside production, legacy reports still verify (with a warning) to support a migration window. signResolutionReport always stamps new reports with version 2. Adds tests and docs/signature-helper.md updates.
PriceFetcher.fetchPrice() previously returned a bare number with no way
to tell whether it came from a primary or fallback provider, making
forensic investigation of a bad price impossible. It now returns a
PriceFetchResult { price, source: "primary" | "fallback", sourceMetadata:
{ provider, requestId }, fetchedAt }, intended to be persisted onto
OracleReport.source. Adds a real primary/fallback provider chain
(PriceProviderConfig), per-fetch correlation ids in all log lines, and
fail-closed behavior: no primaryProvider is required in
NODE_ENV=production (constructor throws instead of using the local
stub), and AllPriceProvidersFailedError is thrown instead of ever
returning a stale/default price. Adds tests and docs/price-fetcher.md
updates.
5 tasks
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.
Closes #1006
Closes #1007
Closes #1008
Closes #1009