All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Update, query,
init, andpost_upgradecanister entry points now interpret an empty input vector as the Candid encoding of(), making them more lenient when no arguments are provided. This does not apply to methods usingdecode_with, which still receive the raw (empty) bytes.
- Added
msg_caller_info_dataandmsg_caller_info_signertoic_cdk::api, exposing the caller's identity attribute data and the signing canister ID respectively.
- [BREAKING] Remove all items deprecated in v0.18.0:
api::call,api::stable,api::management_canistermodules and legacy functions (spawn,print,caller,id,canister_balance,set_certified_data,set_global_timer). - [BREAKING] Move the
bitcoin_canistermodule to a separate crateic-cdk-bitcoin-canister. Users should depend onic-cdk-bitcoin-canisterdirectly. - [BREAKING] Move the
management_canistermodule to a separate crateic-cdk-management-canister. Users should depend onic-cdk-management-canisterdirectly. Thetransform-closurefeature is also moved to the new crate.
- Support Canister Environment Variable. (#636)
- Add binding for
env_var_*API.
- Add binding for
- New Management Canister methods:
canister_metadataread_canister_snapshot_metadataread_canister_snapshot_dataupload_canister_snapshot_metadataupload_canister_snapshot_data
-
[BREAKING] Updated to version 2.0 of the async executor. The
spawnfunction now creates protected tasks that panic (or are canceled, withspawn_weak) if they outlive the canister method (with a newspawn_migratoryfunction for tasks that are supposed to outlive the method). A trap will now cancel all protected tasks in the method it is part of. See the module docs for more information.- The async machinery that is primarily used from macros (i.e.
in_*_context) has been moved toic_cdk::futures::internals.
- The async machinery that is primarily used from macros (i.e.
-
[BREAKING] Upgrade
ic-management-canister-typeswhich contains the changes for:- Canister Environment Variable.
- Non-replicated HTTP outcalls.
- The macros annotate
#[allow(clippy::disallowed_methods)]above the invocation ofic_cdk::futures::spawn.
The ic_cdk::futures::spawn method has a different poll order that can affect canister behavior.
While some projects may wish to enforce a disallowed-methods lint rule to prevent its use, the invocations generated by our macros are a false positive.
This annotation prevents the warning from being triggered for the macro-generated code, ensuring a clean linting experience for developers who adopt the new rule.
- Restored the default
skipping_quotato match the behavior of previous versions of the macros.
- The macros now support 2024 edition.
- MSRV raised to 1.85.0.
- Tasks which return after canceling futures are no longer marked as trapped
- Updated to
ic0v1.0.0
- New
ic_cdk::futuresfunctionspawn_017_compat. This has the code ordering behavior of 0.17, with spawned futures run immediately instead of waiting for the current code to suspend.
- Support
root_keyAPI. (#619)
-
Update bitcoin
regtestcycles cost to be same as the bitcoinmainnet.fees = record { get_current_fee_percentiles = 10_000_000 : nat; get_utxos_maximum = 10_000_000_000 : nat; get_block_headers_cycles_per_ten_instructions = 10 : nat; get_current_fee_percentiles_maximum = 100_000_000 : nat; send_transaction_per_byte = 20_000_000 : nat; get_balance = 10_000_000 : nat; get_utxos_cycles_per_ten_instructions = 10 : nat; get_block_headers_base = 50_000_000 : nat; get_utxos_base = 50_000_000 : nat; get_balance_maximum = 100_000_000 : nat; send_transaction_base = 5_000_000_000 : nat; get_block_headers_maximum = 10_000_000_000 : nat; };You can get the fees by
get_configAPI on the BTC Mainnet Canister.
- New CDK library
ic-cdk-executorcontaining the low-level async executor primitives previously inic-cdk. Most users will never need to use this library and should continue using the interface fromic-cdk.
- Bump
ic-error-typesto v0.2.0 from which we re-export theRejectCodetype.
- Support VetKD management canister API. (#597)
- Add
Call::take_raw_argswhich owns the bytes. (#601)
Please check Version 0.18 Guide for more details.
- New
CallAPI.- Supports bounded-wait inter-canister calls.
- Uses a builder pattern for optional call configuration.
- Allows chaining
.candid()decoding only when needed. - Provides ergonomic Rust error handling to encourage best practices.
- Support for Wasm64 module compilation.
- Seamlessly handles 32-bit and 64-bit System APIs.
- Enhanced macros for flexible argument decoding and result encoding.
update/query/initmacros now support custom argument decoders viadecode_with.update/querymacros now support custom result encoders viaencode_with.
- Simplified module hierarchy with one level under the crate root.
apimodule offers consistent System API bindings.management_canistermodule for convenient Management Canister calls.bitcoin_canistermodule for direct Bitcoin Canisters calls.
- Enhanced cycles cost calculation for Management Canister API calls:
- New system APIs exposed through the
apimodule:cost_http_request,cost_sign_with_ecdsa,cost_sign_with_schnorr,cost_vetkd_derive_key.
- High-level bindings in the
management_canistermodule accept call arguments by reference. - All relevant Management Canister methods now automatically attach the required cycles to calls.
- New system APIs exposed through the
- Introduces a new task scheduler-based executor.
- Capable of scheduling any async task, not limited to inter-canister calls.
- The
futuresmodule is now public to expose functionalities related to the async executor. - The new implementation enables code to have (intended) surprising behavior - it is recommended to read the module docs
- Submodules in
apiare now deprecated in favor of root-level modules.api/call->callapi/management_canister->management_canister&bitcoin_canisterapi/stable->stable
- Add method
bitcoin_get_block_headers. - Support management canister method:
subnet_info. (#532)- Add types:
SubnetInfoArgsandSubnetInfoResult.
- Add types:
- Fix update/query macro could not handle function arguments with the same name as the function itself. (#525)
- Add
AllowedViewersvariant toLogVisibilityenum. (#512)
- Attribute
#[on_low_wasm_memory]for low-memory hook. (#528) - Support Threshold Schnorr signing management canister API. (#518)
- BREAKING: Add the
LoadSnapshotvariant toCanisterChangeDetails. (#504)
- Support Canister State Snapshots. (#504)
- Add methods:
take_canister_snapshot,load_canister_snapshot,list_canister_snapshots,delete_canister_snapshot - Add types:
LoadSnapshotRecord,SnapshotId,Snapshot,TakeCanisterSnapshotArgs,LoadCanisterSnapshotArgs,DeleteCanisterSnapshotArgs
- Add methods:
- BREAKING: Stable Memory always use 64-bit addresses and
stable64_*system API. (#498) - BREAKING: Add
log_visibilityto the management canister API types: (#497)CanisterSettingsDefiniteCanisterSettings.
- Provide safe wrapper of
in_replicated_executionin ic-cdk. (#489)
- Upgrade
ic0to v0.23.0. (#489) - BREAKING: Add
wasm_memory_limitto the management canister API types: (#483)CanisterSettingsDefiniteCanisterSettings.
- Management canister methods for interacting with the chunk store. (#461)
- Provide safe wrapper of
global_timer_setin ic-cdk. (#475)
- Upgrade
ic-cdk-macrosto v0.9.0.
- Add
is_recovering_from_trapfunction for implementing trap cleanup logic. (#456) - Allow setting decoding quota for canister entry points and inter-canister calls. (#465)
- When defining canister entry points, we add the following attributes:
#[update(decoding_quota = 10000, skipping_quota = 100, debug = true)]skipping_quotalimits the amount of work allowed for skipping unneeded data on the wire. If this attributes is not present, we set a default quota of10_000. This affects ALL existing canisters, and is mainly used to improve canister throughput. See docs on the Candid library to understand the skipping cost.decoding_quotalimits the total amount of work the deserializer can perform. See docs on the Candid library to understand the cost model.debug = trueprints the instruction count and the decoding/skipping cost to the replica log, after a successful deserialization. The decoding/skipping cost is logged only when you have already set a quota in the attributes. The debug mode is useful to determine the right quotas above. Developers can send a few large payloads to the debugging entry point and know the actual decoding cost.
- When making inter-canister calls, we have a new function
call_with_configto config the same decoding quotas described above. It's strongly recommended to usecall_with_configwhen calling third-party untrusted canisters.
- When defining canister entry points, we add the following attributes:
ic_cdk::api::call::arg_datatakesArgDecoderConfigas argument. (#465)
- Add "reserved cycles" fields to the management canister API: (#449)
reserved_cyclestoCanisterStatusResponsereserved_cycles_limittoCanisterSettingsandDefiniteCanisterSettings
- The README file is now more informative and used as the front page of the doc site.
- The
call*methods are documented with examples and notes.
- Upgrade
candidto0.10. (#448)
query_statsincanister_statusresponse. (#432)
- Another type of performance counter: "call context instruction counter".
Can be fetched using either method below: (#435)
ic_cdk::api::performance_counter(1);ic_cdk::api::call_context_instruction_counter()as a shorthand;
- Deprecate
ic_cdk::api::call::performance_counter()in favor ofic_cdk::api::performance_counter(). (#435)
cycles_burncorresponding to system APIic0.cycles_burn128. (#434)
- Upgrade
ic0to0.21.1. (#434)
- Upgrade
ic0to0.21.0. (#433)
- Candid Export workflow is changed. (#424)
- No need to compile for WASI separately.
- Canisters should still invoke
ic_cdk::export_candid!()to export candid. - Then use
candid-extractorto extract candid from the canister WASM.
- Upgrade
candidto0.9. (#411) - Remove
exportmodule. Please use candid directly in your project instead of usingic_cdk::export::candid. - Remove
ic_cdk_macro::importmodule. See below for a new way to import canisters.
-
Export Candid: (#386)
- A wasi feature that builds the canister as a standalone WASI binary. Running the binary in wasmtime outputs the canister interface
- Build step:
cargo build --target wasm32-unknown-unknown \ --release \ --package "$package" --features "ic-cdk/wasi" wasmtime "target/wasm32-unknown-unknown/release/$package.wasm" > $did_file cargo build --target wasm32-unknown-unknown \ --release \ --package "$package" ic-wasm "target/wasm32-unknown-unknown/release/$package.wasm" \ -o "target/wasm32-unknown-unknown/release/$package.wasm" \ metadata candid:service -v public -f $did_file- In the canister code, users have to add
ic_cdk::export_candid!()at the end oflib.rs. In the future we may lift this requirement to provide a better DX.
-
Import Candid: (#390)
- Canister project adds
ic_cdk_bindgenas a build dependency to generate canister bindings - build.rs
use ic_cdk_bindgen::{Builder, Config}; fn main() { let counter = Config::new("counter"); let mut builder = Builder::new(); builder.add(counter); builder.build(None); // default write to src/declarations }- In the canister code,
mod declarations; use declarations::counter::counter; counter.inc().await? - Canister project adds
- Hardcodes the fee for
sign_with_ecdsa. (#407)
- Bitcoin API handles cycles cost under the hood. (#406)
- Set caller's canister version in the field
sender_canister_versionof management canister call payloads. (#401) - Add management canister types for
canister_infomanagement canister call (CanisterInfoRequestandCanisterInfoResponse). (#401)
- No hard-coded fees for management canister calls. (#404)
ic0.is_controlleras a public function. (#383)
TransformContext::newhas been replaced with dedicated functions that accept closures. (#385)CallFutureonly makes an inter-canister call if it is awaited. (#391)
WASM_PAGE_SIZE_IN_BYTESmadepub. (#380)http_request_with_cycles. (#381)
- Addressed a compatibility error in the signature of the
callfamily of functions. (#379)
- Fix type name in error message when a deserialization error occurs after making a canister-to-canister call. (#355)
- Update document for http_request. (#372)
- The timers API is not a feature anymore, it moved into a separate library,
ic-cdk-timers. (#368)
- Added
ic0.canister_versionas a public function. (#350)
- Allow timers to cancel themselves. (#360)
- Change from pleco to tanton for the chess library in the chess example. (#345)
- Refactor the executor to prevent a double-free on
join_all. (#357)
-
Added composite queries via
#[query(composite = true)]. (#344)Composite queries cannot be run as update calls, but can make inter-canister calls to other query functions.
-
Implemented the canister timers API, located in module
ic_cdk::timer. (#342)
- Improve error message on trap while decoding arguments. (#339)
- Added
StableIOto implement bothio::Writeandio::Readfor stable memory. (#335) - Added 64-bit support for
io::Writeandio::ReadviaStableIO. - Implement
io::Seekfor stable storage.
StableWriterandStableReaderare now wrappers aroundStableIO.
BREAKING CHANGE of experimental API:
http_requestto supportcontextfield in callback function. (#326)
- Expose
offsetofStableReaderandStableWriter. (#330)
- Doc can build on docs.rs. (#327)
- Separate
ic0crate for system API. (#324)
create_canister_with_extra_cyclesto specify cycles when create canister (#322)
create_canistershould charge 0.1T cycles (#322)
- Upgrade
candidto0.8.0(#321)
- Overhaul management canister, especially
transformtype inhttp_request(#312)
- New
ic_cdk::api::management_canistermodule for calling the IC management canister (#295) - Derive common traits for
RejectionCode(#294) ManualReply::rejectfunction (#297)
- Failure to decode the reply in
ic_cdk::calldoes not trap anymore (#301)
- Derive
CandidTypeandDeserializeforRejectionCode(#291, #293)
instruction_counterfunction as a shorthand forperformance_counter(0)(#283)
- Make
CanisterStableMemorypublic (#281) - BREAKING CHANGE: move performance_counter from the
ic_cdk::api::calltoic_cdk::apimodule (#283)
- Outdated documentation for
ManualReply(#286)
arg_data_raw_sizefor checking the size of the arg-data-raw before copying to a vector or deserializing (#263)performance_counterfor getting the value of specified performance counter (#277)
- Use explicitly type u8 in vector initialization (#264)
- Make
reply_rawavoid writing empty replies - Uses new format for candid environment variables in import macros. Requires DFX >=0.9.2 (#270)
BufferedStableReaderfor efficient reading from stable memory (#247)BufferedStableWriterfor efficient writing to stable memory (#245)reply_rawand publisharg_data_rawfor serialization-agnostic arguments fetching and replies (#256)- Support for one-way calls (see
notifyandnotify_rawfunctions) (#261)
- Panicking after
.awaitdoes not leak resources anymore (#232, #250)
- Update canister calling API for 128-bit cycles (#228)
- Take slice rather than owned Vec as input arg (#217)
- Remove non-stable storage API (#215)
- Allow configuring export macros to not reply (#210)
- Add Clone and Copy to RejectionCode (#202)
- Do not call done() in stable_restore() (#216)
- Remove out-of-bounds vulnerability (#208)
- Run inter-canister calls without awaiting (#233)
candidis required to be included in[dependencies]to use the#[import]macro (#190)- Deprecate block_on in favour of the new spawn function (#189)
- Trap in setup panic hook (#172)
- Update system API for 128 bit cycles (#167)
- Add support for 64 bit stable memory (#137)
- Add support for 'heartbeat' and 'inspect_message' (#129)