-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
feat: n-historical states feature flags #6538
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6538 +/- ##
============================================
- Coverage 61.53% 61.48% -0.05%
============================================
Files 556 556
Lines 58647 58891 +244
Branches 1847 1854 +7
============================================
+ Hits 36087 36212 +125
- Misses 22520 22638 +118
- Partials 40 41 +1 |
// As a result, we throw an IGNORE (whereas the spec says we should REJECT for this scenario). | ||
// this is something we should change this in the future to make the code airtight to the spec. | ||
// [IGNORE] The block's parent (defined by block.parent_root) has been seen (via both gossip and non-gossip sources) (a client MAY queue blocks for processing once the parent block is retrieved). | ||
// [REJECT] The block's parent (defined by block.parent_root) passes validation. | ||
const blockState = await chain.regen | ||
.getBlockSlotState(parentRoot, blockSlot, {dontTransferCache: true}, RegenCaller.validateGossipBlock) | ||
.getPreState(block, {dontTransferCache: true}, RegenCaller.validateGossipBlock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same to getBlockSlotState()
except for it allows to reload state if needed
if block epoch is same to parent epoch, there is no need to dial to block slot
if block epoch > parent epoch, it'll use checkpoint state of block epoch. In regen.ts
it'll use getBlockSlotState()
in the end
return this.getBlockSlotState(toHexString(cp.root), checkpointStartSlot, opts, regenCaller, allowDiskReload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will reduce number of calls to processSlotsToNearestCheckpoint()
which will reduce epochTransitionByCaller
metric
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just the same, if parentEpoch < blockEpoch it'll get checkpoint state. The PrepareNextSlot
should do the epoch transition for us anyway so epoch transition doesn't come from here
|
Benchmark suite | Current: c2ce5ea | Previous: 556e5ec | Ratio |
---|---|---|---|
Buffer.compare 123687377 | 19.467 ms/op | 6.1516 ms/op | 3.16 |
byteArrayEquals 123687377 - random bytes | 26.130 ns/op | 8.4600 ns/op | 3.09 |
Full benchmark results
Benchmark suite | Current: c2ce5ea | Previous: 556e5ec | Ratio |
---|---|---|---|
getPubkeys - index2pubkey - req 1000 vs - 250000 vc | 714.40 us/op | 699.69 us/op | 1.02 |
getPubkeys - validatorsArr - req 1000 vs - 250000 vc | 132.05 us/op | 86.634 us/op | 1.52 |
BLS verify - blst-native | 1.3945 ms/op | 1.3101 ms/op | 1.06 |
BLS verifyMultipleSignatures 3 - blst-native | 2.8969 ms/op | 2.7675 ms/op | 1.05 |
BLS verifyMultipleSignatures 8 - blst-native | 6.4558 ms/op | 6.0399 ms/op | 1.07 |
BLS verifyMultipleSignatures 32 - blst-native | 23.347 ms/op | 22.023 ms/op | 1.06 |
BLS verifyMultipleSignatures 64 - blst-native | 46.421 ms/op | 43.290 ms/op | 1.07 |
BLS verifyMultipleSignatures 128 - blst-native | 91.403 ms/op | 85.344 ms/op | 1.07 |
BLS deserializing 10000 signatures | 968.02 ms/op | 883.25 ms/op | 1.10 |
BLS deserializing 100000 signatures | 9.4406 s/op | 9.2983 s/op | 1.02 |
BLS verifyMultipleSignatures - same message - 3 - blst-native | 1.4747 ms/op | 1.3268 ms/op | 1.11 |
BLS verifyMultipleSignatures - same message - 8 - blst-native | 1.5939 ms/op | 1.5107 ms/op | 1.06 |
BLS verifyMultipleSignatures - same message - 32 - blst-native | 2.5033 ms/op | 2.8992 ms/op | 0.86 |
BLS verifyMultipleSignatures - same message - 64 - blst-native | 3.7152 ms/op | 4.3061 ms/op | 0.86 |
BLS verifyMultipleSignatures - same message - 128 - blst-native | 6.1090 ms/op | 7.5384 ms/op | 0.81 |
BLS aggregatePubkeys 32 - blst-native | 29.609 us/op | 27.569 us/op | 1.07 |
BLS aggregatePubkeys 128 - blst-native | 107.63 us/op | 99.610 us/op | 1.08 |
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 | 85.554 ms/op | 78.812 ms/op | 1.09 |
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 | 103.66 ms/op | 69.883 ms/op | 1.48 |
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 | 62.002 ms/op | 43.933 ms/op | 1.41 |
getSlashingsAndExits - default max | 292.71 us/op | 179.87 us/op | 1.63 |
getSlashingsAndExits - 2k | 783.16 us/op | 394.22 us/op | 1.99 |
proposeBlockBody type=full, size=empty | 8.0776 ms/op | 6.2683 ms/op | 1.29 |
isKnown best case - 1 super set check | 712.00 ns/op | 314.00 ns/op | 2.27 |
isKnown normal case - 2 super set checks | 676.00 ns/op | 307.00 ns/op | 2.20 |
isKnown worse case - 16 super set checks | 680.00 ns/op | 296.00 ns/op | 2.30 |
CheckpointStateCache - add get delete | 10.005 us/op | 5.6440 us/op | 1.77 |
validate api signedAggregateAndProof - struct | 3.1816 ms/op | 2.7936 ms/op | 1.14 |
validate gossip signedAggregateAndProof - struct | 3.2783 ms/op | 2.7529 ms/op | 1.19 |
validate gossip attestation - vc 640000 | 1.5288 ms/op | 1.3593 ms/op | 1.12 |
batch validate gossip attestation - vc 640000 - chunk 32 | 199.44 us/op | 162.67 us/op | 1.23 |
batch validate gossip attestation - vc 640000 - chunk 64 | 175.83 us/op | 141.81 us/op | 1.24 |
batch validate gossip attestation - vc 640000 - chunk 128 | 159.41 us/op | 136.69 us/op | 1.17 |
batch validate gossip attestation - vc 640000 - chunk 256 | 146.08 us/op | 138.56 us/op | 1.05 |
pickEth1Vote - no votes | 1.4229 ms/op | 1.3976 ms/op | 1.02 |
pickEth1Vote - max votes | 11.038 ms/op | 11.140 ms/op | 0.99 |
pickEth1Vote - Eth1Data hashTreeRoot value x2048 | 21.014 ms/op | 17.921 ms/op | 1.17 |
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 | 34.024 ms/op | 32.892 ms/op | 1.03 |
pickEth1Vote - Eth1Data fastSerialize value x2048 | 781.93 us/op | 798.18 us/op | 0.98 |
pickEth1Vote - Eth1Data fastSerialize tree x2048 | 8.7745 ms/op | 7.8650 ms/op | 1.12 |
bytes32 toHexString | 733.00 ns/op | 636.00 ns/op | 1.15 |
bytes32 Buffer.toString(hex) | 318.00 ns/op | 315.00 ns/op | 1.01 |
bytes32 Buffer.toString(hex) from Uint8Array | 511.00 ns/op | 536.00 ns/op | 0.95 |
bytes32 Buffer.toString(hex) + 0x | 318.00 ns/op | 330.00 ns/op | 0.96 |
Object access 1 prop | 0.21900 ns/op | 0.19500 ns/op | 1.12 |
Map access 1 prop | 0.15000 ns/op | 0.15400 ns/op | 0.97 |
Object get x1000 | 8.0560 ns/op | 7.1190 ns/op | 1.13 |
Map get x1000 | 0.89500 ns/op | 0.77900 ns/op | 1.15 |
Object set x1000 | 69.423 ns/op | 54.947 ns/op | 1.26 |
Map set x1000 | 54.280 ns/op | 41.259 ns/op | 1.32 |
Return object 10000 times | 0.26490 ns/op | 0.23810 ns/op | 1.11 |
Throw Error 10000 times | 4.1712 us/op | 3.8751 us/op | 1.08 |
fastMsgIdFn sha256 / 200 bytes | 3.5660 us/op | 3.2790 us/op | 1.09 |
fastMsgIdFn h32 xxhash / 200 bytes | 369.00 ns/op | 274.00 ns/op | 1.35 |
fastMsgIdFn h64 xxhash / 200 bytes | 409.00 ns/op | 328.00 ns/op | 1.25 |
fastMsgIdFn sha256 / 1000 bytes | 12.231 us/op | 11.518 us/op | 1.06 |
fastMsgIdFn h32 xxhash / 1000 bytes | 513.00 ns/op | 400.00 ns/op | 1.28 |
fastMsgIdFn h64 xxhash / 1000 bytes | 504.00 ns/op | 419.00 ns/op | 1.20 |
fastMsgIdFn sha256 / 10000 bytes | 110.04 us/op | 103.51 us/op | 1.06 |
fastMsgIdFn h32 xxhash / 10000 bytes | 2.0610 us/op | 1.9060 us/op | 1.08 |
fastMsgIdFn h64 xxhash / 10000 bytes | 1.4330 us/op | 1.3000 us/op | 1.10 |
send data - 1000 256B messages | 22.731 ms/op | 18.631 ms/op | 1.22 |
send data - 1000 512B messages | 30.104 ms/op | 24.173 ms/op | 1.25 |
send data - 1000 1024B messages | 43.677 ms/op | 41.068 ms/op | 1.06 |
send data - 1000 1200B messages | 45.621 ms/op | 41.642 ms/op | 1.10 |
send data - 1000 2048B messages | 54.677 ms/op | 52.069 ms/op | 1.05 |
send data - 1000 4096B messages | 49.302 ms/op | 47.102 ms/op | 1.05 |
send data - 1000 16384B messages | 136.20 ms/op | 115.30 ms/op | 1.18 |
send data - 1000 65536B messages | 474.82 ms/op | 462.55 ms/op | 1.03 |
enrSubnets - fastDeserialize 64 bits | 1.6830 us/op | 1.6520 us/op | 1.02 |
enrSubnets - ssz BitVector 64 bits | 555.00 ns/op | 545.00 ns/op | 1.02 |
enrSubnets - fastDeserialize 4 bits | 238.00 ns/op | 225.00 ns/op | 1.06 |
enrSubnets - ssz BitVector 4 bits | 568.00 ns/op | 537.00 ns/op | 1.06 |
prioritizePeers score -10:0 att 32-0.1 sync 2-0 | 128.56 us/op | 129.43 us/op | 0.99 |
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 | 158.02 us/op | 147.84 us/op | 1.07 |
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 | 205.97 us/op | 191.24 us/op | 1.08 |
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 | 368.39 us/op | 345.50 us/op | 1.07 |
prioritizePeers score 0:0 att 64-1 sync 4-1 | 400.93 us/op | 380.19 us/op | 1.05 |
array of 16000 items push then shift | 1.7973 us/op | 1.7026 us/op | 1.06 |
LinkedList of 16000 items push then shift | 9.7360 ns/op | 9.2130 ns/op | 1.06 |
array of 16000 items push then pop | 119.56 ns/op | 114.04 ns/op | 1.05 |
LinkedList of 16000 items push then pop | 9.5200 ns/op | 9.4830 ns/op | 1.00 |
array of 24000 items push then shift | 2.5369 us/op | 2.6241 us/op | 0.97 |
LinkedList of 24000 items push then shift | 9.8300 ns/op | 9.9590 ns/op | 0.99 |
array of 24000 items push then pop | 162.11 ns/op | 163.72 ns/op | 0.99 |
LinkedList of 24000 items push then pop | 9.5050 ns/op | 9.4020 ns/op | 1.01 |
intersect bitArray bitLen 8 | 6.3900 ns/op | 6.1920 ns/op | 1.03 |
intersect array and set length 8 | 86.557 ns/op | 89.810 ns/op | 0.96 |
intersect bitArray bitLen 128 | 38.510 ns/op | 37.998 ns/op | 1.01 |
intersect array and set length 128 | 1.0544 us/op | 1.1278 us/op | 0.93 |
bitArray.getTrueBitIndexes() bitLen 128 | 1.9070 us/op | 1.7370 us/op | 1.10 |
bitArray.getTrueBitIndexes() bitLen 248 | 3.1020 us/op | 3.3300 us/op | 0.93 |
bitArray.getTrueBitIndexes() bitLen 512 | 6.5040 us/op | 6.8180 us/op | 0.95 |
Buffer.concat 32 items | 1.1290 us/op | 1.0870 us/op | 1.04 |
Uint8Array.set 32 items | 2.1780 us/op | 2.1360 us/op | 1.02 |
Set add up to 64 items then delete first | 5.3386 us/op | 5.3046 us/op | 1.01 |
OrderedSet add up to 64 items then delete first | 7.1599 us/op | 7.1455 us/op | 1.00 |
Set add up to 64 items then delete last | 5.7268 us/op | 5.6318 us/op | 1.02 |
OrderedSet add up to 64 items then delete last | 7.4279 us/op | 7.5162 us/op | 0.99 |
Set add up to 64 items then delete middle | 5.3229 us/op | 5.5828 us/op | 0.95 |
OrderedSet add up to 64 items then delete middle | 8.4701 us/op | 8.8251 us/op | 0.96 |
Set add up to 128 items then delete first | 10.889 us/op | 11.395 us/op | 0.96 |
OrderedSet add up to 128 items then delete first | 15.130 us/op | 15.903 us/op | 0.95 |
Set add up to 128 items then delete last | 10.591 us/op | 11.296 us/op | 0.94 |
OrderedSet add up to 128 items then delete last | 14.260 us/op | 15.102 us/op | 0.94 |
Set add up to 128 items then delete middle | 11.159 us/op | 11.207 us/op | 1.00 |
OrderedSet add up to 128 items then delete middle | 20.448 us/op | 20.607 us/op | 0.99 |
Set add up to 256 items then delete first | 22.601 us/op | 23.448 us/op | 0.96 |
OrderedSet add up to 256 items then delete first | 31.020 us/op | 32.119 us/op | 0.97 |
Set add up to 256 items then delete last | 21.912 us/op | 22.903 us/op | 0.96 |
OrderedSet add up to 256 items then delete last | 29.222 us/op | 31.638 us/op | 0.92 |
Set add up to 256 items then delete middle | 22.328 us/op | 23.036 us/op | 0.97 |
OrderedSet add up to 256 items then delete middle | 55.586 us/op | 55.011 us/op | 1.01 |
transfer serialized Status (84 B) | 2.0410 us/op | 2.0720 us/op | 0.99 |
copy serialized Status (84 B) | 1.5830 us/op | 1.5930 us/op | 0.99 |
transfer serialized SignedVoluntaryExit (112 B) | 2.0680 us/op | 2.1420 us/op | 0.97 |
copy serialized SignedVoluntaryExit (112 B) | 1.5570 us/op | 1.5580 us/op | 1.00 |
transfer serialized ProposerSlashing (416 B) | 2.3900 us/op | 2.5920 us/op | 0.92 |
copy serialized ProposerSlashing (416 B) | 2.1450 us/op | 2.5100 us/op | 0.85 |
transfer serialized Attestation (485 B) | 2.5740 us/op | 2.6590 us/op | 0.97 |
copy serialized Attestation (485 B) | 2.1830 us/op | 2.7830 us/op | 0.78 |
transfer serialized AttesterSlashing (33232 B) | 2.3010 us/op | 3.2610 us/op | 0.71 |
copy serialized AttesterSlashing (33232 B) | 9.3040 us/op | 10.638 us/op | 0.87 |
transfer serialized Small SignedBeaconBlock (128000 B) | 2.6440 us/op | 3.2090 us/op | 0.82 |
copy serialized Small SignedBeaconBlock (128000 B) | 27.156 us/op | 32.513 us/op | 0.84 |
transfer serialized Avg SignedBeaconBlock (200000 B) | 3.3700 us/op | 3.7610 us/op | 0.90 |
copy serialized Avg SignedBeaconBlock (200000 B) | 42.515 us/op | 47.590 us/op | 0.89 |
transfer serialized BlobsSidecar (524380 B) | 4.0740 us/op | 4.0530 us/op | 1.01 |
copy serialized BlobsSidecar (524380 B) | 140.13 us/op | 120.31 us/op | 1.16 |
transfer serialized Big SignedBeaconBlock (1000000 B) | 5.1220 us/op | 4.9660 us/op | 1.03 |
copy serialized Big SignedBeaconBlock (1000000 B) | 274.02 us/op | 224.38 us/op | 1.22 |
pass gossip attestations to forkchoice per slot | 4.3413 ms/op | 4.2696 ms/op | 1.02 |
forkChoice updateHead vc 100000 bc 64 eq 0 | 763.37 us/op | 722.10 us/op | 1.06 |
forkChoice updateHead vc 600000 bc 64 eq 0 | 4.9585 ms/op | 4.5276 ms/op | 1.10 |
forkChoice updateHead vc 1000000 bc 64 eq 0 | 8.3207 ms/op | 7.5464 ms/op | 1.10 |
forkChoice updateHead vc 600000 bc 320 eq 0 | 4.8226 ms/op | 4.6818 ms/op | 1.03 |
forkChoice updateHead vc 600000 bc 1200 eq 0 | 4.8149 ms/op | 4.9426 ms/op | 0.97 |
forkChoice updateHead vc 600000 bc 7200 eq 0 | 6.3058 ms/op | 9.0407 ms/op | 0.70 |
forkChoice updateHead vc 600000 bc 64 eq 1000 | 11.865 ms/op | 12.173 ms/op | 0.97 |
forkChoice updateHead vc 600000 bc 64 eq 10000 | 12.566 ms/op | 13.775 ms/op | 0.91 |
forkChoice updateHead vc 600000 bc 64 eq 300000 | 30.155 ms/op | 32.625 ms/op | 0.92 |
computeDeltas 500000 validators 300 proto nodes | 7.3363 ms/op | 7.5734 ms/op | 0.97 |
computeDeltas 500000 validators 1200 proto nodes | 7.1049 ms/op | 7.6395 ms/op | 0.93 |
computeDeltas 500000 validators 7200 proto nodes | 7.2637 ms/op | 7.4392 ms/op | 0.98 |
computeDeltas 750000 validators 300 proto nodes | 11.022 ms/op | 10.627 ms/op | 1.04 |
computeDeltas 750000 validators 1200 proto nodes | 10.826 ms/op | 10.557 ms/op | 1.03 |
computeDeltas 750000 validators 7200 proto nodes | 11.145 ms/op | 10.321 ms/op | 1.08 |
computeDeltas 1400000 validators 300 proto nodes | 20.075 ms/op | 19.628 ms/op | 1.02 |
computeDeltas 1400000 validators 1200 proto nodes | 19.418 ms/op | 18.661 ms/op | 1.04 |
computeDeltas 1400000 validators 7200 proto nodes | 19.947 ms/op | 18.661 ms/op | 1.07 |
computeDeltas 2100000 validators 300 proto nodes | 29.516 ms/op | 27.964 ms/op | 1.06 |
computeDeltas 2100000 validators 1200 proto nodes | 31.416 ms/op | 28.181 ms/op | 1.11 |
computeDeltas 2100000 validators 7200 proto nodes | 30.118 ms/op | 28.502 ms/op | 1.06 |
altair processAttestation - 250000 vs - 7PWei normalcase | 3.2996 ms/op | 2.4140 ms/op | 1.37 |
altair processAttestation - 250000 vs - 7PWei worstcase | 4.6749 ms/op | 3.2912 ms/op | 1.42 |
altair processAttestation - setStatus - 1/6 committees join | 207.03 us/op | 184.08 us/op | 1.12 |
altair processAttestation - setStatus - 1/3 committees join | 379.98 us/op | 376.11 us/op | 1.01 |
altair processAttestation - setStatus - 1/2 committees join | 517.02 us/op | 490.70 us/op | 1.05 |
altair processAttestation - setStatus - 2/3 committees join | 647.70 us/op | 654.13 us/op | 0.99 |
altair processAttestation - setStatus - 4/5 committees join | 873.68 us/op | 804.45 us/op | 1.09 |
altair processAttestation - setStatus - 100% committees join | 1.0074 ms/op | 934.63 us/op | 1.08 |
altair processBlock - 250000 vs - 7PWei normalcase | 10.950 ms/op | 10.164 ms/op | 1.08 |
altair processBlock - 250000 vs - 7PWei normalcase hashState | 33.781 ms/op | 39.153 ms/op | 0.86 |
altair processBlock - 250000 vs - 7PWei worstcase | 39.217 ms/op | 41.692 ms/op | 0.94 |
altair processBlock - 250000 vs - 7PWei worstcase hashState | 93.405 ms/op | 98.341 ms/op | 0.95 |
phase0 processBlock - 250000 vs - 7PWei normalcase | 3.0041 ms/op | 3.3318 ms/op | 0.90 |
phase0 processBlock - 250000 vs - 7PWei worstcase | 32.371 ms/op | 29.266 ms/op | 1.11 |
altair processEth1Data - 250000 vs - 7PWei normalcase | 671.51 us/op | 583.25 us/op | 1.15 |
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 | 14.399 us/op | 11.677 us/op | 1.23 |
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 | 44.057 us/op | 100.65 us/op | 0.44 |
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 | 22.907 us/op | 28.962 us/op | 0.79 |
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 | 15.015 us/op | 22.702 us/op | 0.66 |
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 | 219.86 us/op | 298.58 us/op | 0.74 |
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 | 1.2129 ms/op | 2.8692 ms/op | 0.42 |
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 | 1.8274 ms/op | 3.0453 ms/op | 0.60 |
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 | 1.9357 ms/op | 2.2875 ms/op | 0.85 |
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 | 3.5691 ms/op | 3.1617 ms/op | 1.13 |
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 | 2.8428 ms/op | 2.3320 ms/op | 1.22 |
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 | 6.1718 ms/op | 4.8746 ms/op | 1.27 |
Tree 40 250000 create | 390.87 ms/op | 350.98 ms/op | 1.11 |
Tree 40 250000 get(125000) | 210.91 ns/op | 195.00 ns/op | 1.08 |
Tree 40 250000 set(125000) | 1.0927 us/op | 975.82 ns/op | 1.12 |
Tree 40 250000 toArray() | 22.984 ms/op | 20.857 ms/op | 1.10 |
Tree 40 250000 iterate all - toArray() + loop | 23.293 ms/op | 21.032 ms/op | 1.11 |
Tree 40 250000 iterate all - get(i) | 76.038 ms/op | 66.157 ms/op | 1.15 |
MutableVector 250000 create | 14.145 ms/op | 16.956 ms/op | 0.83 |
MutableVector 250000 get(125000) | 6.7880 ns/op | 6.5370 ns/op | 1.04 |
MutableVector 250000 set(125000) | 312.82 ns/op | 268.27 ns/op | 1.17 |
MutableVector 250000 toArray() | 3.8420 ms/op | 3.2197 ms/op | 1.19 |
MutableVector 250000 iterate all - toArray() + loop | 4.0250 ms/op | 3.5902 ms/op | 1.12 |
MutableVector 250000 iterate all - get(i) | 1.5709 ms/op | 1.6085 ms/op | 0.98 |
Array 250000 create | 3.6169 ms/op | 3.0332 ms/op | 1.19 |
Array 250000 clone - spread | 1.4700 ms/op | 1.3177 ms/op | 1.12 |
Array 250000 get(125000) | 1.2220 ns/op | 1.0590 ns/op | 1.15 |
Array 250000 set(125000) | 4.5060 ns/op | 4.0590 ns/op | 1.11 |
Array 250000 iterate all - loop | 171.50 us/op | 163.44 us/op | 1.05 |
effectiveBalanceIncrements clone Uint8Array 300000 | 43.825 us/op | 33.129 us/op | 1.32 |
effectiveBalanceIncrements clone MutableVector 300000 | 461.00 ns/op | 399.00 ns/op | 1.16 |
effectiveBalanceIncrements rw all Uint8Array 300000 | 207.30 us/op | 202.30 us/op | 1.02 |
effectiveBalanceIncrements rw all MutableVector 300000 | 98.078 ms/op | 87.567 ms/op | 1.12 |
phase0 afterProcessEpoch - 250000 vs - 7PWei | 121.21 ms/op | 114.47 ms/op | 1.06 |
phase0 beforeProcessEpoch - 250000 vs - 7PWei | 40.549 ms/op | 57.213 ms/op | 0.71 |
altair processEpoch - mainnet_e81889 | 529.28 ms/op | 504.48 ms/op | 1.05 |
mainnet_e81889 - altair beforeProcessEpoch | 85.335 ms/op | 85.714 ms/op | 1.00 |
mainnet_e81889 - altair processJustificationAndFinalization | 15.952 us/op | 15.261 us/op | 1.05 |
mainnet_e81889 - altair processInactivityUpdates | 6.6858 ms/op | 6.2842 ms/op | 1.06 |
mainnet_e81889 - altair processRewardsAndPenalties | 57.382 ms/op | 78.508 ms/op | 0.73 |
mainnet_e81889 - altair processRegistryUpdates | 2.4450 us/op | 2.6130 us/op | 0.94 |
mainnet_e81889 - altair processSlashings | 537.00 ns/op | 613.00 ns/op | 0.88 |
mainnet_e81889 - altair processEth1DataReset | 478.00 ns/op | 622.00 ns/op | 0.77 |
mainnet_e81889 - altair processEffectiveBalanceUpdates | 1.4052 ms/op | 1.7307 ms/op | 0.81 |
mainnet_e81889 - altair processSlashingsReset | 4.9650 us/op | 7.1240 us/op | 0.70 |
mainnet_e81889 - altair processRandaoMixesReset | 6.0260 us/op | 7.2750 us/op | 0.83 |
mainnet_e81889 - altair processHistoricalRootsUpdate | 854.00 ns/op | 770.00 ns/op | 1.11 |
mainnet_e81889 - altair processParticipationFlagUpdates | 3.8010 us/op | 2.6790 us/op | 1.42 |
mainnet_e81889 - altair processSyncCommitteeUpdates | 1.8660 us/op | 1.7610 us/op | 1.06 |
mainnet_e81889 - altair afterProcessEpoch | 124.22 ms/op | 123.33 ms/op | 1.01 |
capella processEpoch - mainnet_e217614 | 2.1173 s/op | 2.0301 s/op | 1.04 |
mainnet_e217614 - capella beforeProcessEpoch | 509.34 ms/op | 499.26 ms/op | 1.02 |
mainnet_e217614 - capella processJustificationAndFinalization | 16.417 us/op | 22.656 us/op | 0.72 |
mainnet_e217614 - capella processInactivityUpdates | 19.304 ms/op | 18.883 ms/op | 1.02 |
mainnet_e217614 - capella processRewardsAndPenalties | 582.43 ms/op | 570.81 ms/op | 1.02 |
mainnet_e217614 - capella processRegistryUpdates | 22.580 us/op | 23.569 us/op | 0.96 |
mainnet_e217614 - capella processSlashings | 626.00 ns/op | 508.00 ns/op | 1.23 |
mainnet_e217614 - capella processEth1DataReset | 568.00 ns/op | 418.00 ns/op | 1.36 |
mainnet_e217614 - capella processEffectiveBalanceUpdates | 4.7425 ms/op | 4.4501 ms/op | 1.07 |
mainnet_e217614 - capella processSlashingsReset | 3.8610 us/op | 2.9130 us/op | 1.33 |
mainnet_e217614 - capella processRandaoMixesReset | 7.8220 us/op | 7.6410 us/op | 1.02 |
mainnet_e217614 - capella processHistoricalRootsUpdate | 713.00 ns/op | 952.00 ns/op | 0.75 |
mainnet_e217614 - capella processParticipationFlagUpdates | 2.0910 us/op | 1.4080 us/op | 1.49 |
mainnet_e217614 - capella afterProcessEpoch | 321.26 ms/op | 312.20 ms/op | 1.03 |
phase0 processEpoch - mainnet_e58758 | 506.04 ms/op | 517.51 ms/op | 0.98 |
mainnet_e58758 - phase0 beforeProcessEpoch | 191.50 ms/op | 164.35 ms/op | 1.17 |
mainnet_e58758 - phase0 processJustificationAndFinalization | 37.354 us/op | 16.346 us/op | 2.29 |
mainnet_e58758 - phase0 processRewardsAndPenalties | 82.203 ms/op | 68.583 ms/op | 1.20 |
mainnet_e58758 - phase0 processRegistryUpdates | 24.068 us/op | 9.8670 us/op | 2.44 |
mainnet_e58758 - phase0 processSlashings | 1.3240 us/op | 620.00 ns/op | 2.14 |
mainnet_e58758 - phase0 processEth1DataReset | 1.2380 us/op | 633.00 ns/op | 1.96 |
mainnet_e58758 - phase0 processEffectiveBalanceUpdates | 1.5396 ms/op | 1.5811 ms/op | 0.97 |
mainnet_e58758 - phase0 processSlashingsReset | 7.3390 us/op | 4.4860 us/op | 1.64 |
mainnet_e58758 - phase0 processRandaoMixesReset | 9.8670 us/op | 4.8550 us/op | 2.03 |
mainnet_e58758 - phase0 processHistoricalRootsUpdate | 1.3120 us/op | 1.0720 us/op | 1.22 |
mainnet_e58758 - phase0 processParticipationRecordUpdates | 10.449 us/op | 4.9150 us/op | 2.13 |
mainnet_e58758 - phase0 afterProcessEpoch | 116.14 ms/op | 99.841 ms/op | 1.16 |
phase0 processEffectiveBalanceUpdates - 250000 normalcase | 2.2614 ms/op | 1.3192 ms/op | 1.71 |
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 | 1.6766 ms/op | 1.9394 ms/op | 0.86 |
altair processInactivityUpdates - 250000 normalcase | 33.834 ms/op | 31.685 ms/op | 1.07 |
altair processInactivityUpdates - 250000 worstcase | 34.383 ms/op | 29.461 ms/op | 1.17 |
phase0 processRegistryUpdates - 250000 normalcase | 19.761 us/op | 15.111 us/op | 1.31 |
phase0 processRegistryUpdates - 250000 badcase_full_deposits | 698.71 us/op | 673.04 us/op | 1.04 |
phase0 processRegistryUpdates - 250000 worstcase 0.5 | 240.98 ms/op | 152.06 ms/op | 1.58 |
altair processRewardsAndPenalties - 250000 normalcase | 84.571 ms/op | 92.660 ms/op | 0.91 |
altair processRewardsAndPenalties - 250000 worstcase | 91.858 ms/op | 81.507 ms/op | 1.13 |
phase0 getAttestationDeltas - 250000 normalcase | 14.768 ms/op | 8.8139 ms/op | 1.68 |
phase0 getAttestationDeltas - 250000 worstcase | 15.269 ms/op | 9.1782 ms/op | 1.66 |
phase0 processSlashings - 250000 worstcase | 136.32 us/op | 128.71 us/op | 1.06 |
altair processSyncCommitteeUpdates - 250000 | 202.43 ms/op | 153.32 ms/op | 1.32 |
BeaconState.hashTreeRoot - No change | 887.00 ns/op | 380.00 ns/op | 2.33 |
BeaconState.hashTreeRoot - 1 full validator | 211.20 us/op | 170.13 us/op | 1.24 |
BeaconState.hashTreeRoot - 32 full validator | 2.3848 ms/op | 1.8280 ms/op | 1.30 |
BeaconState.hashTreeRoot - 512 full validator | 26.543 ms/op | 19.173 ms/op | 1.38 |
BeaconState.hashTreeRoot - 1 validator.effectiveBalance | 251.32 us/op | 206.65 us/op | 1.22 |
BeaconState.hashTreeRoot - 32 validator.effectiveBalance | 3.6243 ms/op | 2.3873 ms/op | 1.52 |
BeaconState.hashTreeRoot - 512 validator.effectiveBalance | 56.618 ms/op | 29.890 ms/op | 1.89 |
BeaconState.hashTreeRoot - 1 balances | 229.02 us/op | 154.71 us/op | 1.48 |
BeaconState.hashTreeRoot - 32 balances | 1.8993 ms/op | 1.4714 ms/op | 1.29 |
BeaconState.hashTreeRoot - 512 balances | 18.295 ms/op | 14.913 ms/op | 1.23 |
BeaconState.hashTreeRoot - 250000 balances | 319.19 ms/op | 220.53 ms/op | 1.45 |
aggregationBits - 2048 els - zipIndexesInBitList | 62.878 us/op | 27.231 us/op | 2.31 |
byteArrayEquals 32 | 89.630 ns/op | 74.408 ns/op | 1.20 |
Buffer.compare 32 | 69.694 ns/op | 55.696 ns/op | 1.25 |
byteArrayEquals 1024 | 2.8718 us/op | 2.0323 us/op | 1.41 |
Buffer.compare 1024 | 84.477 ns/op | 71.360 ns/op | 1.18 |
byteArrayEquals 16384 | 45.085 us/op | 32.341 us/op | 1.39 |
Buffer.compare 16384 | 292.95 ns/op | 269.66 ns/op | 1.09 |
byteArrayEquals 123687377 | 329.00 ms/op | 243.73 ms/op | 1.35 |
Buffer.compare 123687377 | 19.467 ms/op | 6.1516 ms/op | 3.16 |
byteArrayEquals 32 - diff last byte | 114.91 ns/op | 71.508 ns/op | 1.61 |
Buffer.compare 32 - diff last byte | 80.714 ns/op | 60.380 ns/op | 1.34 |
byteArrayEquals 1024 - diff last byte | 2.7193 us/op | 2.0362 us/op | 1.34 |
Buffer.compare 1024 - diff last byte | 117.69 ns/op | 72.243 ns/op | 1.63 |
byteArrayEquals 16384 - diff last byte | 70.084 us/op | 32.583 us/op | 2.15 |
Buffer.compare 16384 - diff last byte | 319.12 ns/op | 256.38 ns/op | 1.24 |
byteArrayEquals 123687377 - diff last byte | 302.60 ms/op | 245.42 ms/op | 1.23 |
Buffer.compare 123687377 - diff last byte | 17.021 ms/op | 6.2032 ms/op | 2.74 |
byteArrayEquals 32 - random bytes | 7.9950 ns/op | 5.2690 ns/op | 1.52 |
Buffer.compare 32 - random bytes | 74.483 ns/op | 60.796 ns/op | 1.23 |
byteArrayEquals 1024 - random bytes | 7.8540 ns/op | 5.1900 ns/op | 1.51 |
Buffer.compare 1024 - random bytes | 70.094 ns/op | 60.506 ns/op | 1.16 |
byteArrayEquals 16384 - random bytes | 7.8530 ns/op | 5.1960 ns/op | 1.51 |
Buffer.compare 16384 - random bytes | 70.075 ns/op | 60.160 ns/op | 1.16 |
byteArrayEquals 123687377 - random bytes | 26.130 ns/op | 8.4600 ns/op | 3.09 |
Buffer.compare 123687377 - random bytes | 114.30 ns/op | 63.630 ns/op | 1.80 |
regular array get 100000 times | 61.972 us/op | 44.201 us/op | 1.40 |
wrappedArray get 100000 times | 56.141 us/op | 44.184 us/op | 1.27 |
arrayWithProxy get 100000 times | 17.078 ms/op | 15.373 ms/op | 1.11 |
ssz.Root.equals | 63.829 ns/op | 53.403 ns/op | 1.20 |
byteArrayEquals | 63.782 ns/op | 52.436 ns/op | 1.22 |
Buffer.compare | 16.769 ns/op | 10.732 ns/op | 1.56 |
shuffle list - 16384 els | 10.053 ms/op | 8.4073 ms/op | 1.20 |
shuffle list - 250000 els | 150.30 ms/op | 123.60 ms/op | 1.22 |
processSlot - 1 slots | 29.451 us/op | 17.650 us/op | 1.67 |
processSlot - 32 slots | 4.8861 ms/op | 4.5126 ms/op | 1.08 |
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei | 60.277 ms/op | 64.758 ms/op | 0.93 |
getCommitteeAssignments - req 1 vs - 250000 vc | 2.8964 ms/op | 2.6803 ms/op | 1.08 |
getCommitteeAssignments - req 100 vs - 250000 vc | 4.1183 ms/op | 3.8732 ms/op | 1.06 |
getCommitteeAssignments - req 1000 vs - 250000 vc | 4.4353 ms/op | 4.2211 ms/op | 1.05 |
findModifiedValidators - 10000 modified validators | 579.03 ms/op | 563.05 ms/op | 1.03 |
findModifiedValidators - 1000 modified validators | 453.66 ms/op | 430.64 ms/op | 1.05 |
findModifiedValidators - 100 modified validators | 430.40 ms/op | 420.63 ms/op | 1.02 |
findModifiedValidators - 10 modified validators | 400.70 ms/op | 412.09 ms/op | 0.97 |
findModifiedValidators - 1 modified validators | 437.26 ms/op | 414.58 ms/op | 1.05 |
findModifiedValidators - no difference | 432.72 ms/op | 387.67 ms/op | 1.12 |
compare ViewDUs | 4.8733 s/op | 4.9252 s/op | 0.99 |
compare each validator Uint8Array | 1.7383 s/op | 1.9154 s/op | 0.91 |
compare ViewDU to Uint8Array | 1.4142 s/op | 1.0928 s/op | 1.29 |
migrate state 1000000 validators, 24 modified, 0 new | 817.29 ms/op | 889.41 ms/op | 0.92 |
migrate state 1000000 validators, 1700 modified, 1000 new | 1.1518 s/op | 1.2151 s/op | 0.95 |
migrate state 1000000 validators, 3400 modified, 2000 new | 1.3371 s/op | 1.4482 s/op | 0.92 |
migrate state 1500000 validators, 24 modified, 0 new | 804.37 ms/op | 929.61 ms/op | 0.87 |
migrate state 1500000 validators, 1700 modified, 1000 new | 1.1958 s/op | 1.1846 s/op | 1.01 |
migrate state 1500000 validators, 3400 modified, 2000 new | 1.3621 s/op | 1.4629 s/op | 0.93 |
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei | 4.7100 ns/op | 4.1700 ns/op | 1.13 |
state getBlockRootAtSlot - 250000 vs - 7PWei | 575.43 ns/op | 716.63 ns/op | 0.80 |
computeProposers - vc 250000 | 9.4982 ms/op | 8.7214 ms/op | 1.09 |
computeEpochShuffling - vc 250000 | 130.47 ms/op | 122.51 ms/op | 1.06 |
getNextSyncCommittee - vc 250000 | 159.43 ms/op | 158.56 ms/op | 1.01 |
computeSigningRoot for AttestationData | 26.327 us/op | 29.191 us/op | 0.90 |
hash AttestationData serialized data then Buffer.toString(base64) | 2.4054 us/op | 2.2514 us/op | 1.07 |
toHexString serialized data | 1.2187 us/op | 1.0347 us/op | 1.18 |
Buffer.toString(base64) | 231.69 ns/op | 216.55 ns/op | 1.07 |
by benchmarkbot/action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Minor comments
// As a result, we throw an IGNORE (whereas the spec says we should REJECT for this scenario). | ||
// this is something we should change this in the future to make the code airtight to the spec. | ||
// [IGNORE] The block's parent (defined by block.parent_root) has been seen (via both gossip and non-gossip sources) (a client MAY queue blocks for processing once the parent block is retrieved). | ||
// [REJECT] The block's parent (defined by block.parent_root) passes validation. | ||
const blockState = await chain.regen | ||
.getBlockSlotState(parentRoot, blockSlot, {dontTransferCache: true}, RegenCaller.validateGossipBlock) | ||
.getPreState(block, {dontTransferCache: true}, RegenCaller.validateGossipBlock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will reduce number of calls to processSlotsToNearestCheckpoint()
which will reduce epochTransitionByCaller
metric
packages/beacon-node/test/e2e/chain/stateCache/nHistoricalStates.test.ts
Outdated
Show resolved
Hide resolved
@@ -335,6 +359,7 @@ export class BeaconChain implements IBeaconChain { | |||
|
|||
/** Populate in-memory caches with persisted data. Call at least once on startup */ | |||
async loadFromDisk(): Promise<void> { | |||
await this.regen.init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb question: Why don't we need to regen.init()
in the BeaconChain
constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a conventional place to do async init, see the this.opPool.fromPersisted(this.db)
call below
@@ -21,7 +21,10 @@ import {ChainEventEmitter} from "../emitter.js"; | |||
import {ChainEvent} from "../emitter.js"; | |||
import {GENESIS_SLOT} from "../../constants/index.js"; | |||
|
|||
export type {ForkChoiceOpts}; | |||
export type ForkChoiceOpts = RealForkChoiceOpts & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the use of word "real" is a little unconventional here though I can't come up with a better name. Maybe RawForkChoiceOpts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
🎉 This PR is included in v1.18.0 🎉 |
Motivation
Add feature flags for n-historical state work
Description
Flag list includes:
chain.nHistoricalStates
: to turn on the feature,false
by defaultchain.nHistoricalStatesFileDataStore
: use db vs file datastore,false
by defaultchain.maxBlockStates
: max block states in memory, 32 by defaultchain.maxCPStateEpochsInMemory
: max epoch in persistent checkpoint state to keep in memory, 2 by defaultAdd e2e test for different reorg scenarios when using this feature
part of #5968