-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Unnecessary wasm validation error "Smart contract data segments must lie in first 64KiB" #5604
Comments
The 64KB limit serves as a gatekeeper to ensure blockchain is healthy and secure. Changing this limit will result in hardfork or causing more delays on contract loading which introduces blackholes for hackers. Alternatively you can use multi_index table to store const string data, which takes about same amount of memory. |
The reason this occurs for rust is because rust’s compiler, be default, wants 1MB of “stack” to work with. You can reduce this, for example, by |
Thanks @spoonincode! Reducing the stack size worked. FYI for anyone else tinkering with Rust, I ended up adding this to my
|
Hi @taokayan, I build a contract with |
After the update to EOSIO.CDT v1.8.0-RC1 and EOSIO v2.1.0-RC1 I'm getting this error, too, with a pretty large contract. I previously used EOSIO.CDT v.1.7.0 and EOSIO v2.0.7 and have not had any problems. Is there a way solve this? (like setting -stack-size or so?) |
Tried setting -stack-size to something small and -fno-stack-first, both without success. |
While working on Rust bindings I ran into this error: https://github.com/EOSIO/eos/blob/master/libraries/chain/wasm_eosio_validation.cpp#L28
Smart contract data segments must lie in first 64KiB
It seems to be caused by this line in the
.wast
file:(data (i32.const 1048576) "Hello World")
If I change
1048576
to something much smaller like555
then it works as expected.According to @tbfleming on Telegram:
The text was updated successfully, but these errors were encountered: