-
Notifications
You must be signed in to change notification settings - Fork 138
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
Upgrade IC related dependencies #1756
Conversation
In the candid update in particular finally allows more flexibility on extending candid variants and brings a performance improvement.
src/archive/Cargo.toml
Outdated
ic-cdk = "0.8" | ||
ic-cdk-timers = "0.2" | ||
ic-cdk-macros = "0.6" | ||
candid = { version = "0.9", features = ["parser"] } |
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.
What does features = ["parser"]
do and why was it added?
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.
The languages team decided to split the candid library (see here), or rather hide not as often used functionality behind this feature flag. In particular we require the parser
feature to test whether the code actually implements the did file.
But we don't need the parser feature for the canister. I have now only enabled in in dev-dependencies
. Thanks.
@@ -16,7 +16,7 @@ pub fn health_check(env: &StateMachine, canister_id: CanisterId) { | |||
let user_number: types::AnchorNumber = 0; | |||
// XXX: we use "IDLValue" because we're just checking that the canister is sending | |||
// valid data, but we don't care about the actual data. | |||
let _: (candid::parser::value::IDLValue,) = | |||
let _: (candid::types::value::IDLValue,) = |
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.
Was the package moved or are you using something else now?
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.
It was moved, see here.
use serde_bytes::ByteBuf; | ||
|
||
pub type HeaderField = (String, String); | ||
|
||
#[derive(Clone, Debug, CandidType, Deserialize)] | ||
pub struct Token {} | ||
|
||
define_function!(pub StreamingCallbackFunction : (Token) -> (StreamingCallbackHttpResponse) query); |
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.
Can you explain this 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.
Previously, the typings for the streaming callback function were inaccurate (because we just had the raw Func
type because it was super cumbersome to actually define it properly). But it didn't matter, since we don't use the full set of all HTTP gateway interactions.
Now, the languages team made this (common) shortcut error out at runtime and instead provides better functionality (namely the define_function!
macro) to conveniently type a function including the arguments, return values and the mode (i.e. query).
So essentially cleans up an old piece of tech debt.
In the candid update in particular finally allows more flexibility on extending candid variants and brings a performance improvement.