# Reserved WASM exported function names

**URL:** <https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932>\
**Category:** Developers\
**Created:** [August 3, 2023, 2:57pm UTC](https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932 "2023-08-03T14:57:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mraszyk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mraszyk/32/7945_2.png) [@mraszyk](https://forum.dfinity.org/u/mraszyk)\
**Post date:** [August 3, 2023, 2:57pm UTC](https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932/1 "2023-08-03T14:57:25Z")

</div>

**What?**

The IC is going to enforce that exported function names must not start with the `canister_` prefix except for those explicitly allowed by the Interface Specification ([Internet Computer Loading](https://internetcomputer.org/docs/current/references/ic-interface-spec#system-api-module)).

Canister developers need to make sure they don’t deploy new canister modules exporting functions with reserved names in the future.

**Why?**

Exported function names starting with the `canister_` prefix and not explicitly allowed by the Interface Specification are reserved so that the IC might introduce such names for new IC features (as was the case for `canister_composite_query ` recently) without breaking existing canisters.

**How?**

The IC rejects canister modules exporting functions with reserved names during canister module validation. For new canister modules deployed onto the IC, the validation is performed as part of the `install_code` management canister call.

The change is implemented by this MR: [Merge branch 'mraszyk/reject-reserved-exports' into 'master' · dfinity/ic@e4ff4a5 · GitHub](https://github.com/dfinity/ic/commit/e4ff4a5334ed1c6a8abf97e5d00a79efd90ec076).

According to the production logs, existing canisters are not affected by this change. After rolling out the change on mainnet, the IC will reject new canister modules exporting functions with reserved names.

---

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [August 12, 2023, 1:39am UTC](https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932/2 "2023-08-12T01:39:42Z")

</div>

Could this be added as a lint to `ic_cdk` so that this is flagged as an error automatically by a language server like Rust analyzer? Maybe for functions annotated with the `ic_cdk::query` or `ic_cdk::update` attribute?

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [August 12, 2023, 5:20am UTC](https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932/3 "2023-08-12T05:20:44Z")

</div>

If you are using the `query` and `update` attributes from `ic_cdk`, it automatically complies with this requirement. The function name can start with `canister_` prefix just fine. It only forbids the exported function name, which starts with either `canister_update` or `canister_query`. It only affects CDK authors who are exporting more functions than allowed in the interface spec.

---

<div class="post-metadata">

**Author:** ![mraszyk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mraszyk/32/7945_2.png) [@mraszyk](https://forum.dfinity.org/u/mraszyk)\
**Post date:** [August 14, 2023, 5:38am UTC](https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932/4 "2023-08-14T05:38:14Z")

</div>

> [@chenyan](#):
>
> The function name can start with `canister_` prefix just fine. It only forbids the exported function name, which starts with either `canister_update` or `canister_query`. It only affects CDK authors who are exporting more functions than allowed in the interface spec.

Thank you for the clarification! Then the question is if it’d be possible to make `ic_cdk` also forbid all exported function names which start with `canister_` and are not allowed by the spec?

---

<div class="post-metadata">

**Author:** ![AdamS](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/adams/32/5248_2.png) [@AdamS](https://forum.dfinity.org/u/AdamS)\
**Post date:** [August 14, 2023, 2:11pm UTC](https://forum.dfinity.org/t/reserved-wasm-exported-function-names/21932/5 "2023-08-14T14:11:40Z")

</div>

ic-cdk has no control over what `#[export_name]` the user writes; it is not possible to make such a lint. However, a user using ic-cdk has no reason to use `#[export_name]` either. It should in general be a non-issue.
