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: reusable ipns verify #292

Merged
merged 2 commits into from
May 10, 2023
Merged

feat: reusable ipns verify #292

merged 2 commits into from
May 10, 2023

Conversation

laurentsenta
Copy link
Contributor

@laurentsenta laurentsenta commented May 9, 2023

Sister PR in kubo: ipfs/kubo#9867

Extracts the ipns verification code out of kubo to boxo. This makes the verification code reusable, for example, with gateway-conformance testing (ipfs/gateway-conformance#37)

Relates to ipfs/specs#376

  • ⚠️ update with the correct boxo commit when the sister PR is merged

@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Merging #292 (1922e89) into main (d7db1ad) will decrease coverage by 0.16%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #292      +/-   ##
==========================================
- Coverage   48.03%   47.87%   -0.16%     
==========================================
  Files         279      280       +1     
  Lines       33439    33521      +82     
==========================================
- Hits        16062    16048      -14     
- Misses      15697    15786      +89     
- Partials     1680     1687       +7     
Impacted Files Coverage Δ
gateway/handler_ipns_record.go 0.00% <0.00%> (ø)
ipns/entries.go 0.00% <0.00%> (ø)

... and 7 files with indirect coverage changes

Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

I think this is reasonable. This package will likely be refactored at some point in the near future when the lean records get more attention: ipfs/specs#376

Small ask: can we change the following lines to use UnmarshalIpnsEntry?

var record ipns_pb.IpnsEntry
err = proto.Unmarshal(rawRecord, &record)

@laurentsenta laurentsenta requested a review from lidel as a code owner May 9, 2023 14:49
@hacdias hacdias force-pushed the feat/reusable-kubo-ipns-features branch from a96c24f to 1922e89 Compare May 10, 2023 07:42
Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

As I stated previously, I think this is a reasonable change. It will likely be refactored until the end of the year, but it's good to keep this functionality together.

@hacdias hacdias merged commit 236e39e into main May 10, 2023
@hacdias hacdias deleted the feat/reusable-kubo-ipns-features branch May 10, 2023 08:20
@Jorropo
Copy link
Contributor

Jorropo commented May 10, 2023

This makes sense but I am suprised that this is being merged with 0 coverage in entries.go.

@hacdias
Copy link
Member

hacdias commented May 10, 2023

@Jorropo indeed, I was thinking of reverting this.

hacdias added a commit that referenced this pull request May 10, 2023
@hacdias hacdias restored the feat/reusable-kubo-ipns-features branch May 10, 2023 08:29
@hacdias hacdias deleted the feat/reusable-kubo-ipns-features branch May 10, 2023 08:29
@hacdias
Copy link
Member

hacdias commented May 10, 2023

@laurentsenta I merged this too impulsively, reverted in #293. I only realised how coupled all the names were to Kubo's name inspect functionality once I looked more carefully at ipfs/kubo#9867. Do you mind opening this again with this change. Here's some notes:

Verify

  1. Rename to ValidateWithPeerID
  2. Change signature to func ValidateWithPeerID(id peer.ID, entry *ipns_pb.IpnsEntry) error
  3. Remove IpnsInspectValidation. That should stay in Kubo's name inspect logic.
  4. Move it above Validate
  5. Add tests

IpnsInspectEntry and InspectIpnsRecord

Only include these if there's a clear benefit. I do think that they can be useful since the Protobuf type is definitely not the most user-friendly to make operations. However, it needs to make sense. The name of the types are coupled to the command ipfs name inspect. Also, the types of the different fields were also chosen according to what we needed in the command. They may not make sense for a generalisation.


UnmarshalIpnsEntry should also stay.

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.

3 participants