Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update snappy frame decompress #7333

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

wemeetagain
Copy link
Member

Motivation

Description

  • Add checksum check
  • Add skippable chunk type
  • Add data length check

@wemeetagain wemeetagain requested a review from a team as a code owner January 6, 2025 18:42
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 80.76923% with 10 lines in your changes missing coverage. Please review.

Project coverage is 48.76%. Comparing base (ad8c10e) to head (6f7200d).
Report is 7 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7333      +/-   ##
============================================
+ Coverage     48.75%   48.76%   +0.01%     
============================================
  Files           601      601              
  Lines         40222    40243      +21     
  Branches       2061     2067       +6     
============================================
+ Hits          19609    19626      +17     
- Misses        20575    20579       +4     
  Partials         38       38              

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 69617d3 Previous: cb1c695 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.7786 ms/op 1.6601 ms/op 1.07
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 69.185 us/op 39.860 us/op 1.74
BLS verify - blst 1.0453 ms/op 826.45 us/op 1.26
BLS verifyMultipleSignatures 3 - blst 1.5109 ms/op 1.3456 ms/op 1.12
BLS verifyMultipleSignatures 8 - blst 2.1514 ms/op 1.7238 ms/op 1.25
BLS verifyMultipleSignatures 32 - blst 6.3298 ms/op 4.3089 ms/op 1.47
BLS verifyMultipleSignatures 64 - blst 11.941 ms/op 8.2713 ms/op 1.44
BLS verifyMultipleSignatures 128 - blst 18.650 ms/op 16.435 ms/op 1.13
BLS deserializing 10000 signatures 728.35 ms/op 664.89 ms/op 1.10
BLS deserializing 100000 signatures 7.1025 s/op 6.3698 s/op 1.12
BLS verifyMultipleSignatures - same message - 3 - blst 1.0777 ms/op 918.41 us/op 1.17
BLS verifyMultipleSignatures - same message - 8 - blst 1.1041 ms/op 1.1009 ms/op 1.00
BLS verifyMultipleSignatures - same message - 32 - blst 1.7988 ms/op 1.7223 ms/op 1.04
BLS verifyMultipleSignatures - same message - 64 - blst 2.6493 ms/op 2.6255 ms/op 1.01
BLS verifyMultipleSignatures - same message - 128 - blst 4.4246 ms/op 4.1633 ms/op 1.06
BLS aggregatePubkeys 32 - blst 20.947 us/op 20.053 us/op 1.04
BLS aggregatePubkeys 128 - blst 74.338 us/op 68.946 us/op 1.08
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 68.389 ms/op 62.047 ms/op 1.10
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 60.781 ms/op 52.831 ms/op 1.15
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 57.035 ms/op 50.154 ms/op 1.14
getSlashingsAndExits - default max 135.22 us/op 103.19 us/op 1.31
getSlashingsAndExits - 2k 545.64 us/op 569.84 us/op 0.96
proposeBlockBody type=full, size=empty 6.5881 ms/op 6.4607 ms/op 1.02
isKnown best case - 1 super set check 336.00 ns/op 742.00 ns/op 0.45
isKnown normal case - 2 super set checks 480.00 ns/op 837.00 ns/op 0.57
isKnown worse case - 16 super set checks 418.00 ns/op 745.00 ns/op 0.56
InMemoryCheckpointStateCache - add get delete 3.1390 us/op 4.2870 us/op 0.73
validate api signedAggregateAndProof - struct 1.7417 ms/op 1.5309 ms/op 1.14
validate gossip signedAggregateAndProof - struct 1.7015 ms/op 1.5070 ms/op 1.13
batch validate gossip attestation - vc 640000 - chunk 32 146.07 us/op 144.01 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 64 146.08 us/op 130.14 us/op 1.12
batch validate gossip attestation - vc 640000 - chunk 128 128.12 us/op 118.34 us/op 1.08
batch validate gossip attestation - vc 640000 - chunk 256 125.02 us/op 115.15 us/op 1.09
pickEth1Vote - no votes 1.2182 ms/op 1.0891 ms/op 1.12
pickEth1Vote - max votes 8.5127 ms/op 8.0975 ms/op 1.05
pickEth1Vote - Eth1Data hashTreeRoot value x2048 17.678 ms/op 23.771 ms/op 0.74
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 28.389 ms/op 34.667 ms/op 0.82
pickEth1Vote - Eth1Data fastSerialize value x2048 660.92 us/op 649.35 us/op 1.02
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.1037 ms/op 4.5708 ms/op 0.90
bytes32 toHexString 797.00 ns/op 1.0550 us/op 0.76
bytes32 Buffer.toString(hex) 286.00 ns/op 471.00 ns/op 0.61
bytes32 Buffer.toString(hex) from Uint8Array 563.00 ns/op 674.00 ns/op 0.84
bytes32 Buffer.toString(hex) + 0x 285.00 ns/op 483.00 ns/op 0.59
Object access 1 prop 0.23300 ns/op 0.38700 ns/op 0.60
Map access 1 prop 0.15600 ns/op 0.41700 ns/op 0.37
Object get x1000 6.9330 ns/op 5.8110 ns/op 1.19
Map get x1000 7.3940 ns/op 6.1190 ns/op 1.21
Object set x1000 59.203 ns/op 52.040 ns/op 1.14
Map set x1000 41.913 ns/op 35.970 ns/op 1.17
Return object 10000 times 0.33360 ns/op 0.33020 ns/op 1.01
Throw Error 10000 times 3.5651 us/op 2.8615 us/op 1.25
toHex 187.16 ns/op 157.50 ns/op 1.19
Buffer.from 170.44 ns/op 137.64 ns/op 1.24
shared Buffer 108.46 ns/op 92.941 ns/op 1.17
fastMsgIdFn sha256 / 200 bytes 2.7610 us/op 2.3930 us/op 1.15
fastMsgIdFn h32 xxhash / 200 bytes 350.00 ns/op 530.00 ns/op 0.66
fastMsgIdFn h64 xxhash / 200 bytes 310.00 ns/op 494.00 ns/op 0.63
fastMsgIdFn sha256 / 1000 bytes 8.1240 us/op 6.6290 us/op 1.23
fastMsgIdFn h32 xxhash / 1000 bytes 475.00 ns/op 672.00 ns/op 0.71
fastMsgIdFn h64 xxhash / 1000 bytes 395.00 ns/op 606.00 ns/op 0.65
fastMsgIdFn sha256 / 10000 bytes 72.845 us/op 57.444 us/op 1.27
fastMsgIdFn h32 xxhash / 10000 bytes 2.1680 us/op 2.1050 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 1.3190 us/op 1.3990 us/op 0.94
send data - 1000 256B messages 17.238 ms/op 13.167 ms/op 1.31
send data - 1000 512B messages 21.364 ms/op 21.847 ms/op 0.98
send data - 1000 1024B messages 31.642 ms/op 26.800 ms/op 1.18
send data - 1000 1200B messages 31.511 ms/op 19.199 ms/op 1.64
send data - 1000 2048B messages 40.310 ms/op 33.474 ms/op 1.20
send data - 1000 4096B messages 40.595 ms/op 29.572 ms/op 1.37
send data - 1000 16384B messages 87.870 ms/op 70.779 ms/op 1.24
send data - 1000 65536B messages 257.68 ms/op 244.00 ms/op 1.06
enrSubnets - fastDeserialize 64 bits 1.6770 us/op 1.1830 us/op 1.42
enrSubnets - ssz BitVector 64 bits 499.00 ns/op 629.00 ns/op 0.79
enrSubnets - fastDeserialize 4 bits 234.00 ns/op 393.00 ns/op 0.60
enrSubnets - ssz BitVector 4 bits 504.00 ns/op 649.00 ns/op 0.78
prioritizePeers score -10:0 att 32-0.1 sync 2-0 211.77 us/op 151.99 us/op 1.39
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 228.16 us/op 149.88 us/op 1.52
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 343.49 us/op 229.09 us/op 1.50
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 563.54 us/op 361.46 us/op 1.56
prioritizePeers score 0:0 att 64-1 sync 4-1 727.30 us/op 477.53 us/op 1.52
array of 16000 items push then shift 1.7651 us/op 1.3750 us/op 1.28
LinkedList of 16000 items push then shift 8.6380 ns/op 6.9760 ns/op 1.24
array of 16000 items push then pop 136.78 ns/op 118.98 ns/op 1.15
LinkedList of 16000 items push then pop 8.3800 ns/op 6.6040 ns/op 1.27
array of 24000 items push then shift 2.6666 us/op 2.0040 us/op 1.33
LinkedList of 24000 items push then shift 9.0030 ns/op 7.1330 ns/op 1.26
array of 24000 items push then pop 186.35 ns/op 148.62 ns/op 1.25
LinkedList of 24000 items push then pop 8.0350 ns/op 7.9040 ns/op 1.02
intersect bitArray bitLen 8 6.8120 ns/op 5.4050 ns/op 1.26
intersect array and set length 8 65.801 ns/op 55.098 ns/op 1.19
intersect bitArray bitLen 128 32.337 ns/op 26.484 ns/op 1.22
intersect array and set length 128 884.95 ns/op 633.82 ns/op 1.40
bitArray.getTrueBitIndexes() bitLen 128 1.6770 us/op 1.9220 us/op 0.87
bitArray.getTrueBitIndexes() bitLen 248 2.9440 us/op 3.0990 us/op 0.95
bitArray.getTrueBitIndexes() bitLen 512 6.2130 us/op 4.7510 us/op 1.31
Buffer.concat 32 items 908.00 ns/op 1.0850 us/op 0.84
Uint8Array.set 32 items 1.9150 us/op 2.1130 us/op 0.91
Buffer.copy 2.9910 us/op 2.8990 us/op 1.03
Uint8Array.set - with subarray 3.0060 us/op 3.0370 us/op 0.99
Uint8Array.set - without subarray 1.7870 us/op 2.0910 us/op 0.85
getUint32 - dataview 305.00 ns/op 455.00 ns/op 0.67
getUint32 - manual 257.00 ns/op 405.00 ns/op 0.63
Set add up to 64 items then delete first 2.9835 us/op 1.8229 us/op 1.64
OrderedSet add up to 64 items then delete first 4.6781 us/op 2.7979 us/op 1.67
Set add up to 64 items then delete last 3.4172 us/op 2.0589 us/op 1.66
OrderedSet add up to 64 items then delete last 5.2004 us/op 3.1210 us/op 1.67
Set add up to 64 items then delete middle 3.4584 us/op 2.1337 us/op 1.62
OrderedSet add up to 64 items then delete middle 7.2312 us/op 4.9066 us/op 1.47
Set add up to 128 items then delete first 7.6632 us/op 4.2465 us/op 1.80
OrderedSet add up to 128 items then delete first 11.404 us/op 6.6944 us/op 1.70
Set add up to 128 items then delete last 8.2934 us/op 4.0376 us/op 2.05
OrderedSet add up to 128 items then delete last 10.624 us/op 6.0265 us/op 1.76
Set add up to 128 items then delete middle 6.6379 us/op 4.0094 us/op 1.66
OrderedSet add up to 128 items then delete middle 17.553 us/op 12.619 us/op 1.39
Set add up to 256 items then delete first 13.948 us/op 8.3477 us/op 1.67
OrderedSet add up to 256 items then delete first 21.646 us/op 13.287 us/op 1.63
Set add up to 256 items then delete last 14.191 us/op 8.2710 us/op 1.72
OrderedSet add up to 256 items then delete last 22.381 us/op 12.535 us/op 1.79
Set add up to 256 items then delete middle 12.697 us/op 7.6165 us/op 1.67
OrderedSet add up to 256 items then delete middle 48.749 us/op 35.660 us/op 1.37
transfer serialized Status (84 B) 3.3480 us/op 2.6420 us/op 1.27
copy serialized Status (84 B) 1.6800 us/op 1.6150 us/op 1.04
transfer serialized SignedVoluntaryExit (112 B) 3.2710 us/op 2.7080 us/op 1.21
copy serialized SignedVoluntaryExit (112 B) 1.7650 us/op 1.5510 us/op 1.14
transfer serialized ProposerSlashing (416 B) 4.0200 us/op 2.5420 us/op 1.58
copy serialized ProposerSlashing (416 B) 2.2640 us/op 2.1510 us/op 1.05
transfer serialized Attestation (485 B) 3.6190 us/op 3.0270 us/op 1.20
copy serialized Attestation (485 B) 2.2140 us/op 2.2630 us/op 0.98
transfer serialized AttesterSlashing (33232 B) 3.2110 us/op 3.6510 us/op 0.88
copy serialized AttesterSlashing (33232 B) 7.9150 us/op 5.3610 us/op 1.48
transfer serialized Small SignedBeaconBlock (128000 B) 3.9460 us/op 3.4700 us/op 1.14
copy serialized Small SignedBeaconBlock (128000 B) 26.015 us/op 11.235 us/op 2.32
transfer serialized Avg SignedBeaconBlock (200000 B) 5.1060 us/op 3.4520 us/op 1.48
copy serialized Avg SignedBeaconBlock (200000 B) 43.665 us/op 16.287 us/op 2.68
transfer serialized BlobsSidecar (524380 B) 7.0050 us/op 4.5440 us/op 1.54
copy serialized BlobsSidecar (524380 B) 135.94 us/op 74.461 us/op 1.83
transfer serialized Big SignedBeaconBlock (1000000 B) 6.4230 us/op 5.1180 us/op 1.25
copy serialized Big SignedBeaconBlock (1000000 B) 187.20 us/op 214.99 us/op 0.87
pass gossip attestations to forkchoice per slot 3.1857 ms/op 2.3342 ms/op 1.36
forkChoice updateHead vc 100000 bc 64 eq 0 555.45 us/op 428.93 us/op 1.29
forkChoice updateHead vc 600000 bc 64 eq 0 4.7538 ms/op 2.3517 ms/op 2.02
forkChoice updateHead vc 1000000 bc 64 eq 0 5.7646 ms/op 3.4103 ms/op 1.69
forkChoice updateHead vc 600000 bc 320 eq 0 3.2109 ms/op 2.0128 ms/op 1.60
forkChoice updateHead vc 600000 bc 1200 eq 0 3.3082 ms/op 2.1008 ms/op 1.57
forkChoice updateHead vc 600000 bc 7200 eq 0 4.6843 ms/op 2.5505 ms/op 1.84
forkChoice updateHead vc 600000 bc 64 eq 1000 10.724 ms/op 9.5955 ms/op 1.12
forkChoice updateHead vc 600000 bc 64 eq 10000 10.605 ms/op 9.5008 ms/op 1.12
forkChoice updateHead vc 600000 bc 64 eq 300000 16.429 ms/op 11.599 ms/op 1.42
computeDeltas 500000 validators 300 proto nodes 4.9023 ms/op 3.3909 ms/op 1.45
computeDeltas 500000 validators 1200 proto nodes 5.4759 ms/op 3.3520 ms/op 1.63
computeDeltas 500000 validators 7200 proto nodes 4.6378 ms/op 3.3739 ms/op 1.37
computeDeltas 750000 validators 300 proto nodes 6.6283 ms/op 5.2176 ms/op 1.27
computeDeltas 750000 validators 1200 proto nodes 6.6200 ms/op 5.0503 ms/op 1.31
computeDeltas 750000 validators 7200 proto nodes 6.8142 ms/op 4.9978 ms/op 1.36
computeDeltas 1400000 validators 300 proto nodes 12.407 ms/op 9.2617 ms/op 1.34
computeDeltas 1400000 validators 1200 proto nodes 12.047 ms/op 9.3861 ms/op 1.28
computeDeltas 1400000 validators 7200 proto nodes 12.807 ms/op 9.3479 ms/op 1.37
computeDeltas 2100000 validators 300 proto nodes 17.997 ms/op 14.281 ms/op 1.26
computeDeltas 2100000 validators 1200 proto nodes 18.197 ms/op 14.046 ms/op 1.30
computeDeltas 2100000 validators 7200 proto nodes 18.432 ms/op 14.141 ms/op 1.30
altair processAttestation - 250000 vs - 7PWei normalcase 2.1045 ms/op 1.8524 ms/op 1.14
altair processAttestation - 250000 vs - 7PWei worstcase 2.8878 ms/op 2.3555 ms/op 1.23
altair processAttestation - setStatus - 1/6 committees join 130.89 us/op 96.613 us/op 1.35
altair processAttestation - setStatus - 1/3 committees join 254.41 us/op 186.50 us/op 1.36
altair processAttestation - setStatus - 1/2 committees join 368.12 us/op 273.94 us/op 1.34
altair processAttestation - setStatus - 2/3 committees join 449.08 us/op 365.68 us/op 1.23
altair processAttestation - setStatus - 4/5 committees join 615.82 us/op 495.37 us/op 1.24
altair processAttestation - setStatus - 100% committees join 741.83 us/op 614.64 us/op 1.21
altair processBlock - 250000 vs - 7PWei normalcase 4.9151 ms/op 3.4936 ms/op 1.41
altair processBlock - 250000 vs - 7PWei normalcase hashState 29.421 ms/op 28.181 ms/op 1.04
altair processBlock - 250000 vs - 7PWei worstcase 40.624 ms/op 35.396 ms/op 1.15
altair processBlock - 250000 vs - 7PWei worstcase hashState 73.015 ms/op 68.471 ms/op 1.07
phase0 processBlock - 250000 vs - 7PWei normalcase 2.3930 ms/op 1.7083 ms/op 1.40
phase0 processBlock - 250000 vs - 7PWei worstcase 26.392 ms/op 21.847 ms/op 1.21
altair processEth1Data - 250000 vs - 7PWei normalcase 367.51 us/op 270.93 us/op 1.36
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.5400 us/op 5.5670 us/op 1.35
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 78.495 us/op 49.161 us/op 1.60
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.675 us/op 11.336 us/op 0.94
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.8390 us/op 11.288 us/op 0.78
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 186.99 us/op 134.96 us/op 1.39
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3299 ms/op 791.78 us/op 1.68
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8324 ms/op 1.3730 ms/op 1.33
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.8924 ms/op 1.1481 ms/op 1.65
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.4361 ms/op 3.2688 ms/op 1.36
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.8471 ms/op 1.2488 ms/op 1.48
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.2513 ms/op 3.4647 ms/op 1.23
Tree 40 250000 create 264.66 ms/op 216.32 ms/op 1.22
Tree 40 250000 get(125000) 174.79 ns/op 116.78 ns/op 1.50
Tree 40 250000 set(125000) 805.16 ns/op 517.92 ns/op 1.55
Tree 40 250000 toArray() 22.053 ms/op 18.608 ms/op 1.19
Tree 40 250000 iterate all - toArray() + loop 21.801 ms/op 18.396 ms/op 1.19
Tree 40 250000 iterate all - get(i) 59.609 ms/op 54.684 ms/op 1.09
Array 250000 create 3.9558 ms/op 3.2831 ms/op 1.20
Array 250000 clone - spread 1.7926 ms/op 1.1857 ms/op 1.51
Array 250000 get(125000) 0.46000 ns/op 0.58200 ns/op 0.79
Array 250000 set(125000) 0.48500 ns/op 0.58500 ns/op 0.83
Array 250000 iterate all - loop 91.683 us/op 76.217 us/op 1.20
phase0 afterProcessEpoch - 250000 vs - 7PWei 54.983 ms/op 43.932 ms/op 1.25
Array.fill - length 1000000 3.9289 ms/op 2.4142 ms/op 1.63
Array push - length 1000000 19.457 ms/op 15.186 ms/op 1.28
Array.get 0.30617 ns/op 0.30320 ns/op 1.01
Uint8Array.get 0.46001 ns/op 0.36000 ns/op 1.28
phase0 beforeProcessEpoch - 250000 vs - 7PWei 21.509 ms/op 18.932 ms/op 1.14
altair processEpoch - mainnet_e81889 328.85 ms/op 292.62 ms/op 1.12
mainnet_e81889 - altair beforeProcessEpoch 21.236 ms/op 21.380 ms/op 0.99
mainnet_e81889 - altair processJustificationAndFinalization 15.050 us/op 15.141 us/op 0.99
mainnet_e81889 - altair processInactivityUpdates 7.2824 ms/op 5.6589 ms/op 1.29
mainnet_e81889 - altair processRewardsAndPenalties 50.919 ms/op 40.068 ms/op 1.27
mainnet_e81889 - altair processRegistryUpdates 2.7240 us/op 2.3040 us/op 1.18
mainnet_e81889 - altair processSlashings 673.00 ns/op 969.00 ns/op 0.69
mainnet_e81889 - altair processEth1DataReset 600.00 ns/op 1.0520 us/op 0.57
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.8633 ms/op 1.1557 ms/op 1.61
mainnet_e81889 - altair processSlashingsReset 4.4030 us/op 7.2830 us/op 0.60
mainnet_e81889 - altair processRandaoMixesReset 5.8660 us/op 5.3930 us/op 1.09
mainnet_e81889 - altair processHistoricalRootsUpdate 2.4370 us/op 1.4620 us/op 1.67
mainnet_e81889 - altair processParticipationFlagUpdates 1.9270 us/op 2.9300 us/op 0.66
mainnet_e81889 - altair processSyncCommitteeUpdates 793.00 ns/op 1.0210 us/op 0.78
mainnet_e81889 - altair afterProcessEpoch 56.360 ms/op 43.468 ms/op 1.30
capella processEpoch - mainnet_e217614 1.1308 s/op 1.0252 s/op 1.10
mainnet_e217614 - capella beforeProcessEpoch 86.953 ms/op 69.582 ms/op 1.25
mainnet_e217614 - capella processJustificationAndFinalization 16.671 us/op 14.662 us/op 1.14
mainnet_e217614 - capella processInactivityUpdates 20.970 ms/op 14.813 ms/op 1.42
mainnet_e217614 - capella processRewardsAndPenalties 246.02 ms/op 238.03 ms/op 1.03
mainnet_e217614 - capella processRegistryUpdates 19.782 us/op 20.680 us/op 0.96
mainnet_e217614 - capella processSlashings 697.00 ns/op 1.1810 us/op 0.59
mainnet_e217614 - capella processEth1DataReset 471.00 ns/op 927.00 ns/op 0.51
mainnet_e217614 - capella processEffectiveBalanceUpdates 10.074 ms/op 16.528 ms/op 0.61
mainnet_e217614 - capella processSlashingsReset 7.4520 us/op 3.3540 us/op 2.22
mainnet_e217614 - capella processRandaoMixesReset 5.2230 us/op 5.1690 us/op 1.01
mainnet_e217614 - capella processHistoricalRootsUpdate 802.00 ns/op 1.6190 us/op 0.50
mainnet_e217614 - capella processParticipationFlagUpdates 2.0710 us/op 2.0860 us/op 0.99
mainnet_e217614 - capella afterProcessEpoch 133.76 ms/op 109.62 ms/op 1.22
phase0 processEpoch - mainnet_e58758 368.78 ms/op 312.38 ms/op 1.18
mainnet_e58758 - phase0 beforeProcessEpoch 87.857 ms/op 82.763 ms/op 1.06
mainnet_e58758 - phase0 processJustificationAndFinalization 14.689 us/op 17.400 us/op 0.84
mainnet_e58758 - phase0 processRewardsAndPenalties 32.684 ms/op 30.080 ms/op 1.09
mainnet_e58758 - phase0 processRegistryUpdates 10.545 us/op 6.9750 us/op 1.51
mainnet_e58758 - phase0 processSlashings 552.00 ns/op 959.00 ns/op 0.58
mainnet_e58758 - phase0 processEth1DataReset 453.00 ns/op 514.00 ns/op 0.88
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4479 ms/op 842.18 us/op 1.72
mainnet_e58758 - phase0 processSlashingsReset 3.2550 us/op 2.5420 us/op 1.28
mainnet_e58758 - phase0 processRandaoMixesReset 4.7160 us/op 3.3040 us/op 1.43
mainnet_e58758 - phase0 processHistoricalRootsUpdate 484.00 ns/op 786.00 ns/op 0.62
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.1350 us/op 3.3420 us/op 1.24
mainnet_e58758 - phase0 afterProcessEpoch 45.480 ms/op 36.050 ms/op 1.26
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.6095 ms/op 944.37 us/op 1.70
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.4696 ms/op 1.2315 ms/op 2.01
altair processInactivityUpdates - 250000 normalcase 17.153 ms/op 15.363 ms/op 1.12
altair processInactivityUpdates - 250000 worstcase 17.811 ms/op 17.510 ms/op 1.02
phase0 processRegistryUpdates - 250000 normalcase 9.1190 us/op 8.0930 us/op 1.13
phase0 processRegistryUpdates - 250000 badcase_full_deposits 372.05 us/op 347.20 us/op 1.07
phase0 processRegistryUpdates - 250000 worstcase 0.5 116.98 ms/op 98.950 ms/op 1.18
altair processRewardsAndPenalties - 250000 normalcase 40.395 ms/op 42.646 ms/op 0.95
altair processRewardsAndPenalties - 250000 worstcase 40.544 ms/op 40.237 ms/op 1.01
phase0 getAttestationDeltas - 250000 normalcase 8.7439 ms/op 6.4492 ms/op 1.36
phase0 getAttestationDeltas - 250000 worstcase 7.9394 ms/op 5.9690 ms/op 1.33
phase0 processSlashings - 250000 worstcase 103.23 us/op 86.443 us/op 1.19
altair processSyncCommitteeUpdates - 250000 129.81 ms/op 99.377 ms/op 1.31
BeaconState.hashTreeRoot - No change 269.00 ns/op 475.00 ns/op 0.57
BeaconState.hashTreeRoot - 1 full validator 120.09 us/op 106.08 us/op 1.13
BeaconState.hashTreeRoot - 32 full validator 1.6401 ms/op 1.3410 ms/op 1.22
BeaconState.hashTreeRoot - 512 full validator 11.338 ms/op 10.996 ms/op 1.03
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 164.78 us/op 142.22 us/op 1.16
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.9681 ms/op 1.7867 ms/op 1.10
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 24.244 ms/op 22.385 ms/op 1.08
BeaconState.hashTreeRoot - 1 balances 95.744 us/op 105.24 us/op 0.91
BeaconState.hashTreeRoot - 32 balances 867.06 us/op 1.0660 ms/op 0.81
BeaconState.hashTreeRoot - 512 balances 7.7986 ms/op 7.4403 ms/op 1.05
BeaconState.hashTreeRoot - 250000 balances 180.79 ms/op 175.77 ms/op 1.03
aggregationBits - 2048 els - zipIndexesInBitList 28.384 us/op 22.464 us/op 1.26
byteArrayEquals 32 54.408 ns/op 45.647 ns/op 1.19
Buffer.compare 32 17.425 ns/op 14.572 ns/op 1.20
byteArrayEquals 1024 1.6107 us/op 1.2699 us/op 1.27
Buffer.compare 1024 25.595 ns/op 23.413 ns/op 1.09
byteArrayEquals 16384 25.525 us/op 19.331 us/op 1.32
Buffer.compare 16384 190.72 ns/op 272.68 ns/op 0.70
byteArrayEquals 123687377 193.18 ms/op 149.25 ms/op 1.29
Buffer.compare 123687377 8.0409 ms/op 4.3620 ms/op 1.84
byteArrayEquals 32 - diff last byte 53.187 ns/op 48.180 ns/op 1.10
Buffer.compare 32 - diff last byte 17.148 ns/op 16.037 ns/op 1.07
byteArrayEquals 1024 - diff last byte 1.6062 us/op 1.2792 us/op 1.26
Buffer.compare 1024 - diff last byte 25.884 ns/op 24.734 ns/op 1.05
byteArrayEquals 16384 - diff last byte 25.648 us/op 20.360 us/op 1.26
Buffer.compare 16384 - diff last byte 193.84 ns/op 201.49 ns/op 0.96
byteArrayEquals 123687377 - diff last byte 193.34 ms/op 152.42 ms/op 1.27
Buffer.compare 123687377 - diff last byte 8.0998 ms/op 5.8992 ms/op 1.37
byteArrayEquals 32 - random bytes 5.4360 ns/op 4.8280 ns/op 1.13
Buffer.compare 32 - random bytes 17.803 ns/op 15.144 ns/op 1.18
byteArrayEquals 1024 - random bytes 5.4300 ns/op 4.8090 ns/op 1.13
Buffer.compare 1024 - random bytes 17.556 ns/op 15.057 ns/op 1.17
byteArrayEquals 16384 - random bytes 5.3880 ns/op 4.7880 ns/op 1.13
Buffer.compare 16384 - random bytes 17.673 ns/op 15.013 ns/op 1.18
byteArrayEquals 123687377 - random bytes 6.7100 ns/op 7.5900 ns/op 0.88
Buffer.compare 123687377 - random bytes 19.690 ns/op 17.830 ns/op 1.10
regular array get 100000 times 44.801 us/op 29.858 us/op 1.50
wrappedArray get 100000 times 34.280 us/op 29.893 us/op 1.15
arrayWithProxy get 100000 times 13.440 ms/op 8.5698 ms/op 1.57
ssz.Root.equals 47.550 ns/op 42.190 ns/op 1.13
byteArrayEquals 46.828 ns/op 41.742 ns/op 1.12
Buffer.compare 10.813 ns/op 8.7890 ns/op 1.23
processSlot - 1 slots 14.142 us/op 11.011 us/op 1.28
processSlot - 32 slots 2.7806 ms/op 2.3516 ms/op 1.18
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.729 ms/op 37.239 ms/op 1.04
getCommitteeAssignments - req 1 vs - 250000 vc 2.1902 ms/op 1.8215 ms/op 1.20
getCommitteeAssignments - req 100 vs - 250000 vc 4.2536 ms/op 3.6278 ms/op 1.17
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6471 ms/op 3.8025 ms/op 1.22
findModifiedValidators - 10000 modified validators 270.73 ms/op 226.78 ms/op 1.19
findModifiedValidators - 1000 modified validators 219.29 ms/op 159.47 ms/op 1.38
findModifiedValidators - 100 modified validators 199.52 ms/op 147.15 ms/op 1.36
findModifiedValidators - 10 modified validators 196.73 ms/op 144.72 ms/op 1.36
findModifiedValidators - 1 modified validators 191.22 ms/op 147.72 ms/op 1.29
findModifiedValidators - no difference 197.44 ms/op 125.99 ms/op 1.57
compare ViewDUs 3.4858 s/op 3.5398 s/op 0.98
compare each validator Uint8Array 1.7012 s/op 1.7312 s/op 0.98
compare ViewDU to Uint8Array 1.1644 s/op 775.00 ms/op 1.50
migrate state 1000000 validators, 24 modified, 0 new 853.59 ms/op 647.54 ms/op 1.32
migrate state 1000000 validators, 1700 modified, 1000 new 1.2222 s/op 862.31 ms/op 1.42
migrate state 1000000 validators, 3400 modified, 2000 new 1.5168 s/op 1.0304 s/op 1.47
migrate state 1500000 validators, 24 modified, 0 new 1.2357 s/op 673.41 ms/op 1.83
migrate state 1500000 validators, 1700 modified, 1000 new 1.4507 s/op 856.64 ms/op 1.69
migrate state 1500000 validators, 3400 modified, 2000 new 1.7589 s/op 1.0148 s/op 1.73
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.9200 ns/op 6.4600 ns/op 1.07
state getBlockRootAtSlot - 250000 vs - 7PWei 1.3553 us/op 549.86 ns/op 2.46
computeProposers - vc 250000 10.800 ms/op 7.2922 ms/op 1.48
computeEpochShuffling - vc 250000 49.866 ms/op 35.840 ms/op 1.39
getNextSyncCommittee - vc 250000 214.27 ms/op 111.27 ms/op 1.93
computeSigningRoot for AttestationData 27.407 us/op 24.093 us/op 1.14
hash AttestationData serialized data then Buffer.toString(base64) 1.9649 us/op 1.2396 us/op 1.59
toHexString serialized data 1.3598 us/op 765.73 ns/op 1.78
Buffer.toString(base64) 238.06 ns/op 144.00 ns/op 1.65
nodejs block root to RootHex using toHex 168.39 ns/op 115.12 ns/op 1.46
nodejs block root to RootHex using toRootHex 104.05 ns/op 74.475 ns/op 1.40
browser block root to RootHex using the deprecated toHexString 256.57 ns/op 206.35 ns/op 1.24
browser block root to RootHex using toHex 203.46 ns/op 164.95 ns/op 1.23
browser block root to RootHex using toRootHex 188.94 ns/op 150.85 ns/op 1.25

by benchmarkbot/action

@nazarhussain nazarhussain self-requested a review January 7, 2025 15:19
@nflaig nflaig added this to the v1.25.0 milestone Jan 7, 2025
@philknows philknows modified the milestones: v1.25.0, v1.23.0 Jan 7, 2025
Comment on lines 49 to 62
case ChunkType.COMPRESSED:
case ChunkType.UNCOMPRESSED: {
const checksum = frame.subarray(0, 4);
const data = frame.subarray(4);

if (type === ChunkType.COMPRESSED) {
result.append(uncompress(data.subarray(4)));
}
if (type === ChunkType.UNCOMPRESSED) {
result.append(data.subarray(4));
const uncompressed = type === ChunkType.COMPRESSED ? uncompress(data, UNCOMPRESSED_CHUNK_SIZE) : data;
if (uncompressed.length > UNCOMPRESSED_CHUNK_SIZE) {
throw "malformed input: too large";
}
if (crc(uncompressed).compare(checksum) !== 0) {
throw "malformed input: bad checksum";
}
result.append(uncompressed);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to not mix ChunkType.COMPRESSED and ChunkType.UNCOMPRESSED logic in one case.

nflaig
nflaig previously approved these changes Jan 8, 2025
Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

LGTM 🎸 Just a question on why you passed hex instead of decimal format

chunks.append(Uint8Array.from([ChunkType.UNCOMPRESSED, 0x80, 0x00, 0x00]));
// first 4 bytes are checksum
// 0xffffffff is clearly an invalid checksum
chunks.append(Uint8Array.from(Array.from({length: 0x80}, () => 0xff)));
Copy link
Member

Choose a reason for hiding this comment

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

why not use 128 here? Guessing this is a snappy spec thing but curious none-the-less

Suggested change
chunks.append(Uint8Array.from(Array.from({length: 0x80}, () => 0xff)));
chunks.append(Uint8Array.from(Array.from({length: 128}, () => 0xff)));

Copy link
Member Author

Choose a reason for hiding this comment

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

just an artifact from a test case I had been provided, there's nothing special about 128.

@wemeetagain wemeetagain merged commit 18a0d68 into unstable Jan 8, 2025
18 of 20 checks passed
@wemeetagain wemeetagain deleted the cayman/fix-snappy-frame-decode branch January 8, 2025 18:49
@wemeetagain
Copy link
Member Author

🎉 This PR is included in v1.25.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.

5 participants