zkBob / libzkbob-rs

Apache License 2.0
1 stars 3 forks source link

Optimize state sync #5

Closed AllFi closed 2 years ago

lok52 commented 2 years ago

Why we need to insert new commitments each time after notes or an account is decrypted?

https://github.com/zkBob/libzkbob-rs/blob/2537c16bc75fc8dc23335386bcf0330f95edeeb1/libzkbob-rs-wasm/src/client/mod.rs#L304-L307

https://github.com/zkBob/libzkbob-rs/blob/2537c16bc75fc8dc23335386bcf0330f95edeeb1/libzkbob-rs-wasm/src/client/mod.rs#L353-L356

Doesn't this part cover this case?

https://github.com/zkBob/libzkbob-rs/blob/2537c16bc75fc8dc23335386bcf0330f95edeeb1/libzkbob-rs-wasm/src/client/mod.rs#L382-L385

AllFi commented 2 years ago

It is necessary because we need to have correct merkle tree state before calling add_full_tx. It makes sense to update merkle tree only once with tx commitments of others' transactions and leafs of our transactions. But such approach requires rethinking of the whole process of merkle tree updating, so I have decided to leave it to upcoming updates.