Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RiscZero Battleship Example Javascript Error #15

Open
mercush opened this issue Jul 10, 2022 · 1 comment
Open

RiscZero Battleship Example Javascript Error #15

mercush opened this issue Jul 10, 2022 · 1 comment
Assignees

Comments

@mercush
Copy link

mercush commented Jul 10, 2022

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.

@flaub flaub self-assigned this Jul 11, 2022
@austinabell
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants