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

feat: Add large wasm support to canister install #3511

Merged
merged 11 commits into from
Jan 18, 2024
Merged
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# UNRELEASED

### feat: large canister modules now supported

When using `dfx deploy` or `dfx canister install`, previously WASM modules larger than 2MiB would be rejected.
They are now automatically submitted via the chunking API if they are large enough.
From a user perspective the limitation will simply have been lifted.

### feat: dfx deps: wasm_hash_url and loose the hash check

Providers can provide the hash through `wasm_hash_url` instead of hard coding the hash directly.
Expand Down Expand Up @@ -37,6 +43,22 @@ Updated Motoko to [0.10.4](https://github.com/dfinity/motoko/releases/tag/0.10.4

Module hash: 3c86d912ead6de7133b9f787df4ca9feee07bea8835d3ed594b47ee89e6cb730

### Replica

Updated replica to elected commit 072b2a6586c409efa88f2244d658307ff3a645d8.
This incorporates the following executed proposals:

- [127034](https://dashboard.internetcomputer.org/proposal/127034)
- [127031](https://dashboard.internetcomputer.org/proposal/127031)
- [126879](https://dashboard.internetcomputer.org/proposal/126879)
- [126878](https://dashboard.internetcomputer.org/proposal/126878)
- [126730](https://dashboard.internetcomputer.org/proposal/126730)
- [126729](https://dashboard.internetcomputer.org/proposal/126729)
- [126727](https://dashboard.internetcomputer.org/proposal/126727)
- [126366](https://dashboard.internetcomputer.org/proposal/126366)
- [126365](https://dashboard.internetcomputer.org/proposal/126365)
- [126293](https://dashboard.internetcomputer.org/proposal/126293)

# 0.15.3

### fix: allow `http://localhost:*` as `connect-src` in the asset canister's CSP
Expand Down
10 changes: 6 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ license = "Apache-2.0"
[workspace.dependencies]
candid = "0.10.0"
candid_parser = "0.1.2"
ic-agent = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" }
ic-agent = { git = "https://github.com/dfinity/agent-rs.git", rev = "6b02f649a569f354a0a1b370368ba28d31dd8702" }
ic-asset = { path = "src/canisters/frontend/ic-asset" }
ic-cdk = "0.12.0"
ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" }
ic-utils = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" }
ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs.git", rev = "6b02f649a569f354a0a1b370368ba28d31dd8702" }
ic-utils = { git = "https://github.com/dfinity/agent-rs.git", rev = "6b02f649a569f354a0a1b370368ba28d31dd8702" }

aes-gcm = "0.10.3"
anyhow = "1.0.56"
Expand Down
9 changes: 9 additions & 0 deletions e2e/assets/large_canister/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "large"
version = "0.0.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[workspace]
9 changes: 9 additions & 0 deletions e2e/assets/large_canister/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"canisters": {
"large": {
"type": "rust",
"package": "large",
"candid": "large.did"
}
}
}
1 change: 1 addition & 0 deletions e2e/assets/large_canister/large.did
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service : {}
2 changes: 2 additions & 0 deletions e2e/assets/large_canister/patch.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
head -c $((1024 * 1024 * 8)) /dev/urandom >garbage.bin
3 changes: 3 additions & 0 deletions e2e/assets/large_canister/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
targets = ["wasm32-unknown-unknown"]
3 changes: 3 additions & 0 deletions e2e/assets/large_canister/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[used]
#[no_mangle]
pub static LARGE: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/garbage.bin"));
11 changes: 11 additions & 0 deletions e2e/tests-dfx/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ teardown() {
assert_eq "$BUILD_HASH" "$ONCHAIN_HASH"
}

@test "can install >2MiB wasm" {
install_asset large_canister
dfx_start
dfx canister create --all
assert_command dfx build
assert_command dfx canister install --all
assert_command dfx canister info large
HASH="$(sha256sum .dfx/local/canisters/large/large.wasm | head -c 64)"
assert_match "Module hash: 0x$HASH"
}

@test "--mode=auto selects install or upgrade automatically" {
dfx_start
assert_command dfx canister create e2e_project_backend
Expand Down
Loading
Loading