Closed learnforpractice closed 2 years ago
Yeah, I'm thinking about a more compatible approach.
How python runs tests using chain tester is really compatible, maybe similar for JS/TS?
Right, call chain tester from JS/TS through RPC interfaces.
How python runs tests using chain tester is really compatible, maybe similar for JS/TS?
Also I realized theres no real way to test the new intrinsics since ascdk doesn't use the new EOS repo: https://github.com/eosnetworkfoundation/mandel
Also I realized theres no real way to test the new intrinsics since ascdk doesn't use the new EOS repo: https://github.com/eosnetworkfoundation/mandel
Under planning.
An interesting idea I had here was, what if we modified ascdk
to be portable
. The AS compiler itself is written in portable Assemblyscript. What this allows for is compiling using tsc
, then tests could theoretically be run against a JS compiled version of the contract, and get full JS support + debugger
Sounds practical. some low-level functions such as store
, and 'load` wouldn't work though.
we could replace them with custom WASM imports/intrinsics in a debug build
That make things much more complicated. I think we should recommend developers not to use low-level functions.
Thats fine for devs but I believe ascdk
library itself uses store and load
So we need to replace all these functions in the assemblyscript source code which is not compatible with the typescript with custom functions. That's a practical solution.
Is it possible to use a debugger/breakpoints?
It is possible to debug wasm in a browser. See the following link:
https://blog.bitsrc.io/debugging-webassembly-with-chrome-devtools-99dbad485451
For debugging smart contracts in wasm, there is no good solution I think.
The solution I currently use for debugging Rust & Go Smart Contracts is compiling source code to native which is not possible for Assemblyscript Smart Contracts I think.
Have a look here: https://github.com/ProtonProtocol/vert
Have been doing this for a while, works well with ascdk. Although it uses a chain simulator instead of a real chain