Skip to content

Conversation

rafaelcr
Copy link
Collaborator

@rafaelcr rafaelcr commented May 14, 2025

Simply the SQL query for the /extended/v1/tx/events endpoint so it doesn't rely on UNIONs with null columns. It will only query against tables based on the given filters.

Fixes #2261

Copy link

github-actions bot commented May 14, 2025

Vercel deployment URL: https://stacks-blockchain-d2g2gtf2a-hirosystems.vercel.app 🚀

Copy link

codecov bot commented May 14, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/datastore/pg-store.ts 96.29% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@rafaelcr rafaelcr marked this pull request as ready for review May 14, 2025 16:39
@rafaelcr rafaelcr requested a review from janniks May 14, 2025 16:39
@janniks janniks requested a review from Copilot May 14, 2025 20:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the /extended/v1/tx/events SQL to only include relevant event-type subqueries instead of relying on UNIONs against a null‐filled placeholder.

  • Introduce an array of PgSqlQuery segments pushed conditionally per event type.
  • Build the final CTE via reduce to unite only the selected filters.
Comments suppressed due to low confidence (1)

src/datastore/pg-store.ts:1785

  • Add tests covering scenarios where args.eventTypeFilter is empty or includes multiple types to ensure the new dynamic query assembly behaves correctly.
const eventQueries: PgSqlQuery[] = [];

Copy link
Contributor

@janniks janniks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits but looks good 👍

@rafaelcr rafaelcr merged commit 517ca68 into develop May 15, 2025
26 checks passed
@rafaelcr rafaelcr deleted the fix/tx-events-query branch May 15, 2025 14:04
hirosystems-release-bot bot added a commit that referenced this pull request May 26, 2025
## [8.11.0](v8.10.0...v8.11.0) (2025-05-26)

### Features

* add /extended/v2/block-tenures/:height/blocks endpoint ([#2285](#2285)) ([f5c2e01](f5c2e01))
* stacks core event and rpc proxy body limits configurable via env ([#2278](#2278)) ([8a54e9d](8a54e9d))
* store and expose vm_error for failed transactions ([#2286](#2286)) ([7ac7513](7ac7513))

### Bug Fixes

* consider microblock transactions in balance calculations ([#2277](#2277)) ([3418863](3418863))
* count stx mint data at block 0 towards account balances ([#2289](#2289)) ([a0cd9f2](a0cd9f2))
* ignore unanchored param for BNS names endpoint ([#2263](#2263)) ([3d33725](3d33725))
* keep a table of latest stacks node event timestamps ([#2266](#2266)) ([6f111ad](6f111ad))
* module imports in block tenure routes ([#2287](#2287)) ([2cb442e](2cb442e))
* **rosetta:** get current block should only join by stacks chain tip information ([#2265](#2265)) ([78ebad0](78ebad0))
* simplify transaction events query ([#2279](#2279)) ([517ca68](517ca68))
@hirosystems-release-bot
Copy link
Contributor

🎉 This PR is included in version 8.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server error when fetching tx events with stx_asset type

2 participants