Skip to content

Commit 82d7200

Browse files
committed
chore: update dependencies
1 parent 7ee112b commit 82d7200

File tree

27 files changed

+406
-329
lines changed

27 files changed

+406
-329
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ strip = true
1717
opt-level = 's'
1818

1919
[workspace.package]
20-
version = "1.0.1"
20+
version = "1.1.0"
2121
edition = "2021"
2222
repository = "https://github.com/ldclabs/ic-oss"
2323
keywords = ["file", "storage", "oss", "s3", "icp"]
@@ -38,12 +38,12 @@ tokio-stream = "0.1"
3838
tokio-util = { version = "0.7", features = ["codec"] }
3939
k256 = { version = "0.13", features = ["ecdsa"] }
4040
ed25519-dalek = "2"
41-
hex = "0.4"
41+
const-hex = "1"
4242
sha2 = "0.10"
4343
sha3 = "0.10"
4444
num-traits = "0.2"
45-
ic-cdk = "0.17"
46-
ic-cdk-timers = "0.11"
45+
ic-cdk = "0.18"
46+
ic-cdk-timers = "0.12"
4747
ic-stable-structures = "0.6"
4848
icrc-ledger-types = "0.1"
4949
ic-http-certification = { version = "3.0" }
@@ -52,4 +52,5 @@ anyhow = "1"
5252
crc32fast = "1.4"
5353
url = "2.5"
5454
once_cell = "1.20"
55-
getrandom = { version = "0.2", features = ["custom"] }
55+
getrandom = { version = "0.3" }
56+
ic-dummy-getrandom-for-wasm = "0.1"

examples/ai_canister/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ ic-stable-structures = { workspace = true }
1717
ciborium = { workspace = true }
1818
serde = { workspace = true }
1919
serde_bytes = { workspace = true }
20-
getrandom = { workspace = true }
2120
rand = { version = "0.8", features = ["getrandom"] }
2221
ic-oss-types = { path = "../../src/ic_oss_types", version = "1" }
2322
ic-oss-can = { path = "../../src/ic_oss_can", version = "1" }
23+
24+
[dependencies.getrandom]
25+
features = ["custom"]
26+
version = "0.2"

examples/ai_canister/src/lib.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use candid::{CandidType, Principal};
22
use ciborium::{from_reader, into_writer};
3-
use getrandom::register_custom_getrandom;
43
use ic_oss_can::types::{Chunk, FileId};
54
use ic_oss_types::file::*;
65
use ic_stable_structures::{
@@ -45,7 +44,7 @@ thread_local! {
4544
ic_oss_can::ic_oss_fs!();
4645

4746
async fn set_rand() {
48-
let (rr,) = ic_cdk::api::management_canister::main::raw_rand()
47+
let rr = ic_cdk::management_canister::raw_rand()
4948
.await
5049
.expect("failed to get random bytes");
5150
let mut seed = [0u8; 32];
@@ -61,8 +60,11 @@ fn custom_getrandom(buf: &mut [u8]) -> Result<(), getrandom::Error> {
6160
}
6261

6362
pub fn init_rand() {
64-
ic_cdk_timers::set_timer(Duration::from_secs(0), || ic_cdk::spawn(set_rand()));
65-
register_custom_getrandom!(custom_getrandom);
63+
ic_cdk_timers::set_timer(
64+
Duration::from_secs(0),
65+
|| ic_cdk::futures::spawn(set_rand()),
66+
);
67+
getrandom::register_custom_getrandom!(custom_getrandom);
6668
}
6769

6870
#[derive(Default)]
@@ -201,6 +203,11 @@ fn admin_load_model(args: LoadModelInput) -> Result<u64, String> {
201203
Ok(ic_cdk::api::performance_counter(1))
202204
}
203205

206+
#[cfg(all(
207+
target_arch = "wasm32",
208+
target_vendor = "unknown",
209+
target_os = "unknown"
210+
))]
204211
#[ic_cdk::init]
205212
fn init() {
206213
init_rand();
@@ -212,6 +219,11 @@ fn pre_upgrade() {
212219
fs::save();
213220
}
214221

222+
#[cfg(all(
223+
target_arch = "wasm32",
224+
target_vendor = "unknown",
225+
target_os = "unknown"
226+
))]
215227
#[ic_cdk::post_upgrade]
216228
fn post_upgrade() {
217229
init_rand();
@@ -230,7 +242,7 @@ fn post_upgrade() {
230242
}
231243

232244
fn is_controller() -> Result<(), String> {
233-
let caller = ic_cdk::caller();
245+
let caller = ic_cdk::api::canister_self();
234246
if ic_cdk::api::is_controller(&caller) {
235247
Ok(())
236248
} else {
@@ -239,7 +251,7 @@ fn is_controller() -> Result<(), String> {
239251
}
240252

241253
fn is_controller_or_manager() -> Result<(), String> {
242-
let caller = ic_cdk::caller();
254+
let caller = ic_cdk::api::canister_self();
243255
if ic_cdk::api::is_controller(&caller) || fs::is_manager(&caller) {
244256
Ok(())
245257
} else {

src/ic_oss_bucket/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ crate-type = ["cdylib"]
1818
candid = { workspace = true }
1919
ciborium = { workspace = true }
2020
ic-cdk = { workspace = true }
21-
hex = { workspace = true }
21+
const-hex = { workspace = true }
2222
serde = { workspace = true }
2323
serde_bytes = { workspace = true }
2424
base64 = { workspace = true }

0 commit comments

Comments
 (0)