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

IPNS: allow lean V2-only records #376

Closed
2 of 6 tasks
lidel opened this issue Feb 5, 2023 · 5 comments · Fixed by #428
Closed
2 of 6 tasks

IPNS: allow lean V2-only records #376

lidel opened this issue Feb 5, 2023 · 5 comments · Fixed by #428
Assignees
Labels
effort/weeks Estimated to take multiple weeks kind/maintenance Work required to avoid breaking changes or harm to project's status quo P2 Medium: Good to have, but can wait until someone steps up

Comments

@lidel
Copy link
Member

lidel commented Feb 5, 2023

Where we are today (2023 Q1)

We are still living with the legacy of decisions made in 2021 and require creation of hybrid V1+V2 records, but we only care about V2 fields during the validation.

I've researched and documented the current state in #319, and obviously it is not the best.

Gist:

  • Created records have both v1 and V2 signatures, and we have duplicated values in both top level protobuf AND data CBOR field
  • Record Validation only cares about V2 signature, but still requires fields related to V1 to be always present in a record and match values from CBOR in data field, for the record to be considered valid
    • This means many fields MUST be duplicated, even when both ends use a modern client that only cares about signatureV2 that guards CBOR field.

We've been producing and expecting these hybrid V1+V2 records since 2021.

Proposed move to V2-only IPNS

It is time to clean up IPNS ecosystem and stop requiring V1 fields when there is no signatureV1.

For modern IPNS, the outer IpnsEntry protobuf should effectively only have two required fields: data and its signatureV2, and such record, as long signature is valid, should be accepted as valid.

We can get to that future in two steps:

  1. Keep producing V1+V2 records as backward-compatible default, but relax validation
    • Only check/require fields to be duplicated in top level protobuf IF signatureV1 is present. IF there is no signatureV1 and only signatureV2 and data fields are present and valid, the record should be considered valid.
    • This will allow people to build V2-only systems that produce records that are considered valid.
  2. (at some point in the future) stop producing V1+V2 and switch to publishing V2-only records that are protobuf with only two fields: Data CBOR+signatureV2
    • we have to do this in two steps, because we've rushed the way V2 was introduced in 2021, and STILL require field copying, even when signatureV1 is missing 🙃 and we could only care about CBOR versions from the start :(

Migration plan for V2-only IPNS

cc #205 @aschmahmann for sanity check

@lidel lidel added P2 Medium: Good to have, but can wait until someone steps up kind/maintenance Work required to avoid breaking changes or harm to project's status quo effort/weeks Estimated to take multiple weeks labels Feb 5, 2023
@lidel lidel self-assigned this Feb 5, 2023
@ianopolous
Copy link
Member

Yes please! This is long overdue. I've just finished implementing IPNS in Java and was wondering when we would do this. I've gone with only including V2 sig already, but as you say the matching v1 protobuf fields are still required. If this is likely to happen, then I will just relax the validation now.

@aschmahmann
Copy link
Contributor

Yes @lidel we should absolutely do this. I feel bad that this is the current state of things, at the time it was basically the only option if we wanted to implement the improvements associated with v2 records which were even longer overdue.

Given both the proliferation of more IPFS implementations and the ongoing refactor work in the Go IPFS libraries it seems like something that both should be done, and should be easier to do than previously.

@aschmahmann
Copy link
Contributor

For modern IPNS, the outer IpnsEntry protobuf should effectively only have two required fields: data and its signatureV2, and such record, as long signature is valid, should be accepted as valid.

There's also the public key field (i.e. for RSA keys) which could still live in the protobuf as it doesn't need to be signed and isn't currently duplicated in the data field.

@hacdias
Copy link
Member

hacdias commented Mar 6, 2023

I would be happy to take this if it doesn't have any dependencies that we have to wait for.

@lidel
Copy link
Member Author

lidel commented Jul 27, 2023

For anyone following, this work continues in IPIP-428

@BigLep BigLep moved this from 🥞 Todo to 🏃‍♀️ In Progress in IPFS Shipyard Team Aug 3, 2023
@lidel lidel moved this from Todo to In Progress in @lidel's IPFS wishlist Aug 8, 2023
@github-project-automation github-project-automation bot moved this from 🏃‍♀️ In Progress to 🎉 Done in IPFS Shipyard Team Sep 12, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in @lidel's IPFS wishlist Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/weeks Estimated to take multiple weeks kind/maintenance Work required to avoid breaking changes or harm to project's status quo P2 Medium: Good to have, but can wait until someone steps up
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants