Skip to content

Conversation

@lpahlavi
Copy link
Contributor

@lpahlavi lpahlavi commented Sep 30, 2025

(XC-502) Update the ic-cdk version to v0.18. This is a major upgrade of the ic-cdk and as such is a breaking change for canhttp.

BREAKING: There are multiple breaking changes in this PR:

  • IcError is refactored into an enum with two variants for CallRejected and InsufficientLiquidCycleBalance.
  • IcHttpRequestWithCycles and http::CyclesCostEstimator are removed.
  • Client:
    • no longer implements Service<IcHttpRequestWithCycles>
    • now implements Service<ic_management_canister_types::HttpRequestArgs>
  • CyclesAccounting:
    • no longer implements Convert<ic_cdk::api::management_canister::http_request::CanisterHttpRequestArgument>
    • now implements Filter<ic_management_canister_types::HttpRequestArgs>
    • CyclesAccounting::new no longer takes a num_nodes_in_subnet argument.
  • CyclesChargingPolicy::charge_cycles now takes a ic_management_canister_types::HttpRequestArgs as argument.

@lpahlavi lpahlavi force-pushed the lpahlavi/XC-412-update-ic-cdk branch from 3ddd9de to 59aedd8 Compare October 2, 2025 06:49
@lpahlavi lpahlavi changed the title build: update ic-cdk to v0.18.7 build!: update ic-cdk to v0.18.7 Oct 2, 2025
@lpahlavi lpahlavi requested a review from gregorydemay October 2, 2025 07:27
@lpahlavi lpahlavi marked this pull request as ready for review October 2, 2025 07:27
@lpahlavi lpahlavi requested a review from a team as a code owner October 2, 2025 07:27
Copy link
Collaborator

@gregorydemay gregorydemay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, main comment is about error code.

Copy link
Contributor Author

@lpahlavi lpahlavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the review and feedback @gregorydemay! This should be ready for another round 🚀

@lpahlavi lpahlavi requested a review from gregorydemay October 7, 2025 07:53
Copy link
Collaborator

@gregorydemay gregorydemay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lpahlavi for this upgrade!

@lpahlavi lpahlavi merged commit 40da528 into main Oct 7, 2025
10 checks passed
@lpahlavi lpahlavi deleted the lpahlavi/XC-412-update-ic-cdk branch October 7, 2025 09:50
@github-actions github-actions bot mentioned this pull request Oct 8, 2025
lpahlavi added a commit that referenced this pull request Oct 20, 2025
## 🤖 New release

* `canhttp`: 0.2.1 -> 0.3.0 (⚠ API breaking changes)

### ⚠ `canhttp` breaking changes

```text
--- failure enum_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_missing.ron

Failed in:
  enum canhttp::CyclesAccountingError, previously in file /tmp/.tmpHTwER4/canhttp/src/cycles/mod.rs:100

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/struct_missing.ron

Failed in:
  struct canhttp::IcHttpRequestWithCycles, previously in file /tmp/.tmpHTwER4/canhttp/src/client/mod.rs:100
  struct canhttp::CyclesCostEstimator, previously in file /tmp/.tmpHTwER4/canhttp/src/cycles/mod.rs:28
  struct canhttp::CyclesAccounting, previously in file /tmp/.tmpHTwER4/canhttp/src/cycles/mod.rs:114

--- failure struct_with_pub_fields_changed_type: struct with pub fields became an enum or union ---

Description:
A struct with pub fields became an enum or union, breaking accesses to its public fields.
        ref: obi1kenobi/cargo-semver-checks#297 (comment)
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/struct_with_pub_fields_changed_type.ron

Failed in:
  struct canhttp::IcError became enum in file /tmp/.tmpeFTXb6/canhttp/canhttp/src/client/mod.rs:46

--- failure trait_missing: pub trait removed or renamed ---

Description:
A publicly-visible trait cannot be imported by its prior path. A `pub use` may have been removed, or the trait itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/trait_missing.ron

Failed in:
  trait canhttp::CyclesChargingPolicy, previously in file /tmp/.tmpHTwER4/canhttp/src/cycles/mod.rs:10
```

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.3.0] - 2025-10-08

### Added
- **Breaking:** A new method `charge_cycles` that does the actual
charging was added to `CyclesChargingPolicy`
([#7](#7))
- Example of canister using the library to make HTTP requests
([#6](#6))

### Changed
- **Breaking:** Update `ic-cdk` to `v0.18.7` including several changes
to align with the new HTTP outcall API
([#21](#21)). Notably:
  - `IcError` is refactored into an enum
- Use of the new `HttpRequestArgs` and `HttpRequestResult` types in
`CyclesChargingPolicy` and `Client` trait impls
- Removal of `IcHttpRequestWithCycles`, `CyclesCostEstimator`,
`CyclesAccountingError` and `CyclesAccounting` due to the `ic-cdk`
method for making HTTP outcalls now taking care of charging cycles

[0.3.0]:
https://github.com/dfinity/canhttp/compare/canhttp-v0.2.1..canhttp-v0.3.0
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Louis Pahlavi <louis.pahlavi@dfinity.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants