Remove the need for an explicit Candid file for cdk-rs/custom canisters

I’ve opened up a discussion on the sdk repo here: Remove the need for an explicit Candid file for cdk-rs/custom canisters · Discussion #2812 · dfinity/sdk · GitHub

I would appreciate upvotes from interested community members there, and for discussion to move there. I’m posting here for visibility:

"Motoko does not require the user to produce a Candid file. This leads to a superior DX compared with cdk-rs, and thus Azle and Kybra, as a Candid file must either be created by hand, or generated automatically from the Rust code. This automatic generation is difficult to deal with, because you must compile and run the code before the Candid can be retrieved.

Compiling and running the code is difficult to do as part of an automatic build process (which is what we must do for Kybra/Azle to provide a nice DX), as we either have to deploy the canister and call a canister method, or we have to run the canister locally, which requires compiling to the local machine’s architecture (which has caused us problems), and either run a main program or run a test to generate the canister.

This adds extra plumbing to our build process, an extra generated file to the developer’s repo, and adds a few seconds to our build process.

All of this I would think is not necessary. The Rust code provides all of the information necessary to generate the Candid file, and so why can’t dfx just retrieve it from the Rust code itself, or from the Wasm binary metadata section?

I’ve heard arguments for why it’s a good idea to create a Candid file by hand, I don’t really agree with that and none of our users have asked us for the ability to create a Candid file by hand, they’re happy that it’s generated for them. If we want to maintain that functionality, then let’s allow a manual file to override if necessary."

4 Likes

make a candid convertor?