Skip to content

refactor: implement BeaconEngine#9550

Draft
twoeths wants to merge 24 commits into
unstablefrom
te/beacon_engine
Draft

refactor: implement BeaconEngine#9550
twoeths wants to merge 24 commits into
unstablefrom
te/beacon_engine

Conversation

@twoeths

@twoeths twoeths commented Jun 23, 2026

Copy link
Copy Markdown
Member

Motivation

Description

  • wip

AI Assistance Disclosure

  • work in coordination with Claude

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

Copy link
Copy Markdown
Contributor

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 introduces the BeaconEngine class to centralize consensus validation and block production logic, separating it from the facade BeaconChain. It also refactors the fork choice into read-only (IForkChoiceRead) and full (IForkChoice) interfaces. The review feedback highlights a critical issue where simplifying the executionPayloadEnabled check bypasses the Terminal Total Difficulty (TTD) transition check, which could cause failures during the Merge transition. Additionally, the reviewer suggests optimizing performance on the API hot path by passing raw request body bytes directly to handlers to avoid expensive serialization overhead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +151 to +162
// TODO - beacon engine: this caused failed spec tests?
// the BeaconEngine cannot provide a BeaconState
// const executionPayloadEnabled =
// isStatePostBellatrix(preState0) &&
// preState0.isExecutionStateType &&
// isExecutionBlockBodyType(block.message.body) &&
// preState0.isExecutionEnabled(block.message)
// ? block.message.body.executionPayload
// : null;
const executionPayloadEnabled = isExecutionBlockBodyType(block.message.body)
? block.message.body.executionPayload
: null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Commenting out the isExecutionEnabled check and simplifying executionPayloadEnabled bypasses the Terminal Total Difficulty (TTD) transition check. This will cause failures during the Merge transition period (where Bellatrix is active but TTD is not yet reached) and in historical sync/spec tests (as noted in the TODO).

To resolve this without violating the BeaconEngine boundaries, you can retrieve preState0 in verifyBlocksInEpoch (which is a cheap cache hit) and pass it (or a boolean flag indicating if execution is enabled) to verifyBlocksExecutionPayload.

return;
}
// TODO - engine: get block bytes from upstream
const blockBytes = config.getForkTypes(slot).SignedBeaconBlock.serialize(signedBlock);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To avoid the expensive serialization overhead on the API hot path (e.g., SignedBeaconBlock.serialize), consider updating the API router/framework to pass the raw request body bytes directly to these handlers instead of re-serializing the parsed JSON objects.

try {
await validateGossipProposerPreferences(chain, signed);
// TODO - beacon engine: get bytes from the api
const preferencesBytes = ssz.gloas.SignedProposerPreferences.serialize(signed);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To avoid the expensive serialization overhead on the API hot path (e.g., SignedProposerPreferences.serialize), consider updating the API router/framework to pass the raw request body bytes directly to these handlers instead of re-serializing the parsed JSON objects.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 170f6bf Previous: 551b8b0 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 935.23 us/op 1.1804 ms/op 0.79
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 45.550 us/op 40.880 us/op 1.11
BLS verify - blst 778.00 us/op 733.40 us/op 1.06
BLS verifyMultipleSignatures 3 - blst 1.3641 ms/op 1.3844 ms/op 0.99
BLS verifyMultipleSignatures 8 - blst 2.1665 ms/op 2.1952 ms/op 0.99
BLS verifyMultipleSignatures 32 - blst 6.8009 ms/op 6.9438 ms/op 0.98
BLS verifyMultipleSignatures 64 - blst 13.614 ms/op 13.300 ms/op 1.02
BLS verifyMultipleSignatures 128 - blst 25.793 ms/op 26.045 ms/op 0.99
BLS deserializing 10000 signatures 642.73 ms/op 643.85 ms/op 1.00
BLS deserializing 100000 signatures 6.4123 s/op 6.6151 s/op 0.97
BLS verifyMultipleSignatures - same message - 3 - blst 771.03 us/op 747.71 us/op 1.03
BLS verifyMultipleSignatures - same message - 8 - blst 937.59 us/op 942.68 us/op 0.99
BLS verifyMultipleSignatures - same message - 32 - blst 1.5630 ms/op 1.6302 ms/op 0.96
BLS verifyMultipleSignatures - same message - 64 - blst 2.3552 ms/op 2.5732 ms/op 0.92
BLS verifyMultipleSignatures - same message - 128 - blst 4.0085 ms/op 4.2847 ms/op 0.94
BLS aggregatePubkeys 32 - blst 17.744 us/op 18.585 us/op 0.95
BLS aggregatePubkeys 128 - blst 63.387 us/op 66.179 us/op 0.96
getSlashingsAndExits - default max 48.222 us/op 66.447 us/op 0.73
getSlashingsAndExits - 2k 323.76 us/op 411.44 us/op 0.79
isKnown best case - 1 super set check 174.00 ns/op 173.00 ns/op 1.01
isKnown normal case - 2 super set checks 175.00 ns/op 167.00 ns/op 1.05
isKnown worse case - 16 super set checks 175.00 ns/op 167.00 ns/op 1.05
validate api signedAggregateAndProof - struct 1.5179 ms/op 1.5720 ms/op 0.97
validate gossip signedAggregateAndProof - struct 1.5150 ms/op 1.5594 ms/op 0.97
batch validate gossip attestation - vc 640000 - chunk 32 107.67 us/op 111.88 us/op 0.96
batch validate gossip attestation - vc 640000 - chunk 64 98.478 us/op 97.906 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 128 93.242 us/op 91.853 us/op 1.02
batch validate gossip attestation - vc 640000 - chunk 256 84.706 us/op 88.193 us/op 0.96
bytes32 toHexString 291.00 ns/op 286.00 ns/op 1.02
bytes32 Buffer.toString(hex) 172.00 ns/op 169.00 ns/op 1.02
bytes32 Buffer.toString(hex) from Uint8Array 234.00 ns/op 246.00 ns/op 0.95
bytes32 Buffer.toString(hex) + 0x 173.00 ns/op 171.00 ns/op 1.01
Return object 10000 times 0.21610 ns/op 0.21750 ns/op 0.99
Throw Error 10000 times 3.4902 us/op 3.3773 us/op 1.03
toHex 96.334 ns/op 97.444 ns/op 0.99
Buffer.from 90.266 ns/op 89.288 ns/op 1.01
shared Buffer 60.570 ns/op 59.282 ns/op 1.02
fastMsgIdFn sha256 / 200 bytes 1.5050 us/op 1.4850 us/op 1.01
fastMsgIdFn h32 xxhash / 200 bytes 165.00 ns/op 157.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 200 bytes 204.00 ns/op 204.00 ns/op 1.00
fastMsgIdFn sha256 / 1000 bytes 4.7940 us/op 4.8510 us/op 0.99
fastMsgIdFn h32 xxhash / 1000 bytes 253.00 ns/op 246.00 ns/op 1.03
fastMsgIdFn h64 xxhash / 1000 bytes 260.00 ns/op 253.00 ns/op 1.03
fastMsgIdFn sha256 / 10000 bytes 42.071 us/op 42.107 us/op 1.00
fastMsgIdFn h32 xxhash / 10000 bytes 1.2750 us/op 1.2790 us/op 1.00
fastMsgIdFn h64 xxhash / 10000 bytes 814.00 ns/op 834.00 ns/op 0.98
send data - 1000 256B messages 4.0610 ms/op 4.3203 ms/op 0.94
send data - 1000 512B messages 4.9558 ms/op 5.2725 ms/op 0.94
send data - 1000 1024B messages 5.3224 ms/op 5.9719 ms/op 0.89
send data - 1000 1200B messages 5.9885 ms/op 6.8096 ms/op 0.88
send data - 1000 2048B messages 10.276 ms/op 10.893 ms/op 0.94
send data - 1000 4096B messages 30.919 ms/op 76.444 ms/op 0.40
send data - 1000 16384B messages 207.53 ms/op 397.60 ms/op 0.52
send data - 1000 65536B messages 1.1057 s/op 1.8645 s/op 0.59
enrSubnets - fastDeserialize 64 bits 738.00 ns/op 764.00 ns/op 0.97
enrSubnets - ssz BitVector 64 bits 276.00 ns/op 264.00 ns/op 1.05
enrSubnets - fastDeserialize 4 bits 133.00 ns/op 102.00 ns/op 1.30
enrSubnets - ssz BitVector 4 bits 279.00 ns/op 278.00 ns/op 1.00
prioritizePeers score -10:0 att 32-0.1 sync 2-0 199.17 us/op 217.10 us/op 0.92
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 228.39 us/op 246.08 us/op 0.93
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 336.15 us/op 366.22 us/op 0.92
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 611.80 us/op 641.87 us/op 0.95
prioritizePeers score 0:0 att 64-1 sync 4-1 687.62 us/op 740.25 us/op 0.93
array of 16000 items push then shift 1.2884 us/op 1.2957 us/op 0.99
LinkedList of 16000 items push then shift 7.1690 ns/op 8.7200 ns/op 0.82
array of 16000 items push then pop 65.171 ns/op 89.973 ns/op 0.72
LinkedList of 16000 items push then pop 5.9090 ns/op 6.3490 ns/op 0.93
array of 24000 items push then shift 1.9030 us/op 1.9889 us/op 0.96
LinkedList of 24000 items push then shift 6.5230 ns/op 8.2320 ns/op 0.79
array of 24000 items push then pop 91.002 ns/op 125.69 ns/op 0.72
LinkedList of 24000 items push then pop 5.9240 ns/op 6.4570 ns/op 0.92
intersect bitArray bitLen 8 4.7360 ns/op 4.8530 ns/op 0.98
intersect array and set length 8 29.296 ns/op 30.303 ns/op 0.97
intersect bitArray bitLen 128 24.113 ns/op 24.719 ns/op 0.98
intersect array and set length 128 492.42 ns/op 508.05 ns/op 0.97
bitArray.getTrueBitIndexes() bitLen 128 1.0680 us/op 1.1120 us/op 0.96
bitArray.getTrueBitIndexes() bitLen 248 1.7250 us/op 1.8720 us/op 0.92
bitArray.getTrueBitIndexes() bitLen 512 3.5230 us/op 3.8930 us/op 0.90
Full columns - reconstruct all 6 blobs 170.37 us/op 135.58 us/op 1.26
Full columns - reconstruct half of the blobs out of 6 66.656 us/op 71.204 us/op 0.94
Full columns - reconstruct single blob out of 6 30.455 us/op 34.694 us/op 0.88
Half columns - reconstruct all 6 blobs 379.11 ms/op 403.29 ms/op 0.94
Half columns - reconstruct half of the blobs out of 6 194.90 ms/op 201.74 ms/op 0.97
Half columns - reconstruct single blob out of 6 66.957 ms/op 71.756 ms/op 0.93
Set add up to 64 items then delete first 2.2027 us/op 1.6550 us/op 1.33
OrderedSet add up to 64 items then delete first 3.4015 us/op 2.5233 us/op 1.35
Set add up to 64 items then delete last 2.4336 us/op 1.9455 us/op 1.25
OrderedSet add up to 64 items then delete last 3.3277 us/op 2.9662 us/op 1.12
Set add up to 64 items then delete middle 2.1944 us/op 1.9788 us/op 1.11
OrderedSet add up to 64 items then delete middle 4.8153 us/op 4.4771 us/op 1.08
Set add up to 128 items then delete first 4.3184 us/op 3.7748 us/op 1.14
OrderedSet add up to 128 items then delete first 6.6517 us/op 5.5440 us/op 1.20
Set add up to 128 items then delete last 3.9659 us/op 3.8340 us/op 1.03
OrderedSet add up to 128 items then delete last 5.8679 us/op 5.8114 us/op 1.01
Set add up to 128 items then delete middle 3.9597 us/op 3.8321 us/op 1.03
OrderedSet add up to 128 items then delete middle 11.687 us/op 11.867 us/op 0.98
Set add up to 256 items then delete first 8.0230 us/op 7.8313 us/op 1.02
OrderedSet add up to 256 items then delete first 12.274 us/op 11.808 us/op 1.04
Set add up to 256 items then delete last 7.8049 us/op 7.9291 us/op 0.98
OrderedSet add up to 256 items then delete last 11.663 us/op 12.270 us/op 0.95
Set add up to 256 items then delete middle 7.7275 us/op 7.4989 us/op 1.03
OrderedSet add up to 256 items then delete middle 34.910 us/op 36.301 us/op 0.96
runFastConfirmationRules vc:100000 bc:96 eq:0 3.5880 us/op 3.9800 us/op 0.90
runFastConfirmationRules vc:600000 bc:96 eq:0 3.9090 us/op 4.1470 us/op 0.94
runFastConfirmationRules vc:1000000 bc:96 eq:0 3.6160 us/op 3.9280 us/op 0.92
runFastConfirmationRules vc:600000 bc:320 eq:0 9.9400 us/op 9.7340 us/op 1.02
runFastConfirmationRules vc:600000 bc:1200 eq:0 40.895 us/op 40.839 us/op 1.00
runFastConfirmationRules vc:600000 bc:96 eq:1000 3.4580 us/op 3.8590 us/op 0.90
runFastConfirmationRules vc:600000 bc:96 eq:10000 3.4260 us/op 3.8540 us/op 0.89
runFastConfirmationRules vc:600000 bc:96 eq:300000 3.1840 us/op 4.1390 us/op 0.77
pass gossip attestations to forkchoice per slot 2.5483 ms/op 2.6756 ms/op 0.95
forkChoice updateHead vc 100000 bc 64 eq 0 431.83 us/op 443.93 us/op 0.97
forkChoice updateHead vc 600000 bc 64 eq 0 2.5968 ms/op 2.6263 ms/op 0.99
forkChoice updateHead vc 1000000 bc 64 eq 0 4.2840 ms/op 4.4565 ms/op 0.96
forkChoice updateHead vc 600000 bc 320 eq 0 2.6112 ms/op 2.5692 ms/op 1.02
forkChoice updateHead vc 600000 bc 1200 eq 0 2.6501 ms/op 2.6636 ms/op 0.99
forkChoice updateHead vc 600000 bc 7200 eq 0 2.9243 ms/op 3.3596 ms/op 0.87
forkChoice updateHead vc 600000 bc 64 eq 1000 2.6647 ms/op 2.6059 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 10000 2.7478 ms/op 2.8026 ms/op 0.98
forkChoice updateHead vc 600000 bc 64 eq 300000 7.0123 ms/op 7.8076 ms/op 0.90
computeDeltas 1400000 validators 0% inactive 12.566 ms/op 13.037 ms/op 0.96
computeDeltas 1400000 validators 10% inactive 12.080 ms/op 12.354 ms/op 0.98
computeDeltas 1400000 validators 20% inactive 11.104 ms/op 11.265 ms/op 0.99
computeDeltas 1400000 validators 50% inactive 8.4012 ms/op 8.5956 ms/op 0.98
computeDeltas 2100000 validators 0% inactive 19.088 ms/op 19.545 ms/op 0.98
computeDeltas 2100000 validators 10% inactive 18.129 ms/op 18.163 ms/op 1.00
computeDeltas 2100000 validators 20% inactive 16.817 ms/op 16.792 ms/op 1.00
computeDeltas 2100000 validators 50% inactive 12.551 ms/op 9.9008 ms/op 1.27
altair processAttestation - 250000 vs - 7PWei normalcase 1.6953 ms/op 2.0158 ms/op 0.84
altair processAttestation - 250000 vs - 7PWei worstcase 2.4733 ms/op 3.2202 ms/op 0.77
altair processAttestation - setStatus - 1/6 committees join 99.689 us/op 105.25 us/op 0.95
altair processAttestation - setStatus - 1/3 committees join 204.09 us/op 198.88 us/op 1.03
altair processAttestation - setStatus - 1/2 committees join 285.83 us/op 285.17 us/op 1.00
altair processAttestation - setStatus - 2/3 committees join 371.90 us/op 373.08 us/op 1.00
altair processAttestation - setStatus - 4/5 committees join 506.95 us/op 533.82 us/op 0.95
altair processAttestation - setStatus - 100% committees join 601.30 us/op 623.24 us/op 0.96
altair processBlock - 250000 vs - 7PWei normalcase 3.5330 ms/op 4.0437 ms/op 0.87
altair processBlock - 250000 vs - 7PWei normalcase hashState 15.018 ms/op 19.102 ms/op 0.79
altair processBlock - 250000 vs - 7PWei worstcase 21.790 ms/op 22.524 ms/op 0.97
altair processBlock - 250000 vs - 7PWei worstcase hashState 39.289 ms/op 44.015 ms/op 0.89
phase0 processBlock - 250000 vs - 7PWei normalcase 1.2661 ms/op 1.4306 ms/op 0.88
phase0 processBlock - 250000 vs - 7PWei worstcase 16.759 ms/op 18.105 ms/op 0.93
altair processEth1Data - 250000 vs - 7PWei normalcase 302.68 us/op 290.56 us/op 1.04
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:16 3.1520 us/op 5.7190 us/op 0.55
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:220 21.203 us/op 20.845 us/op 1.02
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:43 6.8930 us/op 5.8240 us/op 1.18
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:19 3.7720 us/op 3.9570 us/op 0.95
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1021 93.417 us/op 95.753 us/op 0.98
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11778 1.3750 ms/op 1.3967 ms/op 0.98
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8187 ms/op 1.9350 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7833 ms/op 1.8879 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.5681 ms/op 3.4792 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.0345 ms/op 2.0796 ms/op 0.98
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.8276 ms/op 3.9156 ms/op 0.98
Tree 40 250000 create 299.72 ms/op 393.22 ms/op 0.76
Tree 40 250000 get(125000) 94.998 ns/op 98.381 ns/op 0.97
Tree 40 250000 set(125000) 1.0265 us/op 1.0502 us/op 0.98
Tree 40 250000 toArray() 8.9784 ms/op 18.486 ms/op 0.49
Tree 40 250000 iterate all - toArray() + loop 9.1930 ms/op 18.573 ms/op 0.49
Tree 40 250000 iterate all - get(i) 33.290 ms/op 42.274 ms/op 0.79
Array 250000 create 2.0384 ms/op 2.8244 ms/op 0.72
Array 250000 clone - spread 659.66 us/op 858.61 us/op 0.77
Array 250000 get(125000) 0.29200 ns/op 0.30600 ns/op 0.95
Array 250000 set(125000) 0.29500 ns/op 0.30800 ns/op 0.96
Array 250000 iterate all - loop 56.447 us/op 58.828 us/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 39.307 ms/op 42.370 ms/op 0.93
Array.fill - length 1000000 2.1956 ms/op 2.5991 ms/op 0.84
Array push - length 1000000 7.9844 ms/op 13.827 ms/op 0.58
Array.get 0.20333 ns/op 0.21412 ns/op 0.95
Uint8Array.get 0.23947 ns/op 0.23552 ns/op 1.02
phase0 beforeProcessEpoch - 250000 vs - 7PWei 12.259 ms/op 14.637 ms/op 0.84
altair processEpoch - mainnet_e81889 221.35 ms/op 321.81 ms/op 0.69
mainnet_e81889 - altair beforeProcessEpoch 16.486 ms/op 34.147 ms/op 0.48
mainnet_e81889 - altair processJustificationAndFinalization 4.6600 us/op 8.4260 us/op 0.55
mainnet_e81889 - altair processInactivityUpdates 3.4408 ms/op 3.8982 ms/op 0.88
mainnet_e81889 - altair processRewardsAndPenalties 16.240 ms/op 19.799 ms/op 0.82
mainnet_e81889 - altair processRegistryUpdates 521.00 ns/op 561.00 ns/op 0.93
mainnet_e81889 - altair processSlashings 134.00 ns/op 146.00 ns/op 0.92
mainnet_e81889 - altair processEth1DataReset 135.00 ns/op 145.00 ns/op 0.93
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.6751 ms/op 1.7198 ms/op 0.97
mainnet_e81889 - altair processSlashingsReset 653.00 ns/op 705.00 ns/op 0.93
mainnet_e81889 - altair processRandaoMixesReset 1.0060 us/op 1.3670 us/op 0.74
mainnet_e81889 - altair processHistoricalRootsUpdate 134.00 ns/op 141.00 ns/op 0.95
mainnet_e81889 - altair processParticipationFlagUpdates 413.00 ns/op 443.00 ns/op 0.93
mainnet_e81889 - altair processSyncCommitteeUpdates 105.00 ns/op 119.00 ns/op 0.88
mainnet_e81889 - altair afterProcessEpoch 41.010 ms/op 40.679 ms/op 1.01
capella processEpoch - mainnet_e217614 769.48 ms/op 948.27 ms/op 0.81
mainnet_e217614 - capella beforeProcessEpoch 74.336 ms/op 56.110 ms/op 1.32
mainnet_e217614 - capella processJustificationAndFinalization 5.4540 us/op 7.1480 us/op 0.76
mainnet_e217614 - capella processInactivityUpdates 12.327 ms/op 16.486 ms/op 0.75
mainnet_e217614 - capella processRewardsAndPenalties 86.816 ms/op 113.43 ms/op 0.77
mainnet_e217614 - capella processRegistryUpdates 4.4360 us/op 4.3710 us/op 1.01
mainnet_e217614 - capella processSlashings 135.00 ns/op 124.00 ns/op 1.09
mainnet_e217614 - capella processEth1DataReset 132.00 ns/op 122.00 ns/op 1.08
mainnet_e217614 - capella processEffectiveBalanceUpdates 5.4575 ms/op 16.589 ms/op 0.33
mainnet_e217614 - capella processSlashingsReset 679.00 ns/op 674.00 ns/op 1.01
mainnet_e217614 - capella processRandaoMixesReset 961.00 ns/op 1.3710 us/op 0.70
mainnet_e217614 - capella processHistoricalRootsUpdate 133.00 ns/op 123.00 ns/op 1.08
mainnet_e217614 - capella processParticipationFlagUpdates 422.00 ns/op 419.00 ns/op 1.01
mainnet_e217614 - capella afterProcessEpoch 108.12 ms/op 105.39 ms/op 1.03
phase0 processEpoch - mainnet_e58758 235.99 ms/op 356.63 ms/op 0.66
mainnet_e58758 - phase0 beforeProcessEpoch 46.201 ms/op 72.966 ms/op 0.63
mainnet_e58758 - phase0 processJustificationAndFinalization 4.9200 us/op 7.1630 us/op 0.69
mainnet_e58758 - phase0 processRewardsAndPenalties 15.028 ms/op 16.062 ms/op 0.94
mainnet_e58758 - phase0 processRegistryUpdates 2.2720 us/op 2.3030 us/op 0.99
mainnet_e58758 - phase0 processSlashings 135.00 ns/op 135.00 ns/op 1.00
mainnet_e58758 - phase0 processEth1DataReset 138.00 ns/op 290.00 ns/op 0.48
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 823.62 us/op 837.42 us/op 0.98
mainnet_e58758 - phase0 processSlashingsReset 797.00 ns/op 849.00 ns/op 0.94
mainnet_e58758 - phase0 processRandaoMixesReset 981.00 ns/op 1.3590 us/op 0.72
mainnet_e58758 - phase0 processHistoricalRootsUpdate 139.00 ns/op 136.00 ns/op 1.02
mainnet_e58758 - phase0 processParticipationRecordUpdates 972.00 ns/op 1.2250 us/op 0.79
mainnet_e58758 - phase0 afterProcessEpoch 33.194 ms/op 33.998 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 normalcase 997.88 us/op 1.0199 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.6284 ms/op 1.5544 ms/op 1.05
altair processInactivityUpdates - 250000 normalcase 10.685 ms/op 11.585 ms/op 0.92
altair processInactivityUpdates - 250000 worstcase 10.377 ms/op 13.114 ms/op 0.79
phase0 processRegistryUpdates - 250000 normalcase 2.3170 us/op 2.1830 us/op 1.06
phase0 processRegistryUpdates - 250000 badcase_full_deposits 140.31 us/op 144.11 us/op 0.97
phase0 processRegistryUpdates - 250000 worstcase 0.5 53.391 ms/op 66.465 ms/op 0.80
altair processRewardsAndPenalties - 250000 normalcase 13.048 ms/op 16.039 ms/op 0.81
altair processRewardsAndPenalties - 250000 worstcase 12.795 ms/op 16.835 ms/op 0.76
phase0 getAttestationDeltas - 250000 normalcase 5.2719 ms/op 5.7187 ms/op 0.92
phase0 getAttestationDeltas - 250000 worstcase 5.3168 ms/op 5.7105 ms/op 0.93
phase0 processSlashings - 250000 worstcase 58.235 us/op 65.117 us/op 0.89
altair processSyncCommitteeUpdates - 250000 9.9384 ms/op 11.391 ms/op 0.87
BeaconState.hashTreeRoot - No change 170.00 ns/op 167.00 ns/op 1.02
BeaconState.hashTreeRoot - 1 full validator 57.110 us/op 133.10 us/op 0.43
BeaconState.hashTreeRoot - 32 full validator 616.39 us/op 1.4775 ms/op 0.42
BeaconState.hashTreeRoot - 512 full validator 5.9140 ms/op 12.462 ms/op 0.47
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 68.003 us/op 155.23 us/op 0.44
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 987.72 us/op 1.9625 ms/op 0.50
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 12.044 ms/op 21.600 ms/op 0.56
BeaconState.hashTreeRoot - 1 balances 54.829 us/op 156.39 us/op 0.35
BeaconState.hashTreeRoot - 32 balances 539.72 us/op 880.33 us/op 0.61
BeaconState.hashTreeRoot - 512 balances 4.5324 ms/op 7.8133 ms/op 0.58
BeaconState.hashTreeRoot - 250000 balances 97.560 ms/op 210.37 ms/op 0.46
aggregationBits - 2048 els - zipIndexesInBitList 18.635 us/op 20.087 us/op 0.93
regular array get 100000 times 22.572 us/op 23.245 us/op 0.97
wrappedArray get 100000 times 22.617 us/op 23.296 us/op 0.97
arrayWithProxy get 100000 times 10.501 ms/op 10.826 ms/op 0.97
ssz.Root.equals 21.352 ns/op 21.911 ns/op 0.97
byteArrayEquals 21.172 ns/op 21.688 ns/op 0.98
Buffer.compare 8.7870 ns/op 8.9970 ns/op 0.98
processSlot - 1 slots 7.9190 us/op 9.4530 us/op 0.84
processSlot - 32 slots 1.5045 ms/op 2.2667 ms/op 0.66
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 2.9980 ms/op 5.9004 ms/op 0.51
getCommitteeAssignments - req 1 vs - 250000 vc 1.6673 ms/op 1.6740 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 3.3860 ms/op 3.5050 ms/op 0.97
getCommitteeAssignments - req 1000 vs - 250000 vc 3.6430 ms/op 3.7536 ms/op 0.97
findModifiedValidators - 10000 modified validators 747.27 ms/op 937.20 ms/op 0.80
findModifiedValidators - 1000 modified validators 533.16 ms/op 523.10 ms/op 1.02
findModifiedValidators - 100 modified validators 275.30 ms/op 335.70 ms/op 0.82
findModifiedValidators - 10 modified validators 221.16 ms/op 287.85 ms/op 0.77
findModifiedValidators - 1 modified validators 137.89 ms/op 231.64 ms/op 0.60
findModifiedValidators - no difference 139.97 ms/op 237.87 ms/op 0.59
migrate state 1500000 validators, 3400 modified, 2000 new 2.8567 s/op 4.4208 s/op 0.65
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 3.6500 ns/op 3.7900 ns/op 0.96
state getBlockRootAtSlot - 250000 vs - 7PWei 265.10 ns/op 442.43 ns/op 0.60
computeProposerIndex 100000 validators 1.3447 ms/op 1.3991 ms/op 0.96
getNextSyncCommitteeIndices 1000 validators 2.8631 ms/op 2.9656 ms/op 0.97
getNextSyncCommitteeIndices 10000 validators 25.112 ms/op 25.904 ms/op 0.97
getNextSyncCommitteeIndices 100000 validators 86.828 ms/op 90.862 ms/op 0.96
computeProposers - vc 250000 553.93 us/op 584.95 us/op 0.95
computeEpochShuffling - vc 250000 40.172 ms/op 40.937 ms/op 0.98
getNextSyncCommittee - vc 250000 9.4135 ms/op 10.082 ms/op 0.93
nodejs block root to RootHex using toHex 96.781 ns/op 101.15 ns/op 0.96
nodejs block root to RootHex using toRootHex 63.895 ns/op 67.575 ns/op 0.95
nodejs fromHex(blob) 727.67 us/op 955.93 us/op 0.76
nodejs fromHexInto(blob) 630.00 us/op 628.18 us/op 1.00
nodejs block root to RootHex using the deprecated toHexString 481.11 ns/op 473.99 ns/op 1.02
nodejs byteArrayEquals 32 bytes (block root) 26.044 ns/op 25.985 ns/op 1.00
nodejs byteArrayEquals 48 bytes (pubkey) 37.783 ns/op 37.873 ns/op 1.00
nodejs byteArrayEquals 96 bytes (signature) 37.020 ns/op 34.254 ns/op 1.08
nodejs byteArrayEquals 1024 bytes 43.140 ns/op 42.373 ns/op 1.02
nodejs byteArrayEquals 131072 bytes (blob) 1.7539 us/op 1.7716 us/op 0.99
browser block root to RootHex using toHex 145.00 ns/op 145.87 ns/op 0.99
browser block root to RootHex using toRootHex 130.97 ns/op 131.31 ns/op 1.00
browser fromHex(blob) 1.5419 ms/op 1.7848 ms/op 0.86
browser fromHexInto(blob) 628.64 us/op 648.08 us/op 0.97
browser block root to RootHex using the deprecated toHexString 338.02 ns/op 345.45 ns/op 0.98
browser byteArrayEquals 32 bytes (block root) 27.864 ns/op 28.754 ns/op 0.97
browser byteArrayEquals 48 bytes (pubkey) 39.205 ns/op 40.522 ns/op 0.97
browser byteArrayEquals 96 bytes (signature) 74.291 ns/op 81.463 ns/op 0.91
browser byteArrayEquals 1024 bytes 753.34 ns/op 772.84 ns/op 0.97
browser byteArrayEquals 131072 bytes (blob) 95.654 us/op 97.203 us/op 0.98

by benchmarkbot/action

@twoeths twoeths force-pushed the te/beacon_engine branch from 6ed95ab to 452cc42 Compare June 29, 2026 07:35
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.

3 participants