You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The candid export service doesn't correctly handle canister methods with a return type of ManualReply. Instead of exporting the record type in the canister method signature, it exports a generic ManualReply type. Subsequent ManualReplys will be given incrementing names of format ManualReply_n where n increases for the amount of records.
To Reproduce
Steps to reproduce the behavior:
Create a Rust canister with the following contents:
use ic_cdk::api::call::{self,ManualReply};#[derive(candid::CandidType)]structUser{id:String,}#[ic_cdk_macros::query]#[candid::candid_method(query)]asyncfnmethod() -> ManualReply<User>{let user = User{id:"a".to_string(),};
call::reply((user,));ManualReply::empty()}
candid::export_service!();#[ic_cdk_macros::query(name = "__get_candid_interface_tmp_hack")]fnexport_candid() -> String{__export_service()}#[cfg(test)]mod tests {usesuper::*;#[test]fnwrite_candid_to_disk(){
std::fs::write("test.did",export_candid()).unwrap();}}
I think @chenyan-dfinity was referring to #[query(manual_reply = true)] and #[update(manual_reply = true)]
I use these and my exported interface contains multiple ManualReply types.
However, it's not a problem for me because I'm not writing the exported service to disk; I'm comparing it with a hand-written file that's already on disk using service_compatible.
This seems to still be an issue in 0.9.0-beta.2. I just bumped all the dependencies in my reproducible to the latest available beta versions and am still experiencing this issue.
Describe the bug
The candid export service doesn't correctly handle canister methods with a return type of ManualReply. Instead of exporting the record type in the canister method signature, it exports a generic
ManualReply
type. SubsequentManualReply
s will be given incrementing names of formatManualReply_n
where n increases for the amount of records.To Reproduce
Steps to reproduce the behavior:
Create a Rust canister with the following contents:
Full example can be found at https://github.com/dansteren/candid_export_bug
Run
cargo test
Inspect the generated candid file at canisters/tests/test.did
Notice that it contains a type
ManualReply
which doesn't have the same name as theUser
struct in canisters/test/src/lib.rsExpected behavior
The candid file should name the user type
User
notManualReply
. I.e.Screenshots
N/A
Platform
Additional context
The problem occurs regardless of whether the function is a Query or an Update. The problem does not occur if another function also returns that type (See https://github.com/dansteren/candid_export_bug/tree/include_type_in_other_function_sig).
PS: Your Bug issue template isn't working so I was unable to apply the
Bug
label.The text was updated successfully, but these errors were encountered: