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

fix: Handle invalid (zero) capacity of changelog and roots reliably #930

Merged
merged 8 commits into from
Jul 3, 2024

Conversation

vadorovsky
Copy link
Contributor

  • Validate changelog and roots size not only in new() method, but also in init() and all wrapper types (zero-copy and copy).
  • Add SBF tests which initialize trees with zero capacities and expect an error.
  • Add SBF tests with changelog and root capacity 1. They are expected to succeed.

@vadorovsky vadorovsky requested a review from ananas-block as a code owner July 2, 2024 02:04
@vadorovsky vadorovsky force-pushed the vadorovsky/test-minimum-config branch from e99dfdb to 427caa8 Compare July 2, 2024 02:12
Copy link
Contributor

@ananas-block ananas-block left a comment

Choose a reason for hiding this comment

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

Tests are too long we need to reduce the test iterations.
previous time was 23 not its 35 min

for changelog_size in (1..=5000).step_by(1000) {
for roots_size in (changelog_size..=5000).step_by(1000) {
for queue_capacity in [5003, 6857, 7901] {
test_init_and_insert_into_nullifier_queue(
Copy link
Contributor

@ananas-block ananas-block Jul 2, 2024

Choose a reason for hiding this comment

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

I think this one makes sense to iterate over multiple capacities.
I don't know how the underlying test works but it's probably enough to just do a couple inserts and empty the queue no need to do a lot of transactions here, imo.

canopy_depth: ADDRESS_MERKLE_TREE_CANOPY_DEPTH,
address_changelog_size,
network_fee: Some(5000),
rollover_threshold: Some(95),
Copy link
Contributor

Choose a reason for hiding this comment

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

Iterations make sense!
We can just put the rollover threshold to zero to test this one, that should be faster.
Imo we should still keep one test that advances the slot and modifies the account (idk whether these replaced that original test which did that.)

@vadorovsky vadorovsky force-pushed the vadorovsky/test-minimum-config branch 3 times, most recently from 48a5090 to 2df375c Compare July 3, 2024 17:35
* Validate changelog and roots size not only in `new()` method, but also
  in `init()` and all wrapper types (zero-copy and copy).
* Add SBF tests which initialize trees with zero capacities and expect
  an error.
* Add SBF tests with changelog and root capacity 1. They are expected
  to succeed.

Unverified

This user has not yet uploaded their public signing key.

Verified

This commit was signed with the committer’s verified signature.
BethGriggs Bethany Griggs

Verified

This commit was signed with the committer’s verified signature.
BethGriggs Bethany Griggs
Having them everywhere makes test runs on CI too long.

Verified

This commit was signed with the committer’s verified signature.
BethGriggs Bethany Griggs
Not defining it violates asserts.
@ananas-block ananas-block merged commit 6accb20 into main Jul 3, 2024
13 checks passed
@ananas-block ananas-block deleted the vadorovsky/test-minimum-config branch July 3, 2024 20:42
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

2 participants