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

Add UCAN v0.8 Test Fixtures #37

Merged
merged 3 commits into from
Apr 4, 2022
Merged

Conversation

appcypher
Copy link
Member

@appcypher appcypher commented Mar 24, 2022

Fixes #7

PR adds test fixtures for complying with UCAN v0.8.
While working on this I used a utility other people might find useful when working with UCAN fixtures in the future.
https://github.com/fission-suite/ucan-fixture-gen

Reviews welcome.

@bgins
Copy link
Contributor

bgins commented Mar 24, 2022

Hey @appcypher. Thanks for adding these test fixtures! They are looking great and are much appreciated. 🙏

One detail that should be changed is the ucv in these fixtures. The ucv should use semantic versioning. Instead of 0.8, could we change these to 0.8.1? (Or 0.8.0, if they aren't meant to cover the latest spec version.)

@appcypher appcypher requested review from bgins and expede March 24, 2022 17:15
@appcypher
Copy link
Member Author

@bgins @expede Forgot to mention that the versions have been fixed

}
},
{
"comment": "Delegated UCAN can have multiple valid proofs",
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about rephrasing this comment to "Delegated UCAN is valid with multiple valid proofs"? This would strengthen the idea that a UCAN can have multiple proofs and is valid because of the capabilities granted by each of those proofs.

}
},
{
"comment": "UCAN attenuation is valid syntax",
Copy link
Contributor

Choose a reason for hiding this comment

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

"UCAN attenuation ishas valid syntax"

Typo. Has, not is.

}
},
{
"comment": "Payload `nbf` is valid",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this test redundant with "UCAN is ready to be used"? If we are testing the same thing, we should only keep one.

}
},
{
"comment": "Payload `exp` is valid",
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be testing the same thing as "UCAN has not expired".

}
},
{
"comment": "UCAN header section is missing or invalid",
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to say "UCAN header section is missing" and add a separate test case for an invalid header.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got further down into the invalid cases, and I noticed there are cases of headers with fields missing. That's what I would consider and "invalid" header. No need to add more test cases (same goes for payload comment below, but we could use a garbage signature test case.)

Copy link
Member Author

@appcypher appcypher Mar 28, 2022

Choose a reason for hiding this comment

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

The reason for having it as missing or invalid here is because it can be non-trivial to detect that it is actually missing. For example, the header may in fact not be missing but malformed maybe by having some additional non-compliant fields or missing some compliant fields. Or the header could be in an unexpected position. If it just says missing then we are forcing the implementer to detect all of those cases.
I can reword it as malformed if that is okay.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. Reading through the example, it was trivial to see that the header was missing, but testing for it would be challenging. Renaming to malformed sounds good to me. 👍

}
},
{
"comment": "UCAN payload section is missing or invalid",
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate cases for missing and invalid might be good here as well.

}
},
{
"comment": "UCAN signature is missing or invalid",
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate cases for missing and invalid might be good here too.

}
},
{
"comment": "Witnesses expire before the delegated UCAN",
Copy link
Contributor

Choose a reason for hiding this comment

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

The expiration times for the delegate and witness are 5435042552. Did you mean edit the witness forward in time for this test case?

}
},
{
"comment": "Witness issuer audience did does not align with delegated issuer did",
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be easier to distinguish the decentralized identifiers in this comment if we change "did" to "DID".

}
},
{
"comment": "Witness does not exist",
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment could be made more specific by mentioning proof schemes. One possibility would be "Witness referenced in prf scheme does not exist".

}
},
{
"comment": "Payload `exp` field should be a did:key string",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Payload exp field should be a did:key string number"

The test is right, but the comment is incorrect.

}
},
{
"comment": "Payload `prf` field should be an array of string",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Payload prf field should be an array of stringstrings"

Typo. Strings, not string.

}
},
{
"comment": "Payload `prf` field should be an array of string",
Copy link
Contributor

@bgins bgins Mar 25, 2022

Choose a reason for hiding this comment

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

"Payload prf field should be an array of stringstrings"

Typo. Strings, not string.

Copy link
Contributor

@bgins bgins left a comment

Choose a reason for hiding this comment

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

Fantastic! Thrilled to have these tests, great work on them! 💯 🎉

I left a few comments, mostly nitpicky stuff around the comments. Thanks again for writing these! 🙏

@appcypher appcypher force-pushed the appcypher/v0.8-test-fixtures branch from de16f9d to 73324f8 Compare March 28, 2022 12:23
@appcypher
Copy link
Member Author

Fixed @bgins

appcypher added a commit to ucan-wg/ucan-fixture-gen that referenced this pull request Mar 28, 2022
@appcypher appcypher requested a review from bgins April 1, 2022 07:29
Copy link
Member

@expede expede left a comment

Choose a reason for hiding this comment

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

LGTM 👍

(@appcypher merge #49 first, and the cla-bot will also sign off)

@expede
Copy link
Member

expede commented Apr 3, 2022

@appcypher ucan-fixture-generator is fabulous 🙌 Any concerns against us moving it from fission-suite to ucan-wg?

@appcypher
Copy link
Member Author

@expede None and done

@appcypher appcypher force-pushed the appcypher/v0.8-test-fixtures branch from 73324f8 to e13c7dc Compare April 4, 2022 08:42
@cla-bot cla-bot bot added the cla-signed label Apr 4, 2022
@appcypher appcypher merged commit d1a6490 into main Apr 4, 2022
@expede expede deleted the appcypher/v0.8-test-fixtures branch April 7, 2022 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.8 test fixtures
3 participants