Skip to content

Conversation

@nflaig
Copy link
Member

@nflaig nflaig commented Jun 26, 2025

Updates scoring / sorting of consolidated attestations during block packing to follow processAttestation reward computation to maximize profitability of block.

export function processAttestationsAltair(

Closes #8019

@codecov
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.68%. Comparing base (2fdd3fa) to head (9eb994a).
⚠️ Report is 246 commits behind head on unstable.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #8016   +/-   ##
=========================================
  Coverage     55.68%   55.68%           
=========================================
  Files           835      835           
  Lines         59476    59491   +15     
  Branches       4585     4586    +1     
=========================================
+ Hits          33119    33130   +11     
- Misses        26290    26294    +4     
  Partials         67       67           
🚀 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.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: a1075a3 Previous: 2fdd3fa Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.2390 ms/op 770.21 us/op 1.61
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 42.934 us/op 28.986 us/op 1.48
BLS verify - blst 1.1966 ms/op 887.55 us/op 1.35
BLS verifyMultipleSignatures 3 - blst 1.6027 ms/op 1.3306 ms/op 1.20
BLS verifyMultipleSignatures 8 - blst 2.5188 ms/op 2.2847 ms/op 1.10
BLS verifyMultipleSignatures 32 - blst 7.8676 ms/op 4.4838 ms/op 1.75
BLS verifyMultipleSignatures 64 - blst 13.742 ms/op 8.3388 ms/op 1.65
BLS verifyMultipleSignatures 128 - blst 23.483 ms/op 16.025 ms/op 1.47
BLS deserializing 10000 signatures 824.34 ms/op 629.78 ms/op 1.31
BLS deserializing 100000 signatures 7.9626 s/op 6.3315 s/op 1.26
BLS verifyMultipleSignatures - same message - 3 - blst 960.21 us/op 953.24 us/op 1.01
BLS verifyMultipleSignatures - same message - 8 - blst 1.2268 ms/op 1.0754 ms/op 1.14
BLS verifyMultipleSignatures - same message - 32 - blst 1.7562 ms/op 1.5943 ms/op 1.10
BLS verifyMultipleSignatures - same message - 64 - blst 2.7259 ms/op 2.4967 ms/op 1.09
BLS verifyMultipleSignatures - same message - 128 - blst 4.6426 ms/op 4.1822 ms/op 1.11
BLS aggregatePubkeys 32 - blst 20.598 us/op 17.749 us/op 1.16
BLS aggregatePubkeys 128 - blst 72.558 us/op 62.999 us/op 1.15
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 65.282 ms/op 61.186 ms/op 1.07
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 59.432 ms/op 69.714 ms/op 0.85
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 45.212 ms/op 42.187 ms/op 1.07
getSlashingsAndExits - default max 76.567 us/op 73.849 us/op 1.04
getSlashingsAndExits - 2k 346.81 us/op 554.91 us/op 0.62
proposeBlockBody type=full, size=empty 7.0236 ms/op 8.2609 ms/op 0.85
isKnown best case - 1 super set check 217.00 ns/op 421.00 ns/op 0.52
isKnown normal case - 2 super set checks 216.00 ns/op 420.00 ns/op 0.51
isKnown worse case - 16 super set checks 215.00 ns/op 420.00 ns/op 0.51
InMemoryCheckpointStateCache - add get delete 3.4320 us/op 3.2330 us/op 1.06
validate api signedAggregateAndProof - struct 2.1544 ms/op 1.3695 ms/op 1.57
validate gossip signedAggregateAndProof - struct 2.2977 ms/op 1.8378 ms/op 1.25
batch validate gossip attestation - vc 640000 - chunk 32 117.86 us/op 132.48 us/op 0.89
batch validate gossip attestation - vc 640000 - chunk 64 103.76 us/op 96.841 us/op 1.07
batch validate gossip attestation - vc 640000 - chunk 128 97.375 us/op 88.391 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 256 96.082 us/op 87.771 us/op 1.09
pickEth1Vote - no votes 977.38 us/op 832.59 us/op 1.17
pickEth1Vote - max votes 5.1354 ms/op 4.9151 ms/op 1.04
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.862 ms/op 10.055 ms/op 1.08
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 15.191 ms/op 18.393 ms/op 0.83
pickEth1Vote - Eth1Data fastSerialize value x2048 407.93 us/op 340.82 us/op 1.20
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.0970 ms/op 2.3402 ms/op 0.90
bytes32 toHexString 382.00 ns/op 508.00 ns/op 0.75
bytes32 Buffer.toString(hex) 246.00 ns/op 398.00 ns/op 0.62
bytes32 Buffer.toString(hex) from Uint8Array 338.00 ns/op 475.00 ns/op 0.71
bytes32 Buffer.toString(hex) + 0x 340.00 ns/op 395.00 ns/op 0.86
Object access 1 prop 0.12300 ns/op 0.30300 ns/op 0.41
Map access 1 prop 0.13300 ns/op 0.30900 ns/op 0.43
Object get x1000 6.0490 ns/op 4.8710 ns/op 1.24
Map get x1000 6.8310 ns/op 5.5910 ns/op 1.22
Object set x1000 28.299 ns/op 19.560 ns/op 1.45
Map set x1000 19.958 ns/op 16.944 ns/op 1.18
Return object 10000 times 0.29330 ns/op 0.28360 ns/op 1.03
Throw Error 10000 times 4.4152 us/op 3.5542 us/op 1.24
toHex 142.81 ns/op 92.519 ns/op 1.54
Buffer.from 121.23 ns/op 85.106 ns/op 1.42
shared Buffer 86.375 ns/op 61.873 ns/op 1.40
fastMsgIdFn sha256 / 200 bytes 2.2100 us/op 1.8730 us/op 1.18
fastMsgIdFn h32 xxhash / 200 bytes 265.00 ns/op 375.00 ns/op 0.71
fastMsgIdFn h64 xxhash / 200 bytes 266.00 ns/op 442.00 ns/op 0.60
fastMsgIdFn sha256 / 1000 bytes 7.2650 us/op 5.8450 us/op 1.24
fastMsgIdFn h32 xxhash / 1000 bytes 342.00 ns/op 505.00 ns/op 0.68
fastMsgIdFn h64 xxhash / 1000 bytes 342.00 ns/op 492.00 ns/op 0.70
fastMsgIdFn sha256 / 10000 bytes 65.628 us/op 46.989 us/op 1.40
fastMsgIdFn h32 xxhash / 10000 bytes 2.4800 us/op 1.8650 us/op 1.33
fastMsgIdFn h64 xxhash / 10000 bytes 1.2230 us/op 1.3020 us/op 0.94
send data - 1000 256B messages 11.035 ms/op 9.9838 ms/op 1.11
send data - 1000 512B messages 15.255 ms/op 13.871 ms/op 1.10
send data - 1000 1024B messages 25.035 ms/op 23.182 ms/op 1.08
send data - 1000 1200B messages 22.396 ms/op 16.333 ms/op 1.37
send data - 1000 2048B messages 24.947 ms/op 16.920 ms/op 1.47
send data - 1000 4096B messages 27.034 ms/op 20.485 ms/op 1.32
send data - 1000 16384B messages 54.444 ms/op 72.768 ms/op 0.75
send data - 1000 65536B messages 235.39 ms/op 239.12 ms/op 0.98
enrSubnets - fastDeserialize 64 bits 1.7120 us/op 1.6500 us/op 1.04
enrSubnets - ssz BitVector 64 bits 334.00 ns/op 499.00 ns/op 0.67
enrSubnets - fastDeserialize 4 bits 135.00 ns/op 313.00 ns/op 0.43
enrSubnets - ssz BitVector 4 bits 336.00 ns/op 481.00 ns/op 0.70
prioritizePeers score -10:0 att 32-0.1 sync 2-0 190.77 us/op 101.94 us/op 1.87
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 240.95 us/op 119.06 us/op 2.02
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 327.30 us/op 173.90 us/op 1.88
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 529.72 us/op 308.86 us/op 1.72
prioritizePeers score 0:0 att 64-1 sync 4-1 672.52 us/op 377.42 us/op 1.78
array of 16000 items push then shift 1.7324 us/op 1.1905 us/op 1.46
LinkedList of 16000 items push then shift 7.6300 ns/op 7.3260 ns/op 1.04
array of 16000 items push then pop 81.282 ns/op 63.805 ns/op 1.27
LinkedList of 16000 items push then pop 7.6460 ns/op 6.0270 ns/op 1.27
array of 24000 items push then shift 2.4461 us/op 1.7469 us/op 1.40
LinkedList of 24000 items push then shift 7.2370 ns/op 6.6590 ns/op 1.09
array of 24000 items push then pop 107.11 ns/op 90.226 ns/op 1.19
LinkedList of 24000 items push then pop 8.2320 ns/op 6.2020 ns/op 1.33
intersect bitArray bitLen 8 6.5040 ns/op 5.4970 ns/op 1.18
intersect array and set length 8 39.132 ns/op 33.052 ns/op 1.18
intersect bitArray bitLen 128 30.388 ns/op 26.673 ns/op 1.14
intersect array and set length 128 633.98 ns/op 540.27 ns/op 1.17
bitArray.getTrueBitIndexes() bitLen 128 1.2510 us/op 1.1360 us/op 1.10
bitArray.getTrueBitIndexes() bitLen 248 2.4960 us/op 1.8290 us/op 1.36
bitArray.getTrueBitIndexes() bitLen 512 4.7580 us/op 3.3600 us/op 1.42
Buffer.concat 32 items 704.00 ns/op 984.00 ns/op 0.72
Uint8Array.set 32 items 971.00 ns/op 1.7100 us/op 0.57
Buffer.copy 2.7920 us/op 2.1370 us/op 1.31
Uint8Array.set - with subarray 3.2500 us/op 1.9200 us/op 1.69
Uint8Array.set - without subarray 1.9480 us/op 974.00 ns/op 2.00
getUint32 - dataview 206.00 ns/op 370.00 ns/op 0.56
getUint32 - manual 127.00 ns/op 303.00 ns/op 0.42
Set add up to 64 items then delete first 2.2794 us/op 1.7125 us/op 1.33
OrderedSet add up to 64 items then delete first 3.3014 us/op 2.6615 us/op 1.24
Set add up to 64 items then delete last 2.3754 us/op 1.9465 us/op 1.22
OrderedSet add up to 64 items then delete last 3.8860 us/op 3.0738 us/op 1.26
Set add up to 64 items then delete middle 2.6122 us/op 1.9737 us/op 1.32
OrderedSet add up to 64 items then delete middle 5.3374 us/op 4.4211 us/op 1.21
Set add up to 128 items then delete first 5.2086 us/op 3.8022 us/op 1.37
OrderedSet add up to 128 items then delete first 7.5128 us/op 5.8161 us/op 1.29
Set add up to 128 items then delete last 5.1971 us/op 3.7282 us/op 1.39
OrderedSet add up to 128 items then delete last 7.8639 us/op 5.9354 us/op 1.32
Set add up to 128 items then delete middle 5.2693 us/op 3.7939 us/op 1.39
OrderedSet add up to 128 items then delete middle 14.053 us/op 13.866 us/op 1.01
Set add up to 256 items then delete first 10.699 us/op 7.5575 us/op 1.42
OrderedSet add up to 256 items then delete first 17.913 us/op 11.700 us/op 1.53
Set add up to 256 items then delete last 11.706 us/op 7.5164 us/op 1.56
OrderedSet add up to 256 items then delete last 17.294 us/op 12.048 us/op 1.44
Set add up to 256 items then delete middle 10.190 us/op 7.4031 us/op 1.38
OrderedSet add up to 256 items then delete middle 41.502 us/op 33.987 us/op 1.22
transfer serialized Status (84 B) 2.4560 us/op 1.9700 us/op 1.25
copy serialized Status (84 B) 1.3880 us/op 1.3580 us/op 1.02
transfer serialized SignedVoluntaryExit (112 B) 2.6580 us/op 2.0190 us/op 1.32
copy serialized SignedVoluntaryExit (112 B) 1.3270 us/op 1.2050 us/op 1.10
transfer serialized ProposerSlashing (416 B) 2.6140 us/op 2.0060 us/op 1.30
copy serialized ProposerSlashing (416 B) 1.8250 us/op 1.2160 us/op 1.50
transfer serialized Attestation (485 B) 3.4790 us/op 2.2070 us/op 1.58
copy serialized Attestation (485 B) 2.4650 us/op 1.3060 us/op 1.89
transfer serialized AttesterSlashing (33232 B) 3.3380 us/op 2.5610 us/op 1.30
copy serialized AttesterSlashing (33232 B) 4.5750 us/op 4.4880 us/op 1.02
transfer serialized Small SignedBeaconBlock (128000 B) 3.8460 us/op 2.8820 us/op 1.33
copy serialized Small SignedBeaconBlock (128000 B) 10.706 us/op 11.486 us/op 0.93
transfer serialized Avg SignedBeaconBlock (200000 B) 3.8610 us/op 3.0740 us/op 1.26
copy serialized Avg SignedBeaconBlock (200000 B) 15.295 us/op 15.780 us/op 0.97
transfer serialized BlobsSidecar (524380 B) 4.2550 us/op 3.4810 us/op 1.22
copy serialized BlobsSidecar (524380 B) 67.197 us/op 55.322 us/op 1.21
transfer serialized Big SignedBeaconBlock (1000000 B) 4.2800 us/op 4.3550 us/op 0.98
copy serialized Big SignedBeaconBlock (1000000 B) 120.96 us/op 106.26 us/op 1.14
pass gossip attestations to forkchoice per slot 2.8637 ms/op 2.4014 ms/op 1.19
forkChoice updateHead vc 100000 bc 64 eq 0 477.82 us/op 340.26 us/op 1.40
forkChoice updateHead vc 600000 bc 64 eq 0 3.0270 ms/op 2.2123 ms/op 1.37
forkChoice updateHead vc 1000000 bc 64 eq 0 4.9021 ms/op 3.8862 ms/op 1.26
forkChoice updateHead vc 600000 bc 320 eq 0 2.9621 ms/op 2.2560 ms/op 1.31
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9546 ms/op 2.3010 ms/op 1.28
forkChoice updateHead vc 600000 bc 7200 eq 0 3.0894 ms/op 2.3910 ms/op 1.29
forkChoice updateHead vc 600000 bc 64 eq 1000 10.525 ms/op 9.7194 ms/op 1.08
forkChoice updateHead vc 600000 bc 64 eq 10000 10.248 ms/op 9.5430 ms/op 1.07
forkChoice updateHead vc 600000 bc 64 eq 300000 13.381 ms/op 10.888 ms/op 1.23
computeDeltas 500000 validators 300 proto nodes 4.1712 ms/op 3.1188 ms/op 1.34
computeDeltas 500000 validators 1200 proto nodes 4.1486 ms/op 3.0974 ms/op 1.34
computeDeltas 500000 validators 7200 proto nodes 4.2461 ms/op 3.0863 ms/op 1.38
computeDeltas 750000 validators 300 proto nodes 6.6211 ms/op 4.7268 ms/op 1.40
computeDeltas 750000 validators 1200 proto nodes 6.3057 ms/op 4.7081 ms/op 1.34
computeDeltas 750000 validators 7200 proto nodes 6.4251 ms/op 4.8299 ms/op 1.33
computeDeltas 1400000 validators 300 proto nodes 11.293 ms/op 8.9770 ms/op 1.26
computeDeltas 1400000 validators 1200 proto nodes 11.249 ms/op 8.9358 ms/op 1.26
computeDeltas 1400000 validators 7200 proto nodes 11.438 ms/op 8.8640 ms/op 1.29
computeDeltas 2100000 validators 300 proto nodes 16.776 ms/op 13.434 ms/op 1.25
computeDeltas 2100000 validators 1200 proto nodes 16.697 ms/op 13.472 ms/op 1.24
computeDeltas 2100000 validators 7200 proto nodes 17.292 ms/op 13.431 ms/op 1.29
altair processAttestation - 250000 vs - 7PWei normalcase 2.1314 ms/op 1.8142 ms/op 1.17
altair processAttestation - 250000 vs - 7PWei worstcase 3.0046 ms/op 2.6287 ms/op 1.14
altair processAttestation - setStatus - 1/6 committees join 122.71 us/op 96.764 us/op 1.27
altair processAttestation - setStatus - 1/3 committees join 240.36 us/op 180.59 us/op 1.33
altair processAttestation - setStatus - 1/2 committees join 344.84 us/op 261.53 us/op 1.32
altair processAttestation - setStatus - 2/3 committees join 430.00 us/op 344.31 us/op 1.25
altair processAttestation - setStatus - 4/5 committees join 598.32 us/op 484.78 us/op 1.23
altair processAttestation - setStatus - 100% committees join 701.55 us/op 551.53 us/op 1.27
altair processBlock - 250000 vs - 7PWei normalcase 6.4554 ms/op 3.6764 ms/op 1.76
altair processBlock - 250000 vs - 7PWei normalcase hashState 37.442 ms/op 24.296 ms/op 1.54
altair processBlock - 250000 vs - 7PWei worstcase 44.437 ms/op 32.086 ms/op 1.38
altair processBlock - 250000 vs - 7PWei worstcase hashState 91.868 ms/op 87.756 ms/op 1.05
phase0 processBlock - 250000 vs - 7PWei normalcase 2.2476 ms/op 1.2902 ms/op 1.74
phase0 processBlock - 250000 vs - 7PWei worstcase 27.148 ms/op 22.622 ms/op 1.20
altair processEth1Data - 250000 vs - 7PWei normalcase 373.90 us/op 274.03 us/op 1.36
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.0000 us/op 5.1970 us/op 1.35
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 52.857 us/op 33.487 us/op 1.58
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 13.344 us/op 8.7920 us/op 1.52
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.5020 us/op 5.5000 us/op 1.55
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 211.20 us/op 87.519 us/op 2.41
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.2627 ms/op 1.3411 ms/op 1.69
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4668 ms/op 1.6793 ms/op 1.47
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.4395 ms/op 1.7895 ms/op 1.36
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.7578 ms/op 3.9404 ms/op 1.21
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.6836 ms/op 1.8229 ms/op 1.47
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.2188 ms/op 3.9178 ms/op 1.59
Tree 40 250000 create 477.57 ms/op 344.76 ms/op 1.39
Tree 40 250000 get(125000) 145.83 ns/op 100.24 ns/op 1.45
Tree 40 250000 set(125000) 1.6350 us/op 1.2239 us/op 1.34
Tree 40 250000 toArray() 20.451 ms/op 15.198 ms/op 1.35
Tree 40 250000 iterate all - toArray() + loop 21.333 ms/op 13.712 ms/op 1.56
Tree 40 250000 iterate all - get(i) 57.838 ms/op 41.841 ms/op 1.38
Array 250000 create 2.7274 ms/op 2.4345 ms/op 1.12
Array 250000 clone - spread 1.4675 ms/op 624.94 us/op 2.35
Array 250000 get(125000) 0.42800 ns/op 0.56400 ns/op 0.76
Array 250000 set(125000) 0.43700 ns/op 0.57000 ns/op 0.77
Array 250000 iterate all - loop 83.776 us/op 72.985 us/op 1.15
phase0 afterProcessEpoch - 250000 vs - 7PWei 43.275 ms/op 38.186 ms/op 1.13
Array.fill - length 1000000 3.3775 ms/op 2.4411 ms/op 1.38
Array push - length 1000000 14.959 ms/op 12.721 ms/op 1.18
Array.get 0.27987 ns/op 0.26255 ns/op 1.07
Uint8Array.get 0.45107 ns/op 0.34223 ns/op 1.32
phase0 beforeProcessEpoch - 250000 vs - 7PWei 18.350 ms/op 14.491 ms/op 1.27
altair processEpoch - mainnet_e81889 272.48 ms/op 287.64 ms/op 0.95
mainnet_e81889 - altair beforeProcessEpoch 19.627 ms/op 14.290 ms/op 1.37
mainnet_e81889 - altair processJustificationAndFinalization 6.7990 us/op 5.7520 us/op 1.18
mainnet_e81889 - altair processInactivityUpdates 5.1979 ms/op 3.7485 ms/op 1.39
mainnet_e81889 - altair processRewardsAndPenalties 41.019 ms/op 47.309 ms/op 0.87
mainnet_e81889 - altair processRegistryUpdates 734.00 ns/op 839.00 ns/op 0.87
mainnet_e81889 - altair processSlashings 195.00 ns/op 398.00 ns/op 0.49
mainnet_e81889 - altair processEth1DataReset 208.00 ns/op 393.00 ns/op 0.53
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2761 ms/op 920.75 us/op 1.39
mainnet_e81889 - altair processSlashingsReset 980.00 ns/op 1.2240 us/op 0.80
mainnet_e81889 - altair processRandaoMixesReset 1.2640 us/op 1.4790 us/op 0.85
mainnet_e81889 - altair processHistoricalRootsUpdate 183.00 ns/op 385.00 ns/op 0.48
mainnet_e81889 - altair processParticipationFlagUpdates 598.00 ns/op 688.00 ns/op 0.87
mainnet_e81889 - altair processSyncCommitteeUpdates 149.00 ns/op 360.00 ns/op 0.41
mainnet_e81889 - altair afterProcessEpoch 46.100 ms/op 41.308 ms/op 1.12
capella processEpoch - mainnet_e217614 1.0905 s/op 810.03 ms/op 1.35
mainnet_e217614 - capella beforeProcessEpoch 67.623 ms/op 61.704 ms/op 1.10
mainnet_e217614 - capella processJustificationAndFinalization 6.1100 us/op 4.4990 us/op 1.36
mainnet_e217614 - capella processInactivityUpdates 16.172 ms/op 11.358 ms/op 1.42
mainnet_e217614 - capella processRewardsAndPenalties 201.45 ms/op 186.51 ms/op 1.08
mainnet_e217614 - capella processRegistryUpdates 6.8340 us/op 7.4230 us/op 0.92
mainnet_e217614 - capella processSlashings 206.00 ns/op 403.00 ns/op 0.51
mainnet_e217614 - capella processEth1DataReset 200.00 ns/op 413.00 ns/op 0.48
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.2589 ms/op 3.4869 ms/op 1.22
mainnet_e217614 - capella processSlashingsReset 950.00 ns/op 1.0540 us/op 0.90
mainnet_e217614 - capella processRandaoMixesReset 1.3160 us/op 1.5000 us/op 0.88
mainnet_e217614 - capella processHistoricalRootsUpdate 191.00 ns/op 429.00 ns/op 0.45
mainnet_e217614 - capella processParticipationFlagUpdates 533.00 ns/op 747.00 ns/op 0.71
mainnet_e217614 - capella afterProcessEpoch 122.30 ms/op 109.06 ms/op 1.12
phase0 processEpoch - mainnet_e58758 302.19 ms/op 329.71 ms/op 0.92
mainnet_e58758 - phase0 beforeProcessEpoch 81.996 ms/op 81.007 ms/op 1.01
mainnet_e58758 - phase0 processJustificationAndFinalization 6.4110 us/op 6.7390 us/op 0.95
mainnet_e58758 - phase0 processRewardsAndPenalties 40.675 ms/op 39.423 ms/op 1.03
mainnet_e58758 - phase0 processRegistryUpdates 3.2890 us/op 3.3700 us/op 0.98
mainnet_e58758 - phase0 processSlashings 201.00 ns/op 415.00 ns/op 0.48
mainnet_e58758 - phase0 processEth1DataReset 206.00 ns/op 413.00 ns/op 0.50
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.2894 ms/op 1.0169 ms/op 2.25
mainnet_e58758 - phase0 processSlashingsReset 1.1720 us/op 1.0190 us/op 1.15
mainnet_e58758 - phase0 processRandaoMixesReset 1.3240 us/op 1.5560 us/op 0.85
mainnet_e58758 - phase0 processHistoricalRootsUpdate 210.00 ns/op 415.00 ns/op 0.51
mainnet_e58758 - phase0 processParticipationRecordUpdates 984.00 ns/op 1.2450 us/op 0.79
mainnet_e58758 - phase0 afterProcessEpoch 38.012 ms/op 34.570 ms/op 1.10
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3841 ms/op 961.12 us/op 1.44
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.2436 ms/op 1.5177 ms/op 1.48
altair processInactivityUpdates - 250000 normalcase 20.111 ms/op 16.114 ms/op 1.25
altair processInactivityUpdates - 250000 worstcase 20.120 ms/op 21.295 ms/op 0.94
phase0 processRegistryUpdates - 250000 normalcase 13.343 us/op 5.8020 us/op 2.30
phase0 processRegistryUpdates - 250000 badcase_full_deposits 344.57 us/op 298.67 us/op 1.15
phase0 processRegistryUpdates - 250000 worstcase 0.5 120.85 ms/op 112.04 ms/op 1.08
altair processRewardsAndPenalties - 250000 normalcase 30.867 ms/op 26.392 ms/op 1.17
altair processRewardsAndPenalties - 250000 worstcase 29.029 ms/op 24.634 ms/op 1.18
phase0 getAttestationDeltas - 250000 normalcase 11.750 ms/op 6.2650 ms/op 1.88
phase0 getAttestationDeltas - 250000 worstcase 7.9557 ms/op 4.8759 ms/op 1.63
phase0 processSlashings - 250000 worstcase 111.69 us/op 93.927 us/op 1.19
altair processSyncCommitteeUpdates - 250000 11.973 ms/op 10.350 ms/op 1.16
BeaconState.hashTreeRoot - No change 247.00 ns/op 434.00 ns/op 0.57
BeaconState.hashTreeRoot - 1 full validator 105.47 us/op 79.101 us/op 1.33
BeaconState.hashTreeRoot - 32 full validator 931.89 us/op 853.98 us/op 1.09
BeaconState.hashTreeRoot - 512 full validator 10.414 ms/op 10.419 ms/op 1.00
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 116.53 us/op 96.178 us/op 1.21
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5849 ms/op 1.5139 ms/op 1.05
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 24.494 ms/op 20.476 ms/op 1.20
BeaconState.hashTreeRoot - 1 balances 79.822 us/op 61.458 us/op 1.30
BeaconState.hashTreeRoot - 32 balances 820.29 us/op 713.52 us/op 1.15
BeaconState.hashTreeRoot - 512 balances 8.6631 ms/op 7.7501 ms/op 1.12
BeaconState.hashTreeRoot - 250000 balances 192.68 ms/op 209.11 ms/op 0.92
aggregationBits - 2048 els - zipIndexesInBitList 26.184 us/op 18.430 us/op 1.42
byteArrayEquals 32 56.773 ns/op 48.320 ns/op 1.17
Buffer.compare 32 18.778 ns/op 16.288 ns/op 1.15
byteArrayEquals 1024 1.6837 us/op 1.3082 us/op 1.29
Buffer.compare 1024 27.184 ns/op 23.143 ns/op 1.17
byteArrayEquals 16384 27.046 us/op 20.697 us/op 1.31
Buffer.compare 16384 226.18 ns/op 206.07 ns/op 1.10
byteArrayEquals 123687377 204.89 ms/op 153.29 ms/op 1.34
Buffer.compare 123687377 8.5984 ms/op 5.1760 ms/op 1.66
byteArrayEquals 32 - diff last byte 57.068 ns/op 48.124 ns/op 1.19
Buffer.compare 32 - diff last byte 19.148 ns/op 15.951 ns/op 1.20
byteArrayEquals 1024 - diff last byte 1.6990 us/op 1.2848 us/op 1.32
Buffer.compare 1024 - diff last byte 27.843 ns/op 22.954 ns/op 1.21
byteArrayEquals 16384 - diff last byte 26.159 us/op 20.390 us/op 1.28
Buffer.compare 16384 - diff last byte 209.70 ns/op 174.70 ns/op 1.20
byteArrayEquals 123687377 - diff last byte 205.20 ms/op 153.34 ms/op 1.34
Buffer.compare 123687377 - diff last byte 15.660 ms/op 5.3046 ms/op 2.95
byteArrayEquals 32 - random bytes 5.3470 ns/op 4.8830 ns/op 1.10
Buffer.compare 32 - random bytes 18.222 ns/op 15.846 ns/op 1.15
byteArrayEquals 1024 - random bytes 5.3210 ns/op 4.9030 ns/op 1.09
Buffer.compare 1024 - random bytes 18.167 ns/op 15.854 ns/op 1.15
byteArrayEquals 16384 - random bytes 5.3280 ns/op 5.1780 ns/op 1.03
Buffer.compare 16384 - random bytes 17.908 ns/op 15.829 ns/op 1.13
byteArrayEquals 123687377 - random bytes 7.8800 ns/op 7.7100 ns/op 1.02
Buffer.compare 123687377 - random bytes 20.620 ns/op 18.780 ns/op 1.10
regular array get 100000 times 40.022 us/op 30.855 us/op 1.30
wrappedArray get 100000 times 34.348 us/op 30.826 us/op 1.11
arrayWithProxy get 100000 times 13.535 ms/op 9.4068 ms/op 1.44
ssz.Root.equals 48.058 ns/op 42.481 ns/op 1.13
byteArrayEquals 47.176 ns/op 38.900 ns/op 1.21
Buffer.compare 10.659 ns/op 9.3560 ns/op 1.14
processSlot - 1 slots 13.473 us/op 8.6730 us/op 1.55
processSlot - 32 slots 3.9342 ms/op 1.9341 ms/op 2.03
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 7.9028 ms/op 2.0352 ms/op 3.88
getCommitteeAssignments - req 1 vs - 250000 vc 2.2369 ms/op 1.8119 ms/op 1.23
getCommitteeAssignments - req 100 vs - 250000 vc 4.3908 ms/op 3.5559 ms/op 1.23
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7686 ms/op 3.7612 ms/op 1.27
findModifiedValidators - 10000 modified validators 1.0588 s/op 753.07 ms/op 1.41
findModifiedValidators - 1000 modified validators 783.94 ms/op 659.23 ms/op 1.19
findModifiedValidators - 100 modified validators 280.67 ms/op 156.34 ms/op 1.80
findModifiedValidators - 10 modified validators 177.32 ms/op 126.52 ms/op 1.40
findModifiedValidators - 1 modified validators 207.50 ms/op 144.36 ms/op 1.44
findModifiedValidators - no difference 161.46 ms/op 134.69 ms/op 1.20
compare ViewDUs 6.5998 s/op 6.0387 s/op 1.09
compare each validator Uint8Array 1.7796 s/op 1.7370 s/op 1.02
compare ViewDU to Uint8Array 1.3481 s/op 752.16 ms/op 1.79
migrate state 1000000 validators, 24 modified, 0 new 972.86 ms/op 885.90 ms/op 1.10
migrate state 1000000 validators, 1700 modified, 1000 new 1.4563 s/op 1.1730 s/op 1.24
migrate state 1000000 validators, 3400 modified, 2000 new 1.6109 s/op 1.1768 s/op 1.37
migrate state 1500000 validators, 24 modified, 0 new 998.56 ms/op 865.09 ms/op 1.15
migrate state 1500000 validators, 1700 modified, 1000 new 1.4263 s/op 1.0041 s/op 1.42
migrate state 1500000 validators, 3400 modified, 2000 new 1.5159 s/op 1.1897 s/op 1.27
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.3600 ns/op 5.9200 ns/op 0.91
state getBlockRootAtSlot - 250000 vs - 7PWei 625.25 ns/op 461.63 ns/op 1.35
naive computeProposerIndex 100000 validators 68.313 ms/op 43.241 ms/op 1.58
computeProposerIndex 100000 validators 1.7179 ms/op 1.2903 ms/op 1.33
naiveGetNextSyncCommitteeIndices 1000 validators 9.8044 s/op 5.9698 s/op 1.64
getNextSyncCommitteeIndices 1000 validators 172.47 ms/op 94.107 ms/op 1.83
naiveGetNextSyncCommitteeIndices 10000 validators 10.064 s/op 5.9797 s/op 1.68
getNextSyncCommitteeIndices 10000 validators 179.60 ms/op 92.895 ms/op 1.93
naiveGetNextSyncCommitteeIndices 100000 validators 9.2621 s/op 6.5229 s/op 1.42
getNextSyncCommitteeIndices 100000 validators 130.01 ms/op 89.003 ms/op 1.46
naive computeShuffledIndex 100000 validators 29.255 s/op 20.593 s/op 1.42
cached computeShuffledIndex 100000 validators 590.59 ms/op 474.60 ms/op 1.24
naive computeShuffledIndex 2000000 validators 509.75 s/op 391.25 s/op 1.30
cached computeShuffledIndex 2000000 validators 40.384 s/op 42.453 s/op 0.95
computeProposers - vc 250000 631.96 us/op 697.87 us/op 0.91
computeEpochShuffling - vc 250000 43.627 ms/op 45.918 ms/op 0.95
getNextSyncCommittee - vc 250000 10.790 ms/op 13.342 ms/op 0.81
computeSigningRoot for AttestationData 21.469 us/op 21.554 us/op 1.00
hash AttestationData serialized data then Buffer.toString(base64) 1.6542 us/op 1.2563 us/op 1.32
toHexString serialized data 1.3806 us/op 1.0472 us/op 1.32
Buffer.toString(base64) 173.61 ns/op 169.24 ns/op 1.03
nodejs block root to RootHex using toHex 147.46 ns/op 108.35 ns/op 1.36
nodejs block root to RootHex using toRootHex 93.605 ns/op 73.121 ns/op 1.28
browser block root to RootHex using the deprecated toHexString 255.19 ns/op 196.17 ns/op 1.30
browser block root to RootHex using toHex 196.57 ns/op 269.74 ns/op 0.73
browser block root to RootHex using toRootHex 187.27 ns/op 221.20 ns/op 0.85

by benchmarkbot/action

@nflaig nflaig marked this pull request as ready for review June 26, 2025 16:18
@nflaig nflaig requested a review from a team as a code owner June 26, 2025 16:18
Copy link
Contributor

@ensi321 ensi321 left a comment

Choose a reason for hiding this comment

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

Clean 👍

Copy link
Contributor

@twoeths twoeths left a comment

Choose a reason for hiding this comment

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

while I see how straightforward it is to bring processAttestation reward computation to this flow, we need to also consider how this affects blockprint because we change our algorithm and how unique we are compared to other client (which the old algorithm is)

with our total consolidations are < 8 most of the time, this will not bring better block profit compared to our current sort algorithm

I'd keep the old sorting algorithm and put this new sorting algorithm as a comment or refer to it somewhere so that it give us more insights when we have to revisit this later, unless metrics show we have better profit with this

@nflaig
Copy link
Member Author

nflaig commented Jun 27, 2025

As noted by Michael, keeping the current sorting / scoring is good for blockprint as it’s slightly different from other clients and should help differentiate Lodestar.

I also tend towards just closing this for now and revisit in the future / in different network conditions as it could make a difference during non-finality when there are a lot of different votes (less consolidation) + missed slots which require us to fill up the block most of the time.

@nflaig
Copy link
Member Author

nflaig commented Jun 27, 2025

created an issue #8019 to keep track of this

@nflaig nflaig closed this Jun 27, 2025
@nflaig nflaig reopened this Jul 1, 2025
@nflaig nflaig marked this pull request as draft July 1, 2025 07:36
@nflaig
Copy link
Member Author

nflaig commented Jul 20, 2025

based on data from running this on feat2-mainnet-hzax41 it shows the same block values as stable branch as there are not many (if any) cases where we fully pack the block and hence sorting does not make a difference

it makes sense to re-test this branch in a non-finality network or once we have implemented #8028

@nflaig
Copy link
Member Author

nflaig commented Aug 26, 2025

@twoeths any reason we shouldn't improve our scoring now that blockprint is dead? it's bit theoretical right now as it might just make a difference in unstable network, we can also wait for #8076

@twoeths
Copy link
Contributor

twoeths commented Aug 27, 2025

@twoeths any reason we shouldn't improve our scoring now that blockprint is dead? it's bit theoretical right now as it might just make a difference in unstable network, we can also wait for #8076

no reason, I think we can merge this. I'm not sure when can I continue with SingleAttestation inclusion for block production anyway.

@nflaig nflaig marked this pull request as ready for review August 27, 2025 03:42
@nflaig
Copy link
Member Author

nflaig commented Aug 27, 2025

/gemini review

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 updates the scoring mechanism for attestations to maximize block profitability. The new logic correctly uses participation flags (timely source, target, and head) and their associated weights to score attestations, which is a more accurate model of the actual proposer rewards compared to the previous heuristic. The implementation looks solid. I've added one suggestion to improve the readability of the weight calculation logic.

@nflaig nflaig merged commit dc288bc into unstable Aug 27, 2025
19 of 20 checks passed
@nflaig nflaig deleted the nflaig/score-by-profitability branch August 27, 2025 13:21
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.34.0 🎉

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.

Sort attestations for block by profitability

5 participants