Skip to content

Conversation

@seniorjoinu
Copy link
Contributor

Overview
Many APIs of candid encoding are private. This makes it harder to use this library in case of unusual scenarios implementation.
In one of my projects (ic-event-hub) I need to be able to transfer a (possibly very big) batch of objects between canisters in as few messages as possible, as efficiently as possible. I can achieve that using ValueSerializer and TypeSerialize structs, filling messages with objects sequentially. But in order to do that, I'm using a custom candid fork where all methods of these structs are public.

Here is the PR with some of these methods made public (enough to achieve what I want). But I strongly recommend the team managing this repo to choose more open policy in terms of method visibility and to make everything public. Yes, this will increase the risk of error making for beginners. But for experienced developers who understand the internals this is actually a lot more useful, because it allows them to program custom serialization logic on top of this library.

Considerations
This PR doesn't affect performance or security, but it could be useful to mark affected methods as FOR ADVANCED USE ONLY in the docs.

@seniorjoinu
Copy link
Contributor Author

@chenyan-dfinity, could you please take a look.

@chenyan-dfinity
Copy link
Contributor

I'm a bit hesitated to make these public, as they are internal APIs and can change at any time. Probably better to add #[doc(hidden)] to hide them from docs.

@seniorjoinu
Copy link
Contributor Author

Done @chenyan-dfinity

@chenyan-dfinity chenyan-dfinity merged commit 0c8e620 into dfinity:master Mar 10, 2022
ninegua pushed a commit to ninegua/candid that referenced this pull request Apr 22, 2022
Including LICENSE and a proper author/description/keywords. More could be added
later but this fixes the requirements for open sourcing.

Fixes dfinity#322

Co-authored-by: Kyle Peacock <kylpeacock@gmail.com>
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.

2 participants