Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add principal cache etag to account endpoints #2097

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

rafaelcr
Copy link
Collaborator

@rafaelcr rafaelcr commented Sep 26, 2024

Creates an ETag for endpoints that serve confirmed data for a single principal (address or contract ID) and adds it to all single-account endpoints.

The ETag is formed with the SHA256 of a string containing the last transaction IDs of those that changed the account's STX, FT or NFT balance:

sha256(`${activity.stx_tx_id}:${activity.ft_tx_id}:${activity.nft_tx_id}`)

Other changes:

  • Remove code that was moved to the API toolkit
  • Consider sponsor_address in entries to the principal_stx_txs table, including a migration to backfill missing transactions

A future PR will add a similar ETag but also considering that account's mempool activity.

#1230

@rafaelcr rafaelcr changed the title feat: add principal cache feat: add principal cache etag to account endpoints Sep 26, 2024
Copy link

github-actions bot commented Sep 26, 2024

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

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/api/controllers/cache-controller.ts 75.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@rafaelcr
Copy link
Collaborator Author

@zone117x I've added the fix for sponsor_address, can you take another look?

Copy link
Member

@zone117x zone117x left a comment

Choose a reason for hiding this comment

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

LGTM!

@rafaelcr rafaelcr merged commit 28e9864 into develop Sep 30, 2024
27 checks passed
@rafaelcr rafaelcr deleted the feat/principal-cache branch September 30, 2024 15:07
blockstack-devops pushed a commit that referenced this pull request Oct 7, 2024
## [8.1.0-beta.1](v8.0.3...v8.1.0-beta.1) (2024-10-07)

### Features

* add block etag ([#2103](#2103)) ([66e6800](66e6800))
* add cache handler for principal activity including mempool transactions ([#2100](#2100)) ([2370c21](2370c21))
* add principal cache etag to account endpoints ([#2097](#2097)) ([28e9864](28e9864))
* return estimated balance in account balance endpoints ([#2104](#2104)) ([e217cea](e217cea))

### Bug Fixes

* prune and restore mempool transactions with equal nonces for the same sender ([#2091](#2091)) ([1ce75de](1ce75de))
* use total_count CTE and return it with the parsed results ([#2073](#2073)) ([bb30911](bb30911))
@blockstack-devops
Copy link

🎉 This PR is included in version 8.1.0-beta.1 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants