Skip to content

feat: use zig backed lodestar-z shuffle - #9829

Open
nazarhussain wants to merge 2 commits into
unstablefrom
nh/zig-shuffle-integration
Open

feat: use zig backed lodestar-z shuffle#9829
nazarhussain wants to merge 2 commits into
unstablefrom
nh/zig-shuffle-integration

Conversation

@nazarhussain

Copy link
Copy Markdown
Contributor

Motivation

Migrate shuffling to the new zig-based implementation from ChainSafe/lodestar-z#559, removing the rust-based @chainsafe/swap-or-not-shuffle dependency.

Description

  • Add @chainsafe/lodestar-z (pinned via pnpm catalog) and remove @chainsafe/swap-or-not-shuffle from state-transition and beacon-node
  • Switch unshuffleList/asyncUnshuffleList/computeProposerIndex/computeSyncCommitteeIndices call sites to bindings.shuffle — API is identical, no logic changes

Verified with build, check-types, lint, state-transition unit tests, and a shuffle/unshuffle roundtrip smoke test.

🤖 AI-assisted (Claude Code)

@nazarhussain
nazarhussain requested a review from a team as a code owner August 15, 2026 06:33
@nazarhussain nazarhussain changed the title feat: replace @chainsafe/swap-or-not-shuffle with zig-based lodestar-z shuffle feat: use zig backedlodestar-z shuffle Aug 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c3cfb0d97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pnpm-workspace.yaml
nodeLinker: isolated

catalog:
"@chainsafe/lodestar-z": "github:ChainSafe/lodestar-z#nh/swap-or-not-shuffle-parity"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pin the published shuffle dependency to a commit

When @lodestar/state-transition is packed or published, pnpm replaces its catalog: dependency with this catalog value, so downstream users receive the mutable nh/swap-or-not-shuffle-parity branch rather than the commit recorded in this repository's lockfile. A later branch update could therefore change consensus-critical native shuffling code without a Lodestar change or lockfile review. Use the resolved commit hash or a released package version in the catalog.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

Performance Report

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 6db7945 Previous: ec59619 Ratio
send data - 1000 4096B messages 35.104 ms/op 113.88 ms/op 0.31
Full benchmark results
Benchmark suite Current: 6db7945 Previous: ec59619 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 892.06 us/op 895.72 us/op 1.00
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 37.773 us/op 38.969 us/op 0.97
BLS verify - blst 680.40 us/op 724.28 us/op 0.94
BLS verifyMultipleSignatures 3 - blst 1.3140 ms/op 1.3786 ms/op 0.95
BLS verifyMultipleSignatures 8 - blst 2.0640 ms/op 2.2009 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst 6.4620 ms/op 7.4072 ms/op 0.87
BLS verifyMultipleSignatures 64 - blst 12.495 ms/op 13.316 ms/op 0.94
BLS verifyMultipleSignatures 128 - blst 25.022 ms/op 26.894 ms/op 0.93
BLS deserializing 10000 signatures 626.85 ms/op 629.19 ms/op 1.00
BLS deserializing 100000 signatures 6.2791 s/op 6.4187 s/op 0.98
BLS verifyMultipleSignatures - same message - 3 - blst 777.27 us/op 812.41 us/op 0.96
BLS verifyMultipleSignatures - same message - 8 - blst 806.90 us/op 944.53 us/op 0.85
BLS verifyMultipleSignatures - same message - 32 - blst 1.4943 ms/op 1.5329 ms/op 0.97
BLS verifyMultipleSignatures - same message - 64 - blst 2.3042 ms/op 2.3307 ms/op 0.99
BLS verifyMultipleSignatures - same message - 128 - blst 3.9441 ms/op 4.0989 ms/op 0.96
BLS aggregatePubkeys 32 - blst 17.210 us/op 17.843 us/op 0.96
BLS aggregatePubkeys 128 - blst 61.659 us/op 62.929 us/op 0.98
getSlashingsAndExits - default max 45.290 us/op 67.746 us/op 0.67
getSlashingsAndExits - 2k 329.67 us/op 363.92 us/op 0.91
proposeBlockBody type=full, size=empty 791.03 us/op 631.47 us/op 1.25
isKnown best case - 1 super set check 161.00 ns/op 192.00 ns/op 0.84
isKnown normal case - 2 super set checks 160.00 ns/op 169.00 ns/op 0.95
isKnown worse case - 16 super set checks 158.00 ns/op 169.00 ns/op 0.93
validate api signedAggregateAndProof - struct 1.4532 ms/op 1.5783 ms/op 0.92
validate gossip signedAggregateAndProof - struct 1.4617 ms/op 1.5680 ms/op 0.93
batch validate gossip attestation - vc 640000 - chunk 32 106.22 us/op 116.84 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 64 94.620 us/op 103.06 us/op 0.92
batch validate gossip attestation - vc 640000 - chunk 128 87.930 us/op 88.817 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 256 84.134 us/op 85.326 us/op 0.99
bytes32 toHexString 285.00 ns/op 303.00 ns/op 0.94
bytes32 Buffer.toString(hex) 168.00 ns/op 184.00 ns/op 0.91
bytes32 Buffer.toString(hex) from Uint8Array 237.00 ns/op 246.00 ns/op 0.96
bytes32 Buffer.toString(hex) + 0x 171.00 ns/op 185.00 ns/op 0.92
Return object 10000 times 0.21040 ns/op 0.21770 ns/op 0.97
Throw Error 10000 times 3.4413 us/op 3.3851 us/op 1.02
toHex 93.693 ns/op 99.182 ns/op 0.94
Buffer.from 84.650 ns/op 92.277 ns/op 0.92
shared Buffer 56.454 ns/op 60.131 ns/op 0.94
fastMsgIdFn sha256 / 200 bytes 1.4610 us/op 1.5150 us/op 0.96
fastMsgIdFn h32 xxhash / 200 bytes 152.00 ns/op 163.00 ns/op 0.93
fastMsgIdFn h64 xxhash / 200 bytes 197.00 ns/op 215.00 ns/op 0.92
fastMsgIdFn sha256 / 1000 bytes 4.6890 us/op 4.8600 us/op 0.96
fastMsgIdFn h32 xxhash / 1000 bytes 243.00 ns/op 262.00 ns/op 0.93
fastMsgIdFn h64 xxhash / 1000 bytes 247.00 ns/op 266.00 ns/op 0.93
fastMsgIdFn sha256 / 10000 bytes 41.222 us/op 42.994 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 1.2440 us/op 1.3210 us/op 0.94
fastMsgIdFn h64 xxhash / 10000 bytes 805.00 ns/op 868.00 ns/op 0.93
send data - 1000 256B messages 4.1214 ms/op 4.8647 ms/op 0.85
send data - 1000 512B messages 5.4396 ms/op 6.1331 ms/op 0.89
send data - 1000 1024B messages 5.8200 ms/op 6.7877 ms/op 0.86
send data - 1000 1200B messages 6.1682 ms/op 7.9028 ms/op 0.78
send data - 1000 2048B messages 15.572 ms/op 13.266 ms/op 1.17
send data - 1000 4096B messages 35.104 ms/op 113.88 ms/op 0.31
send data - 1000 16384B messages 252.30 ms/op 476.46 ms/op 0.53
send data - 1000 65536B messages 866.48 ms/op 1.9168 s/op 0.45
enrSubnets - fastDeserialize 64 bits 740.00 ns/op 765.00 ns/op 0.97
enrSubnets - ssz BitVector 64 bits 255.00 ns/op 282.00 ns/op 0.90
enrSubnets - fastDeserialize 4 bits 104.00 ns/op 105.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 250.00 ns/op 280.00 ns/op 0.89
prioritizePeers score -10:0 att 32-0.1 sync 2-0 198.60 us/op 206.81 us/op 0.96
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 224.00 us/op 238.04 us/op 0.94
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 326.37 us/op 341.25 us/op 0.96
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 589.28 us/op 608.95 us/op 0.97
prioritizePeers score 0:0 att 64-1 sync 4-1 677.10 us/op 711.65 us/op 0.95
array of 16000 items push then shift 1.2367 us/op 1.2816 us/op 0.97
LinkedList of 16000 items push then shift 7.2260 ns/op 8.8310 ns/op 0.82
array of 16000 items push then pop 78.907 ns/op 77.269 ns/op 1.02
LinkedList of 16000 items push then pop 5.8770 ns/op 6.5320 ns/op 0.90
array of 24000 items push then shift 1.8278 us/op 1.8605 us/op 0.98
LinkedList of 24000 items push then shift 6.8500 ns/op 8.0730 ns/op 0.85
array of 24000 items push then pop 112.64 ns/op 106.59 ns/op 1.06
LinkedList of 24000 items push then pop 5.9450 ns/op 6.5850 ns/op 0.90
intersect bitArray bitLen 8 3.8040 ns/op 4.0750 ns/op 0.93
intersect array and set length 8 28.779 ns/op 30.885 ns/op 0.93
intersect bitArray bitLen 128 22.857 ns/op 23.339 ns/op 0.98
intersect array and set length 128 493.00 ns/op 500.90 ns/op 0.98
bitArray.getTrueBitIndexes() bitLen 128 929.00 ns/op 944.00 ns/op 0.98
bitArray.getTrueBitIndexes() bitLen 248 1.6710 us/op 1.7160 us/op 0.97
bitArray.getTrueBitIndexes() bitLen 512 3.4540 us/op 3.6530 us/op 0.95
Full columns - reconstruct all 6 blobs 219.55 us/op 127.88 us/op 1.72
Full columns - reconstruct half of the blobs out of 6 139.38 us/op 71.856 us/op 1.94
Full columns - reconstruct single blob out of 6 42.796 us/op 34.637 us/op 1.24
Half columns - reconstruct all 6 blobs 378.55 ms/op 399.29 ms/op 0.95
Half columns - reconstruct half of the blobs out of 6 188.40 ms/op 200.02 ms/op 0.94
Half columns - reconstruct single blob out of 6 67.767 ms/op 71.506 ms/op 0.95
Set add up to 64 items then delete first 1.6318 us/op 2.1554 us/op 0.76
OrderedSet add up to 64 items then delete first 2.3846 us/op 3.4372 us/op 0.69
Set add up to 64 items then delete last 1.8154 us/op 2.3973 us/op 0.76
OrderedSet add up to 64 items then delete last 2.6293 us/op 3.3650 us/op 0.78
Set add up to 64 items then delete middle 1.8285 us/op 2.1638 us/op 0.85
OrderedSet add up to 64 items then delete middle 4.0438 us/op 4.8879 us/op 0.83
Set add up to 128 items then delete first 3.5765 us/op 4.3009 us/op 0.83
OrderedSet add up to 128 items then delete first 5.4952 us/op 6.6930 us/op 0.82
Set add up to 128 items then delete last 3.4877 us/op 3.9074 us/op 0.89
OrderedSet add up to 128 items then delete last 5.1626 us/op 5.9504 us/op 0.87
Set add up to 128 items then delete middle 3.4627 us/op 4.8056 us/op 0.72
OrderedSet add up to 128 items then delete middle 10.894 us/op 12.493 us/op 0.87
Set add up to 256 items then delete first 7.1486 us/op 8.1166 us/op 0.88
OrderedSet add up to 256 items then delete first 11.462 us/op 13.426 us/op 0.85
Set add up to 256 items then delete last 6.8558 us/op 9.4293 us/op 0.73
OrderedSet add up to 256 items then delete last 10.835 us/op 14.009 us/op 0.77
Set add up to 256 items then delete middle 6.8456 us/op 8.8193 us/op 0.78
OrderedSet add up to 256 items then delete middle 33.352 us/op 39.951 us/op 0.83
runFastConfirmationRules vc:100000 bc:96 eq:0 4.3210 ms/op 5.2908 ms/op 0.82
runFastConfirmationRules vc:600000 bc:96 eq:0 33.332 ms/op 36.084 ms/op 0.92
runFastConfirmationRules vc:1000000 bc:96 eq:0 55.266 ms/op 61.368 ms/op 0.90
runFastConfirmationRules vc:600000 bc:320 eq:0 34.382 ms/op 36.467 ms/op 0.94
runFastConfirmationRules vc:100000 bc:96 eq:1000 1.1130 s/op 1.2096 s/op 0.92
pass gossip attestations to forkchoice per slot 2.5508 ms/op 2.6914 ms/op 0.95
forkChoice updateHead vc 100000 bc 64 eq 0 401.98 us/op 423.04 us/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 0 2.3990 ms/op 2.5246 ms/op 0.95
forkChoice updateHead vc 1000000 bc 64 eq 0 3.9939 ms/op 4.2129 ms/op 0.95
forkChoice updateHead vc 600000 bc 320 eq 0 2.3913 ms/op 2.4810 ms/op 0.96
forkChoice updateHead vc 600000 bc 1200 eq 0 2.4316 ms/op 2.5861 ms/op 0.94
forkChoice updateHead vc 600000 bc 7200 eq 0 3.8267 ms/op 2.8962 ms/op 1.32
forkChoice updateHead vc 600000 bc 64 eq 1000 2.4001 ms/op 2.5288 ms/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 10000 2.5421 ms/op 2.6219 ms/op 0.97
forkChoice updateHead vc 600000 bc 64 eq 300000 7.1149 ms/op 7.0089 ms/op 1.02
computeDeltas 1400000 validators 0% inactive 11.925 ms/op 12.512 ms/op 0.95
computeDeltas 1400000 validators 10% inactive 11.265 ms/op 11.927 ms/op 0.94
computeDeltas 1400000 validators 20% inactive 10.599 ms/op 11.281 ms/op 0.94
computeDeltas 1400000 validators 50% inactive 8.6456 ms/op 9.2449 ms/op 0.94
computeDeltas 2100000 validators 0% inactive 17.864 ms/op 18.982 ms/op 0.94
computeDeltas 2100000 validators 10% inactive 17.392 ms/op 17.925 ms/op 0.97
computeDeltas 2100000 validators 20% inactive 15.857 ms/op 16.920 ms/op 0.94
computeDeltas 2100000 validators 50% inactive 10.433 ms/op 11.171 ms/op 0.93
altair processAttestation - 250000 vs - 7PWei normalcase 2.3603 ms/op 1.9501 ms/op 1.21
altair processAttestation - 250000 vs - 7PWei worstcase 3.2080 ms/op 3.3977 ms/op 0.94
altair processAttestation - setStatus - 1/6 committees join 103.52 us/op 98.337 us/op 1.05
altair processAttestation - setStatus - 1/3 committees join 194.88 us/op 201.25 us/op 0.97
altair processAttestation - setStatus - 1/2 committees join 293.68 us/op 290.01 us/op 1.01
altair processAttestation - setStatus - 2/3 committees join 366.63 us/op 393.83 us/op 0.93
altair processAttestation - setStatus - 4/5 committees join 511.79 us/op 559.54 us/op 0.91
altair processAttestation - setStatus - 100% committees join 592.39 us/op 645.60 us/op 0.92
altair processBlock - 250000 vs - 7PWei normalcase 4.1183 ms/op 3.7242 ms/op 1.11
altair processBlock - 250000 vs - 7PWei normalcase hashState 16.006 ms/op 17.271 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase 21.159 ms/op 21.572 ms/op 0.98
altair processBlock - 250000 vs - 7PWei worstcase hashState 42.222 ms/op 43.861 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei normalcase 1.3775 ms/op 1.4851 ms/op 0.93
phase0 processBlock - 250000 vs - 7PWei worstcase 16.088 ms/op 19.989 ms/op 0.80
altair processEth1Data - 250000 vs - 7PWei normalcase 273.87 us/op 308.14 us/op 0.89
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 2.9730 us/op 6.8070 us/op 0.44
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 18.704 us/op 22.354 us/op 0.84
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 5.4870 us/op 7.1240 us/op 0.77
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 3.5040 us/op 4.6690 us/op 0.75
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 85.354 us/op 102.96 us/op 0.83
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.3637 ms/op 1.4420 ms/op 0.95
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.7914 ms/op 2.1154 ms/op 0.85
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7911 ms/op 1.8904 ms/op 0.95
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.6163 ms/op 3.8439 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.0402 ms/op 2.3893 ms/op 0.85
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.9778 ms/op 5.7496 ms/op 0.69
Tree 40 250000 create 323.80 ms/op 367.48 ms/op 0.88
Tree 40 250000 get(125000) 90.585 ns/op 95.291 ns/op 0.95
Tree 40 250000 set(125000) 982.98 ns/op 1.0424 us/op 0.94
Tree 40 250000 toArray() 17.083 ms/op 9.9050 ms/op 1.72
Tree 40 250000 iterate all - toArray() + loop 15.586 ms/op 10.017 ms/op 1.56
Tree 40 250000 iterate all - get(i) 36.983 ms/op 36.143 ms/op 1.02
Array 250000 create 2.5787 ms/op 2.2951 ms/op 1.12
Array 250000 clone - spread 776.35 us/op 739.54 us/op 1.05
Array 250000 get(125000) 0.28800 ns/op 0.31300 ns/op 0.92
Array 250000 set(125000) 0.30500 ns/op 0.31400 ns/op 0.97
Array 250000 iterate all - loop 56.989 us/op 59.202 us/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 40.306 ms/op 52.449 ms/op 0.77
Array.fill - length 1000000 4.1464 ms/op 5.7739 ms/op 0.72
Array push - length 1000000 15.135 ms/op 15.457 ms/op 0.98
Array.get 0.20138 ns/op 0.21056 ns/op 0.96
Uint8Array.get 0.23297 ns/op 0.23793 ns/op 0.98
phase0 beforeProcessEpoch - 250000 vs - 7PWei 14.376 ms/op 14.738 ms/op 0.98
altair processEpoch - mainnet_e81889 276.75 ms/op 382.13 ms/op 0.72
mainnet_e81889 - altair beforeProcessEpoch 14.494 ms/op 37.748 ms/op 0.38
mainnet_e81889 - altair processJustificationAndFinalization 5.9050 us/op 6.1710 us/op 0.96
mainnet_e81889 - altair processInactivityUpdates 3.5211 ms/op 3.7158 ms/op 0.95
mainnet_e81889 - altair processRewardsAndPenalties 19.152 ms/op 20.653 ms/op 0.93
mainnet_e81889 - altair processRegistryUpdates 537.00 ns/op 589.00 ns/op 0.91
mainnet_e81889 - altair processSlashings 138.00 ns/op 147.00 ns/op 0.94
mainnet_e81889 - altair processEth1DataReset 136.00 ns/op 143.00 ns/op 0.95
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5787 ms/op 5.4121 ms/op 0.29
mainnet_e81889 - altair processSlashingsReset 678.00 ns/op 709.00 ns/op 0.96
mainnet_e81889 - altair processRandaoMixesReset 1.0820 us/op 1.5240 us/op 0.71
mainnet_e81889 - altair processHistoricalRootsUpdate 135.00 ns/op 142.00 ns/op 0.95
mainnet_e81889 - altair processParticipationFlagUpdates 451.00 ns/op 467.00 ns/op 0.97
mainnet_e81889 - altair processSyncCommitteeUpdates 112.00 ns/op 121.00 ns/op 0.93
mainnet_e81889 - altair afterProcessEpoch 40.392 ms/op 41.623 ms/op 0.97
capella processEpoch - mainnet_e217614 788.30 ms/op 1.0390 s/op 0.76
mainnet_e217614 - capella beforeProcessEpoch 61.879 ms/op 59.226 ms/op 1.04
mainnet_e217614 - capella processJustificationAndFinalization 6.0810 us/op 32.191 ms/op 0.00
mainnet_e217614 - capella processInactivityUpdates 14.032 ms/op 11.093 ms/op 1.26
mainnet_e217614 - capella processRewardsAndPenalties 88.938 ms/op 95.621 ms/op 0.93
mainnet_e217614 - capella processRegistryUpdates 4.4090 us/op 4.4050 us/op 1.00
mainnet_e217614 - capella processSlashings 148.00 ns/op 142.00 ns/op 1.04
mainnet_e217614 - capella processEth1DataReset 144.00 ns/op 136.00 ns/op 1.06
mainnet_e217614 - capella processEffectiveBalanceUpdates 11.594 ms/op 5.0783 ms/op 2.28
mainnet_e217614 - capella processSlashingsReset 684.00 ns/op 698.00 ns/op 0.98
mainnet_e217614 - capella processRandaoMixesReset 1.1530 us/op 1.3880 us/op 0.83
mainnet_e217614 - capella processHistoricalRootsUpdate 143.00 ns/op 141.00 ns/op 1.01
mainnet_e217614 - capella processParticipationFlagUpdates 462.00 ns/op 467.00 ns/op 0.99
mainnet_e217614 - capella afterProcessEpoch 106.21 ms/op 106.55 ms/op 1.00
phase0 processEpoch - mainnet_e58758 304.36 ms/op 364.77 ms/op 0.83
mainnet_e58758 - phase0 beforeProcessEpoch 64.993 ms/op 66.867 ms/op 0.97
mainnet_e58758 - phase0 processJustificationAndFinalization 6.2550 us/op 6.1800 us/op 1.01
mainnet_e58758 - phase0 processRewardsAndPenalties 15.732 ms/op 15.935 ms/op 0.99
mainnet_e58758 - phase0 processRegistryUpdates 2.1920 us/op 2.3650 us/op 0.93
mainnet_e58758 - phase0 processSlashings 148.00 ns/op 155.00 ns/op 0.95
mainnet_e58758 - phase0 processEth1DataReset 145.00 ns/op 148.00 ns/op 0.98
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0494 ms/op 1.1678 ms/op 0.90
mainnet_e58758 - phase0 processSlashingsReset 846.00 ns/op 861.00 ns/op 0.98
mainnet_e58758 - phase0 processRandaoMixesReset 1.2010 us/op 1.3540 us/op 0.89
mainnet_e58758 - phase0 processHistoricalRootsUpdate 146.00 ns/op 153.00 ns/op 0.95
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.0250 us/op 1.2540 us/op 0.82
mainnet_e58758 - phase0 afterProcessEpoch 32.426 ms/op 33.784 ms/op 0.96
phase0 processEffectiveBalanceUpdates - 250000 normalcase 968.09 us/op 978.05 us/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5538 ms/op 1.9327 ms/op 0.80
altair processInactivityUpdates - 250000 normalcase 10.505 ms/op 10.835 ms/op 0.97
altair processInactivityUpdates - 250000 worstcase 10.569 ms/op 10.920 ms/op 0.97
phase0 processRegistryUpdates - 250000 normalcase 2.0520 us/op 2.3540 us/op 0.87
phase0 processRegistryUpdates - 250000 badcase_full_deposits 136.74 us/op 146.67 us/op 0.93
phase0 processRegistryUpdates - 250000 worstcase 0.5 59.531 ms/op 173.38 ms/op 0.34
altair processRewardsAndPenalties - 250000 normalcase 15.545 ms/op 15.840 ms/op 0.98
altair processRewardsAndPenalties - 250000 worstcase 15.343 ms/op 14.002 ms/op 1.10
phase0 getAttestationDeltas - 250000 normalcase 5.7766 ms/op 5.4220 ms/op 1.07
phase0 getAttestationDeltas - 250000 worstcase 5.4673 ms/op 5.3844 ms/op 1.02
phase0 processSlashings - 250000 worstcase 56.971 us/op 63.400 us/op 0.90
altair processSyncCommitteeUpdates - 250000 9.5744 ms/op 10.635 ms/op 0.90
BeaconState.hashTreeRoot - No change 183.00 ns/op 210.00 ns/op 0.87
BeaconState.hashTreeRoot - 1 full validator 71.444 us/op 87.048 us/op 0.82
BeaconState.hashTreeRoot - 32 full validator 857.40 us/op 1.0408 ms/op 0.82
BeaconState.hashTreeRoot - 512 full validator 7.3857 ms/op 8.0072 ms/op 0.92
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 88.753 us/op 112.14 us/op 0.79
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.3799 ms/op 1.6550 ms/op 0.83
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.339 ms/op 14.203 ms/op 1.08
BeaconState.hashTreeRoot - 1 balances 70.912 us/op 79.985 us/op 0.89
BeaconState.hashTreeRoot - 32 balances 708.17 us/op 857.79 us/op 0.83
BeaconState.hashTreeRoot - 512 balances 5.9200 ms/op 5.2381 ms/op 1.13
BeaconState.hashTreeRoot - 250000 balances 184.28 ms/op 190.49 ms/op 0.97
aggregationBits - 2048 els - zipIndexesInBitList 18.614 us/op 20.086 us/op 0.93
regular array get 100000 times 22.219 us/op 23.236 us/op 0.96
wrappedArray get 100000 times 22.184 us/op 23.373 us/op 0.95
arrayWithProxy get 100000 times 9.4455 ms/op 9.6534 ms/op 0.98
ssz.Root.equals 20.724 ns/op 21.837 ns/op 0.95
byteArrayEquals 20.521 ns/op 21.595 ns/op 0.95
Buffer.compare 8.5150 ns/op 8.9290 ns/op 0.95
processSlot - 1 slots 9.8850 us/op 9.4990 us/op 1.04
processSlot - 32 slots 2.0512 ms/op 2.0644 ms/op 0.99
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 4.7512 ms/op 4.1217 ms/op 1.15
getCommitteeAssignments - req 1 vs - 250000 vc 1.6094 ms/op 1.6746 ms/op 0.96
getCommitteeAssignments - req 100 vs - 250000 vc 3.3144 ms/op 3.5629 ms/op 0.93
getCommitteeAssignments - req 1000 vs - 250000 vc 3.5520 ms/op 3.6838 ms/op 0.96
findModifiedValidators - 10000 modified validators 666.25 ms/op 800.57 ms/op 0.83
findModifiedValidators - 1000 modified validators 501.45 ms/op 579.01 ms/op 0.87
findModifiedValidators - 100 modified validators 388.53 ms/op 350.16 ms/op 1.11
findModifiedValidators - 10 modified validators 308.38 ms/op 270.32 ms/op 1.14
findModifiedValidators - 1 modified validators 192.49 ms/op 232.79 ms/op 0.83
findModifiedValidators - no difference 196.88 ms/op 188.81 ms/op 1.04
migrate state 1500000 validators, 3400 modified, 2000 new 2.7682 s/op 3.8324 s/op 0.72
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.6600 ns/op 3.8100 ns/op 0.96
state getBlockRootAtSlot - 250000 vs - 7PWei 324.06 ns/op 468.09 ns/op 0.69
computeProposerIndex 100000 validators 1.2303 ms/op 1.3318 ms/op 0.92
getNextSyncCommitteeIndices 1000 validators 1.0799 ms/op 2.8689 ms/op 0.38
getNextSyncCommitteeIndices 10000 validators 13.031 ms/op 25.023 ms/op 0.52
getNextSyncCommitteeIndices 100000 validators 49.233 ms/op 91.176 ms/op 0.54
computeProposers - vc 250000 474.70 us/op 551.00 us/op 0.86
computeEpochShuffling - vc 250000 39.304 ms/op 40.335 ms/op 0.97
getNextSyncCommittee - vc 250000 9.0873 ms/op 10.181 ms/op 0.89
nodejs block root to RootHex using toHex 94.479 ns/op 100.46 ns/op 0.94
nodejs block root to RootHex using toRootHex 60.402 ns/op 65.064 ns/op 0.93
nodejs fromHex(blob) 715.74 us/op 944.18 us/op 0.76
nodejs fromHexInto(blob) 607.67 us/op 650.20 us/op 0.93
nodejs block root to RootHex using the deprecated toHexString 473.25 ns/op 514.11 ns/op 0.92
nodejs byteArrayEquals 32 bytes (block root) 25.252 ns/op 26.720 ns/op 0.95
nodejs byteArrayEquals 48 bytes (pubkey) 36.797 ns/op 38.568 ns/op 0.95
nodejs byteArrayEquals 96 bytes (signature) 33.067 ns/op 36.304 ns/op 0.91
nodejs byteArrayEquals 1024 bytes 41.267 ns/op 43.656 ns/op 0.95
nodejs byteArrayEquals 131072 bytes (blob) 1.7041 us/op 1.7920 us/op 0.95
browser block root to RootHex using toHex 139.14 ns/op 148.42 ns/op 0.94
browser block root to RootHex using toRootHex 124.68 ns/op 135.56 ns/op 0.92
browser fromHex(blob) 1.4789 ms/op 1.7226 ms/op 0.86
browser fromHexInto(blob) 622.63 us/op 647.36 us/op 0.96
browser block root to RootHex using the deprecated toHexString 333.97 ns/op 363.76 ns/op 0.92
browser byteArrayEquals 32 bytes (block root) 27.576 ns/op 28.874 ns/op 0.96
browser byteArrayEquals 48 bytes (pubkey) 39.298 ns/op 40.725 ns/op 0.96
browser byteArrayEquals 96 bytes (signature) 73.082 ns/op 78.474 ns/op 0.93
browser byteArrayEquals 1024 bytes 739.01 ns/op 772.14 ns/op 0.96
browser byteArrayEquals 131072 bytes (blob) 92.981 us/op 99.574 us/op 0.93

by benchmarkbot/action

@twoeths twoeths left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

need to wait for a @chainsafe/lodestar-z release

nazarhussain added a commit to ChainSafe/lodestar-z that referenced this pull request Aug 19, 2026
Review feedback: the async variants are unused (ChainSafe/lodestar#9829
calls unshuffleList, computeProposerIndex and computeSyncCommitteeIndices),
so drop asyncShuffleList/asyncUnshuffleList and the async_task helper --
the zapi AsyncTask work waits for a future release. Also unbind the other
unused package exports (forward shuffleList, ComputeShuffledIndex, the
Electra wrappers, SHUFFLE_ROUNDS_* and ByteCount); the Zig module still
implements them, so re-binding later is a few lines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nazarhussain nazarhussain changed the title feat: use zig backedlodestar-z shuffle feat: use zig backed lodestar-z shuffle Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants