Repository navigation
fix: redirect v3 tx id and block hash params missing the 0x prefix - #2712
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Percent-encoded hashes bypass redirects and can still cause datastore serialization failures.
1 open finding
What changed in this PR
Aligns v3 transaction and block hash handling with v1 by redirecting unprefixed hashes to prefixed URLs.
Changes:
- Adds a shared redirect hook before validation and caching.
- Applies it to six v3 endpoints.
- Adds redirect and pass-through regression tests.
| File | Description |
|---|---|
| tests/api/transactions/v3-hash-redirects.test.ts | Tests redirects, preserved queries, and unchanged inputs. |
| src/api/routes/v3/transactions.ts | Hooks transaction detail, events, and batch routes. |
| src/api/routes/v3/principals.ts | Hooks both balance-change routes. |
| src/api/routes/v3/blocks.ts | Hooks block transaction lookups. |
| src/api/query-helpers.ts | Adds shared path and query hash redirects. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
rafa-stacks
marked this pull request as ready for review
October 8, 2026 17:30
bgridley-stacks
approved these changes
Oct 8, 2026
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.

Every v3 endpoint that takes a transaction id or block hash now answers a hash supplied without the
0xprefix with a302to the same URL with the prefix added. This matches the v1 behavior (/extended/v1/tx/:tx_id,/extended/v1/block/:hash).