Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-frontend-canister.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up
run: |
rustup target add wasm32-unknown-unknown
cargo install --version 0.1.5 ic-wasm
cargo install --version 0.2.0 ic-wasm
- name: Build frontend canister
run: |
./scripts/update-frontend-canister.sh
Expand Down
18 changes: 9 additions & 9 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions src/dfx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ humantime = "2.1.0"
humantime-serde = "1.1.1"
hyper-rustls = { version = "0.23.0", features = [ "webpki-roots", "http2" ] }
ic-asset = { version = "0.20.0", path = "../canisters/frontend/ic-asset" }
ic-wasm = { version = "0.1.3" }
ic-wasm = "0.2.0"
indicatif = "0.16.0"
itertools = "0.10.3"
k256 = { version = "0.11.4", features = ["pem"] }
Expand Down Expand Up @@ -83,7 +83,6 @@ tiny-bip39 = "1.0.0"
tokio = { version = "1.17.0", features = [ "fs" ] }
url = "2.1.0"
walkdir = "2.2.9"
walrus = "0.19.0"
wasmparser = "0.87.0"
which = "4.2.5"

Expand Down
12 changes: 3 additions & 9 deletions src/dfx/src/lib/builders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,9 @@ impl BuildConfig {
fn shrink_wasm(wasm_path: impl AsRef<Path>) -> DfxResult {
let wasm_path = wasm_path.as_ref();
let wasm = std::fs::read(wasm_path).context("Could not read the WASM module.")?;
let mut module_config = walrus::ModuleConfig::new();
module_config.generate_name_section(true);
module_config.generate_producers_section(false);
let mut module = module_config
.parse(&wasm)
.context("Could not parse the WASM module.")?;
ic_wasm::shrink::shrink(&mut module);
module
.emit_wasm_file(wasm_path)
let shrinked_wasm =
ic_wasm::shrink::shrink(&wasm).context("Could not shrink the WASM module.")?;
std::fs::write(wasm_path, &shrinked_wasm)
.with_context(|| format!("Could not write shrinked WASM to {:?}", wasm_path))?;
Ok(())
}
Expand Down
13 changes: 5 additions & 8 deletions src/dfx/src/lib/wasm/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ use std::path::Path;

#[context("Failed to add candid service metadata from {} to {}.", idl_path.to_string_lossy(), wasm_path.to_string_lossy())]
pub fn add_candid_service_metadata(wasm_path: &Path, idl_path: &Path) -> DfxResult {
let mut m = walrus::ModuleConfig::new()
.parse_file(wasm_path)
.with_context(|| format!("Failed to parse file {}", wasm_path.to_string_lossy()))?;
let wasm = std::fs::read(wasm_path).context("Could not read the WASM module.")?;
let idl = std::fs::read(&idl_path)
.with_context(|| format!("Failed to read {}", idl_path.to_string_lossy()))?;

add_metadata(&mut m, Kind::Public, CANDID_SERVICE, idl);

m.emit_wasm_file(wasm_path)
.with_context(|| format!("Failed to emit wasm to {}", wasm_path.to_string_lossy()))?;
let processed_wasm = add_metadata(&wasm, Kind::Public, CANDID_SERVICE, idl)
.context("Could not add metadata to the WASM module.")?;
std::fs::write(wasm_path, &processed_wasm)
.with_context(|| format!("Could not write WASM to {:?}", wasm_path))?;
Ok(())
}
Binary file modified src/distributed/assetstorage.wasm.gz
Binary file not shown.