I am working on some property tests for Azle and in one of the tests we have some very large canisters being generated. We keep getting the following error:
The replica returned a rejection error: reject code CanisterError, reject message Error from Canister bkyz2-fmaaa-aaaaa-qaaaq-cai: Canister’s Wasm module is not valid: Wasm module has an invalid custom section. Invalid custom sections: total size of the custom sections exceeds the maximum allowed: size 1135213 bytes, allowed 1048576 bytes.
This is likely an error with the compiler/CDK toolchain being used to build the canister. Please report the error to IC devs on the forum: https://forum.dfinity.org and include which language/CDK was used to create the canister., error code None
I was hoping someone might be able to help me get some clarification on this error
Just adding to the OP, I would like to know what custom sections it is talking about…I assume this is the custom metadata? So is it possibly that our candid string stored in the custom metadata is too large? Is there a reason the custom section limit is so small?
Catching up on the forums tonight and it seems like we’re facing some hurdles with Azle? In another post, I raised the question of whether tools like this are essential for ICP’s success because of the instruction limit. Honestly, I’m concerned they might hurting our potential in the long run. We are building on revolutionary technology. I think its fair that developers adapt…
Custom sections have indeed a limit of 1MB, even though Wasm binary can be up to 100MB:
I think the reason for this limit is that custom sections are served in the state tree and users can query them, so custom sections consume more resources than the rest of the Wasm binary:
@bdemann: what do you store in the custom section? Can that be stored in data section instead?
My guess is it’s the Candid, these tests generate very large random canisters, so I assume the Candid generated and stored in the Candid section of the custom metadata is quite large… actually did we check @bdemann ? I thought you said it was ~400 KiB of Candid?
So if it is the Candid, we kind of can’t do it anywhere else. This is just from one of our property tests that is really pushing things to the limit, so not blocking us that I know of, but still…
Well we’re testing real canisters as close to production as possible, so the purpose is to test under normal conditions. We don’t want to create custom workarounds to get the test to pass, that defeats the purpose of the test.
We’re using dfx and a local replica, these are end-to-end/integration tests.