Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

IC-1462 extend the error space for update requests#143

Merged
Dfinity-Bjoern merged 12 commits into
masterfrom
rumenov/NET-1335
Apr 19, 2023
Merged

IC-1462 extend the error space for update requests#143
Dfinity-Bjoern merged 12 commits into
masterfrom
rumenov/NET-1335

Conversation

@rumenov

@rumenov rumenov commented Mar 3, 2023

Copy link
Copy Markdown
Contributor

More context can be found at https://dfinity.atlassian.net/browse/IC-1462.

To summarize, the current problem we are facing is that IC platform errors are mixed with canister owner errors which causes confusion among engineers how different errors should be handled.

This proposal is an attempt to have have a clear separation between canister owner errors and IC platform errors.

@rumenov rumenov requested a review from a team as a code owner March 3, 2023 08:41
@netlify

netlify Bot commented Mar 3, 2023

Copy link
Copy Markdown

Deploy Preview for ic-interface-spec ready!

Name Link
🔨 Latest commit dbeb145
🔍 Latest deploy log https://app.netlify.com/sites/ic-interface-spec/deploys/643feedc5669420008469538
😎 Deploy Preview https://deploy-preview-143--ic-interface-spec.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Comment thread spec/index.adoc Outdated
Comment thread spec/ic.did Outdated
Comment thread spec/index.adoc Outdated
Comment thread spec/index.adoc Outdated
rumenov and others added 2 commits March 8, 2023 09:53
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>

@mraszyk mraszyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@alin-at-dfinity alin-at-dfinity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks.

Comment thread spec/index.adoc Outdated
Co-authored-by: Alin Sinpalean <58422065+alin-at-dfinity@users.noreply.github.com>
@Dfinity-Bjoern

Copy link
Copy Markdown
Contributor

The errors that we want to return as 200s in the future – were they returned as 202 or as 4xx/5xx? If we returned a 4xx/5xx before and now we signal errors through a 200 with a CBOR, isn't that a backward-incompatible change? Meaning: shouldn't we rather do this as an /api/v3/... HTTP call?

@dsarlis

dsarlis commented Mar 15, 2023

Copy link
Copy Markdown

The errors that we want to return as 200s in the future – were they returned as 202 or as 4xx/5xx? If we returned a 4xx/5xx before and now we signal errors through a 200 with a CBOR, isn't that a backward-incompatible change? Meaning: shouldn't we rather do this as an /api/v3/... HTTP call?

Yeah I think that's a good point. My understanding is that certain 5xx errors would become 200 + CBOR body, so we should make it in a backwards compatible way. If you think /api/v3/... is the best way, I am all for it.

cc @rumenov for his opinion as the original proposer of the change.

@rumenov

rumenov commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

@Dfinity-Bjoern

The errors that we want to return as 200s in the future – were they returned as 202 or as 4xx/5xx? If we returned a 4xx/5xx before and now we signal errors through a 200 with a CBOR, isn't that a backward-incompatible change? Meaning: shouldn't we rather do this as an /api/v3/... HTTP call?

There was actually a breaking change ~6 months ago which moved 202 codes to 5xx/4xx. Now we want partially to move those 5xx/4xx to 200.

Not sure if it worth doing 'api/v3/..' if you think we should do it. What is the correct way to do this ? I assume there must be some boundary node changes as well.

In addition, I am not sure it is that bad of a breaking change. I more or less consider it as an extensions. Now callers need to handle 200 status code. Client handling of 5xx/4xx stays the same.

@rumenov rumenov requested review from a user and raymondk March 20, 2023 14:27
Comment thread spec/index.adoc
Comment thread spec/index.adoc
@rumenov rumenov requested a review from viviveevee March 20, 2023 19:52

@rikonor rikonor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No objection from BN and Trust teams. 👍

@viviveevee viviveevee left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM from CDK and Agent side

@rumenov

rumenov commented Mar 22, 2023

Copy link
Copy Markdown
Contributor Author

@Dfinity-Bjoern, can you please take one more look

We discussed the changes with the BN (@rikonor ), SDK (@sesi200 ), Trust (@nathanosdev) and we didn't flag any backward incompatible problems with the proposed changes.

Comment thread spec/index.adoc Outdated
Comment thread spec/index.adoc
Comment thread spec/index.adoc Outdated
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
@rumenov

rumenov commented Mar 30, 2023

Copy link
Copy Markdown
Contributor Author

@Dfinity-Bjoern are we waiting for anything else on this MR ? I think everything is resolved by now.

@mraszyk

mraszyk commented Mar 30, 2023

Copy link
Copy Markdown
Contributor

@Dfinity-Bjoern are we waiting for anything else on this MR ? I think everything is resolved by now.

We might want to wait with merging this until the code changes are ready to be merged.

@Dfinity-Bjoern Dfinity-Bjoern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good now!

@levifeldman

levifeldman commented Apr 27, 2023

Copy link
Copy Markdown

To summarize, the current problem we are facing is that IC platform errors are mixed with canister owner errors which causes confusion among engineers how different errors should be handled.

This proposal is an attempt to have have a clear separation between canister owner errors and IC platform errors.

I thought the way to separate between an IC platform error and a canister owner error is that reject codes 1,2, and 3 are for IC platform errors and reject codes 4 and 5 are for canister owner errors.

What additional benefits does this bring for separating between canister owner errors and IC platform errors?

It seems there can still be an IC platform error - reject codes 1, 2, and 3 - in the read_state call, after this call returns 202, and the spec as written in this PR still allows for canister errors - reject codes 4 and 5 - to be returned from a 200 response.

If there is an additional separation that this brings, should it be done for query calls too?

@rumenov

rumenov commented May 4, 2023

Copy link
Copy Markdown
Contributor Author

@levifeldman,

First I want to clarify, that the spec change is only relevant when the canister_inspect_message fails.

This said, today when canister_inspect_message fails we return a HTTP error code as part of the response (no reject codes are being included as part of the body). The spec change suggests that we return a 200 with a body that contains the reject code, similar to what happens when a query is being executed.

I am not sure I completely understand

It seems there can still be an IC platform error - reject codes 1, 2, and 3 - in the read_state call, after this call returns 202, and the spec as written in this PR still allows for canister errors - reject codes 4 and 5 - to be returned from a 200 response.

However, please not that the spec change is under the call section and not under the read_state section.

If there is an additional separation that this brings, should it be done for query calls too?

The spec change actually adopts the exact same behaviour as what we have for query calls.

@dsarlis

dsarlis commented May 4, 2023

Copy link
Copy Markdown

To add a bit to Rosti's reply: I think there might be a confusion because of the wording used.

The goal was to make it more clear when we have IC platform errors, in the sense of replica code hitting some unexpected error case (and which are important for the operators of the network but not end users) and IC protocol-level errors, i.e. errors that are intrinsic to IC behaviour that is captured by the reject codes in the spec (and which is more useful to end users).

As Rosti explained, the change actually makes things more consistent to query calls by returning the IC protocol specific errors inside the body of the HTTP reply.

@levifeldman

Copy link
Copy Markdown

Hi @rumenov, I see, thanks! Before there was no way to return the reject code when canister_inspect_message fails and now with this change there is a way. Cool!

I was thinking that IC-platform-errors were the reject codes 1,2, and 3, and the canister-owner-errors were reject codes 4 and 5. Thanks @dsarlis for the clarification that we are talking about a separation between the IC-protocol-level errors which are the reject codes as a whole, and between the network-operator replica errors.

Thank you both.

gitlab-dfinity pushed a commit to dfinity/ic that referenced this pull request May 31, 2023
chore: [NET-1402] bump IC-agent version to 0.24

closes NET-1402

This MR is needed in order to upgrade IC-agent to version 0.24. The new ic-agent version is needed as part of a larger work item, where we are planning on changing the response body of rejected call requests, see the according [interface spec change](dfinity/interface-spec#143).

This MR also bumps the dependencies of `k256` and `p256` to `0.13.2` and adds them as workspace dependencies. The new version of `ic-agent` requires a type `SecretKey` in some of its APIs, where `SecretKey` is introduced in the newer versions of `k256` and `p256`. An example function of such as function is [from_private_key(private_key: SecretKey)](https://docs.rs/ic-agent/latest/ic_agent/identity/struct.Secp256k1Identity.html#method.from_private_key). 

Closes NET-1402

See merge request dfinity-lab/public/ic!12595
gitlab-dfinity pushed a commit to dfinity/ic that referenced this pull request Jun 14, 2023
feature: [NET-1335] Implement spec change IC-1462

closes NET-1335

Implements the spec change [IC-1462](dfinity/interface-spec#143). 

Closes NET-1335

See merge request dfinity-lab/public/ic!12635
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants