Repository navigation
Conversation
resolveUtxoRefsFromChain (8 v1 endpoints) and the single-ref proxy resolver interpolated caller-supplied txHash values straight into the Blockfrost URL (`txs/<hash>/utxos`), accepted the same ref twice, and issued one serial Blockfrost call per ref with no upper bound. - txHash must be 64 hex (canonicalised to lowercase) before any chain call, so a value like `../accounts/...` can no longer steer our project key to a different Blockfrost endpoint. - A repeated ref is a 400 instead of a doubled builder input. - At most 455 refs (16 KiB / 36 bytes per input): more than one transaction could ever spend; previously a 200 KB body could trigger ~2,000 calls. - Refs sharing a transaction are resolved with one fetch; Blockfrost returns every output of the tx whether or not an index is passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017rkSXFUyVC6wzduGmfdTVc
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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.
What
Hardens
resolveUtxoRefsFromChain— the helper behindutxoRefson 8 v1 endpoints (botStakeCertificate,botDRepCertificate,proxySetup,proxySpend,proxyCleanup,proxyDRepCertificate,proxyVote) — and the single-ref resolver inproxyUtxos.ts(collateralRef,proxyUtxoRefs).Why
BlockfrostProvider.fetchUTxOsrequeststxs/${hash}/utxos. Any string with a non-negativeoutputIndexwas passed through, so atxHashlike../accounts/stake…sent a request with our project key to a different Blockfrost endpoint. NowtxHashmust be 64 hex characters (lowercased) before any chain call.txHash#indextwice was added to the builder twice, so its value was counted twice. It now returns 400 withutxoRefs[i] repeats ….MAX_UTXO_REFS= 455 (16 KiB / 36 bytes per input), which is more than one transaction could ever spend. Refs that share a transaction now use one fetch, because Blockfrost returns every output of the tx whether or not an index is passed (Mesh filters afterwards).All errors stay 400. Every ref is validated before the first upstream call.
Behaviour change for clients
txHashis now rejected. It was already unusable upstream.utxoRefsas a pool to select from, so a client offering more than 455 candidates would now be refused. The CI scenarios and bot-ref build refs fromfreeUtxos, so their hashes are 64 lowercase hex and the refs are distinct.src/pages/api/v1/README.mddocuments the rules.Tests
resolveUtxoRefsFromChain.test.tsis rewritten as a spec: 13 tests covering parsing, path-like hashes, the cap, validate-before-fetch, duplicates in different case, fetch-once-per-tx, canonical lowercase, and the three 400 paths.proxyUtxos.test.ts: a new test checks that a crafted hash never reaches the provider. Fixtures now use 64-hex hashes.npx tsc --noEmit: clean.node scripts/run-tests.mjs: 185 suites, 2363 passed and 2 skipped (preprod baseline was 2352), plus 13 suites with 140 passed.Not done / follow-up
proxyUtxoRefsinproxySpendandproxyCleanupstill resolves one call per ref, with no cap or duplicate check. It now only gets the hash check.txs/{hash}/utxosalso returns spent outputs. Neither the old code nor the new code detects them before submission, and the "not found or already spent" message has always overstated that. Fixing it needs a separateconsumed_by_txcheck.Generated by Claude Code