-
Notifications
You must be signed in to change notification settings - Fork 246
Internal evercbor #7524
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
Closed
Closed
Internal evercbor #7524
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right, I think the target_include_directories should be PRIVATE instead, and probably not refer to the install interface, since the point of moving from external to internal is to not export these headers.
For this to work, we need to make sure that none of the headers we export in include/ccf include headers from evercbor. I do not know if that is (already) the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR simply moves it from exported to internal to avoid them being packaged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we still export the include directory as a public dependency, so that seems like a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's 2 levels of fix here, but we should do both.
First is moving from
exportedtointernalto say that consumers of CCF should not use ourevercbordirectly, and it is not packaged with the install. As a side effect of that (of the changes in this PR already), I believe theinclude/3rdparty/evercbordirectory will not be created in the installed dir, so we should remove the line below.Second is whether consumers of our
evercbor-using libraries (eg - a test case callingverify_uvm_endorsements_against_roots_of_trust) need to seeevercborheaders (types) themselves. I think the answer to that is also no, so we should make thisPRIVATErather thanPUBLIC. A corollary of that, though hard-to-enforce (beyond "it'll probably break the build"), is that we should only be includingevercborheaders in.cppfiles, never in.hfiles, so that it's visibility can be contained to specific libraries. I think that's another reason for defining some wrappers - not just getting C++-type-safety back, but also drawing a firm line on visibility.2 notes on the latter:
qcbor, but didn't, as we have a lot of header-implementation, and new of apps that might want to do their own parsing of CBOR/COSE. I think the former is an accident, and the latter should be avoided - they get implementation-library-agnostic wrappers if we think they're of sufficient value, or include their own CBOR support libraries.nlohmann::jsonandquickjsare 3rd party dependencies where we explicitly make the other choice. We thinknlohmann::jsonis a sufficiently useful, rich type that we use it directly in the API between CCF and app code, so apps need to see "our" copy of the library. That's also easier because it is header-only. Forquickjswe do have wrappers for safe lifetime-management, but accept that they're incomplete and leaky. Apps get to accessJSValues directly and call functions inquickjsheaders directly, so that they can insert FFIs directly into the runtime, and accept that they're eventually hitting aquickjsbinary that we have built.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right about the two levels.
Never in exported .h files (i.e. files under include/ccf). We already have a check that looks at exported headers, it should be too difficult to add one that looks for "evercbor" in there too.
I don't remember how the
qcborsituation came to be, but I think it was a mistake that happened because other headers accidentally exposed t_cose/qcbor, not a deliberate decision to provide the library. One thing to consider is that even if no types are exposed in the API, static objects have no visibility mechanisms to cope with conflicting copies of the same symbols.Interestingly, because evercbor is extracted from F*, it is perhaps relatively easy to obtain a copy with all the symbols prefixed (I believe the generate supports that), and we may want to do that.