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: new rpc RawCheckpoints #372

Merged
merged 20 commits into from
May 4, 2023
Merged

Conversation

gusin13
Copy link
Contributor

@gusin13 gusin13 commented May 2, 2023

Description

This PR is part of optimizations done to improve babylon-api performance.

The explorer calls RawCheckpoint rpc multiple times for each epoch. I have added a new rpc RawCheckpoints which can ingest a range of epochs using pagination params.

Testing

Added fuzz, e2e tests and cli queries.

@gusin13 gusin13 force-pushed the BM-607-optimize-raw-checkpoint-rpc branch from 4558e01 to 7824663 Compare May 2, 2023 10:51
@gusin13 gusin13 changed the base branch from BM-603-api-add-new-rpc-queries-finalized to dev May 2, 2023 17:56
@gusin13 gusin13 force-pushed the BM-607-optimize-raw-checkpoint-rpc branch from a37569c to cd3081b Compare May 2, 2023 18:40
@gusin13 gusin13 changed the title feat: Add new rpc RawCheckpoints feat: new rpc RawCheckpoints May 4, 2023
@gusin13 gusin13 force-pushed the BM-607-optimize-raw-checkpoint-rpc branch from f3e78bf to 5874e85 Compare May 4, 2023 04:20
@gusin13 gusin13 marked this pull request as ready for review May 4, 2023 08:06
@@ -24,6 +24,13 @@ service Query {
"/babylon/checkpointing/v1/raw_checkpoint/{epoch_num}";
}

// RawCheckpoints queries a checkpoints at a given epoch number.
Copy link
Member

Choose a reason for hiding this comment

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

There's no epoch number in the request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, was a typo, fixed now


var checkpointList []*types.RawCheckpointWithMeta
pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
ckptWithMeta, err := types.BytesToCkptWithMeta(k.cdc, value)
Copy link
Member

Choose a reason for hiding this comment

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

Why not use unmarshal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BytesToCkptWithMeta unmarshals, its used in other places in code as well so used the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to MustUnmarshal as per our offline discussion.

x/checkpointing/keeper/grpc_query_checkpoint_test.go Outdated Show resolved Hide resolved
@gusin13 gusin13 merged commit 5d0f2d9 into dev May 4, 2023
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