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 unmodified validators #397

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Aug 22, 2024

Motivation

Some validators.get(i) may call and it's tracked in viewsChanged, right now we compute its root in batch while we should not

Description

  • commit all validators first
  • filter out those have roots already
  • update benchmark to test it

Benchmark
with half of validators.get() called without modifying anything

  • current
BeaconState ViewDU partially modified tree vc=200000 numModified=100000
    ✓ BeaconState ViewDU batchHashTreeRoot vc=200000                      3.311916 ops/s    301.9400 ms/op        -         40 runs   20.7 s
    ✓ BeaconState ViewDU batchHashTreeRoot - commit step vc=200000        3.735825 ops/s    267.6785 ms/op        -         50 runs   20.5 s
    ✓ BeaconState ViewDU batchHashTreeRoot - hash step vc=200000          21.26964 ops/s    47.01538 ms/op        -         44 runs   25.0 s
    ✓ BeaconState ViewDU hashTreeRoot() vc=200000                         2.024038 ops/s    494.0618 ms/op        -         34 runs   22.1 s
    ✓ BeaconState ViewDU hashTreeRoot - commit step vc=200000             15.08328 ops/s    66.29857 ms/op        -        101 runs   21.8 s
    ✓ BeaconState ViewDU hashTreeRoot - validator tree creation vc=100    6.294561 ops/s    158.8673 ms/op        -         57 runs   20.4 s
  • this PR
 BeaconState ViewDU partially modified tree vc=200000 numModified=100000
    ✓ BeaconState ViewDU batchHashTreeRoot vc=200000                      5.816562 ops/s    171.9229 ms/op        -         57 runs   20.5 s
    ✓ BeaconState ViewDU batchHashTreeRoot - commit step vc=200000        6.362287 ops/s    157.1762 ms/op        -         67 runs   20.3 s
    ✓ BeaconState ViewDU batchHashTreeRoot - hash step vc=200000          36.34095 ops/s    27.51717 ms/op        -         52 runs   20.7 s
    ✓ BeaconState ViewDU hashTreeRoot() vc=200000                         2.066677 ops/s    483.8685 ms/op        -         33 runs   20.7 s
    ✓ BeaconState ViewDU hashTreeRoot - commit step vc=200000             16.28455 ops/s    61.40789 ms/op        -        100 runs   20.2 s
    ✓ BeaconState ViewDU hashTreeRoot - validator tree creation vc=100    6.153062 ops/s    162.5207 ms/op        -         57 runs   20.3 s


@twoeths twoeths requested a review from a team as a code owner August 22, 2024 09:00
@github-actions github-actions bot added the ssz label Aug 22, 2024
@twoeths twoeths merged commit ad686e6 into te/batch_hash_tree_root Aug 22, 2024
7 checks passed
@twoeths twoeths deleted the te/handle_unmodified_validators branch August 22, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant