Skip to content

fix: ic-cdk-bindgen v0.2.1 — escape service type method names in generated bindings - #713

Merged
lwshang merged 1 commit into
mainfrom
fix/bindgen-candid-parser-0.4.1
Aug 14, 2026
Merged

fix: ic-cdk-bindgen v0.2.1 — escape service type method names in generated bindings#713
lwshang merged 1 commit into
mainfrom
fix/bindgen-candid-parser-0.4.1

Conversation

@lwshang

@lwshang lwshang commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

Upgrades candid_parser to v0.4.1, which escapes the method names of a service type when generating the Rust bindings. Previously such a name was emitted raw between the quotes of a Rust string literal, so a name containing characters that are legal in Candid text but significant in Rust produced incorrect generated code. Fixed upstream in dfinity/candid#759.

Also raises the minimum candid version to v0.10.28. candid_parser v0.4 needs it to compile but declares v0.10.16, so without this a consumer with an older candid pinned in their lockfile resolves to a combination that fails to build. The proper fix belongs in candid_parser's manifest; this keeps the upgrade path working in the meantime.

This PR also releases ic-cdk-bindgen v0.2.1 (version bumps in the workspace + crate manifests and the corresponding CHANGELOG entry).

How Has This Been Tested?

  • Generated bindings for both e2e canisters (management_canister.rs, bindgen_callee.rs) are byte-identical before and after the upgrade, confirming no codegen change for ordinary .did files.
  • Regenerated bindings through the real ic_cdk_bindgen::Config::generate() pipeline from a .did whose service-type method names need escaping, and confirmed the output is well-formed.
  • Minimum candid verified empirically: v0.10.26 fails to compile, v0.10.28 builds (v0.10.27 is yanked).
  • cargo check --workspace --all-targets, cargo fmt --check and cargo clippy --workspace --all-targets -- -D warnings are clean; the workspace test suite passes.

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

🤖 Generated with Claude Code

…rated bindings

Upgrades `candid_parser` to v0.4.1, which escapes the method names of a
service type when generating the Rust bindings. Previously such a name was
emitted raw between the quotes of a Rust string literal, so a name containing
characters that are legal in Candid text but significant in Rust produced
incorrect generated code.

Also raises the minimum `candid` version to v0.10.28, which `candid_parser`
v0.4 requires to compile but declares as v0.10.16. Without this, a consumer
with an older candid in their lockfile resolves to a combination that fails
to build.

Generated bindings are byte-identical for `.did` files whose service-type
method names are ordinary identifiers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lwshang
lwshang marked this pull request as ready for review August 14, 2026 14:15
@lwshang
lwshang requested a review from a team as a code owner August 14, 2026 14:15
@zeropath-ai

zeropath-ai Bot commented Aug 14, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 84c0b94.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► ic-cdk-bindgen/Cargo.toml
    0.2.1 version bump to align with change
► ic-cdk-bindgen/CHANGELOG.md
    Unreleased changelog updated to add 0.2.1 with fixes for candid_parser and candid version requirements
► Cargo.toml (root)
    bump ic-cdk-bindgen dependency version from 0.2.0 to 0.2.1

@lwshang
lwshang merged commit 199df1b into main Aug 14, 2026
17 checks passed
@lwshang
lwshang deleted the fix/bindgen-candid-parser-0.4.1 branch August 14, 2026 14:16
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