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

api/consensus/validators: Expose validator signed blocks info #760

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Oct 2, 2024

Whether it is a validator prop or separated endpoint is up to backend. Oasis Scan returns an array of { block: boolean height: number }
https://www.oasisscan.com/mainnet/validator/stats?address=oasis1qqekv2ymgzmd8j2s2u7g0hhc7e77e654kvwqtjwm
In UI we want to showLast 100 blocks

@ptrus ptrus force-pushed the ptrus/feature/validator-signed-blocks branch 3 times, most recently from 55f9939 to 9294586 Compare October 2, 2024 12:27
@ptrus ptrus changed the title api/consensus/valudators: Expose validator signed blocks info api/consensus/validators: Expose validator signed blocks info Oct 2, 2024
@ptrus ptrus force-pushed the ptrus/feature/validator-signed-blocks branch 7 times, most recently from 3cebf3d to 34b6a16 Compare October 8, 2024 10:44
Copy link
Collaborator

@Andrew7234 Andrew7234 left a comment

Choose a reason for hiding this comment

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

Thanks, this impl looks pretty good. Mostly left minor comments; the only major one is about supporting the validator dashboard mocks, which call for information on all validators over the past 24hrs.

storage/client/client.go Outdated Show resolved Hide resolved
storage/client/client.go Show resolved Hide resolved
Comment on lines 323 to 333
ValidatorLast100BlocksSigned = `
SELECT
height,
COALESCE($1 = ANY(signer_entity_ids), FALSE)
FROM (
SELECT height, signer_entity_ids
FROM chain.blocks
ORDER BY height DESC
LIMIT 100
) AS subquery
ORDER BY height ASC`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a use case to sort by height ASC? I think the explorer is displaying the blocks in desc order so maybe we can just leave it as height DESC, and it simplifies the query too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will ask forntend if they care about the order here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to return in DESC order and simplified the query.

api/spec/v1.yaml Outdated Show resolved Hide resolved
api/spec/v1.yaml Outdated Show resolved Hide resolved
storage/client/client.go Show resolved Hide resolved
@ptrus ptrus force-pushed the ptrus/feature/validator-signed-blocks branch from 34b6a16 to 41f7ea4 Compare October 9, 2024 07:26
@ptrus ptrus requested a review from Andrew7234 October 9, 2024 07:28
@ptrus ptrus force-pushed the ptrus/feature/validator-signed-blocks branch from 41f7ea4 to 1e7c373 Compare October 9, 2024 07:28
@ptrus ptrus merged commit daf42bf into main Oct 10, 2024
16 checks passed
@ptrus ptrus deleted the ptrus/feature/validator-signed-blocks branch October 10, 2024 11:57
@csillag csillag mentioned this pull request Dec 22, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants