diff --git a/docs/chap-host-api.md b/docs/chap-host-api.md index 5bff31ba6..ee75602ee 100644 --- a/docs/chap-host-api.md +++ b/docs/chap-host-api.md @@ -1088,15 +1088,18 @@ All data and results generated by Offchain workers are unique per node and nonde ###### Definition -def-num- HTTP Status Code {#defn-http-status-code} :::definition -**HTTP status codes** that can get returned by certain Offchain HTTP functions. +An enumerated data type that holds a finite set of distinct variants that gets SCALE-encoded as described in ([Definition -def-num-ref-](id-cryptography-encoding#defn-scale-variable-type)) and returned by offchain http functions. The set of variants is defined as follows. -- `0`: the specified request identifier is invalid. +| Id | Name | Description | +|-----|-------------------------|------------------------------------------------------------| +| 0 | *DeadlineReached* | the deadline for the started request was reached. | +| 1 | *IoError* | an error has occurred during the request. | +| 2 | *Invalid* | the specified request identifier is invalid. | +| 3 | *Finished(http_status)* | the request has finished with the given HTTP status code. | -- `10`: the deadline for the started request was reached. - -- `20`: an error has occurred during the request, e.g. a timeout or the remote server has closed the connection. On returning this error code, the request is considered destroyed and must be reconstructed again. +**where** -- `100`-`999`: the request has finished with the given HTTP status code. +- `http_status`: a 16-bit unsigned integer type representing the [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) to be returned. ::: ###### Definition -def-num- HTTP Error {#defn-http-error} diff --git a/docs/id-cryptography-encoding.md b/docs/id-cryptography-encoding.md index bef7b99a7..08429a34f 100644 --- a/docs/id-cryptography-encoding.md +++ b/docs/id-cryptography-encoding.md @@ -421,7 +421,7 @@ $$ {\mathcal{{T}}}={\left\lbrace{T}_{{1}},\ldots,{T}_{{n}}\right\rbrace} $$ -A value ${A}$ of varying date type is a pair ${\left({A}_{{\text{Type}}},{A}_{{\text{Value}}}\right)}$ where ${A}_{{\text{Type}}}={T}_{{i}}$ for some ${T}_{{i}}\in{\mathcal{{T}}}$ and ${A}_{{\text{Value}}}$ is its value of type ${T}_{{i}}$, which can be empty. We define $\text{idx}{\left({T}_{{i}}\right)}={i}-{1}$, unless it is explicitly defined as another value in the definition of a particular varying data type. +A value ${A}$ of varying data type is a pair ${\left({A}_{{\text{Type}}},{A}_{{\text{Value}}}\right)}$ where ${A}_{{\text{Type}}}={T}_{{i}}$ for some ${T}_{{i}}\in{\mathcal{{T}}}$ and ${A}_{{\text{Value}}}$ is its value of type ${T}_{{i}}$, which can be empty. We define $\text{idx}{\left({T}_{{i}}\right)}={i}-{1}$, unless it is explicitly defined as another value in the definition of a particular varying data type. In particular, we define two specific varying data which are frequently used in various part of Polkadot protocol: *Option* ([Definition -def-num-ref-](id-cryptography-encoding#defn-option-type)) and *Result* ([Definition -def-num-ref-](id-cryptography-encoding#defn-result-type)).