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

fix(share/p2p)!: share.ErrNamespaceNotFound and integration into shrex-nd #2156

Closed

Conversation

distractedm1nd
Copy link
Collaborator

This PR resolves #2145 . A followup PR may come that changes the response layer between the RPC and the internal GetSharesByNamespace call.

@distractedm1nd distractedm1nd added area:shares Shares and samples kind:fix Attached to bug-fixing PRs labels May 3, 2023
@distractedm1nd distractedm1nd self-assigned this May 3, 2023
@codecov-commenter
Copy link

codecov-commenter commented May 3, 2023

Codecov Report

Merging #2156 (e7b262b) into main (7e65a72) will decrease coverage by 0.10%.
The diff coverage is 64.28%.

@@            Coverage Diff             @@
##             main    #2156      +/-   ##
==========================================
- Coverage   55.54%   55.44%   -0.10%     
==========================================
  Files         212      212              
  Lines       13583    13601      +18     
==========================================
- Hits         7544     7541       -3     
- Misses       5275     5294      +19     
- Partials      764      766       +2     
Impacted Files Coverage Δ
share/getter.go 78.78% <ø> (ø)
share/getters/cascade.go 76.71% <0.00%> (-3.29%) ⬇️
share/getters/store.go 82.27% <0.00%> (ø)
share/p2p/shrexnd/params.go 100.00% <ø> (ø)
share/p2p/shrexnd/pb/share.pb.go 35.81% <ø> (ø)
share/getters/utils.go 75.00% <50.00%> (ø)
share/getters/shrex.go 83.63% <62.50%> (-1.95%) ⬇️
share/p2p/shrexnd/server.go 67.15% <81.81%> (+0.23%) ⬆️
share/p2p/shrexnd/client.go 68.85% <100.00%> (+0.51%) ⬆️

... and 3 files with indirect coverage changes

@walldiss
Copy link
Member

walldiss commented May 3, 2023

Please add support in ipld.Getter too

@distractedm1nd
Copy link
Collaborator Author

@walldiss There is support for IPLDGetter - its just through the collectSharesByNamespace util. You can see getter_test to verify it works correctly

Copy link
Member

@walldiss walldiss left a comment

Choose a reason for hiding this comment

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

Need support in shrex-getter to stop retries after client returns ErrNamespaceNotFound

share/getter.go Outdated Show resolved Hide resolved
@distractedm1nd
Copy link
Collaborator Author

Thank you @walldiss, somehow I forgot the most important part of the PR 😂

share/getters/utils.go Outdated Show resolved Hide resolved
share/getters/store.go Show resolved Hide resolved
share/getter.go Outdated Show resolved Hide resolved
@@ -8,7 +8,7 @@ import (
"github.com/celestiaorg/celestia-node/share/p2p"
)

const protocolString = "/shrex/nd/0.0.1"
const protocolString = "/shrex/nd/0.0.2"
Copy link
Contributor

@derrandz derrandz May 11, 2023

Choose a reason for hiding this comment

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

I had a question about this while I was writing docs for peer manager and exploring getters, why is it that versions in other protocols we have are prefixed with v and shrex/nd is not. (e.g: /shrex/nd/v0.0.2)

Maybe since this is a breaking PR we can fix this and make this protocol uniform with the rest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch. Will fix

Copy link
Member

Choose a reason for hiding this comment

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

you still didnt fix

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is fixed, just not showing in the diff

@@ -8,7 +8,7 @@ import (
"github.com/celestiaorg/celestia-node/share/p2p"
)

const protocolString = "/shrex/nd/0.0.1"
const protocolString = "/shrex/nd/0.0.2"
Copy link
Member

Choose a reason for hiding this comment

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

you still didnt fix

@Wondertan
Copy link
Member

Conflicts

Comment on lines 123 to +126
shares, err = collectSharesByNamespace(ctx, blockGetter, root, nID)
if errors.Is(err, ipld.ErrNodeNotFound) {
// convert error to satisfy getter interface contract
err = share.ErrNotFound
err = share.ErrNamespaceNotFound
Copy link
Member

Choose a reason for hiding this comment

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

As part of this PR collectSharesByNamespace has been changed to return share.ErrNamespaceNotFound. Could you please explain the case, when you get ipld.ErrNodeNotFound and need to convert it?

Copy link
Collaborator Author

@distractedm1nd distractedm1nd May 19, 2023

Choose a reason for hiding this comment

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

This is actually incorrect AFAIU. ErrNodeNotFound should in fact be converted to an ErrNotFound. So I will look into it one more time while writing tests and update

Comment on lines +190 to +193
roots := filterRootsByNamespace(root, id)
if len(roots) == 0 {
return nil, share.ErrNamespaceNotFound
}
Copy link
Member

Choose a reason for hiding this comment

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

Optional: Would be nice if you find time to add quick test for this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done but not showing in diff, will reopen PR

@Wondertan Wondertan enabled auto-merge (squash) May 19, 2023 05:32
auto-merge was automatically disabled May 19, 2023 08:09

Pull request was closed

distractedm1nd added a commit that referenced this pull request May 19, 2023
…x-nd (#2230)

This PR replaces #2156 , as gh was not showing the diff properly. It
closes #2145

---------

Co-authored-by: Hlib Kanunnikov <hlibwondertan@gmail.com>
vgonkivs pushed a commit to vgonkivs/celestia-node that referenced this pull request May 22, 2023
…x-nd (celestiaorg#2230)

This PR replaces celestiaorg#2156 , as gh was not showing the diff properly. It
closes celestiaorg#2145

---------

Co-authored-by: Hlib Kanunnikov <hlibwondertan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:shares Shares and samples kind:fix Attached to bug-fixing PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(shares/GetSharesByNamespace): missing response type ErrNamespaceNotFound
6 participants