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

[ZKS-04] Track committee size. #2213

Merged
merged 20 commits into from
Feb 9, 2024
Merged

[ZKS-04] Track committee size. #2213

merged 20 commits into from
Feb 9, 2024

Conversation

d0cd
Copy link
Contributor

@d0cd d0cd commented Nov 28, 2023

This PR:

  • tracks the committee size in a metadata mapping.
  • enforces that the committee size does not exceed 200.
  • enforces that the number of delegators does not exceed 100_000.

The benches/rewards branch measures the performance of atomic_post_ratify for various numbers of delegators distributed uniformly over 200 validators.
On a 2021 M1 MAX:

DB: `atomic_post_ratify` with 0 delegators and 200 validators
                        time:   [18.821 ms 19.708 ms 20.456 ms]

DB: `atomic_post_ratify` with 1000 delegators and 200 validators
                        time:   [88.696 ms 104.41 ms 131.43 ms]

DB: `atomic_post_ratify` with 10000 delegators and 200 validators
                        time:   [750.47 ms 793.26 ms 838.26 ms]

DB: `atomic_post_ratify` with 100000 delegators and 200 validators
                        time:   [4.0215 s 4.3443 s 4.7269 s]

DB: `atomic_post_ratify` with 1000000 delegators and 200 validators
                        time:   [37.494 s 37.753 s 38.058 s]

Using memory based storage, we found:

Memory: `atomic_post_ratify` with 0 delegators and 200 validators
                        time:   [53.368 ms 53.403 ms 53.433 ms]

Memory: `atomic_post_ratify` with 1000 delegators and 200 validators
                        time:   [181.87 ms 182.05 ms 182.29 ms]

Memory: `atomic_post_ratify` with 10000 delegators and 200 validators
                        time:   [1.3540 s 1.3547 s 1.3553 s]

Memory: `atomic_post_ratify` with 100000 delegators and 200 validators
                        time:   [13.088 s 13.224 s 13.480 s]

Memory: `atomic_post_ratify` with 1000000 delegators and 200 validators
                        time:   [131.51 s 131.59 s 131.68 s]

Helps with addressing Audit Finding: [zksecurity 04] Garbage Collection Can Block Commits From Happening

@d0cd d0cd marked this pull request as draft November 28, 2023 00:27
Signed-off-by: Howard Wu <9260812+howardwu@users.noreply.github.com>
@randomsleep
Copy link
Contributor

Hi, I recently submitted a bug report (id: 2289066) at HackerOne that is directly related to the committee update. The report shows that updating the committee at every block will cause some consensus issues. I suggest to review the report and take it into consideration.

@vicsn
Copy link
Contributor

vicsn commented Jan 18, 2024

Hi @randomsleep thank you for the extra heads up. Just FYI we've seen the issue, great finding, we will circle back on HackerOne.

@d0cd d0cd marked this pull request as ready for review February 9, 2024 14:03
@howardwu howardwu merged commit b0b09d0 into mainnet Feb 9, 2024
71 of 78 checks passed
@howardwu howardwu deleted the feat/track-committee-size branch February 9, 2024 20:47
@raychu86 raychu86 changed the title [Feature] Track committee size. [Feature] [zksecurity 04] Track committee size. Feb 12, 2024
@raychu86 raychu86 changed the title [Feature] [zksecurity 04] Track committee size. [zksecurity 04] Track committee size. Feb 12, 2024
@raychu86 raychu86 changed the title [zksecurity 04] Track committee size. [ZKS-04] Track committee size. Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants