Repository navigation
fix(calculated-price): require decimals quorum before scaling - #5626
Draft
kyleburton-cl wants to merge 1 commit into
Draft
kyleburton-cl wants to merge 1 commit into
kyleburton-cl wants to merge 1 commit into
Conversation
Every successful source must report the decimals field and agree; an omission is now treated as a disagreement (502) instead of being filtered out before the consistency check. Previously a single source reporting the field could dictate the scaling exponent while other sources omitted it, shifting the delivered price by 10^delta. Fixes HackerOne 3846990.
🦋 Changeset detectedLatest commit: f98c538 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
kyleburton-cl
force-pushed
the
fix/hackerone-3846990-calculated-price-decimals-quorum
branch
from
November 24, 2026 00:06
cfbc2b1 to
f98c538
Compare
This branch has not been deployed
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.
Description
calculated-pricescales the computed result by adecimalsexponent read from each source's response (whenoperandNDecimalsFieldandoutputDecimalsare configured). InfetchFromSources, sources that omit the field were filtered out before the consistency check, so the check passed when exactly one source reported it — and that single source's exponent then scaled the whole price by10^delta, returned as a valid200. Omission was tolerated for the exponent while the value still required aminAnswersquorum.This change requires every successful source to report a valid integer exponent and for all reported values to agree; an omission is treated as a disagreement and the request fails closed (
502).Changes
packages/composites/calculated-price/src/transport/computePrice.ts— no longer filter omitters before the consistency check; requirevalidDecimals.length === successfulResults.lengthand a single unique value. Tighten validation toNumber.isInteger(rejects non-numeric / non-integer values the previous!Number.isNaNguard allowed).packages/composites/calculated-price/test/integration/adapter.test.ts— regression test: two sources withminAnswers=2, only one reportsdecimals→ expects502..changeset/calculated-price-decimals-quorum.md— patch changeset.Steps to Test
yarn && yarn setupyarn test packages/composites/calculated-price/testreturns failure when only some upstream responses report the decimals fieldpasses (502), and the existing decimal-scaling tests still pass (200 when all sources agree, 502 on mismatch / all-missing).Quality Assurance
infra-k8sconfiguration file. — N/A: no environment variable changes.adapter-secretsconfiguration file. — N/A: no secret changes.test-payload.jsonfile with relevant requests. — N/A: no new endpoint.feature/x,chore/x,release/x,hotfix/x,fix/x) or is created from Jira.