Skip to content
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

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

frederikrothenberger
Copy link
Contributor

@frederikrothenberger frederikrothenberger commented Jul 26, 2023

In the candid update in particular finally allows more flexibility on extending candid variants and brings a performance improvement.

Frederik Rothenberger added 3 commits July 26, 2023 16:34
In the candid update in  particular finally allows more flexibility on extending
candid variants and brings a performance improvement.
ic-cdk = "0.8"
ic-cdk-timers = "0.2"
ic-cdk-macros = "0.6"
candid = { version = "0.9", features = ["parser"] }
Copy link
Contributor

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?

Copy link
Contributor Author

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,) =
Copy link
Contributor

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?

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@frederikrothenberger frederikrothenberger added this pull request to the merge queue Jul 27, 2023
Merged via the queue into main with commit 2bd8ff1 Jul 27, 2023
46 checks passed
@frederikrothenberger frederikrothenberger deleted the frederik/update-ic-dependencies branch July 27, 2023 08:36
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