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

The excessively long bytes cannot be toHexString. #39

Open
LiRiu opened this issue Jan 1, 2024 · 3 comments
Open

The excessively long bytes cannot be toHexString. #39

LiRiu opened this issue Jan 1, 2024 · 3 comments
Assignees

Comments

@LiRiu
Copy link
Contributor

LiRiu commented Jan 1, 2024

When the Bytes are too large, the toHexString function cannot execute.

Env

  • zkgraph-lib: v1.0.1
  • zkgraph-cli: v1.0.0

Reproduce

  1. npm init zkgraph@latest
  2. Follow the guide to initialize a project of type "event"
  3. modify src/mapping.ts as follow:
//@ts-ignore
import { Bytes, Block } from "@hyperoracle/zkgraph-lib";

export function handleBlocks(blocks: Block[]): Bytes {
  const event = blocks[0].events[0];
  event.data.toHexString();
  return Bytes.empty();
}
  1. modify src/zkgraph.yaml as follow:
specVersion: 0.0.2
apiVersion: 0.0.2
name: eg_event
description: "This demo zkGraph shows 3 ways to access / filter out source events."
repository: https://github.com/hyperoracle/zkgraph
dataSources:
  - kind: ethereum
    network: sepolia
    event:
      - address: '0xfa002dc692d045afde265d5eac09d012c1af50e8'
        events: 
          - "ethscriptions_protocol_CreateEthscription(address,string)"

mapping:
  language: wasm/assemblyscript
  file: ./mapping.ts
  handler: handleBlocks

dataDestinations:
  - kind: ethereum
    network: sepolia
    address: "0x0000000000000000000000000000000000000001"
  1. npm run compile && npm run exec -- 4940316
    Next, there will be the following error message from execue.
image
@LiRiu LiRiu changed the title 过长的bytes无法toHexString The excessively long bytes cannot be toHexString. Jan 1, 2024
@lightmanM
Copy link
Contributor

lightmanM commented Jan 10, 2024

Found that the issue is due to the limit of the memory size defined in the zkgraph-c compiler. Solution: double the default memory size for now, then we can handle event.data with size ~1.2kb.

@lightmanM lightmanM self-assigned this Jan 10, 2024
@lightmanM
Copy link
Contributor

lightmanM commented Jan 10, 2024

Although we can address the memory change in the as side, zkwasm seems has its own memory limit, and is causing prove fail. Need to discuss with Gao.
zkgraph-c@e9ec825

@nom4dv3
Copy link
Member

nom4dv3 commented Jan 10, 2024

turns out this is an OOM, should figure out why does it use that much, before blaming on zkwasm memory limit.
We did turn off gc in zkGraph, but still 1M mem should be enough under this case.

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