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: implement /v1/blocks/{hash_or_height} endpoint #42

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

zone117x
Copy link
Member

@zone117x zone117x commented Nov 8, 2024

Closes #25

Implement /v1/blocks/{hash_or_height} endpoint.

Can also take a latest arg GET /v1/blocks/latest

Copy link

github-actions bot commented Nov 8, 2024

Vercel deployment URL: https://signer-metrics-k6smqst84-hirosystems.vercel.app 🚀

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 98.32215% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/api/schemas.ts 92.59% 4 Missing ⚠️
src/pg/pg-store.ts 99.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment on lines +174 to +189
test('get block by latest', async () => {
// Note: the current block payload test data does not have signer data for the latest block
const expectedBlockData: BlocksEntry = {
block_height: 112291,
block_hash: '0x82ac0b52a4dde86ac05d04f59d81081d047125d0c7eaf424683191fc3fd839f2',
block_time: 1730554958,
index_block_hash: '0x7183de5c4ae700248283fede9264d31a37ab3ca1b54b4fd24adc449fbbd4c2b7',
burn_block_height: 65206,
tenure_height: 53408,
};

const { body: testBlockLatest } = (await supertest(apiServer.server)
.get(`/signer-metrics/v1/blocks/latest`)
.expect(200)) as { body: BlocksEntry };
expect(testBlockLatest).toEqual(expectedBlockData);
});
Copy link
Member Author

Choose a reason for hiding this comment

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

If a given block doesn't have signer metric data then no signer related information is returned. It should be possible to at least return the expected number of signers (from the cycle reward set), and number of accepted signers (number of signatures in the block).

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.

👍🏻

@zone117x zone117x merged commit 3ec299e into main Nov 8, 2024
5 checks passed
@zone117x zone117x deleted the feat/get-block-endpoint branch November 8, 2024 12:09
blockstack-devops pushed a commit that referenced this pull request Nov 8, 2024
## [0.7.0](v0.6.0...v0.7.0) (2024-11-08)

### Features

* implement `/v1/blocks/{hash_or_height}` endpoint ([#42](#42)) ([3ec299e](3ec299e))
@blockstack-devops
Copy link

🎉 This PR is included in version 0.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement /v1/blocks/{hash_or_height} endpoint
3 participants