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 QGB query attestation CLI command #1892

Merged
merged 6 commits into from
Jun 12, 2023

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Jun 7, 2023

Overview

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 Jun 7, 2023
@rach-id rach-id self-assigned this Jun 7, 2023
@rach-id rach-id requested a review from evan-forbes as a code owner June 7, 2023 12:19
@MSevey MSevey requested review from a team and rootulp and removed request for a team June 7, 2023 12:19
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Overall code LGTM but I think it would be beneficial if this PR contains tests that verify the new feature. I attempted to use it via $ ./scripts/single-node.sh:

$ ./build/celestia-appd query qgb attestation 1 | jq
{
  "nonce": 1,
  "members": [
    {
      "power": 4294967296,
      "evm_address": "0x966e6f22781EF6a6A82BBB4DB3df8E225DfD9488"
    }
  ],
  "height": 1,
  "time": "2023-06-07T19:50:41.120241Z"
}
$ ./build/celestia-appd query qgb attestation 2 | jq
Error: rpc error: code = Unknown desc = attestation not found: unknown request

Questions:

  1. How would I verify that attestation 2+ work? Do I need to run something else to get more attestations added to state
  2. Is that error expected for an attestation that doesn't exist yet?

@rach-id
Copy link
Member Author

rach-id commented Jun 7, 2023

How would I verify that attestation 2+ work? Do I need to run something else to get more attestations added to state
Is that error expected for an attestation that doesn't exist yet?

At chain start, there is only 1 attestation. And after 400 blocks, you will see another one.

For the tests, I will check if I can write something. The thing is it's just calling a query, it's not doing anything fancy. Thus, I thought that testing it would only be testing if cobra works well, then if the query works fine (and that's already tested in the keepers)

Edit: added test

@MSevey MSevey requested a review from a team June 7, 2023 23:41
@rach-id rach-id requested a review from rootulp June 7, 2023 23:41
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2023

Codecov Report

Merging #1892 (67ff49e) into main (376a1d4) will decrease coverage by 0.63%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1892      +/-   ##
==========================================
- Coverage   21.85%   21.22%   -0.63%     
==========================================
  Files         117      120       +3     
  Lines       13304    13696     +392     
==========================================
  Hits         2907     2907              
- Misses      10107    10499     +392     
  Partials      290      290              
Impacted Files Coverage Δ
x/qgb/client/query.go 0.00% <0.00%> (ø)
x/qgb/keeper/query_attestation.go 0.00% <0.00%> (ø)
x/qgb/module.go 7.27% <0.00%> (ø)

... and 2 files with indirect coverage changes

x/qgb/client/query_test.go Outdated Show resolved Hide resolved
@MSevey MSevey requested a review from a team June 8, 2023 13:43
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Thanks for adding the test! LGTM. I'm not sure if you saw this:

Is that error expected for an attestation that doesn't exist yet?

@rach-id
Copy link
Member Author

rach-id commented Jun 8, 2023

Yes. I updated the error message to have a clearer message

@rach-id rach-id merged commit bdbdeb0 into celestiaorg:main Jun 12, 2023
14 of 15 checks passed
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