0chain / gosdk

A client SDK in Go to interface the blockchain and storage platform, and other smart contracts
MIT License
32 stars 29 forks source link

get wasm demo working with wasm_exec.js version go1.21.0 #1272

Closed boddumanohar closed 11 months ago

boddumanohar commented 11 months ago

Currently wasm demo uses wasm_exec.js version go1.21

https://github.com/0chain/gosdk/blob/acc4fcd55ab597f547c422eb3ed1655d71395109/wasmsdk/demo/index.html#L6

But using this version results in this error

Screenshot 2023-11-05 at 13 49 37

To reproduce this:

  1. Start the wasm demo:
    
    # generate wasm sdk
    make wasm-build
    cp ./zcn.wasm ./wasmsdk/demo/zcn.wasm

go to wasm demo folder

cd wasmsdk/demo go run main.go



2. Open the URL: `http://127.0.0.1:8080/` in browser and check the console tab. You can find this error. 

To fix this, Currently, I have to use version `1.18.5` and that will work as expected. 

We should understand why our wasm binary doesn't work with go1.21
sculptex commented 11 months ago

The wasm_exec.js version has to match version of go that the wasm target is built with

boddumanohar commented 11 months ago

the go version used to build the wasm binary and wasm_exec.js version. Both of them should always match. Thanks for clarifying @sculptex 👍