zk-kit icon indicating copy to clipboard operation
zk-kit copied to clipboard

TS `insert()` and `update()` doesn't check if the new leaf exists already

Open 0xbok opened this issue 3 months ago • 0 comments

In Solidity version of LeanIMT, existing leaves cannot be inserted or updated, but TS version allows it.

https://github.com/privacy-scaling-explorations/zk-kit/blob/950dc5bd5f8f53069c12b56581ed63faa5382515/packages/imt/src/lean-imt/lean-imt.ts#L116

https://github.com/privacy-scaling-explorations/zk-kit/blob/950dc5bd5f8f53069c12b56581ed63faa5382515/packages/imt/src/lean-imt/lean-imt.ts#L156

https://github.com/privacy-scaling-explorations/zk-kit/blob/950dc5bd5f8f53069c12b56581ed63faa5382515/packages/imt/src/lean-imt/lean-imt.ts#L199

https://github.com/privacy-scaling-explorations/zk-kit/blob/950dc5bd5f8f53069c12b56581ed63faa5382515/packages/imt.sol/contracts/internal/InternalLeanIMT.sol#L40-L46

0xbok avatar Apr 08 '24 20:04 0xbok