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

feat(rln-relay): use batch operations API #617

Merged
merged 1 commit into from
Aug 12, 2023
Merged

Conversation

richard-ramos
Copy link
Member

Replace inserting/removing members individually by using batch operations with zerokit's atomic_write

@status-im-auto
Copy link

status-im-auto commented Jul 28, 2023

Jenkins Builds

Click to see older builds (28)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 11ad6be #1 2023-07-28 17:27:34 ~14 sec nix-flake 📄log
✔️ 11ad6be #1 2023-07-28 17:28:28 ~1 min linux 📦deb
✖️ 11ad6be #1 2023-07-28 17:29:21 ~2 min tests 📄log
✔️ 11ad6be #1 2023-07-28 17:31:35 ~4 min android 📦tgz
✔️ 11ad6be #1 2023-07-28 17:32:31 ~5 min ios 📦tgz
✔️ a40dfa5 #2 2023-08-01 17:08:30 ~1 min linux 📦deb
✖️ a40dfa5 #2 2023-08-01 17:09:07 ~1 min tests 📄log
✔️ a40dfa5 #2 2023-08-01 17:09:26 ~2 min nix-flake 📄log
✔️ a40dfa5 #2 2023-08-01 17:10:50 ~3 min android 📦tgz
✔️ a40dfa5 #2 2023-08-01 17:12:11 ~4 min ios 📦tgz
✔️ c7ac05a #3 2023-08-01 17:09:03 ~30 sec linux 📦deb
✔️ c7ac05a #3 2023-08-01 17:12:15 ~4 min ios 📦tgz
✔️ 9b6ee32 #4 2023-08-01 17:10:00 ~32 sec linux 📦deb
✖️ 9b6ee32 #4 2023-08-01 17:10:23 ~51 sec tests 📄log
✔️ 9b6ee32 #3 2023-08-01 17:11:25 ~1 min nix-flake 📄log
✔️ 9b6ee32 #4 2023-08-01 17:14:04 ~4 min ios 📦tgz
✔️ 9b6ee32 #3 2023-08-01 17:14:12 ~3 min android 📦tgz
✔️ 7863549 #5 2023-08-01 17:55:59 ~35 sec linux 📦deb
✔️ 7863549 #5 2023-08-01 17:56:59 ~1 min tests 📄log
✔️ 7863549 #4 2023-08-01 17:57:21 ~1 min nix-flake 📄log
✔️ 7863549 #4 2023-08-01 17:58:43 ~3 min android 📦tgz
✔️ 7863549 #5 2023-08-01 17:59:06 ~3 min ios 📦tgz
✖️ b96c5b0 #5 2023-08-07 19:45:37 ~12 sec nix-flake 📄log
✔️ b96c5b0 #6 2023-08-07 19:45:56 ~31 sec linux 📦deb
✔️ b96c5b0 #6 2023-08-07 19:47:02 ~1 min tests 📄log
✔️ b96c5b0 #5 2023-08-07 19:49:12 ~3 min android 📦tgz
✔️ b96c5b0 #6 2023-08-07 19:50:01 ~4 min ios 📦tgz
✔️ b96c5b0 #1 2023-08-09 08:00:46 ~3 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 2e2a76f #7 2023-08-10 17:05:32 ~33 sec linux 📦deb
✔️ 2e2a76f #2 2023-08-10 17:06:42 ~1 min tests 📄log
✔️ 2e2a76f #7 2023-08-10 17:06:45 ~1 min tests 📄log
✔️ 2e2a76f #6 2023-08-10 17:07:03 ~2 min nix-flake 📄log
✔️ 2e2a76f #6 2023-08-10 17:08:31 ~3 min android 📦tgz
✔️ 2e2a76f #7 2023-08-10 17:09:19 ~4 min ios 📦tgz
✔️ 2b71b1b #8 2023-08-11 16:03:57 ~34 sec linux 📦deb
✔️ 2b71b1b #3 2023-08-11 16:04:59 ~1 min tests 📄log
✔️ 2b71b1b #8 2023-08-11 16:05:02 ~1 min tests 📄log
✔️ 2b71b1b #7 2023-08-11 16:05:17 ~1 min nix-flake 📄log
✔️ 2b71b1b #7 2023-08-11 16:06:25 ~3 min android 📦tgz
✔️ 2b71b1b #8 2023-08-11 16:07:30 ~4 min ios 📦tgz

}
indexes = append(indexes, event.Index.Uint64())
indexes = append(indexes, uint(event.Index.Uint64()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't this cause truncation in future if someone uses a 32bit machine and membership set size grows?

Copy link
Member Author

Choose a reason for hiding this comment

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

hm. indeed. I'm gonna change go-zerokit-rln to receive uint64 instead of only uints

Copy link
Member Author

Choose a reason for hiding this comment

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

nvm. Looking at the implementation in zerokit, the functions that accept indexes receive an uintptr_t value which will depend on the platform architecture...

@rymnc - do you think we should change zerokit's FFI api to use u64 instead of usize for the indexes? what's the maximum number of leaves that a merkle tree can have?

Copy link

Choose a reason for hiding this comment

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

by default, the tree_height is 20, so 1_048_576
I think we fixed the issue of serialization for usize's 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, serialization should be fine, but i wonder if in this case (ffi), it would be a problem, as you'd be limited to a maximum index of 2^32-1 in a 32b machine, due to using usize 🤔

Copy link

Choose a reason for hiding this comment

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

I don't believe we'd cross 2^32 ~ since 2^20 is the max tree height

@chaitanyaprem
Copy link
Collaborator

Also , looks like SHA has to be updated for the nix build to be successful.

Copy link
Collaborator

@chaitanyaprem chaitanyaprem left a comment

Choose a reason for hiding this comment

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

LGTM!

@richard-ramos richard-ramos merged commit c320b38 into master Aug 12, 2023
11 checks passed
@richard-ramos richard-ramos deleted the rln/atomics branch August 12, 2023 11:44
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