RiscZero Battleship Example Javascript Error
I am trying to run the tutorial risczero battleship example (available here) but am getting the following error message.
new_game: JsValue(Error: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: panicked at 'called `Result::unwrap()` on an `Err` value: MethodVerificationError', /Users/flaub/.cargo/registry/src/github.com-1ecc6299db9ec823/risc0-zkvm-verify-0.8.0/src/zkvm/mod.rs:40:47"}} TypedError@https://cdn.jsdelivr.net/npm/[email protected]/dist/near-api-js.js:3269:9 ServerError@https://cdn.jsdelivr.net/npm/[email protected]/dist/near-api-js.js:3595:1 ServerTransactionError@https://cdn.jsdelivr.net/npm/[email protected]/dist/near-api-js.js:3598:1 parseResultError@https://cdn.jsdelivr.net/npm/[email protected]/dist/near-api-js.js:3611:29 signAndSendTransactionV2@https://cdn.jsdelivr.net/npm/[email protected]/dist/near-api-js.js:163:36 )
I get this error message shortly after I make my move in the game.
It should be noted that I wasn't initially able to build the example so I made a modification to the code. In the contract/cargo.toml file, I added the dependency getrandom = { version = "0.2", features = ["js"] }. This is what I was advised to do here.
Please let me know if there is a way to make this work.
So the issue is that the js feature imports and exports a lot of wasm-bindgen specific host functions which cannot be compiled by the NEAR runtime (all symbols prefixed __wbindgen_).
I suppose the rand utils are meant for convenience for consumers, but this feels like it should be behind a feature flag or have the core utils be in a lower-level lib.
Perhaps the ability to compile to wasm isn't a core use case, and this example will be deprecated?