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 average stacks block time to burn block endpoints #1963

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

zone117x
Copy link
Member

Closes #1919

Adds average stacks block time to burn block endpoints.

Examples:

GET /extended/v2/burn-blocks/latest

{
  "burn_block_time": 1594233639,
  "burn_block_time_iso": "2020-08-27T16:41:26.000Z",
  "burn_block_hash": "0xb154c008df2101023a6d0d54986b3964cee58119eed14f5bed98e15678e18fe2",
  "burn_block_height": 654439,
  "stacks_blocks": [
    "0x54647c277eefe60519b407f2c897749005fdb7f831034135063b2ee43fdacb04",
    "0xdaf61d2b355f35c94cf019af99aeb73d8e7db7301c7cd693a464ebd1cfc2228c",
    "0xb9e9b308cf9621ecbf66ca7b4689fe384b9b67c4588ec827d8163ab602fb935e",
    "0x754562cba6ec243f90485e97778ab472f462fd123ef5b83cc79d8759ca8875f5"
  ],
  "avg_block_time": 15.3
}

GET /extended/v2/burn-blocks

{
  "limit": 1,
  "offset": 0,
  "total": 21707,
  "results": [
    {
      "burn_block_time": 1626281749,
      "burn_block_time_iso": "2021-07-14T16:55:49.000Z",
      "burn_block_hash": "0x0000000000000000000ea16f8e906e85ee1cb4dff1e5424e93843b3cec8b0bcb",
      "burn_block_height": 691014,
      "stacks_blocks": [
        "0x54647c277eefe60519b407f2c897749005fdb7f831034135063b2ee43fdacb04",
        "0xdaf61d2b355f35c94cf019af99aeb73d8e7db7301c7cd693a464ebd1cfc2228c",
        "0xb9e9b308cf9621ecbf66ca7b4689fe384b9b67c4588ec827d8163ab602fb935e",
        "0x754562cba6ec243f90485e97778ab472f462fd123ef5b83cc79d8759ca8875f5"
      ],
      "avg_block_time": 15.3
    }
  ]
}

Copy link

Vercel deployment URL: https://stacks-blockchain-j339r6jqb-blockstack.vercel.app 🚀

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 17.96%. Comparing base (20097fc) to head (54efbf6).
Report is 233 commits behind head on develop.

Files Patch % Lines
src/api/routes/v2/helpers.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #1963       +/-   ##
============================================
- Coverage    76.82%   17.96%   -58.86%     
============================================
  Files           80       94       +14     
  Lines        11515    12571     +1056     
  Branches      2575     2931      +356     
============================================
- Hits          8846     2259     -6587     
- Misses        2540     9530     +6990     
- Partials       129      782      +653     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@rafaelcr rafaelcr left a comment

Choose a reason for hiding this comment

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

LGTM! We should keep an eye on the query's performance, though. If it becomes too heavy we could write the avg block time to some table when we get a tenure change.

@zone117x zone117x merged commit 31c2eed into develop Apr 29, 2024
30 of 31 checks passed
@zone117x zone117x deleted the feat/burn-block-avg-time branch April 29, 2024 10:28
blockstack-devops pushed a commit that referenced this pull request May 1, 2024
## [7.11.0-beta.5](v7.11.0-beta.4...v7.11.0-beta.5) (2024-05-01)

### Features

* add average stacks block time to burn block endpoints ([#1963](#1963)) ([31c2eed](31c2eed))
* add total tx count to burn block endpoints ([#1965](#1965)) ([d38b78a](d38b78a))
* average block times endpoint ([#1962](#1962)) ([cd151aa](cd151aa))

### Bug Fixes

* issue with block_time receipt not being written to db ([#1961](#1961)) ([74c06c6](74c06c6))
@blockstack-devops
Copy link

🎉 This PR is included in version 7.11.0-beta.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

blockstack-devops pushed a commit that referenced this pull request Jun 7, 2024
## [7.11.0](v7.10.0...v7.11.0) (2024-06-07)

### Features

* add average stacks block time to burn block endpoints ([#1963](#1963)) ([31c2eed](31c2eed))
* add burn_block_height to Rosetta endpoints ([#1974](#1974)) ([9648ac8](9648ac8))
* add burn_block_height to transactions ([#1969](#1969)) ([3e2d524](3e2d524))
* add signer_address to pox signer endpoints ([#1975](#1975)) ([7d3444b](7d3444b))
* add total tx count to burn block endpoints ([#1965](#1965)) ([d38b78a](d38b78a))
* average block times endpoint ([#1962](#1962)) ([cd151aa](cd151aa))
* docker build for arm ([#1947](#1947)) ([2c526fc](2c526fc))
* include solo and pooled stackers in signer stacker endpoints ([#1987](#1987)) ([302a5d8](302a5d8))
* support multiple STX faucet source accounts ([#1946](#1946)) ([be5db0c](be5db0c))
* support multiple STX faucet source accounts ([#1946](#1946)) ([5d69c7c](5d69c7c))

### Bug Fixes

* ensure events are inserted into the raw event request table ([#1925](#1925)) ([34a8454](34a8454))
* inconsistent block transaction results in Rosetta response ([#1958](#1958)) ([a5bec61](a5bec61))
* issue with block_time receipt not being written to db ([#1961](#1961)) ([74c06c6](74c06c6))
* pox4 properties missing in various endpoints ([#1977](#1977)) ([521d771](521d771))
* rosetta account endpoint should assume chain tip if block not specified ([#1956](#1956)) ([4bba526](4bba526))
* signer stacker query using string instead of int for cycle_id ([#1991](#1991)) ([5ce9b44](5ce9b44))
* socket-io client must only use websocket transport ([#1976](#1976)) ([85ea5af](85ea5af))
@blockstack-devops
Copy link

🎉 This PR is included in version 7.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to be able to get the average block time from the API
3 participants