Closed luckycoder99 closed 6 years ago
I also encountered this problem.
Since the console.log is outputting "Assembling WASM..." the trace appears to be from structs.js
if(/^\s*\(module/.test(code)) {
console.log('Assembling WASM...')
const wasm = Buffer.from(binaryen.parseText(code).emitBinary())
result.code = wasm
} else {
result.code = object.code
So this seems to be prior to hitting the blockchain. I also don't see the eos.setcode unit test in src/index.test.js which has all the passing unit tests. Perhaps @jcalfee has some suggestions for a workaround?
I'll add a unit test..
Thanks James! Appreciate any help here...
So far the unit test is able to deploy the currency contract using eosjs with binaryen.
There are some complications making the unit test but unrelated. a) exchange contract deploy exceeds the maximum network usage, b) re-deploying the same wast rejected..
Since your wast files starts with "(module" it should be valid web assembly text format. The error is really between your wast file and binaryen. The wast file is not the format you write by hand but rather the 1st compilation of your program. The binaryen is a second pass on the wast file. I believe eosio has a program that converts c++ to this wast file. Is that what your using?
I tested using binaryen@37.0.0 ..
There was an unrelated error in the ABI structs fixed in the comment above (the eosjs-json upgrade) .. I'll push a release later today.
Published: eosjs@8.0.1 .. Let us know more about how you created your wast file..
Thanks for getting on this so fast.
I'm going to investigate this more later and provide more color with the new release. I was creating both the abi and the wast files using eosiocpp. So the files were output using 'eosiocpp -o hello.wast hello.cpp' and 'eosiocpp -g hello.abi hello.cpp'. These files generate with a few warnings, however. Once these files are created, I'm able to successfully deploy the contract via cleos using these files. The trouble comes when using these same files with the setcode command and fs/binaryen.
If you are able to deploy with the new version,, that's good news. I'll take a look at the new release and report back on this thread. Let me know if you need more details to reproduce anything.
More to do. Just a quick update. The error is gone when using the previous version of binaryen (v37). The latest version with standard npm install binaryen (v46) seemed to cause the error. Will continue investigating...
This sounds related to https://github.com/EOSIO/eos/issues/2187
Solved. It works with binaryen v37. You are the best.
It works with binaryen v37. Failed to use v46 before.
Hi James and Chris. Great work on putting this library together...I'm trying to publish a contract using the Dawn3 eosjs release and getting wasm errors. I'm using the boilerplate code on the readme - pulling in the individual files with fs and using binaryen.
Specifically, I'm running the Dawn3 release on Ubuntu 16.04 (not with Docker) and I can publish all contracts via cleos, but not with the eosjs@dawn3 api. I've tried simplifying with just the hello-world contracts on the eosio wiki and still get an error. Is the format for setcode() with eosjs@dawn3 the same as dawn2? It looks like cleos in Dawn3 now seems to only require a folder 'cleos set contract hello.code ../hello -p hello.code' and not the actual files?
Here's the error Assembling WASM... [parse exception: expected list (at 267:18)]Fatal: error in parsing wasm text
Do you have any documentation or insight that could help? Thanks so much in advance for all the great work on this library.