# SNS upgrade canister wasm limit

**URL:** <https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780>\
**Category:** Developers\
**Created:** [September 5, 2024, 11:19am UTC](https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780 "2024-09-05T11:19:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [September 5, 2024, 11:19am UTC](https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780/1 "2024-09-05T11:19:05Z")

</div>

It seems after upgrading to the latest SNS version there is a lower limit on wasm size when upgrading. Is there a way to increase it for a canister with a proposal?

Trying to upgrade using **quill** produces error:  
“the maximum canister WASM and argument size for UpgradeSnsControlledCanister is 2000000 bytes.”

Before upgrading SNS the canister was deploying. It is 2,070,589 bytes. Just 70kb above. Any suggestions on how to optimize it with moc compiler arguments or another tool are welcome. It has 3 actors inside, so that’s why it’s bigger.

The canister we are trying to upgrade - [https://dashboard.internetcomputer.org/canister/wxer6-3yaaa-aaaal-qjnua-cai](https://dashboard.internetcomputer.org/canister/wxer6-3yaaa-aaaal-qjnua-cai)

---

<div class="post-metadata">

**Author:** ![aterga](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/aterga/32/4143_2.png) [@aterga](https://forum.dfinity.org/u/aterga)\
**Post date:** [September 5, 2024, 2:50pm UTC](https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780/2 "2024-09-05T14:50:37Z")

</div>

Hi @infu,

Looks like the limit was introduced around 4 months ago in 7842ba0dd46bc44036448b7449c6c0ee26f0ae89.

Are you trying to upgrade to a gzipped WASM? If not, that might help.

Otherwise, it’s hard to tell how to optimize the WASM size without seeing your code. Maybe there are some dependencies / libraries that you could remove?

Pinging @ggreif and @chenyan in case there’s a better way to optimize Motoko for WASM size.

---

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [September 5, 2024, 3:21pm UTC](https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780/3 "2024-09-05T15:21:01Z")

</div>

I am compiling it with moc. So I can just gzip the wasm and try to deploy the gzipped file?

---

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [September 5, 2024, 3:32pm UTC](https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780/4 "2024-09-05T15:32:50Z")

</div>

Ok that worked. Thanks!

---

<div class="post-metadata">

**Author:** ![ggreif](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ggreif/32/301_2.png) [@ggreif](https://forum.dfinity.org/u/ggreif)\
**Post date:** [September 5, 2024, 10:03pm UTC](https://forum.dfinity.org/t/sns-upgrade-canister-wasm-limit/34780/5 "2024-09-05T22:03:22Z")

</div>

> [@infu](#):
>
> Any suggestions on how to optimize it with moc compiler arguments or another tool are welcome.

Please check out [Canister Optimizer available in dfx 0.14.0](https://forum.dfinity.org/t/canister-optimizer-available-in-dfx-0-14-0/21157). It can significantly reduce Wasm size.
