ora-io / zkgraph

Template for zkGraph.

Home Page:https://docs.hyperoracle.io/zkgraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bytes object slice() function infinite recursive error

nom4dv3 opened this issue · comments

commented

Which branch
bignum

What is the problem
Bytes.slice falls to infinite recursive, causing error

What behavior did you observed
call slice of a Bytes object, the program throws RangeError: Maximum call stack size exceeded

What is the expected behavior
should have no error

How to reproduce
use the following code:

mapping.ts:

//@ts-ignore
import { require } from "../lib/common/zkwasm";
import { Bytes, Event, BigInt } from "../lib/common/type";

export function handleEvents(events: Event[]): Bytes {
    let a = new Bytes(0);
    (a as Uint8Array).slice()
    return a
}

$ npm run compile-local && npm run exec-local 0x10d1125

output:

...
wasm://wasm/f852f21e:1


RangeError: Maximum call stack size exceeded
    at wasm://wasm/f852f21e:wasm-function[17]:0xf0e
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30
    at wasm://wasm/f852f21e:wasm-function[17]:0xf30

Other information you'd like to share