The problem occurs when using the command "near-vm" to execute a simulation test of an assemblyscript smart contract method that takes inputs of type numbers like i32, u32, i64, u64. The following error is returned "FunctionCallError":"WasmUnknownError".
How to reproduce:
yarn
) and Run test (yarn test
). Everything should works wellsrc/simple/assembly/index.ts
export function add(a: i32, b: i32): i32 {
return a + b;
}
src/simple/__tests__/index.unit.spec.ts
and it will pass successfullyit("should return the sum of two integers", () => {
const sum = add(1, 2);
expect(sum).toBe(3);
})
yarn near-vm --wasm-file build/debug/simple.wasm --method-name add --input '{"a": 1, "b": :2}
Then you get "FunctionCallError":"WasmUnknownError"
{"outcome"{"balance":"10000000000000000000000000",
"storage_usage":100,"return_data":"None","burnt_gas":39848843793,"used_gas":39848843793,"logs":[]},
"err":{"FunctionCallError":"WasmUnknownError"},"receipts":[],"state":{}}
Note that this problem doesn't occur when the method parameters are strings.
the simulation tests there are outdated and need to be updated
Check out this new way of simulating NEAR contracts