Skip to content

Commit b4c8c47

Browse files
authored
docs: update outdated URLs and local replica terminology (#441)
1 parent d0bc921 commit b4c8c47

File tree

28 files changed

+68
-68
lines changed

28 files changed

+68
-68
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ The different properties of query and update calls present a trade off in terms
1414

1515
Canister certification provides a solution to this problem by pre-calculating responses and putting those pre-calculated responses through consensus. Consensus will produce a certificate for the pre-calculated responses that can be returned with the responses by any individual replica. Any clients requesting these responses can then verify this certificate to validate that consensus has agreed on this response prior to the request. This approach will give the performance characteristics of a query call, with the security profile of an update call, providing the best of both types of calls.
1616

17-
Canister certification is enabled by the [Certified data](https://internetcomputer.org/docs/current/references/ic-interface-spec/#system-api-certified-data) feature of the Internet Computer. This feature allows canisters to specify a 32 byte blob that will be included in consensus. How this 32 byte blob is determined is entirely up to canister developers to decide for themselves. This repo provides solutions that rely on merkle trees and won't discuss any other methods, but there are many other possibilities for imaginative developers that would like to roll their own solution.
17+
Canister certification is enabled by the [Certified data](https://internetcomputer.org/docs/references/ic-interface-spec/#system-api-certified-data) feature of the Internet Computer. This feature allows canisters to specify a 32 byte blob that will be included in consensus. How this 32 byte blob is determined is entirely up to canister developers to decide for themselves. This repo provides solutions that rely on merkle trees and won't discuss any other methods, but there are many other possibilities for imaginative developers that would like to roll their own solution.
1818

19-
In the next consensus round following this 32 byte blob being set (via [`ic0.certified_data_set`](https://internetcomputer.org/docs/current/references/ic-interface-spec/#system-api-certified-data)), the Internet Computer will prepare a certificate for the canister. This certificate, and the process for verifying it, is described in detail in the [interface spec](https://internetcomputer.org/docs/current/references/ic-interface-spec/#certification).
19+
In the next consensus round following this 32 byte blob being set (via [`ic0.certified_data_set`](https://internetcomputer.org/docs/references/ic-interface-spec/#system-api-certified-data)), the Internet Computer will prepare a certificate for the canister. This certificate, and the process for verifying it, is described in detail in the [interface spec](https://internetcomputer.org/docs/references/ic-interface-spec/#certification).
2020

21-
When responding to query calls, a canister can request the certificate (via [`ic0.certified_data_size`](https://internetcomputer.org/docs/current/references/ic-interface-spec/#system-api-certified-data) and [`ic0.certified_data_copy`](https://internetcomputer.org/docs/current/references/ic-interface-spec/#system-api-certified-data)) and then include this certificate in the response, to allow for clients to validate the response's authenticity.
21+
When responding to query calls, a canister can request the certificate (via [`ic0.certified_data_size`](https://internetcomputer.org/docs/references/ic-interface-spec/#system-api-certified-data) and [`ic0.certified_data_copy`](https://internetcomputer.org/docs/references/ic-interface-spec/#system-api-certified-data)) and then include this certificate in the response, to allow for clients to validate the response's authenticity.
2222

2323
## Standard Certification
2424

@@ -37,7 +37,7 @@ There are a number of questions that a developer needs to answer on a per-projec
3737
- What properties are included/excluded? (e.g., `response_timestamp` is excluded but `id` is included).
3838
- What format of each property is hashed? (e.g., leb, big/little endian encoding for numbers).
3939
- In what order are properties hashed? (e.g., sort properties alphabetically).
40-
- The [representation independent hash](https://internetcomputer.org/docs/current/references/ic-interface-spec/#hash-of-map) from the Internet Computer Protocol spec can be used, or serve as inspiration for developers.
40+
- The [representation independent hash](https://internetcomputer.org/docs/references/ic-interface-spec/#hash-of-map) from the Internet Computer Protocol spec can be used, or serve as inspiration for developers.
4141
- How are response hashes arranged in the tree?
4242
- Each exposed canister method should have a pre-determined path where its response hash will be presented in the merkle tree (e.g., the `get_count` method returns a response and the hash of this response is present at the `["count"]` path of the merkle tree).
4343
- This pre-determined path may use parameters of the request or calling principal to arrange more dynamic data in the tree (e.g., the `get_account` method returns a response and the hash of this response is present at the `["account", caller.to_text()]` path of the merkle tree).
@@ -200,7 +200,7 @@ The `ic-asset-certification` crate provides a simple API for canisters to serve
200200

201201
Response verification on the [Internet Computer](https://dfinity.org) is the process of verifying that an HTTP-compatible canister response from a replica has gone through consensus with other replicas hosting the same canister. It is the client-side counterpart to [HTTP Certification](#http-certification) and [Asset Certification](#asset-certification).
202202

203-
The `ic-response-verification` and `@dfinity/response-verification` packages encapsulate this verification protocol. It is used by [ICX Proxy](https://github.com/dfinity/ic/tree/master/rs/boundary_node/icx_proxy) and the [local HTTP Proxy](https://github.com/dfinity/http-proxy) and may be used by other implementations of the [HTTP Gateway Protocol](https://internetcomputer.org/docs/current/references/ic-interface-spec/#http-gateway) in the future.
203+
The `ic-response-verification` and `@dfinity/response-verification` packages encapsulate this verification protocol. It is used by [ICX Proxy](https://github.com/dfinity/ic/tree/master/rs/boundary_node/icx_proxy) and the [local HTTP Proxy](https://github.com/dfinity/http-proxy) and may be used by other implementations of the [HTTP Gateway Protocol](https://internetcomputer.org/docs/references/ic-interface-spec/#http-gateway) in the future.
204204

205205
### Resources
206206

@@ -212,7 +212,7 @@ The `ic-response-verification` and `@dfinity/response-verification` packages enc
212212

213213
### Representation Independent Hash
214214

215-
This is a utility crate to implement [representation independent hashing](https://internetcomputer.org/docs/current/references/ic-interface-spec/#hash-of-map) of data.
215+
This is a utility crate to implement [representation independent hashing](https://internetcomputer.org/docs/references/ic-interface-spec/#hash-of-map) of data.
216216

217217
- [`ic-representation-independant-hash` Cargo crate](https://crates.io/crates/ic-representation-independent-hash).
218218
- [`ic-representation-independant-hash` docs](https://docs.rs/ic-representation-independent-hash/2.3.0/ic_representation_independent_hash).
@@ -317,7 +317,7 @@ Make sure to follow the [system setup](#system-setup) instructions first.
317317
- [Install Rust](https://www.rust-lang.org/learn/get-started)
318318
- [Install wasm-pack](https://rustwasm.github.io/wasm-pack/installer)
319319
- [Install NVM](https://github.com/nvm-sh/nvm)
320-
- [Install DFX](https://internetcomputer.org/docs/current/developer-docs/setup/install)
320+
- [Install dfx](https://internetcomputer.org/docs/building-apps/getting-started/install)
321321

322322
Install the correct version of NodeJS:
323323

examples/http-certification/assets/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Serving static assets over HTTP
22

3-
This guide walks through an example project that demonstrates how to create a canister that can serve certified static assets (HTML, CSS, JS) over HTTP. The example project presents a very simple single-page JavaScript application. Assets are embedded into the canister when it is compiled.
3+
This guide walks through an example project that demonstrates how to create a canister that can serve certified static assets (HTML, CSS, JS) over HTTP. The example project presents a very simple single page JavaScript application. Assets are embedded into the canister when it is compiled.
44

55
This is not a beginner's canister development guide. Many fundamental concepts that a relatively experienced canister developer should already know will be omitted. Concepts specific to asset certification will be called out here and can help to understand the [full code example](https://github.com/dfinity/response-verification/tree/main/examples/http-certification/assets).
66

77
The certification and serving of assets is based on the high-level [`ic-asset-certification` crate](https://crates.io/crates/ic-asset-certification).
88

9-
If more flexibility than what this crate provides is needed, the lower-level [`ic-http-certification` crate](https://crates.io/crates/ic-http-certification) can be used. Be sure to check out the ["Custom HTTP Canisters"](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/custom-http-canisters) and ["Custom asset canisters"](https://internetcomputer.org/docs/current/developer-docs/web-apps/http-compatible-canisters/serving-static-assets-over-http) guides to learn more about how to use that library for serving assets.
9+
If more flexibility than what this crate provides is needed, the lower-level [`ic-http-certification` crate](https://crates.io/crates/ic-http-certification) can be used. Be sure to check out the ["Custom HTTP canisters"](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/custom-http-canisters) and ["Custom asset canisters"](https://internetcomputer.org/docs/current/developer-docs/web-apps/http-compatible-canisters/serving-static-assets-over-http) guides to learn more about how to use that library for serving assets.
1010

1111
## The frontend assets
1212

@@ -342,7 +342,7 @@ fn serve_metrics() -> HttpResponse<'static> {
342342

343343
This example uses a canister called `http_certification_assets_backend`.
344344

345-
To test the canister, you can use [`dfx`](https://internetcomputer.org/docs/current/developer-docs/getting-started/install) to start a local instance of the replica:
345+
To test the canister, you can use [`dfx`](https://internetcomputer.org/docs/building-apps/getting-started/install) to start a local development environment:
346346

347347
```shell
348348
dfx start --background --clean

examples/http-certification/custom-assets/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ This is not a beginner's canister development guide. Many fundamental concepts t
88

99
It's recommended to check out earlier guides before reading this one. The JSON API example in particular will be referenced and the previous static assets guide will be best suited for most projects. The approach followed in this guide is better tailored for extreme edge cases that require additional flexibility.
1010

11-
- [x] Complete the ["Serving static assets over HTTP"](https://internetcomputer.org/docs/current/developer-docs/web-apps/http-compatible-canisters/serving-static-assets-over-http) guide.
12-
- [x] Complete the ["Custom HTTP Canisters"](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/custom-http-canisters) guide.
13-
- [x] Complete the ["Serving JSON over HTTP"](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/serving-json-over-http) guide.
11+
- [x] Complete the ["Serving static assets over HTTP"](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-static-assets-over-http) guide.
12+
- [x] Complete the ["Custom HTTP canisters"](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/custom-http-canisters) guide.
13+
- [x] Complete the ["Serving JSON over HTTP"](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-json-over-http) guide.
1414

1515
## The frontend assets
1616

@@ -76,7 +76,7 @@ fn post_upgrade() {
7676

7777
## CEL expressions
7878

79-
The CEL expression definition is simpler in the case of assets compared to the [JSON API example](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/serving-json-over-http) as the same CEL expression is used for every asset including the fallback response.
79+
The CEL expression definition is simpler in the case of assets compared to the [JSON API example](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-json-over-http) as the same CEL expression is used for every asset including the fallback response.
8080

8181
```rust
8282
lazy_static! {
@@ -100,7 +100,7 @@ The assets are imported from the frontend build directory:
100100
static ASSETS_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../frontend/dist");
101101
```
102102

103-
With the assets loaded, similar to the [JSON API](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/serving-json-over-http), the pre-calculated responses and certifications need to be stored somewhere. In this example, however, a slightly different structure is used.
103+
With the assets loaded, similar to the [JSON API](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-json-over-http), the pre-calculated responses and certifications need to be stored somewhere. In this example, however, a slightly different structure is used.
104104

105105
Encoded assets are stored in a separate `HashMap` to make routing easier. This will be more apparent later in this guide.
106106

@@ -117,13 +117,13 @@ thread_local! {
117117
}
118118
```
119119

120-
Certifying responses is more involved here compared to the simpler approach used in the [JSON API](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/serving-json-over-http) example. There are some paths used in the following functions that warrant some explanation:
120+
Certifying responses is more involved here compared to the simpler approach used in the [JSON API](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-json-over-http) example. There are some paths used in the following functions that warrant some explanation:
121121

122122
- `asset_tree_path`: the `HttpCertificationPath` that will be used to store the asset in the tree, for example, `HttpCertificationPath::exact("/assets/app.js")`.
123123
- `asset_file_path`: the relative file path of the asset on disk before being imported into the canister, for example, `assets/app.js`.
124124
- `asset_req_path`: the absolute path that will be used to request the asset `/assets/app.js` from a browser.
125125

126-
The first step is defining a reusable function to create a response with all of the necessary default headers. This function is very similar to the counterpart in the [JSON API](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/serving-json-over-http) example with the biggest difference being in the headers that are used. Since the responses from an API serving static assets will be rendered directly in the browser, more security-focused headers are necessary:
126+
The first step is defining a reusable function to create a response with all of the necessary default headers. This function is very similar to the counterpart in the [JSON API](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-json-over-http) example with the biggest difference being in the headers that are used. Since the responses from an API serving static assets will be rendered directly in the browser, more security-focused headers are necessary:
127127

128128
```rust
129129
fn get_asset_headers(
@@ -376,7 +376,7 @@ fn add_certification_skips() {
376376
}
377377
```
378378

379-
After setting all certifications, the canister's [certified data](https://internetcomputer.org/docs/current/references/ic-interface-spec#system-api-certified-data) needs to be set. This will make sure that the correct certified data is set so that it can be signed during the next consensus round:
379+
After setting all certifications, the canister's [certified data](https://internetcomputer.org/docs/references/ic-interface-spec#system-api-certified-data) needs to be set. This will make sure that the correct certified data is set so that it can be signed during the next consensus round:
380380

381381
```rust
382382
fn update_certified_data() {
@@ -415,7 +415,7 @@ With all assets certified, they can be served over HTTP. The steps to follow whe
415415
- Serve the Brotli encoded asset if it exists and it was requested.
416416
- Otherwise, serve the Gzip encoded asset if it exists and it was requested.
417417
- Otherwise, serve the original asset.
418-
- Add the certificate header. This is the same process as with the [JSON API](https://internetcomputer.org/docs/current/developer-docs/http-compatible-canisters/serving-json-over-http).
418+
- Add the certificate header. This is the same process as with the [JSON API](https://internetcomputer.org/docs/building-apps/network-features/using-http/http-certification/serving-json-over-http).
419419

420420
```rust
421421
fn asset_handler(req: &HttpRequest) -> HttpResponse<'static> {
@@ -550,7 +550,7 @@ fn http_request(req: HttpRequest) -> HttpResponse {
550550

551551
This example uses a canister called `http_certification_custom_assets_backend`.
552552

553-
To test the canister, you can use [`dfx`](https://internetcomputer.org/docs/current/developer-docs/getting-started/install) to start a local instance of the replica:
553+
To test the canister, you can use [`dfx`](https://internetcomputer.org/docs/building-apps/getting-started/install) to start a local development environment:
554554

555555
```shell
556556
dfx start --background --clean

0 commit comments

Comments
 (0)