Skip to content

fix(adapters): coerce raw asset and difficulty falling back to unknown (Fixes #893) - #953

Open
yunyue-taste-it wants to merge 1 commit into
MergeFi:mainfrom
yunyue-taste-it:fix/issue-893-coerce-asset-and-difficulty
Open

yunyue-taste-it wants to merge 1 commit into
MergeFi:mainfrom
yunyue-taste-it:fix/issue-893-coerce-asset-and-difficulty

Conversation

@yunyue-taste-it

Copy link
Copy Markdown

Summary

Fixes #893

  • Added coerceAsset and coerceDifficulty helpers in src/lib/utils.ts to guard untrusted JSON values, falling back to explicit "unknown" values rather than passing unvalidated values through.
  • Updated adaptBounty, adaptMilestone, and adaptMaintenancePool in src/lib/adapters.ts to use coerceAsset and coerceDifficulty.
  • Added support for "unknown" difficulty in DifficultyBadge (src/components/ui/Badge.tsx) and accentByDifficulty (src/components/bounty/BountyCard.tsx).
  • Handled "unknown" asset safely in rewardToUsd (src/lib/bounty-query.ts) and formatCryptoAmount (src/lib/locale.ts).
  • Cleaned up duplicate syntax residue in utils.ts and updated Badge.test.tsx, utils.test.ts, and adapters.test.ts unit tests (178/178 tests pass).

Payout Wallet (EVM): 0x53A47C81DdaCEDFba1048842D5D5f011a80e386D

@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

@yunyue-taste-it is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

adaptBounty passes asset and difficulty through with no validation, unlike status which is coerced

1 participant