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

fix: support eth_getBlockByNumber #6442

Merged
merged 2 commits into from
Mar 14, 2024
Merged

Conversation

jeluard
Copy link
Contributor

@jeluard jeluard commented Feb 16, 2024

Motivation

Make sure the web3 provider prover wrapper correctly handles eth_getBlockByNumber

Description

During verification, wrapped calls to eth_getBlockByNumber try to access EL blocks using block numbers, which is incorrect. Issue is fixed by keeping track of slots numbers when new light-client header are received.

Note that when trying to access older blocks it might get slow, as current implementation tries to find matching EL blocks by querying CL slots one by one starting from freshly finalized slots.

Closes #6032

@jeluard jeluard force-pushed the jeluard/prover-block-by-number branch from 34374ac to 314d60e Compare February 16, 2024 16:41
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Merging #6442 (7cb4598) into unstable (d01c542) will decrease coverage by 0.07%.
Report is 4 commits behind head on unstable.
The diff coverage is 74.28%.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6442      +/-   ##
============================================
- Coverage     61.70%   61.64%   -0.07%     
============================================
  Files           553      553              
  Lines         57858    57874      +16     
  Branches       1829     1830       +1     
============================================
- Hits          35702    35677      -25     
- Misses        22119    22160      +41     
  Partials         37       37              

Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 7b591d3 Previous: 227930c Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 589.80 us/op 1.0117 ms/op 0.58
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 118.97 us/op 136.42 us/op 0.87
BLS verify - blst-native 1.3588 ms/op 1.4219 ms/op 0.96
BLS verifyMultipleSignatures 3 - blst-native 2.8344 ms/op 3.2112 ms/op 0.88
BLS verifyMultipleSignatures 8 - blst-native 6.2477 ms/op 6.5660 ms/op 0.95
BLS verifyMultipleSignatures 32 - blst-native 23.032 ms/op 23.979 ms/op 0.96
BLS verifyMultipleSignatures 64 - blst-native 45.578 ms/op 49.038 ms/op 0.93
BLS verifyMultipleSignatures 128 - blst-native 90.890 ms/op 92.836 ms/op 0.98
BLS deserializing 10000 signatures 948.81 ms/op 1.0304 s/op 0.92
BLS deserializing 100000 signatures 9.6736 s/op 9.7190 s/op 1.00
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3762 ms/op 1.4825 ms/op 0.93
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5649 ms/op 1.6369 ms/op 0.96
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.4254 ms/op 2.4798 ms/op 0.98
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.5539 ms/op 3.6889 ms/op 0.96
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.6322 ms/op 5.9955 ms/op 0.94
BLS aggregatePubkeys 32 - blst-native 25.980 us/op 27.449 us/op 0.95
BLS aggregatePubkeys 128 - blst-native 101.42 us/op 105.59 us/op 0.96
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 63.848 ms/op 67.411 ms/op 0.95
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 63.489 ms/op 62.800 ms/op 1.01
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 49.209 ms/op 50.269 ms/op 0.98
getSlashingsAndExits - default max 217.04 us/op 486.86 us/op 0.45
getSlashingsAndExits - 2k 565.40 us/op 802.26 us/op 0.70
proposeBlockBody type=full, size=empty 6.9517 ms/op 7.3752 ms/op 0.94
isKnown best case - 1 super set check 671.00 ns/op 708.00 ns/op 0.95
isKnown normal case - 2 super set checks 561.00 ns/op 786.00 ns/op 0.71
isKnown worse case - 16 super set checks 573.00 ns/op 776.00 ns/op 0.74
CheckpointStateCache - add get delete 6.7320 us/op 6.9340 us/op 0.97
validate api signedAggregateAndProof - struct 2.8753 ms/op 2.9611 ms/op 0.97
validate gossip signedAggregateAndProof - struct 2.9090 ms/op 3.0849 ms/op 0.94
validate gossip attestation - vc 640000 1.3976 ms/op 1.5317 ms/op 0.91
batch validate gossip attestation - vc 640000 - chunk 32 223.95 us/op 196.53 us/op 1.14
batch validate gossip attestation - vc 640000 - chunk 64 167.96 us/op 182.15 us/op 0.92
batch validate gossip attestation - vc 640000 - chunk 128 150.26 us/op 181.33 us/op 0.83
batch validate gossip attestation - vc 640000 - chunk 256 133.88 us/op 176.50 us/op 0.76
pickEth1Vote - no votes 1.2632 ms/op 1.7401 ms/op 0.73
pickEth1Vote - max votes 9.9045 ms/op 20.140 ms/op 0.49
pickEth1Vote - Eth1Data hashTreeRoot value x2048 19.290 ms/op 26.402 ms/op 0.73
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 28.493 ms/op 41.441 ms/op 0.69
pickEth1Vote - Eth1Data fastSerialize value x2048 689.54 us/op 841.77 us/op 0.82
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.5671 ms/op 9.5507 ms/op 0.58
bytes32 toHexString 555.00 ns/op 921.00 ns/op 0.60
bytes32 Buffer.toString(hex) 304.00 ns/op 392.00 ns/op 0.78
bytes32 Buffer.toString(hex) from Uint8Array 613.00 ns/op 676.00 ns/op 0.91
bytes32 Buffer.toString(hex) + 0x 324.00 ns/op 348.00 ns/op 0.93
Object access 1 prop 0.22200 ns/op 0.28500 ns/op 0.78
Map access 1 prop 0.15400 ns/op 0.16900 ns/op 0.91
Object get x1000 7.6640 ns/op 8.6990 ns/op 0.88
Map get x1000 0.88100 ns/op 1.0550 ns/op 0.84
Object set x1000 66.437 ns/op 89.216 ns/op 0.74
Map set x1000 50.104 ns/op 64.122 ns/op 0.78
Return object 10000 times 0.25230 ns/op 0.31280 ns/op 0.81
Throw Error 10000 times 4.1402 us/op 4.2594 us/op 0.97
fastMsgIdFn sha256 / 200 bytes 3.4080 us/op 4.0450 us/op 0.84
fastMsgIdFn h32 xxhash / 200 bytes 323.00 ns/op 414.00 ns/op 0.78
fastMsgIdFn h64 xxhash / 200 bytes 405.00 ns/op 457.00 ns/op 0.89
fastMsgIdFn sha256 / 1000 bytes 11.747 us/op 12.897 us/op 0.91
fastMsgIdFn h32 xxhash / 1000 bytes 474.00 ns/op 608.00 ns/op 0.78
fastMsgIdFn h64 xxhash / 1000 bytes 462.00 ns/op 517.00 ns/op 0.89
fastMsgIdFn sha256 / 10000 bytes 105.64 us/op 111.70 us/op 0.95
fastMsgIdFn h32 xxhash / 10000 bytes 2.0640 us/op 2.2330 us/op 0.92
fastMsgIdFn h64 xxhash / 10000 bytes 1.4030 us/op 1.6390 us/op 0.86
send data - 1000 256B messages 21.687 ms/op 32.397 ms/op 0.67
send data - 1000 512B messages 28.830 ms/op 33.982 ms/op 0.85
send data - 1000 1024B messages 46.975 ms/op 50.773 ms/op 0.93
send data - 1000 1200B messages 41.846 ms/op 47.343 ms/op 0.88
send data - 1000 2048B messages 52.751 ms/op 55.852 ms/op 0.94
send data - 1000 4096B messages 34.868 ms/op 46.471 ms/op 0.75
send data - 1000 16384B messages 127.27 ms/op 130.62 ms/op 0.97
send data - 1000 65536B messages 570.81 ms/op 518.29 ms/op 1.10
enrSubnets - fastDeserialize 64 bits 1.8500 us/op 1.6110 us/op 1.15
enrSubnets - ssz BitVector 64 bits 630.00 ns/op 610.00 ns/op 1.03
enrSubnets - fastDeserialize 4 bits 265.00 ns/op 273.00 ns/op 0.97
enrSubnets - ssz BitVector 4 bits 617.00 ns/op 655.00 ns/op 0.94
prioritizePeers score -10:0 att 32-0.1 sync 2-0 134.60 us/op 141.40 us/op 0.95
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 167.89 us/op 185.49 us/op 0.91
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 230.91 us/op 213.48 us/op 1.08
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 388.01 us/op 387.34 us/op 1.00
prioritizePeers score 0:0 att 64-1 sync 4-1 420.10 us/op 430.06 us/op 0.98
array of 16000 items push then shift 1.7926 us/op 1.9550 us/op 0.92
LinkedList of 16000 items push then shift 11.039 ns/op 11.705 ns/op 0.94
array of 16000 items push then pop 131.23 ns/op 132.00 ns/op 0.99
LinkedList of 16000 items push then pop 10.469 ns/op 10.997 ns/op 0.95
array of 24000 items push then shift 2.8144 us/op 2.8998 us/op 0.97
LinkedList of 24000 items push then shift 12.327 ns/op 12.113 ns/op 1.02
array of 24000 items push then pop 176.19 ns/op 205.92 ns/op 0.86
LinkedList of 24000 items push then pop 10.324 ns/op 10.917 ns/op 0.95
intersect bitArray bitLen 8 6.5660 ns/op 7.0000 ns/op 0.94
intersect array and set length 8 100.35 ns/op 107.12 ns/op 0.94
intersect bitArray bitLen 128 39.414 ns/op 40.497 ns/op 0.97
intersect array and set length 128 1.2264 us/op 1.1866 us/op 1.03
bitArray.getTrueBitIndexes() bitLen 128 2.2130 us/op 2.0990 us/op 1.05
bitArray.getTrueBitIndexes() bitLen 248 3.4950 us/op 3.1630 us/op 1.10
bitArray.getTrueBitIndexes() bitLen 512 7.6840 us/op 7.0160 us/op 1.10
Buffer.concat 32 items 1.1810 us/op 1.1690 us/op 1.01
Uint8Array.set 32 items 2.3310 us/op 2.2320 us/op 1.04
Set add up to 64 items then delete first 5.3619 us/op 5.3966 us/op 0.99
OrderedSet add up to 64 items then delete first 6.8874 us/op 6.7994 us/op 1.01
Set add up to 64 items then delete last 6.2248 us/op 6.0971 us/op 1.02
OrderedSet add up to 64 items then delete last 7.9001 us/op 8.1319 us/op 0.97
Set add up to 64 items then delete middle 5.7775 us/op 5.8901 us/op 0.98
OrderedSet add up to 64 items then delete middle 10.350 us/op 8.1676 us/op 1.27
Set add up to 128 items then delete first 11.919 us/op 11.581 us/op 1.03
OrderedSet add up to 128 items then delete first 16.822 us/op 15.291 us/op 1.10
Set add up to 128 items then delete last 11.235 us/op 11.023 us/op 1.02
OrderedSet add up to 128 items then delete last 14.917 us/op 13.818 us/op 1.08
Set add up to 128 items then delete middle 11.206 us/op 10.958 us/op 1.02
OrderedSet add up to 128 items then delete middle 22.229 us/op 20.345 us/op 1.09
Set add up to 256 items then delete first 24.325 us/op 22.468 us/op 1.08
OrderedSet add up to 256 items then delete first 34.078 us/op 31.975 us/op 1.07
Set add up to 256 items then delete last 24.650 us/op 22.674 us/op 1.09
OrderedSet add up to 256 items then delete last 34.097 us/op 29.700 us/op 1.15
Set add up to 256 items then delete middle 26.706 us/op 22.381 us/op 1.19
OrderedSet add up to 256 items then delete middle 71.006 us/op 55.612 us/op 1.28
transfer serialized Status (84 B) 3.8320 us/op 1.9720 us/op 1.94
copy serialized Status (84 B) 2.9640 us/op 1.5370 us/op 1.93
transfer serialized SignedVoluntaryExit (112 B) 3.8640 us/op 2.2860 us/op 1.69
copy serialized SignedVoluntaryExit (112 B) 2.7430 us/op 1.5960 us/op 1.72
transfer serialized ProposerSlashing (416 B) 5.1350 us/op 2.6750 us/op 1.92
copy serialized ProposerSlashing (416 B) 4.7030 us/op 2.4580 us/op 1.91
transfer serialized Attestation (485 B) 3.6350 us/op 2.6040 us/op 1.40
copy serialized Attestation (485 B) 3.8760 us/op 2.6120 us/op 1.48
transfer serialized AttesterSlashing (33232 B) 3.8490 us/op 3.4130 us/op 1.13
copy serialized AttesterSlashing (33232 B) 15.482 us/op 10.136 us/op 1.53
transfer serialized Small SignedBeaconBlock (128000 B) 4.1350 us/op 3.2670 us/op 1.27
copy serialized Small SignedBeaconBlock (128000 B) 57.994 us/op 32.647 us/op 1.78
transfer serialized Avg SignedBeaconBlock (200000 B) 4.2650 us/op 4.1130 us/op 1.04
copy serialized Avg SignedBeaconBlock (200000 B) 71.821 us/op 39.214 us/op 1.83
transfer serialized BlobsSidecar (524380 B) 5.5550 us/op 4.6640 us/op 1.19
copy serialized BlobsSidecar (524380 B) 168.29 us/op 233.66 us/op 0.72
transfer serialized Big SignedBeaconBlock (1000000 B) 4.0130 us/op 4.7190 us/op 0.85
copy serialized Big SignedBeaconBlock (1000000 B) 275.52 us/op 217.08 us/op 1.27
pass gossip attestations to forkchoice per slot 4.2178 ms/op 4.5448 ms/op 0.93
forkChoice updateHead vc 100000 bc 64 eq 0 704.92 us/op 744.30 us/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 0 4.8066 ms/op 5.0857 ms/op 0.95
forkChoice updateHead vc 1000000 bc 64 eq 0 8.2340 ms/op 7.9006 ms/op 1.04
forkChoice updateHead vc 600000 bc 320 eq 0 4.6454 ms/op 4.5976 ms/op 1.01
forkChoice updateHead vc 600000 bc 1200 eq 0 9.1536 ms/op 4.5982 ms/op 1.99
forkChoice updateHead vc 600000 bc 7200 eq 0 6.0949 ms/op 6.8546 ms/op 0.89
forkChoice updateHead vc 600000 bc 64 eq 1000 11.755 ms/op 13.928 ms/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 10000 12.969 ms/op 15.851 ms/op 0.82
forkChoice updateHead vc 600000 bc 64 eq 300000 35.293 ms/op 49.068 ms/op 0.72
computeDeltas 500000 validators 300 proto nodes 7.2849 ms/op 7.9361 ms/op 0.92
computeDeltas 500000 validators 1200 proto nodes 6.9299 ms/op 7.5440 ms/op 0.92
computeDeltas 500000 validators 7200 proto nodes 6.9059 ms/op 7.2509 ms/op 0.95
computeDeltas 750000 validators 300 proto nodes 10.668 ms/op 11.236 ms/op 0.95
computeDeltas 750000 validators 1200 proto nodes 10.622 ms/op 11.031 ms/op 0.96
computeDeltas 750000 validators 7200 proto nodes 10.793 ms/op 10.969 ms/op 0.98
computeDeltas 1400000 validators 300 proto nodes 20.559 ms/op 21.312 ms/op 0.96
computeDeltas 1400000 validators 1200 proto nodes 19.956 ms/op 20.836 ms/op 0.96
computeDeltas 1400000 validators 7200 proto nodes 20.496 ms/op 21.175 ms/op 0.97
computeDeltas 2100000 validators 300 proto nodes 30.939 ms/op 32.506 ms/op 0.95
computeDeltas 2100000 validators 1200 proto nodes 29.299 ms/op 32.572 ms/op 0.90
computeDeltas 2100000 validators 7200 proto nodes 29.208 ms/op 31.153 ms/op 0.94
altair processAttestation - 250000 vs - 7PWei normalcase 2.6412 ms/op 3.5656 ms/op 0.74
altair processAttestation - 250000 vs - 7PWei worstcase 4.0697 ms/op 4.3790 ms/op 0.93
altair processAttestation - setStatus - 1/6 committees join 160.17 us/op 210.14 us/op 0.76
altair processAttestation - setStatus - 1/3 committees join 299.94 us/op 418.48 us/op 0.72
altair processAttestation - setStatus - 1/2 committees join 409.34 us/op 607.58 us/op 0.67
altair processAttestation - setStatus - 2/3 committees join 507.44 us/op 658.53 us/op 0.77
altair processAttestation - setStatus - 4/5 committees join 691.38 us/op 867.83 us/op 0.80
altair processAttestation - setStatus - 100% committees join 817.20 us/op 1.1618 ms/op 0.70
altair processBlock - 250000 vs - 7PWei normalcase 10.223 ms/op 12.251 ms/op 0.83
altair processBlock - 250000 vs - 7PWei normalcase hashState 37.876 ms/op 43.140 ms/op 0.88
altair processBlock - 250000 vs - 7PWei worstcase 42.164 ms/op 55.086 ms/op 0.77
altair processBlock - 250000 vs - 7PWei worstcase hashState 107.00 ms/op 119.99 ms/op 0.89
phase0 processBlock - 250000 vs - 7PWei normalcase 4.4540 ms/op 4.5720 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei worstcase 34.896 ms/op 41.969 ms/op 0.83
altair processEth1Data - 250000 vs - 7PWei normalcase 630.81 us/op 1.0257 ms/op 0.62
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 11.318 us/op 25.750 us/op 0.44
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 83.611 us/op 115.83 us/op 0.72
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 25.098 us/op 35.327 us/op 0.71
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 20.132 us/op 24.422 us/op 0.82
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 199.59 us/op 254.43 us/op 0.78
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.1678 ms/op 1.9892 ms/op 0.59
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.1476 ms/op 3.0561 ms/op 0.70
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7300 ms/op 2.6452 ms/op 0.65
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.2540 ms/op 5.3250 ms/op 0.80
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.6255 ms/op 3.2228 ms/op 0.81
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.3569 ms/op 7.9376 ms/op 0.80
Tree 40 250000 create 393.12 ms/op 609.89 ms/op 0.64
Tree 40 250000 get(125000) 207.71 ns/op 222.74 ns/op 0.93
Tree 40 250000 set(125000) 1.1078 us/op 1.3830 us/op 0.80
Tree 40 250000 toArray() 19.633 ms/op 27.791 ms/op 0.71
Tree 40 250000 iterate all - toArray() + loop 22.203 ms/op 27.758 ms/op 0.80
Tree 40 250000 iterate all - get(i) 71.569 ms/op 81.940 ms/op 0.87
MutableVector 250000 create 14.822 ms/op 19.120 ms/op 0.78
MutableVector 250000 get(125000) 6.4470 ns/op 7.2450 ns/op 0.89
MutableVector 250000 set(125000) 267.00 ns/op 402.42 ns/op 0.66
MutableVector 250000 toArray() 3.3396 ms/op 5.3331 ms/op 0.63
MutableVector 250000 iterate all - toArray() + loop 3.7384 ms/op 5.9040 ms/op 0.63
MutableVector 250000 iterate all - get(i) 1.5627 ms/op 1.6845 ms/op 0.93
Array 250000 create 3.6145 ms/op 4.6283 ms/op 0.78
Array 250000 clone - spread 1.3178 ms/op 1.5734 ms/op 0.84
Array 250000 get(125000) 1.0780 ns/op 1.7370 ns/op 0.62
Array 250000 set(125000) 4.7670 ns/op 6.1340 ns/op 0.78
Array 250000 iterate all - loop 180.93 us/op 181.10 us/op 1.00
effectiveBalanceIncrements clone Uint8Array 300000 48.712 us/op 88.374 us/op 0.55
effectiveBalanceIncrements clone MutableVector 300000 385.00 ns/op 587.00 ns/op 0.66
effectiveBalanceIncrements rw all Uint8Array 300000 216.28 us/op 221.40 us/op 0.98
effectiveBalanceIncrements rw all MutableVector 300000 89.120 ms/op 126.59 ms/op 0.70
phase0 afterProcessEpoch - 250000 vs - 7PWei 117.12 ms/op 126.58 ms/op 0.93
phase0 beforeProcessEpoch - 250000 vs - 7PWei 55.504 ms/op 79.115 ms/op 0.70
altair processEpoch - mainnet_e81889 508.62 ms/op 575.31 ms/op 0.88
mainnet_e81889 - altair beforeProcessEpoch 88.442 ms/op 102.46 ms/op 0.86
mainnet_e81889 - altair processJustificationAndFinalization 17.028 us/op 19.284 us/op 0.88
mainnet_e81889 - altair processInactivityUpdates 6.4351 ms/op 6.7493 ms/op 0.95
mainnet_e81889 - altair processRewardsAndPenalties 60.971 ms/op 73.525 ms/op 0.83
mainnet_e81889 - altair processRegistryUpdates 2.8460 us/op 2.4670 us/op 1.15
mainnet_e81889 - altair processSlashings 603.00 ns/op 441.00 ns/op 1.37
mainnet_e81889 - altair processEth1DataReset 539.00 ns/op 557.00 ns/op 0.97
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4409 ms/op 1.7409 ms/op 0.83
mainnet_e81889 - altair processSlashingsReset 3.9840 us/op 6.1210 us/op 0.65
mainnet_e81889 - altair processRandaoMixesReset 5.9280 us/op 6.0700 us/op 0.98
mainnet_e81889 - altair processHistoricalRootsUpdate 824.00 ns/op 695.00 ns/op 1.19
mainnet_e81889 - altair processParticipationFlagUpdates 2.0430 us/op 2.2470 us/op 0.91
mainnet_e81889 - altair processSyncCommitteeUpdates 1.2320 us/op 731.00 ns/op 1.69
mainnet_e81889 - altair afterProcessEpoch 123.28 ms/op 126.84 ms/op 0.97
capella processEpoch - mainnet_e217614 2.1879 s/op 2.3811 s/op 0.92
mainnet_e217614 - capella beforeProcessEpoch 495.27 ms/op 522.05 ms/op 0.95
mainnet_e217614 - capella processJustificationAndFinalization 16.852 us/op 20.474 us/op 0.82
mainnet_e217614 - capella processInactivityUpdates 22.435 ms/op 23.739 ms/op 0.95
mainnet_e217614 - capella processRewardsAndPenalties 446.72 ms/op 434.82 ms/op 1.03
mainnet_e217614 - capella processRegistryUpdates 34.465 us/op 41.079 us/op 0.84
mainnet_e217614 - capella processSlashings 570.00 ns/op 892.00 ns/op 0.64
mainnet_e217614 - capella processEth1DataReset 725.00 ns/op 949.00 ns/op 0.76
mainnet_e217614 - capella processEffectiveBalanceUpdates 5.3111 ms/op 6.1673 ms/op 0.86
mainnet_e217614 - capella processSlashingsReset 6.7810 us/op 6.2760 us/op 1.08
mainnet_e217614 - capella processRandaoMixesReset 4.9450 us/op 8.7500 us/op 0.57
mainnet_e217614 - capella processHistoricalRootsUpdate 647.00 ns/op 658.00 ns/op 0.98
mainnet_e217614 - capella processParticipationFlagUpdates 1.9010 us/op 6.2540 us/op 0.30
mainnet_e217614 - capella afterProcessEpoch 336.39 ms/op 379.09 ms/op 0.89
phase0 processEpoch - mainnet_e58758 580.28 ms/op 596.73 ms/op 0.97
mainnet_e58758 - phase0 beforeProcessEpoch 197.78 ms/op 180.70 ms/op 1.09
mainnet_e58758 - phase0 processJustificationAndFinalization 25.454 us/op 41.516 us/op 0.61
mainnet_e58758 - phase0 processRewardsAndPenalties 60.099 ms/op 68.859 ms/op 0.87
mainnet_e58758 - phase0 processRegistryUpdates 19.384 us/op 13.185 us/op 1.47
mainnet_e58758 - phase0 processSlashings 1.3660 us/op 783.00 ns/op 1.74
mainnet_e58758 - phase0 processEth1DataReset 647.00 ns/op 888.00 ns/op 0.73
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.2750 ms/op 1.4416 ms/op 1.58
mainnet_e58758 - phase0 processSlashingsReset 8.7500 us/op 5.4630 us/op 1.60
mainnet_e58758 - phase0 processRandaoMixesReset 13.321 us/op 7.5400 us/op 1.77
mainnet_e58758 - phase0 processHistoricalRootsUpdate 979.00 ns/op 1.0240 us/op 0.96
mainnet_e58758 - phase0 processParticipationRecordUpdates 12.614 us/op 5.7320 us/op 2.20
mainnet_e58758 - phase0 afterProcessEpoch 140.15 ms/op 106.43 ms/op 1.32
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.2672 ms/op 1.8588 ms/op 1.22
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.4441 ms/op 2.0565 ms/op 1.19
altair processInactivityUpdates - 250000 normalcase 47.102 ms/op 39.905 ms/op 1.18
altair processInactivityUpdates - 250000 worstcase 37.076 ms/op 35.561 ms/op 1.04
phase0 processRegistryUpdates - 250000 normalcase 22.941 us/op 20.164 us/op 1.14
phase0 processRegistryUpdates - 250000 badcase_full_deposits 708.04 us/op 522.89 us/op 1.35
phase0 processRegistryUpdates - 250000 worstcase 0.5 274.11 ms/op 153.44 ms/op 1.79
altair processRewardsAndPenalties - 250000 normalcase 85.596 ms/op 58.780 ms/op 1.46
altair processRewardsAndPenalties - 250000 worstcase 61.639 ms/op 66.227 ms/op 0.93
phase0 getAttestationDeltas - 250000 normalcase 14.363 ms/op 9.4895 ms/op 1.51
phase0 getAttestationDeltas - 250000 worstcase 16.029 ms/op 13.058 ms/op 1.23
phase0 processSlashings - 250000 worstcase 141.34 us/op 114.00 us/op 1.24
altair processSyncCommitteeUpdates - 250000 222.55 ms/op 176.56 ms/op 1.26
BeaconState.hashTreeRoot - No change 1.2230 us/op 871.00 ns/op 1.40
BeaconState.hashTreeRoot - 1 full validator 265.08 us/op 177.54 us/op 1.49
BeaconState.hashTreeRoot - 32 full validator 1.8909 ms/op 1.8706 ms/op 1.01
BeaconState.hashTreeRoot - 512 full validator 22.908 ms/op 22.158 ms/op 1.03
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 299.43 us/op 231.57 us/op 1.29
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 4.4991 ms/op 3.2077 ms/op 1.40
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 61.922 ms/op 35.881 ms/op 1.73
BeaconState.hashTreeRoot - 1 balances 229.76 us/op 170.72 us/op 1.35
BeaconState.hashTreeRoot - 32 balances 1.8282 ms/op 1.2713 ms/op 1.44
BeaconState.hashTreeRoot - 512 balances 20.369 ms/op 13.646 ms/op 1.49
BeaconState.hashTreeRoot - 250000 balances 342.42 ms/op 276.46 ms/op 1.24
aggregationBits - 2048 els - zipIndexesInBitList 37.683 us/op 31.704 us/op 1.19
byteArrayEquals 32 94.443 ns/op 80.941 ns/op 1.17
Buffer.compare 32 64.010 ns/op 60.732 ns/op 1.05
byteArrayEquals 1024 4.1479 us/op 2.2312 us/op 1.86
Buffer.compare 1024 87.638 ns/op 78.403 ns/op 1.12
byteArrayEquals 16384 38.558 us/op 35.899 us/op 1.07
Buffer.compare 16384 301.60 ns/op 296.92 ns/op 1.02
byteArrayEquals 123687377 329.60 ms/op 260.80 ms/op 1.26
Buffer.compare 123687377 12.591 ms/op 8.2623 ms/op 1.52
byteArrayEquals 32 - diff last byte 111.93 ns/op 85.091 ns/op 1.32
Buffer.compare 32 - diff last byte 64.972 ns/op 63.052 ns/op 1.03
byteArrayEquals 1024 - diff last byte 2.2892 us/op 2.2032 us/op 1.04
Buffer.compare 1024 - diff last byte 99.992 ns/op 79.491 ns/op 1.26
byteArrayEquals 16384 - diff last byte 39.880 us/op 35.754 us/op 1.12
Buffer.compare 16384 - diff last byte 275.85 ns/op 288.46 ns/op 0.96
byteArrayEquals 123687377 - diff last byte 277.79 ms/op 256.10 ms/op 1.08
Buffer.compare 123687377 - diff last byte 10.308 ms/op 8.1832 ms/op 1.26
byteArrayEquals 32 - random bytes 7.2980 ns/op 6.4380 ns/op 1.13
Buffer.compare 32 - random bytes 66.573 ns/op 64.724 ns/op 1.03
byteArrayEquals 1024 - random bytes 6.6270 ns/op 6.9100 ns/op 0.96
Buffer.compare 1024 - random bytes 63.968 ns/op 64.584 ns/op 0.99
byteArrayEquals 16384 - random bytes 6.4710 ns/op 6.0030 ns/op 1.08
Buffer.compare 16384 - random bytes 63.397 ns/op 64.148 ns/op 0.99
byteArrayEquals 123687377 - random bytes 9.5300 ns/op 9.8700 ns/op 0.97
Buffer.compare 123687377 - random bytes 75.870 ns/op 84.300 ns/op 0.90
regular array get 100000 times 47.756 us/op 49.205 us/op 0.97
wrappedArray get 100000 times 46.751 us/op 47.809 us/op 0.98
arrayWithProxy get 100000 times 14.896 ms/op 17.588 ms/op 0.85
ssz.Root.equals 56.233 ns/op 56.332 ns/op 1.00
byteArrayEquals 54.954 ns/op 55.081 ns/op 1.00
Buffer.compare 12.485 ns/op 12.408 ns/op 1.01
shuffle list - 16384 els 7.3667 ms/op 7.6323 ms/op 0.97
shuffle list - 250000 els 109.42 ms/op 112.58 ms/op 0.97
processSlot - 1 slots 20.922 us/op 17.090 us/op 1.22
processSlot - 32 slots 3.9883 ms/op 3.4610 ms/op 1.15
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 61.333 ms/op 64.926 ms/op 0.94
getCommitteeAssignments - req 1 vs - 250000 vc 2.5261 ms/op 2.6126 ms/op 0.97
getCommitteeAssignments - req 100 vs - 250000 vc 3.7382 ms/op 3.8703 ms/op 0.97
getCommitteeAssignments - req 1000 vs - 250000 vc 4.0970 ms/op 4.2876 ms/op 0.96
findModifiedValidators - 10000 modified validators 566.72 ms/op 562.21 ms/op 1.01
findModifiedValidators - 1000 modified validators 430.61 ms/op 457.61 ms/op 0.94
findModifiedValidators - 100 modified validators 402.63 ms/op 417.03 ms/op 0.97
findModifiedValidators - 10 modified validators 458.80 ms/op 460.25 ms/op 1.00
findModifiedValidators - 1 modified validators 424.03 ms/op 450.56 ms/op 0.94
findModifiedValidators - no difference 415.99 ms/op 459.45 ms/op 0.91
compare ViewDUs 4.7614 s/op 5.0228 s/op 0.95
compare each validator Uint8Array 1.6107 s/op 2.0036 s/op 0.80
compare ViewDU to Uint8Array 1.4135 s/op 1.6241 s/op 0.87
migrate state 1000000 validators, 24 modified, 0 new 802.62 ms/op 961.31 ms/op 0.83
migrate state 1000000 validators, 1700 modified, 1000 new 1.0718 s/op 1.3263 s/op 0.81
migrate state 1000000 validators, 3400 modified, 2000 new 1.3738 s/op 1.4220 s/op 0.97
migrate state 1500000 validators, 24 modified, 0 new 864.47 ms/op 969.95 ms/op 0.89
migrate state 1500000 validators, 1700 modified, 1000 new 1.1342 s/op 1.2874 s/op 0.88
migrate state 1500000 validators, 3400 modified, 2000 new 1.5039 s/op 1.7338 s/op 0.87
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.0600 ns/op 6.0100 ns/op 0.84
state getBlockRootAtSlot - 250000 vs - 7PWei 865.17 ns/op 929.36 ns/op 0.93
computeProposers - vc 250000 10.579 ms/op 15.058 ms/op 0.70
computeEpochShuffling - vc 250000 105.75 ms/op 139.24 ms/op 0.76
getNextSyncCommittee - vc 250000 167.41 ms/op 221.81 ms/op 0.75
computeSigningRoot for AttestationData 26.269 us/op 36.265 us/op 0.72
hash AttestationData serialized data then Buffer.toString(base64) 2.3485 us/op 2.6570 us/op 0.88
toHexString serialized data 1.1996 us/op 2.0912 us/op 0.57
Buffer.toString(base64) 249.10 ns/op 313.21 ns/op 0.80

by benchmarkbot/action

@jeluard jeluard marked this pull request as ready for review February 19, 2024 09:58
@jeluard jeluard requested a review from a team as a code owner February 19, 2024 09:58
Copy link
Contributor

@nazarhussain nazarhussain left a comment

Choose a reason for hiding this comment

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

As this PR is addressing a user facing bug, let's extract the refactoring to a separate PR.

  1. Changes of Record to Map, have no objection just keep in separate PR.
  2. Would be nice to add an E2E test for the fianlized block root, it will be easy to test in the current e2e test setup.

@@ -6,14 +6,21 @@ import {Logger} from "@lodestar/utils";
import {MAX_PAYLOAD_HISTORY} from "../constants.js";
import {hexToBuffer} from "./conversion.js";

export async function fetchBlock(api: Api, slot: number): Promise<capella.SignedBeaconBlock | undefined> {
const res = await api.beacon.getBlockV2(slot);
Copy link
Member

Choose a reason for hiding this comment

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

are we fine with throwing here if there is a network error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If an error is thrown here then a light-client header is not processed (that error will be logged).

I think that it's ok in the context of this PR as it doesn't change this behavior. If required a proper solution could be implemented separately.

@jeluard jeluard merged commit 30d347d into unstable Mar 14, 2024
19 of 20 checks passed
@jeluard jeluard deleted the jeluard/prover-block-by-number branch March 14, 2024 15:02
@wemeetagain
Copy link
Member

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

lodestar/prover eth_getBlockByNumber doesn't work correctly
4 participants