o1-labs / o1js

TypeScript framework for zk-SNARKs and zkApps

Home Page:https://docs.minaprotocol.com/en/zkapps/how-to-write-a-zkapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make MerkleTree.nodes public or refactor MerkleTree to not use depreciated in o1js 0.18.0 CircuitValue and arrayProp

dfstio opened this issue · comments

commented

The MerkleTree.nodes is private:

class MerkleTree {
  private nodes: Record<number, Record<string, Field>> = {};
  private zeroes: Field[];
  ...

https://github.com/o1-labs/o1js/blob/main/src/lib/provable/merkle-tree.ts#L28

I need to serialize MerkleTree in my project, so I need access to nodes. In o1js 0.17.0, I have copied the MerkleTree code and defined the toJSON() method. With o1js 0.18.0, CircuitValue and arrayProp, which MerkleTree is using, are depreciated, and this code does not work anymore. I can copy CircuitValue and arrayProp code also, but a better way is to make MerkleTree.nodes public.

See also #1482

thanks for reporting this, I made #1555

commented

Thanks a lot!