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

Tidy up inter-canister calls #3881

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

oggy-dfin
Copy link
Member

Strengthen the specification of ic0.call_perform as discussed in the interface spec meeting. Also unify the naming of reject codes (previously was also "rejection code").

Thank you for your contribution to the IC Developer Portal. This repo contains the content for https://internetcomputer.org and the ICP Developer Documentation, https://internetcomputer.org/docs/.

If you are submitting a Pull Request for adding or changing content on the ICP Developer Documentation, please make sure that your contribution meets the following requirements:

Strengthen the specification of `ic0.call_perform` as discussed in the
interface spec meeting. Also unify the naming of reject codes (previously was
also "rejection code").
@oggy-dfin oggy-dfin requested a review from a team as a code owner December 13, 2024 13:13
@oggy-dfin
Copy link
Member Author

FIY @lwshang

@github-actions github-actions bot added the interface-spec Changes to the IC Interface Specification label Dec 13, 2024
Copy link

github-actions bot commented Dec 13, 2024

🤖 Here's your preview: https://c3z4p-2iaaa-aaaam-abaya-cai.icp0.io

oggy-dfin and others added 2 commits December 13, 2024 19:54
Copy link
Member

@Dfinity-Bjoern Dfinity-Bjoern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistent with discussion in the interface spec meeting, thanks Oggy!

@@ -1757,9 +1757,9 @@ There must be at most one call to `ic0.call_on_cleanup` between `ic0.call_new` a

This deducts `MAX_CYCLES_PER_RESPONSE` cycles from the canister balance and sets them aside for response processing.

If the function returns `0` as the `err_code`, the IC was able to enqueue the call. In this case, the call will either be delivered, returned because the destination canister does not exist, returned due to a lack of resources within the IC, or returned because of an out of cycles condition. This also means that exactly one of the reply or reject callbacks will be executed.
The returned `err_code` is always one of `0`, `1`, `2`, and `3`. An `err_code` of `0` means that no error occurred and that the IC could enqueue the call. In this case, the call will either be delivered, returned because the destination canister does not exist, returned due to a lack of resources within the IC, or returned because of an out of cycles condition. This also means that exactly one of the reply or reject callbacks will be executed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned err_code is always one of 0, 1, 2, and 3.

Are we sure that the implementation does not start producing the new code 6 for "unknown" in some cases in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we obviously can never be sure that the implementation won't start ignoring the spec but I can't think of a reason why a synchronous error would be raised for unknown reasons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion in the interface spec meeting:

  • Currently there is inconsistent behavior in messages sent to the IC management canister, where in case of an invalid candid payload, the canister would trap. (Which is inconsistent with what happens if invalid candid is sent to another canister.)
  • For the same case for ingress messages, we would fail with a 4.
  • If we ever wanted to clean up this behavior, this would mean we would want to return a 4 synchronously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interface-spec Changes to the IC Interface Specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants