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 LastValsetRequestBeforeNonce rpc call #1325

Merged

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Feb 1, 2023

Overview

This RPC call was left out somewhere when adapting the state for V2. This PR introduces it back.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@rach-id rach-id added the x/qgb label Feb 1, 2023
@rach-id rach-id self-assigned this Feb 1, 2023
@MSevey MSevey requested a review from a team February 1, 2023 11:39
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2023

Codecov Report

Merging #1325 (749bbdb) into main (852a229) will decrease coverage by 1.54%.
The diff coverage is 43.00%.

@@            Coverage Diff             @@
##             main    #1325      +/-   ##
==========================================
- Coverage   49.79%   48.26%   -1.54%     
==========================================
  Files          76       77       +1     
  Lines        4374     4397      +23     
==========================================
- Hits         2178     2122      -56     
- Misses       2014     2098      +84     
+ Partials      182      177       -5     
Impacted Files Coverage Δ
app/parse_txs.go 22.00% <0.00%> (-78.00%) ⬇️
app/prepare_proposal.go 0.00% <0.00%> (ø)
app/process_proposal.go 0.00% <0.00%> (ø)
app/verify_txs.go 0.00% <0.00%> (ø)
pkg/da/data_availability_header.go 79.64% <ø> (ø)
pkg/proof/querier.go 21.73% <0.00%> (ø)
x/blob/module.go 3.70% <0.00%> (ø)
x/blob/types/payforblob.go 82.48% <ø> (ø)
x/qgb/keeper/keeper_valset.go 27.11% <ø> (ø)
pkg/proof/proof.go 67.46% <82.05%> (-8.49%) ⬇️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

Looks good to me! I made a few minor suggestions for improvement. But, since I don't have all the details, I'll leave it for others to give the final approval.

proto/celestia/qgb/v1/query.proto Outdated Show resolved Hide resolved
proto/celestia/qgb/v1/query.proto Outdated Show resolved Hide resolved
@@ -31,6 +31,15 @@ service Query {
returns (QueryLatestAttestationNonceResponse) {
option (google.api.http).get = "/qgb/v1/attestations/nonce/latest";
}
// LastValsetRequestBeforeNonce Queries last Valset request before nonce.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does Valset stand for? is it validator set? can we please add the full term in the description as well

Copy link
Member Author

@rach-id rach-id Feb 2, 2023

Choose a reason for hiding this comment

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

Yes, It's a type that describes validator sets:

// Valset is the EVM Bridge Multsig Set, each qgb validator also
// maintains an ETH key to sign messages, these are used to check signatures on
// ETH because of the significant gas savings
message Valset {
option (cosmos_proto.implements_interface) = "AttestationRequestI";
// Universal nonce defined under:
// https://github.com/celestiaorg/celestia-app/pull/464
uint64 nonce = 1;
// List of BridgeValidator containing the current validator set.
repeated BridgeValidator members = 2 [ (gogoproto.nullable) = false ];
// Current chain height
uint64 height = 3;
}

@MSevey MSevey requested a review from a team February 2, 2023 08:37
@@ -130,7 +130,7 @@ func normalizeValidatorPower(rawPower uint64, totalValidatorPower cosmosmath.Int

// GetLastValsetBeforeNonce returns the previous valset before the provided `nonce`.
// the `nonce` can be a valset, but this method will return the valset before it.
// If the provided nonce is 1. It will return an error. Because, there is no valset before nonce 1.
// If the provided nonce is 1, it will return an error, because, there is no valset before nonce 1.
func (k Keeper) GetLastValsetBeforeNonce(ctx sdk.Context, nonce uint64) (*types.Valset, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the second argument be *QueryLastValsetRequestBeforeNonceRequest? Or where does the actual query get called to

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the keeper. It's called in the querier here:

func (k Keeper) LastValsetRequestBeforeNonce(
c context.Context,
req *types.QueryLastValsetRequestBeforeNonceRequest,
) (*types.QueryLastValsetRequestBeforeNonceResponse, error) {

That change is just a docs change that Sanaz spotted and I fixed it in this PR (instead of opening a new one)

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

so if I'm understanding correctly, the querier was already defined, we just missed the proto definitions somewhere along the line?

do we need some basic unit tests to ensure basic functionality? like, perhaps we could include this in this test, or in a similar one, where we spin up a node and query using grpc

@rach-id
Copy link
Member Author

rach-id commented Feb 6, 2023

so if I'm understanding correctly, the querier was already defined, we just missed the proto definitions somewhere along the line?

Yes 100%

do we need some basic unit tests to ensure basic functionality? like, perhaps we could include this in this test, or in a similar one, where we spin up a node and query using grpc

Good idea 👍 #1343

@rach-id rach-id merged commit a138c19 into celestiaorg:main Feb 6, 2023
@rach-id rach-id deleted the add_last_valset_request_before_nonce_rpc branch February 6, 2023 20:45
evan-forbes pushed a commit that referenced this pull request Feb 27, 2023
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

This RPC call was left out somewhere when adapting the state for V2.
This PR introduces it back.

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [ ] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords
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.

None yet

5 participants