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

Optimize state sync #5

Merged
merged 8 commits into from
May 26, 2022
Merged

Optimize state sync #5

merged 8 commits into from
May 26, 2022

Conversation

AllFi
Copy link

@AllFi AllFi commented May 21, 2022

No description provided.

@AllFi AllFi requested review from EvgenKor and lok52 May 21, 2022 13:37
@AllFi AllFi mentioned this pull request May 21, 2022
Copy link
Collaborator

@EvgenKor EvgenKor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues were found. Need to increase minor version (-> 0.3.10) for libzkbob-rs and libzkbob-rs-wasm

@lok52
Copy link
Collaborator

lok52 commented May 23, 2022

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

if other_tx_commitments.len() > 0 {
let commitments = other_tx_commitments.drain(..);
self.inner.borrow_mut().state.tree.add_tx_commitments(other_tx_start_index.unwrap(), commitments);
}

if other_tx_commitments.len() > 0 {
let commitments = other_tx_commitments.drain(..);
self.inner.borrow_mut().state.tree.add_tx_commitments(other_tx_start_index.unwrap(), commitments);
}

Doesn't this part cover this case?

if other_tx_commitments.len() > 0 {
let commitments = other_tx_commitments.drain(..);
self.inner.borrow_mut().state.tree.add_tx_commitments(other_tx_start_index.unwrap(), commitments);
}

@AllFi
Copy link
Author

AllFi commented May 23, 2022

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.

@EvgenKor EvgenKor merged commit 7fca456 into main May 26, 2022
@EvgenKor EvgenKor deleted the optimize_state_sync branch October 11, 2022 19:50
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

Successfully merging this pull request may close these issues.

None yet

3 participants