Skip to content

Commit 7e0f758

Browse files
committed
Merge branch 'master' into release-0.30.2
2 parents 0912343 + f37b078 commit 7e0f758

File tree

27 files changed

+1195
-572
lines changed

27 files changed

+1195
-572
lines changed

.github/workflows/audit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v4
3636
- uses: actions-rust-lang/audit@v1
37+
with:
38+
# TODO: remove this once the fix is backported to rkyv v0.7
39+
# https://github.com/rkyv/rkyv/issues/644
40+
ignore: RUSTSEC-2026-0001

CHANGELOG.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22

33
# UNRELEASED
44

5-
### Frontend canister
6-
7-
Sets the `ic_env` cookie for all HTML files only if the canister environment changed in the `commit_batch` method.
8-
9-
- Module hash: c156183e6a6f5c3c71ecde5f38a7280b770ff172b4827127ef03b89b764065ba
10-
- https://github.com/dfinity/sdk/pull/4446
11-
125
# 0.30.2
136

147
### Improve frontend canister sync logic
158

169
Previously, committing frontend canister changes happened in multiple batches defined by simple heuristics that would likely not exceed the ingress message size limit.
1710
Now, the ingress message size limit is respected more explicitly, and also a limit of total content size per batch since all content in the batch newly gets hashed in the canister.
1811

12+
### Frontend canister
13+
14+
Sets the `ic_env` cookie for all HTML files only if the canister environment changed in the `commit_batch` method.
15+
16+
Use canister self-calls to avoid hitting instruction limits during `commit_batch`, `compute_evidence`, and `compute_state_hash`.
17+
18+
- Module hash: 63d122d0149a29f4e48603efdd7d2bce656a6a83bac1e3207897c68e8e225bb6
19+
- https://github.com/dfinity/sdk/pull/4450
20+
1921
## Dependencies
2022

2123
### Motoko

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ candid = "0.10.18"
2727
candid_parser = "0.2.4"
2828
dfx-core = { path = "src/dfx-core", version = "0.2.0" }
2929
ic-agent = "0.44.2"
30-
ic-asset = { path = "src/canisters/frontend/ic-asset", version = "0.25.0" }
30+
ic-asset = { path = "src/canisters/frontend/ic-asset", version = "0.26.0" }
3131
ic-cdk = "0.19.0-beta.2"
3232
ic-identity-hsm = "0.44.2"
3333
ic-utils = "0.44.2"
@@ -45,6 +45,7 @@ clap = "4.5"
4545
clap_complete = "4.5"
4646
dialoguer = "0.11.0"
4747
directories-next = "2.0.0"
48+
dunce = "1.0"
4849
flate2 = { version = "1.0.11" }
4950
futures = "0.3.21"
5051
handlebars = "4.3.3"
@@ -64,9 +65,7 @@ mime_guess = "2.0.4"
6465
num-traits = "0.2.14"
6566
pem = "1.0.2"
6667
proptest = "1.0.0"
67-
reqwest = { version = "0.12.4", default-features = false, features = [
68-
"rustls-tls",
69-
] }
68+
reqwest = { version = "0.12.4", default-features = false, features = ["rustls-tls"] }
7069
ring = { version = "0.17.14", features = ["std"] }
7170
schemars = "0.8"
7271
sec1 = "0.3.0"

src/canisters/frontend/ic-asset/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ic-asset"
3-
version = "0.25.0" # sync with icx-asset
3+
version = "0.26.0" # sync with icx-asset
44
authors.workspace = true
55
edition.workspace = true
66
repository.workspace = true
@@ -19,7 +19,7 @@ backoff.workspace = true
1919
brotli = "6.0.0"
2020
candid = { workspace = true }
2121
derivative = "2.2.0"
22-
dfx-core.workspace = true
22+
dunce.workspace = true
2323
flate2.workspace = true
2424
futures.workspace = true
2525
futures-intrusive = "0.4.0"

src/canisters/frontend/ic-asset/src/asset/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl AssetSourceDirectoryConfiguration {
176176
&mut self,
177177
canonical_path: &Path,
178178
) -> Result<AssetConfig, GetAssetConfigError> {
179-
let parent_dir = dfx_core::fs::parent(canonical_path)?;
179+
let parent_dir = crate::fs::parent(canonical_path)?;
180180
Ok(self
181181
.config_map
182182
.get(&parent_dir)
@@ -243,7 +243,7 @@ impl AssetConfigTreeNode {
243243
};
244244
let mut rules = vec![];
245245
if let Some(config_path) = config_path {
246-
let content = dfx_core::fs::read_to_string(&config_path)?;
246+
let content = crate::fs::read_to_string(&config_path)?;
247247

248248
let interim_rules: Vec<rule_utils::InterimAssetConfigRule> = json5::from_str(&content)
249249
.map_err(|e| MalformedAssetConfigFile(config_path.to_path_buf(), e))?;
@@ -264,7 +264,7 @@ impl AssetConfigTreeNode {
264264
};
265265

266266
configs.insert(dir.to_path_buf(), parent_ref.clone());
267-
for f in dfx_core::fs::read_dir(dir)?
267+
for f in crate::fs::read_dir(dir)?
268268
.filter_map(|x| x.ok())
269269
.filter(|x| x.file_type().map_or_else(|_e| false, |ft| ft.is_dir()))
270270
{

src/canisters/frontend/ic-asset/src/asset/content.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::asset::content_encoder::ContentEncoder;
2+
use crate::error::fs::ReadFileError;
23
use brotli::CompressorWriter;
3-
use dfx_core::error::fs::ReadFileError;
44
use flate2::Compression;
55
use flate2::write::GzEncoder;
66
use mime::Mime;
@@ -16,7 +16,7 @@ pub(crate) struct Content {
1616

1717
impl Content {
1818
pub fn load(path: &Path) -> Result<Content, ReadFileError> {
19-
let data = dfx_core::fs::read(path)?;
19+
let data = crate::fs::read(path)?;
2020

2121
// todo: check contents if mime_guess fails https://github.com/dfinity/sdk/issues/1594
2222
let media_type = mime_guess::from_path(path)

src/canisters/frontend/ic-asset/src/batch_upload/plumbing.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,6 @@ impl<'agent> ChunkUploader<'agent> {
159159
self.chunks.load(Ordering::SeqCst)
160160
}
161161

162-
/// Get total size of chunks by their canister chunk IDs
163-
pub(crate) async fn get_canister_chunk_total_size(&self, canister_chunk_ids: &[Nat]) -> usize {
164-
let sizes = self.canister_chunk_sizes.lock().await;
165-
canister_chunk_ids
166-
.iter()
167-
.filter_map(|id| sizes.get(id))
168-
.sum()
169-
}
170-
171162
/// Call only after `finalize_upload` has completed.
172163
pub(crate) async fn uploader_ids_to_canister_chunk_ids(
173164
&self,
@@ -448,7 +439,7 @@ async fn make_project_asset(
448439
logger: &Logger,
449440
progress: Option<&dyn AssetSyncProgressRenderer>,
450441
) -> Result<ProjectAsset, CreateProjectAssetError> {
451-
let file_size = dfx_core::fs::metadata(&asset_descriptor.source)?.len();
442+
let file_size = crate::fs::metadata(&asset_descriptor.source)?.len();
452443
let permits = (file_size.div_ceil(1000000) as usize).clamp(1, MAX_COST_SINGLE_FILE_MB);
453444
let _releaser = semaphores.file.acquire(permits).await;
454445
let content = Content::load(&asset_descriptor.source)

src/canisters/frontend/ic-asset/src/error/create_project_asset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::error::create_encoding::CreateEncodingError;
2-
use dfx_core::error::fs::{ReadFileError, ReadMetadataError};
2+
use crate::error::fs::{ReadFileError, ReadMetadataError};
33
use thiserror::Error;
44

55
/// Errors related to creating an asset found in the project in the asset canister.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
use std::path::PathBuf;
2+
use thiserror::Error;
3+
4+
#[derive(Error, Debug)]
5+
#[error("failed to canonicalize '{path}'")]
6+
pub struct CanonicalizePathError {
7+
pub path: PathBuf,
8+
pub source: std::io::Error,
9+
}
10+
11+
#[derive(Error, Debug)]
12+
#[error("failed to copy {from} to {to}")]
13+
pub struct CopyFileError {
14+
pub from: PathBuf,
15+
pub to: PathBuf,
16+
pub source: std::io::Error,
17+
}
18+
19+
#[derive(Error, Debug)]
20+
#[error("failed to create directory {path} and parents")]
21+
pub struct CreateDirAllError {
22+
pub path: PathBuf,
23+
pub source: std::io::Error,
24+
}
25+
26+
#[derive(Error, Debug)]
27+
pub enum EnsureDirExistsError {
28+
#[error(transparent)]
29+
CreateDirAll(#[from] CreateDirAllError),
30+
31+
#[error("path {0} is not a directory")]
32+
NotADirectory(PathBuf),
33+
}
34+
35+
#[derive(Error, Debug)]
36+
pub enum EnsureParentDirExistsError {
37+
#[error(transparent)]
38+
EnsureDirExists(#[from] EnsureDirExistsError),
39+
40+
#[error(transparent)]
41+
NoParentPath(#[from] NoParentPathError),
42+
}
43+
44+
#[derive(Error, Debug)]
45+
#[error("failed to determine parent path for '{0}'")]
46+
pub struct NoParentPathError(pub PathBuf);
47+
48+
#[derive(Error, Debug)]
49+
#[error("failed to read directory {path}")]
50+
pub struct ReadDirError {
51+
pub path: PathBuf,
52+
pub source: std::io::Error,
53+
}
54+
55+
#[derive(Error, Debug)]
56+
#[error("failed to read from {path}")]
57+
pub struct ReadFileError {
58+
pub path: PathBuf,
59+
pub source: std::io::Error,
60+
}
61+
62+
#[derive(Error, Debug)]
63+
#[error("failed to remove directory {path}")]
64+
pub struct RemoveDirectoryError {
65+
pub path: PathBuf,
66+
pub source: std::io::Error,
67+
}
68+
69+
#[derive(Error, Debug)]
70+
#[error("failed to write to {path}")]
71+
pub struct WriteFileError {
72+
pub path: PathBuf,
73+
pub source: std::io::Error,
74+
}
75+
76+
#[derive(Error, Debug)]
77+
#[error("failed to read metadata of {path}")]
78+
pub struct ReadMetadataError {
79+
pub path: PathBuf,
80+
pub source: std::io::Error,
81+
}
82+
83+
#[derive(Error, Debug)]
84+
#[error("failed to read permissions of {path}")]
85+
pub struct ReadPermissionsError {
86+
pub path: PathBuf,
87+
pub source: std::io::Error,
88+
}
89+
90+
#[derive(Error, Debug)]
91+
#[error("failed to read {path} as string")]
92+
pub struct ReadToStringError {
93+
pub path: PathBuf,
94+
pub source: std::io::Error,
95+
}
96+
97+
#[derive(Error, Debug)]
98+
#[error("failed to remove directory {path} and its contents")]
99+
pub struct RemoveDirectoryAndContentsError {
100+
pub path: PathBuf,
101+
pub source: std::io::Error,
102+
}
103+
104+
#[derive(Error, Debug)]
105+
#[error("failed to remove file {path}")]
106+
pub struct RemoveFileError {
107+
pub path: PathBuf,
108+
pub source: std::io::Error,
109+
}
110+
111+
#[derive(Error, Debug)]
112+
#[error("Failed to rename {from} to {to}")]
113+
pub struct RenameError {
114+
pub from: PathBuf,
115+
pub to: PathBuf,
116+
pub source: std::io::Error,
117+
}
118+
119+
#[derive(Error, Debug)]
120+
#[error("failed to set permissions of {path}")]
121+
pub struct SetPermissionsError {
122+
pub path: PathBuf,
123+
pub source: std::io::Error,
124+
}
125+
126+
#[derive(Error, Debug)]
127+
pub enum SetPermissionsReadWriteError {
128+
#[error(transparent)]
129+
ReadPermissions(#[from] ReadPermissionsError),
130+
131+
#[error(transparent)]
132+
SetPermissions(#[from] SetPermissionsError),
133+
}

0 commit comments

Comments
 (0)