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

insert after delete #44

Merged
merged 2 commits into from
Apr 30, 2024
Merged

insert after delete #44

merged 2 commits into from
Apr 30, 2024

Conversation

ilya-korotya
Copy link
Contributor

No description provided.

await mt.add(7n, 7n);
});

it('test insert delete node right fork', async () => {

Choose a reason for hiding this comment

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

"right branch"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I renamed all unit tests. From fork to branch

await mt.add(7n, 7n);

const existProof = await mt.generateProof(7n);
expect(existProof.proof.existence).to.be.true;

Choose a reason for hiding this comment

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

Don't you want to check the proof siblings here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for all new unit tests

Choose a reason for hiding this comment

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

Maybe you can check something like this as well?
add(1,1)
add(7,1)
add(15,1)
delete(15)
check the proof of 7: existence = true, siblings == expected siblings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a unit test for 3, 7, 15. It will be equally deep. Don't see any reason for this unit test.

Choose a reason for hiding this comment

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

It is a bit different. When you remove 7 or 15 the sibling leaf will move only one level up but not 2 levels up as in case with 1,7,15.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also I added the same test for left branch

@@ -702,6 +702,85 @@ for (let index = 0; index < storages.length; index++) {
expect(rleaf.entry[0].bigInt()).to.be.eq(1n);
});

// https://github.com/iden3/go-merkletree-sql/issues/23
it('test issue 23', async () => {

Choose a reason for hiding this comment

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

I wouldn't address an issue number in test name. May be it is ok to leave the issue reference in comments but better to name the test by exactly what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed

@ilya-korotya ilya-korotya merged commit 9ffaf74 into main Apr 30, 2024
2 checks passed
@ilya-korotya ilya-korotya deleted the fix/insert-after-delete branch April 30, 2024 09:36
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.

4 participants