Skip to content

Conversation

nazarhussain
Copy link
Contributor

@nazarhussain nazarhussain commented Sep 25, 2025

Motivation

Make sure all specs passes.

Description

  • Fix the broken spec tests
  • Add condition to fix the types used for deserialization.

Closes #7839

Steps to test or reproduce

Run all tests

@nazarhussain nazarhussain requested a review from a team as a code owner September 25, 2025 14:04
Copy link
Contributor

Summary of Changes

Hello @nazarhussain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the reliability and correctness of Merkle proof spec tests. It addresses issues related to integer precision during deserialization by introducing BigInt handling for large values and refines the test assertions for more thorough verification. Additionally, it improves documentation around UintNum64 to guide developers on proper type usage, ultimately making the testing framework more robust.

Highlights

  • Test Fixes: Resolved previously broken spec tests for Merkle proofs, ensuring all related tests now pass correctly.
  • Deserialization Logic: Implemented conditional deserialization logic to handle large unsigned integer (Uint) values that exceed JavaScript's safe integer limit by replacing them with BigInt types for specific test cases, preventing precision loss.
  • Enhanced Test Assertions: Improved the Merkle proof test assertions to perform more granular comparisons, verifying the leaf, branch, and leaf index components individually.
  • Documentation Update: Added a detailed JSDoc comment to UintNum64 to clarify the precision limitations of JavaScript numbers for 64-bit integers and provided guidance on when to use UintBn64 (BigInt) to avoid precision issues.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes broken Merkle proof spec tests by addressing issues with large integer deserialization. The approach involves conditionally replacing uint types with bigint for specific test cases that are known to exceed JavaScript's safe integer limit. The test logic is also updated to correctly calculate and verify Merkle proofs for different fork versions. My main feedback is to make the condition for using bigints more robust to improve test maintainability.

Comment on lines 20 to 22
testCaseName.includes("random") || testCaseName.includes("max_blobs") || testCaseName.includes("multiple_blobs")
? replaceUintTypeWithUintBigintType(sszTypesFor(fork).BeaconBlockBody)
: sszTypesFor(fork).BeaconBlockBody;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The condition for switching to bigint types relies on testCaseName.includes(...). This approach is a bit brittle and might lead to issues in the future:

  • It could lead to false positives. For example, a test case named not_random would match includes("random").
  • If new test cases requiring bigint are added with names that don't match these substrings, the tests will fail unexpectedly.

Consider making this check more robust. For example, you could use a Set of exact test suite names or more specific regular expressions to avoid ambiguity and make the test suite easier to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we have some future cases we will be aware of their failure can add those exact tests.

Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.25%. Comparing base (83de5b8) to head (20f2548).
⚠️ Report is 13 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8469      +/-   ##
============================================
+ Coverage     52.22%   52.25%   +0.03%     
============================================
  Files           853      852       -1     
  Lines         64898    64977      +79     
  Branches       4768     4771       +3     
============================================
+ Hits          33893    33956      +63     
- Misses        30935    30952      +17     
+ Partials         70       69       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

github-actions bot commented Sep 25, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 1b77c0c Previous: 248b252 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 957.02 us/op 2.1921 ms/op 0.44
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 36.000 us/op 46.937 us/op 0.77
BLS verify - blst 1.5518 ms/op 1.1051 ms/op 1.40
BLS verifyMultipleSignatures 3 - blst 2.2737 ms/op 1.8027 ms/op 1.26
BLS verifyMultipleSignatures 8 - blst 2.2106 ms/op 2.3595 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst 6.7994 ms/op 8.3660 ms/op 0.81
BLS verifyMultipleSignatures 64 - blst 10.746 ms/op 15.761 ms/op 0.68
BLS verifyMultipleSignatures 128 - blst 17.484 ms/op 24.223 ms/op 0.72
BLS deserializing 10000 signatures 685.32 ms/op 893.32 ms/op 0.77
BLS deserializing 100000 signatures 6.8840 s/op 10.410 s/op 0.66
BLS verifyMultipleSignatures - same message - 3 - blst 914.57 us/op 1.3966 ms/op 0.65
BLS verifyMultipleSignatures - same message - 8 - blst 1.1676 ms/op 1.4337 ms/op 0.81
BLS verifyMultipleSignatures - same message - 32 - blst 1.7656 ms/op 2.1946 ms/op 0.80
BLS verifyMultipleSignatures - same message - 64 - blst 2.6551 ms/op 3.3958 ms/op 0.78
BLS verifyMultipleSignatures - same message - 128 - blst 4.4866 ms/op 7.0619 ms/op 0.64
BLS aggregatePubkeys 32 - blst 19.609 us/op 28.366 us/op 0.69
BLS aggregatePubkeys 128 - blst 76.722 us/op 96.911 us/op 0.79
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 60.502 ms/op 79.248 ms/op 0.76
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 52.488 ms/op 71.891 ms/op 0.73
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 39.517 ms/op 67.921 ms/op 0.58
getSlashingsAndExits - default max 74.605 us/op 146.85 us/op 0.51
getSlashingsAndExits - 2k 314.78 us/op 706.71 us/op 0.45
isKnown best case - 1 super set check 210.00 ns/op 257.00 ns/op 0.82
isKnown normal case - 2 super set checks 202.00 ns/op 270.00 ns/op 0.75
isKnown worse case - 16 super set checks 208.00 ns/op 257.00 ns/op 0.81
InMemoryCheckpointStateCache - add get delete 2.3920 us/op 3.4140 us/op 0.70
validate api signedAggregateAndProof - struct 2.5905 ms/op 2.2979 ms/op 1.13
validate gossip signedAggregateAndProof - struct 2.5940 ms/op 2.4571 ms/op 1.06
batch validate gossip attestation - vc 640000 - chunk 32 120.12 us/op 151.64 us/op 0.79
batch validate gossip attestation - vc 640000 - chunk 64 104.76 us/op 150.34 us/op 0.70
batch validate gossip attestation - vc 640000 - chunk 128 97.728 us/op 176.78 us/op 0.55
batch validate gossip attestation - vc 640000 - chunk 256 101.18 us/op 157.17 us/op 0.64
pickEth1Vote - no votes 1.0041 ms/op 1.3228 ms/op 0.76
pickEth1Vote - max votes 5.4573 ms/op 11.044 ms/op 0.49
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.389 ms/op 20.321 ms/op 0.56
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 16.416 ms/op 26.941 ms/op 0.61
pickEth1Vote - Eth1Data fastSerialize value x2048 469.44 us/op 572.12 us/op 0.82
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.1573 ms/op 4.7223 ms/op 0.46
bytes32 toHexString 420.00 ns/op 465.00 ns/op 0.90
bytes32 Buffer.toString(hex) 260.00 ns/op 313.00 ns/op 0.83
bytes32 Buffer.toString(hex) from Uint8Array 418.00 ns/op 432.00 ns/op 0.97
bytes32 Buffer.toString(hex) + 0x 255.00 ns/op 390.00 ns/op 0.65
Object access 1 prop 0.12200 ns/op 0.15100 ns/op 0.81
Map access 1 prop 0.14200 ns/op 0.15500 ns/op 0.92
Object get x1000 6.5230 ns/op 7.3520 ns/op 0.89
Map get x1000 6.9500 ns/op 7.8980 ns/op 0.88
Object set x1000 31.326 ns/op 38.322 ns/op 0.82
Map set x1000 21.228 ns/op 25.412 ns/op 0.84
Return object 10000 times 0.30440 ns/op 0.34540 ns/op 0.88
Throw Error 10000 times 4.6155 us/op 5.7603 us/op 0.80
toHex 139.11 ns/op 186.66 ns/op 0.75
Buffer.from 132.86 ns/op 167.91 ns/op 0.79
shared Buffer 85.430 ns/op 96.920 ns/op 0.88
fastMsgIdFn sha256 / 200 bytes 2.2600 us/op 2.7590 us/op 0.82
fastMsgIdFn h32 xxhash / 200 bytes 210.00 ns/op 235.00 ns/op 0.89
fastMsgIdFn h64 xxhash / 200 bytes 281.00 ns/op 361.00 ns/op 0.78
fastMsgIdFn sha256 / 1000 bytes 7.5810 us/op 9.1220 us/op 0.83
fastMsgIdFn h32 xxhash / 1000 bytes 352.00 ns/op 434.00 ns/op 0.81
fastMsgIdFn h64 xxhash / 1000 bytes 356.00 ns/op 412.00 ns/op 0.86
fastMsgIdFn sha256 / 10000 bytes 69.980 us/op 82.404 us/op 0.85
fastMsgIdFn h32 xxhash / 10000 bytes 1.9870 us/op 4.6310 us/op 0.43
fastMsgIdFn h64 xxhash / 10000 bytes 1.4050 us/op 4.1150 us/op 0.34
send data - 1000 256B messages 20.467 ms/op 24.592 ms/op 0.83
send data - 1000 512B messages 20.383 ms/op 29.732 ms/op 0.69
send data - 1000 1024B messages 28.041 ms/op 37.838 ms/op 0.74
send data - 1000 1200B messages 37.078 ms/op 42.887 ms/op 0.86
send data - 1000 2048B messages 32.454 ms/op 35.944 ms/op 0.90
send data - 1000 4096B messages 37.790 ms/op 48.549 ms/op 0.78
send data - 1000 16384B messages 62.880 ms/op 70.116 ms/op 0.90
send data - 1000 65536B messages 147.00 ms/op 164.92 ms/op 0.89
enrSubnets - fastDeserialize 64 bits 1.0260 us/op 1.1020 us/op 0.93
enrSubnets - ssz BitVector 64 bits 402.00 ns/op 405.00 ns/op 0.99
enrSubnets - fastDeserialize 4 bits 154.00 ns/op 155.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 386.00 ns/op 416.00 ns/op 0.93
prioritizePeers score -10:0 att 32-0.1 sync 2-0 288.51 us/op 273.53 us/op 1.05
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 307.92 us/op 352.50 us/op 0.87
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 436.88 us/op 529.97 us/op 0.82
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 833.20 us/op 883.19 us/op 0.94
prioritizePeers score 0:0 att 64-1 sync 4-1 963.47 us/op 1.0525 ms/op 0.92
array of 16000 items push then shift 1.7231 us/op 1.9412 us/op 0.89
LinkedList of 16000 items push then shift 11.568 ns/op 8.9180 ns/op 1.30
array of 16000 items push then pop 92.685 ns/op 96.347 ns/op 0.96
LinkedList of 16000 items push then pop 8.5750 ns/op 8.7100 ns/op 0.98
array of 24000 items push then shift 2.7750 us/op 2.8912 us/op 0.96
LinkedList of 24000 items push then shift 8.9280 ns/op 8.9540 ns/op 1.00
array of 24000 items push then pop 134.63 ns/op 124.72 ns/op 1.08
LinkedList of 24000 items push then pop 9.4470 ns/op 8.7170 ns/op 1.08
intersect bitArray bitLen 8 7.0570 ns/op 7.6230 ns/op 0.93
intersect array and set length 8 43.849 ns/op 45.776 ns/op 0.96
intersect bitArray bitLen 128 33.012 ns/op 35.359 ns/op 0.93
intersect array and set length 128 724.10 ns/op 750.21 ns/op 0.97
bitArray.getTrueBitIndexes() bitLen 128 1.2860 us/op 1.2420 us/op 1.04
bitArray.getTrueBitIndexes() bitLen 248 2.1880 us/op 2.2550 us/op 0.97
bitArray.getTrueBitIndexes() bitLen 512 4.8830 us/op 4.5000 us/op 1.09
Buffer.concat 32 items 809.00 ns/op 959.00 ns/op 0.84
Uint8Array.set 32 items 2.1840 us/op 1.8680 us/op 1.17
Buffer.copy 3.2600 us/op 2.6590 us/op 1.23
Uint8Array.set - with subarray 3.7340 us/op 2.6510 us/op 1.41
Uint8Array.set - without subarray 2.1130 us/op 1.8040 us/op 1.17
getUint32 - dataview 231.00 ns/op 253.00 ns/op 0.91
getUint32 - manual 135.00 ns/op 157.00 ns/op 0.86
Set add up to 64 items then delete first 3.2256 us/op 3.6534 us/op 0.88
OrderedSet add up to 64 items then delete first 5.5275 us/op 5.2408 us/op 1.05
Set add up to 64 items then delete last 2.6005 us/op 2.8834 us/op 0.90
OrderedSet add up to 64 items then delete last 5.4804 us/op 5.3854 us/op 1.02
Set add up to 64 items then delete middle 3.9280 us/op 3.5839 us/op 1.10
OrderedSet add up to 64 items then delete middle 7.5842 us/op 6.7128 us/op 1.13
Set add up to 128 items then delete first 7.1912 us/op 7.1300 us/op 1.01
OrderedSet add up to 128 items then delete first 11.764 us/op 12.409 us/op 0.95
Set add up to 128 items then delete last 7.6036 us/op 7.3526 us/op 1.03
OrderedSet add up to 128 items then delete last 11.839 us/op 11.655 us/op 1.02
Set add up to 128 items then delete middle 7.5262 us/op 7.5337 us/op 1.00
OrderedSet add up to 128 items then delete middle 19.273 us/op 18.626 us/op 1.03
Set add up to 256 items then delete first 15.854 us/op 14.766 us/op 1.07
OrderedSet add up to 256 items then delete first 26.034 us/op 24.182 us/op 1.08
Set add up to 256 items then delete last 14.902 us/op 14.218 us/op 1.05
OrderedSet add up to 256 items then delete last 23.949 us/op 20.088 us/op 1.19
Set add up to 256 items then delete middle 15.524 us/op 15.044 us/op 1.03
OrderedSet add up to 256 items then delete middle 53.573 us/op 60.316 us/op 0.89
transfer serialized Status (84 B) 3.6440 us/op 3.2350 us/op 1.13
copy serialized Status (84 B) 2.0440 us/op 1.6720 us/op 1.22
transfer serialized SignedVoluntaryExit (112 B) 2.9730 us/op 3.2120 us/op 0.93
copy serialized SignedVoluntaryExit (112 B) 1.8960 us/op 2.1220 us/op 0.89
transfer serialized ProposerSlashing (416 B) 4.2630 us/op 3.2060 us/op 1.33
copy serialized ProposerSlashing (416 B) 3.1530 us/op 2.5050 us/op 1.26
transfer serialized Attestation (485 B) 4.7870 us/op 3.1480 us/op 1.52
copy serialized Attestation (485 B) 2.9600 us/op 1.9930 us/op 1.49
transfer serialized AttesterSlashing (33232 B) 5.2730 us/op 3.6330 us/op 1.45
copy serialized AttesterSlashing (33232 B) 7.5510 us/op 5.6760 us/op 1.33
transfer serialized Small SignedBeaconBlock (128000 B) 4.7280 us/op 4.2860 us/op 1.10
copy serialized Small SignedBeaconBlock (128000 B) 19.352 us/op 17.993 us/op 1.08
transfer serialized Avg SignedBeaconBlock (200000 B) 4.9500 us/op 5.6660 us/op 0.87
copy serialized Avg SignedBeaconBlock (200000 B) 26.090 us/op 26.416 us/op 0.99
transfer serialized BlobsSidecar (524380 B) 5.6150 us/op 5.5770 us/op 1.01
copy serialized BlobsSidecar (524380 B) 88.916 us/op 82.220 us/op 1.08
transfer serialized Big SignedBeaconBlock (1000000 B) 5.6290 us/op 6.1000 us/op 0.92
copy serialized Big SignedBeaconBlock (1000000 B) 125.06 us/op 146.56 us/op 0.85
pass gossip attestations to forkchoice per slot 3.5495 ms/op 3.7173 ms/op 0.95
forkChoice updateHead vc 100000 bc 64 eq 0 503.19 us/op 589.61 us/op 0.85
forkChoice updateHead vc 600000 bc 64 eq 0 4.3387 ms/op 4.0718 ms/op 1.07
forkChoice updateHead vc 1000000 bc 64 eq 0 8.1520 ms/op 6.9400 ms/op 1.17
forkChoice updateHead vc 600000 bc 320 eq 0 4.4318 ms/op 3.7255 ms/op 1.19
forkChoice updateHead vc 600000 bc 1200 eq 0 4.5421 ms/op 4.5717 ms/op 0.99
forkChoice updateHead vc 600000 bc 7200 eq 0 4.7045 ms/op 5.0290 ms/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 1000 11.449 ms/op 13.252 ms/op 0.86
forkChoice updateHead vc 600000 bc 64 eq 10000 11.694 ms/op 13.731 ms/op 0.85
forkChoice updateHead vc 600000 bc 64 eq 300000 26.182 ms/op 26.869 ms/op 0.97
computeDeltas 500000 validators 300 proto nodes 5.2119 ms/op 5.1622 ms/op 1.01
computeDeltas 500000 validators 1200 proto nodes 4.8788 ms/op 5.1764 ms/op 0.94
computeDeltas 500000 validators 7200 proto nodes 4.8147 ms/op 5.1269 ms/op 0.94
computeDeltas 750000 validators 300 proto nodes 6.2830 ms/op 6.7449 ms/op 0.93
computeDeltas 750000 validators 1200 proto nodes 6.2180 ms/op 6.9850 ms/op 0.89
computeDeltas 750000 validators 7200 proto nodes 6.1713 ms/op 7.1269 ms/op 0.87
computeDeltas 1400000 validators 300 proto nodes 12.789 ms/op 11.998 ms/op 1.07
computeDeltas 1400000 validators 1200 proto nodes 13.214 ms/op 11.900 ms/op 1.11
computeDeltas 1400000 validators 7200 proto nodes 15.958 ms/op 11.787 ms/op 1.35
computeDeltas 2100000 validators 300 proto nodes 22.640 ms/op 18.101 ms/op 1.25
computeDeltas 2100000 validators 1200 proto nodes 19.722 ms/op 18.321 ms/op 1.08
computeDeltas 2100000 validators 7200 proto nodes 21.050 ms/op 18.869 ms/op 1.12
altair processAttestation - 250000 vs - 7PWei normalcase 3.4755 ms/op 2.3884 ms/op 1.46
altair processAttestation - 250000 vs - 7PWei worstcase 4.6772 ms/op 3.3926 ms/op 1.38
altair processAttestation - setStatus - 1/6 committees join 173.20 us/op 144.62 us/op 1.20
altair processAttestation - setStatus - 1/3 committees join 322.33 us/op 261.54 us/op 1.23
altair processAttestation - setStatus - 1/2 committees join 395.07 us/op 369.78 us/op 1.07
altair processAttestation - setStatus - 2/3 committees join 565.36 us/op 474.08 us/op 1.19
altair processAttestation - setStatus - 4/5 committees join 801.49 us/op 646.46 us/op 1.24
altair processAttestation - setStatus - 100% committees join 913.56 us/op 764.95 us/op 1.19
altair processBlock - 250000 vs - 7PWei normalcase 5.9952 ms/op 4.8928 ms/op 1.23
altair processBlock - 250000 vs - 7PWei normalcase hashState 36.299 ms/op 31.985 ms/op 1.13
altair processBlock - 250000 vs - 7PWei worstcase 42.286 ms/op 38.651 ms/op 1.09
altair processBlock - 250000 vs - 7PWei worstcase hashState 105.53 ms/op 80.082 ms/op 1.32
phase0 processBlock - 250000 vs - 7PWei normalcase 2.8287 ms/op 1.7757 ms/op 1.59
phase0 processBlock - 250000 vs - 7PWei worstcase 26.537 ms/op 23.500 ms/op 1.13
altair processEth1Data - 250000 vs - 7PWei normalcase 377.53 us/op 365.26 us/op 1.03
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.9970 us/op 6.2730 us/op 1.43
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 63.470 us/op 39.555 us/op 1.60
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.742 us/op 11.303 us/op 1.75
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 13.622 us/op 6.9080 us/op 1.97
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 182.74 us/op 192.61 us/op 0.95
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.6552 ms/op 2.4397 ms/op 1.09
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.9383 ms/op 2.8921 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.9045 ms/op 2.6894 ms/op 1.08
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 8.6603 ms/op 4.9344 ms/op 1.76
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 4.2972 ms/op 2.6808 ms/op 1.60
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 8.6588 ms/op 5.3972 ms/op 1.60
Tree 40 250000 create 572.84 ms/op 648.83 ms/op 0.88
Tree 40 250000 get(125000) 170.69 ns/op 150.99 ns/op 1.13
Tree 40 250000 set(125000) 1.7278 us/op 1.9186 us/op 0.90
Tree 40 250000 toArray() 20.738 ms/op 20.587 ms/op 1.01
Tree 40 250000 iterate all - toArray() + loop 20.663 ms/op 16.944 ms/op 1.22
Tree 40 250000 iterate all - get(i) 62.807 ms/op 59.620 ms/op 1.05
Array 250000 create 3.7395 ms/op 3.0511 ms/op 1.23
Array 250000 clone - spread 1.6332 ms/op 1.6110 ms/op 1.01
Array 250000 get(125000) 0.49400 ns/op 0.42600 ns/op 1.16
Array 250000 set(125000) 0.53000 ns/op 0.44900 ns/op 1.18
Array 250000 iterate all - loop 114.86 us/op 86.422 us/op 1.33
phase0 afterProcessEpoch - 250000 vs - 7PWei 46.526 ms/op 44.143 ms/op 1.05
Array.fill - length 1000000 3.9558 ms/op 3.7798 ms/op 1.05
Array push - length 1000000 19.927 ms/op 15.600 ms/op 1.28
Array.get 0.33985 ns/op 0.29772 ns/op 1.14
Uint8Array.get 0.61474 ns/op 0.48352 ns/op 1.27
phase0 beforeProcessEpoch - 250000 vs - 7PWei 19.575 ms/op 18.745 ms/op 1.04
altair processEpoch - mainnet_e81889 370.95 ms/op 279.13 ms/op 1.33
mainnet_e81889 - altair beforeProcessEpoch 21.211 ms/op 19.657 ms/op 1.08
mainnet_e81889 - altair processJustificationAndFinalization 7.0910 us/op 7.0490 us/op 1.01
mainnet_e81889 - altair processInactivityUpdates 6.6871 ms/op 4.3119 ms/op 1.55
mainnet_e81889 - altair processRewardsAndPenalties 49.665 ms/op 37.631 ms/op 1.32
mainnet_e81889 - altair processRegistryUpdates 926.00 ns/op 703.00 ns/op 1.32
mainnet_e81889 - altair processSlashings 336.00 ns/op 227.00 ns/op 1.48
mainnet_e81889 - altair processEth1DataReset 208.00 ns/op 197.00 ns/op 1.06
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4267 ms/op 1.2792 ms/op 1.12
mainnet_e81889 - altair processSlashingsReset 1.5980 us/op 949.00 ns/op 1.68
mainnet_e81889 - altair processRandaoMixesReset 2.0840 us/op 1.4420 us/op 1.45
mainnet_e81889 - altair processHistoricalRootsUpdate 216.00 ns/op 219.00 ns/op 0.99
mainnet_e81889 - altair processParticipationFlagUpdates 751.00 ns/op 618.00 ns/op 1.22
mainnet_e81889 - altair processSyncCommitteeUpdates 212.00 ns/op 159.00 ns/op 1.33
mainnet_e81889 - altair afterProcessEpoch 57.022 ms/op 47.513 ms/op 1.20
capella processEpoch - mainnet_e217614 1.2480 s/op 1.0772 s/op 1.16
mainnet_e217614 - capella beforeProcessEpoch 79.018 ms/op 72.373 ms/op 1.09
mainnet_e217614 - capella processJustificationAndFinalization 6.5540 us/op 6.7080 us/op 0.98
mainnet_e217614 - capella processInactivityUpdates 16.952 ms/op 17.556 ms/op 0.97
mainnet_e217614 - capella processRewardsAndPenalties 229.47 ms/op 215.46 ms/op 1.07
mainnet_e217614 - capella processRegistryUpdates 8.0510 us/op 8.0840 us/op 1.00
mainnet_e217614 - capella processSlashings 258.00 ns/op 228.00 ns/op 1.13
mainnet_e217614 - capella processEth1DataReset 287.00 ns/op 210.00 ns/op 1.37
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.9419 ms/op 4.8361 ms/op 1.02
mainnet_e217614 - capella processSlashingsReset 1.1570 us/op 1.1480 us/op 1.01
mainnet_e217614 - capella processRandaoMixesReset 1.5240 us/op 1.4670 us/op 1.04
mainnet_e217614 - capella processHistoricalRootsUpdate 218.00 ns/op 244.00 ns/op 0.89
mainnet_e217614 - capella processParticipationFlagUpdates 614.00 ns/op 631.00 ns/op 0.97
mainnet_e217614 - capella afterProcessEpoch 163.19 ms/op 133.91 ms/op 1.22
phase0 processEpoch - mainnet_e58758 411.25 ms/op 398.75 ms/op 1.03
mainnet_e58758 - phase0 beforeProcessEpoch 109.94 ms/op 120.21 ms/op 0.91
mainnet_e58758 - phase0 processJustificationAndFinalization 7.5260 us/op 8.0310 us/op 0.94
mainnet_e58758 - phase0 processRewardsAndPenalties 46.648 ms/op 54.136 ms/op 0.86
mainnet_e58758 - phase0 processRegistryUpdates 3.9810 us/op 4.1230 us/op 0.97
mainnet_e58758 - phase0 processSlashings 242.00 ns/op 210.00 ns/op 1.15
mainnet_e58758 - phase0 processEth1DataReset 211.00 ns/op 201.00 ns/op 1.05
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4382 ms/op 4.0032 ms/op 0.36
mainnet_e58758 - phase0 processSlashingsReset 1.0670 us/op 1.2530 us/op 0.85
mainnet_e58758 - phase0 processRandaoMixesReset 1.6100 us/op 1.6080 us/op 1.00
mainnet_e58758 - phase0 processHistoricalRootsUpdate 200.00 ns/op 231.00 ns/op 0.87
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.0250 us/op 1.0980 us/op 0.93
mainnet_e58758 - phase0 afterProcessEpoch 42.690 ms/op 42.968 ms/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.6080 ms/op 1.6759 ms/op 0.96
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 6.1248 ms/op 6.8413 ms/op 0.90
altair processInactivityUpdates - 250000 normalcase 24.899 ms/op 24.038 ms/op 1.04
altair processInactivityUpdates - 250000 worstcase 21.534 ms/op 21.946 ms/op 0.98
phase0 processRegistryUpdates - 250000 normalcase 12.157 us/op 12.059 us/op 1.01
phase0 processRegistryUpdates - 250000 badcase_full_deposits 478.30 us/op 486.50 us/op 0.98
phase0 processRegistryUpdates - 250000 worstcase 0.5 144.18 ms/op 134.29 ms/op 1.07
altair processRewardsAndPenalties - 250000 normalcase 36.182 ms/op 34.533 ms/op 1.05
altair processRewardsAndPenalties - 250000 worstcase 38.118 ms/op 35.227 ms/op 1.08
phase0 getAttestationDeltas - 250000 normalcase 9.5994 ms/op 7.9581 ms/op 1.21
phase0 getAttestationDeltas - 250000 worstcase 7.1567 ms/op 9.6188 ms/op 0.74
phase0 processSlashings - 250000 worstcase 128.63 us/op 134.59 us/op 0.96
altair processSyncCommitteeUpdates - 250000 11.737 ms/op 16.449 ms/op 0.71
BeaconState.hashTreeRoot - No change 222.00 ns/op 326.00 ns/op 0.68
BeaconState.hashTreeRoot - 1 full validator 89.293 us/op 128.22 us/op 0.70
BeaconState.hashTreeRoot - 32 full validator 1.3870 ms/op 1.2019 ms/op 1.15
BeaconState.hashTreeRoot - 512 full validator 11.963 ms/op 18.729 ms/op 0.64
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 168.91 us/op 150.27 us/op 1.12
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.3270 ms/op 2.3475 ms/op 0.99
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 30.673 ms/op 40.484 ms/op 0.76
BeaconState.hashTreeRoot - 1 balances 85.893 us/op 102.98 us/op 0.83
BeaconState.hashTreeRoot - 32 balances 784.16 us/op 1.2069 ms/op 0.65
BeaconState.hashTreeRoot - 512 balances 9.2103 ms/op 11.685 ms/op 0.79
BeaconState.hashTreeRoot - 250000 balances 257.92 ms/op 254.26 ms/op 1.01
aggregationBits - 2048 els - zipIndexesInBitList 25.693 us/op 25.635 us/op 1.00
byteArrayEquals 32 64.235 ns/op 62.225 ns/op 1.03
Buffer.compare 32 20.547 ns/op 22.143 ns/op 0.93
byteArrayEquals 1024 1.8438 us/op 1.8455 us/op 1.00
Buffer.compare 1024 30.473 ns/op 28.486 ns/op 1.07
byteArrayEquals 16384 29.305 us/op 33.267 us/op 0.88
Buffer.compare 16384 219.84 ns/op 250.37 ns/op 0.88
byteArrayEquals 123687377 237.18 ms/op 244.82 ms/op 0.97
Buffer.compare 123687377 9.8674 ms/op 11.694 ms/op 0.84
byteArrayEquals 32 - diff last byte 59.055 ns/op 65.527 ns/op 0.90
Buffer.compare 32 - diff last byte 19.737 ns/op 21.176 ns/op 0.93
byteArrayEquals 1024 - diff last byte 1.7880 us/op 1.9770 us/op 0.90
Buffer.compare 1024 - diff last byte 30.221 ns/op 31.704 ns/op 0.95
byteArrayEquals 16384 - diff last byte 30.078 us/op 36.274 us/op 0.83
Buffer.compare 16384 - diff last byte 236.35 ns/op 231.14 ns/op 1.02
byteArrayEquals 123687377 - diff last byte 224.99 ms/op 265.79 ms/op 0.85
Buffer.compare 123687377 - diff last byte 8.4284 ms/op 15.657 ms/op 0.54
byteArrayEquals 32 - random bytes 5.4930 ns/op 7.4790 ns/op 0.73
Buffer.compare 32 - random bytes 19.311 ns/op 20.985 ns/op 0.92
byteArrayEquals 1024 - random bytes 5.8160 ns/op 8.3640 ns/op 0.70
Buffer.compare 1024 - random bytes 19.697 ns/op 21.366 ns/op 0.92
byteArrayEquals 16384 - random bytes 5.6250 ns/op 8.2350 ns/op 0.68
Buffer.compare 16384 - random bytes 19.609 ns/op 40.835 ns/op 0.48
byteArrayEquals 123687377 - random bytes 7.5900 ns/op 12.590 ns/op 0.60
Buffer.compare 123687377 - random bytes 29.740 ns/op 37.940 ns/op 0.78
regular array get 100000 times 43.151 us/op 61.138 us/op 0.71
wrappedArray get 100000 times 35.306 us/op 60.121 us/op 0.59
arrayWithProxy get 100000 times 14.635 ms/op 22.293 ms/op 0.66
ssz.Root.equals 50.099 ns/op 79.256 ns/op 0.63
byteArrayEquals 62.112 ns/op 105.47 ns/op 0.59
Buffer.compare 12.463 ns/op 19.457 ns/op 0.64
processSlot - 1 slots 15.473 us/op 20.718 us/op 0.75
processSlot - 32 slots 4.5708 ms/op 7.3950 ms/op 0.62
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 4.4254 ms/op 7.4737 ms/op 0.59
getCommitteeAssignments - req 1 vs - 250000 vc 2.4027 ms/op 2.6435 ms/op 0.91
getCommitteeAssignments - req 100 vs - 250000 vc 4.2472 ms/op 5.4465 ms/op 0.78
getCommitteeAssignments - req 1000 vs - 250000 vc 4.4937 ms/op 5.7593 ms/op 0.78
findModifiedValidators - 10000 modified validators 914.95 ms/op 1.2972 s/op 0.71
findModifiedValidators - 1000 modified validators 784.34 ms/op 739.81 ms/op 1.06
findModifiedValidators - 100 modified validators 287.97 ms/op 426.23 ms/op 0.68
findModifiedValidators - 10 modified validators 278.91 ms/op 377.63 ms/op 0.74
findModifiedValidators - 1 modified validators 291.14 ms/op 534.05 ms/op 0.55
findModifiedValidators - no difference 215.43 ms/op 489.43 ms/op 0.44
compare ViewDUs 7.4989 s/op 12.013 s/op 0.62
compare each validator Uint8Array 2.5292 s/op 3.2224 s/op 0.78
compare ViewDU to Uint8Array 1.7085 s/op 2.7260 s/op 0.63
migrate state 1000000 validators, 24 modified, 0 new 896.46 ms/op 1.0340 s/op 0.87
migrate state 1000000 validators, 1700 modified, 1000 new 1.1685 s/op 1.3637 s/op 0.86
migrate state 1000000 validators, 3400 modified, 2000 new 1.3292 s/op 1.4441 s/op 0.92
migrate state 1500000 validators, 24 modified, 0 new 977.36 ms/op 1.0371 s/op 0.94
migrate state 1500000 validators, 1700 modified, 1000 new 1.2140 s/op 1.3119 s/op 0.93
migrate state 1500000 validators, 3400 modified, 2000 new 1.4001 s/op 1.5001 s/op 0.93
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.2000 ns/op 5.0300 ns/op 0.83
state getBlockRootAtSlot - 250000 vs - 7PWei 505.40 ns/op 1.2534 us/op 0.40
naive computeProposerIndex 100000 validators 49.298 ms/op 64.436 ms/op 0.77
computeProposerIndex 100000 validators 1.4969 ms/op 1.6984 ms/op 0.88
naiveGetNextSyncCommitteeIndices 1000 validators 7.6881 s/op 9.2349 s/op 0.83
getNextSyncCommitteeIndices 1000 validators 108.05 ms/op 141.02 ms/op 0.77
naiveGetNextSyncCommitteeIndices 10000 validators 7.4717 s/op 7.9642 s/op 0.94
getNextSyncCommitteeIndices 10000 validators 111.68 ms/op 119.32 ms/op 0.94
naiveGetNextSyncCommitteeIndices 100000 validators 7.8987 s/op 8.7902 s/op 0.90
getNextSyncCommitteeIndices 100000 validators 113.39 ms/op 138.86 ms/op 0.82
naive computeShuffledIndex 100000 validators 25.496 s/op 32.166 s/op 0.79
cached computeShuffledIndex 100000 validators 573.56 ms/op 611.21 ms/op 0.94
naive computeShuffledIndex 2000000 validators 532.28 s/op 568.50 s/op 0.94
cached computeShuffledIndex 2000000 validators 33.585 s/op 62.359 s/op 0.54
computeProposers - vc 250000 637.55 us/op 786.44 us/op 0.81
computeEpochShuffling - vc 250000 43.021 ms/op 51.939 ms/op 0.83
getNextSyncCommittee - vc 250000 10.837 ms/op 12.940 ms/op 0.84
computeSigningRoot for AttestationData 19.338 us/op 36.028 us/op 0.54
hash AttestationData serialized data then Buffer.toString(base64) 1.6597 us/op 1.9510 us/op 0.85
toHexString serialized data 1.3194 us/op 2.0677 us/op 0.64
Buffer.toString(base64) 166.87 ns/op 179.02 ns/op 0.93
nodejs block root to RootHex using toHex 160.87 ns/op 186.41 ns/op 0.86
nodejs block root to RootHex using toRootHex 91.815 ns/op 121.85 ns/op 0.75
nodejs fromhex(blob) 131.62 ms/op 135.59 ms/op 0.97
nodejs fromHexInto(blob) 100.93 ms/op 110.35 ms/op 0.91
browser block root to RootHex using the deprecated toHexString 222.43 ns/op 273.37 ns/op 0.81
browser block root to RootHex using toHex 186.26 ns/op 209.89 ns/op 0.89
browser block root to RootHex using toRootHex 171.77 ns/op 189.96 ns/op 0.90
browser fromHexInto(blob) 942.88 us/op 939.21 us/op 1.00
browser fromHex(blob) 822.48 ms/op 916.31 ms/op 0.90

by benchmarkbot/action

Comment on lines +23 to +24
? replaceUintTypeWithUintBigintType(sszTypesFor(fork).BeaconBlockBody)
: sszTypesFor(fork).BeaconBlockBody;
Copy link
Member

Choose a reason for hiding this comment

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

any reason why we can't always replace values?

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 would change our types only for the cases we explicitly been aware of have issues with the tests.

Copy link
Member

Choose a reason for hiding this comment

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

I tend to think we should always replace uint values here. Reason is less code and less brittle as tests update. The comment is helpful still.

Comment on lines 26 to 27
* If you are not fully sure about the limit of a certain value where you use this type, particularly
* types related to network interaction, then we would encourage to use `UintBn64` instead.
Copy link
Member

Choose a reason for hiding this comment

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

hmm, this doesnt read very convincing, using UintNum64 in the wrong place could lead to a consensus failure so we need to make sure ot not get this wrong

"you are not fully sure"

then research how the value is used and make sure to not get this wrong, I don't think encouraging use of UintBn64 is good (due to it's perf impact), we should only do it if it's necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what is been mentioned in here. That use UintBn64 when you are fully sure of the range of values. Having performance impact is not as crucial as consensus failure.

Feel free to suggest how you want to phrase it.

Copy link
Member

Choose a reason for hiding this comment

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

I would just remove the last paragraph

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's see what other feels about it.

@nazarhussain nazarhussain requested a review from nflaig September 29, 2025 07:45
Comment on lines +23 to +24
? replaceUintTypeWithUintBigintType(sszTypesFor(fork).BeaconBlockBody)
: sszTypesFor(fork).BeaconBlockBody;
Copy link
Member

Choose a reason for hiding this comment

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

I tend to think we should always replace uint values here. Reason is less code and less brittle as tests update. The comment is helpful still.

@nazarhussain
Copy link
Contributor Author

@wemeetagain

I tend to think we should always replace uint values here. Reason is less code and less brittle as tests update. The comment is helpful still.

The question will pop up should we do it for merkle-proof spec tests or all. If only for merkle-proof then what's the semantic difference for this spec and others.

So I think it's much easier to reason about and only do conditional replace for the individual test cases we found have such random data.

@wemeetagain
Copy link
Member

wemeetagain commented Oct 1, 2025

then what's the semantic difference for this spec and others.

This is what your added comment helps illuminate.

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.

fulu: missing new spec test runners

3 participants