-
-
Notifications
You must be signed in to change notification settings - Fork 410
fix: remove getAttestationsForBlockPreElectra #8048
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
base: unstable
Are you sure you want to change the base?
Conversation
| // since Jul 2025, only support electra | ||
| const forkSeq = ForkSeq[fork]; | ||
| return forkSeq >= ForkSeq.electra | ||
| ? this.getAttestationsForBlockElectra(fork, forkChoice, state) | ||
| : this.getAttestationsForBlockPreElectra(fork, forkChoice, state); | ||
| } | ||
|
|
||
| /** | ||
| * Get attestations to be included in a block pre-electra. Returns up to $MAX_ATTESTATIONS items | ||
| */ | ||
| getAttestationsForBlockPreElectra( | ||
| fork: ForkName, | ||
| forkChoice: IForkChoice, | ||
| state: CachedBeaconStateAllForks | ||
| ): phase0.Attestation[] { | ||
| const stateSlot = state.slot; | ||
| const stateEpoch = state.epochCtx.epoch; | ||
| const statePrevEpoch = stateEpoch - 1; | ||
|
|
||
| const notSeenValidatorsFn = getNotSeenValidatorsFn(state); | ||
| const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state); | ||
|
|
||
| const attestationsByScore: AttestationWithScore[] = []; | ||
|
|
||
| const slots = Array.from(this.attestationGroupByIndexByDataHexBySlot.keys()).sort((a, b) => b - a); | ||
| let minScore = Number.MAX_SAFE_INTEGER; | ||
| let slotCount = 0; | ||
| slot: for (const slot of slots) { | ||
| slotCount++; | ||
| const attestationGroupByIndexByDataHash = this.attestationGroupByIndexByDataHexBySlot.get(slot); | ||
| // should not happen | ||
| if (!attestationGroupByIndexByDataHash) { | ||
| throw Error(`No aggregated attestation pool for slot=${slot}`); | ||
| } | ||
|
|
||
| const epoch = computeEpochAtSlot(slot); | ||
| // validateAttestation condition: Attestation target epoch not in previous or current epoch | ||
| if (!(epoch === stateEpoch || epoch === statePrevEpoch)) { | ||
| continue; // Invalid attestations | ||
| } | ||
| // validateAttestation condition: Attestation slot not within inclusion window | ||
| if ( | ||
| !( | ||
| slot + MIN_ATTESTATION_INCLUSION_DELAY <= stateSlot && | ||
| // Post deneb, attestations are valid for current and previous epoch | ||
| (ForkSeq[fork] >= ForkSeq.deneb || stateSlot <= slot + SLOTS_PER_EPOCH) | ||
| ) | ||
| ) { | ||
| continue; // Invalid attestations | ||
| } | ||
|
|
||
| const inclusionDistance = stateSlot - slot; | ||
| for (const attestationGroupByIndex of attestationGroupByIndexByDataHash.values()) { | ||
| for (const [committeeIndex, attestationGroup] of attestationGroupByIndex.entries()) { | ||
| const notSeenCommitteeMembers = notSeenValidatorsFn(epoch, slot, committeeIndex); | ||
| if (notSeenCommitteeMembers === null || notSeenCommitteeMembers.size === 0) { | ||
| continue; | ||
| } | ||
|
|
||
| if ( | ||
| slotCount > 2 && | ||
| attestationsByScore.length >= MAX_ATTESTATIONS && | ||
| notSeenCommitteeMembers.size / inclusionDistance < minScore | ||
| ) { | ||
| // after 2 slots, there are a good chance that we have 2 * MAX_ATTESTATIONS attestations and break the for loop early | ||
| // if not, we may have to scan all slots in the pool | ||
| // if we have enough attestations and the max possible score is lower than scores of `attestationsByScore`, we should skip | ||
| // otherwise it takes time to check attestation, add it and remove it later after the sort by score | ||
| continue; | ||
| } | ||
|
|
||
| if (validateAttestationDataFn(attestationGroup.data) !== null) { | ||
| continue; | ||
| } | ||
|
|
||
| // TODO: Is it necessary to validateAttestation for: | ||
| // - Attestation committee index not within current committee count | ||
| // - Attestation aggregation bits length does not match committee length | ||
| // | ||
| // These properties should not change after being validate in gossip | ||
| // IF they have to be validated, do it only with one attestation per group since same data | ||
| // The committeeCountPerSlot can be precomputed once per slot | ||
| const getAttestationsResult = attestationGroup.getAttestationsForBlock( | ||
| fork, | ||
| state.epochCtx.effectiveBalanceIncrements, | ||
| notSeenCommitteeMembers, | ||
| MAX_ATTESTATIONS_PER_GROUP | ||
| ); | ||
| for (const {attestation, newSeenEffectiveBalance} of getAttestationsResult.result) { | ||
| const score = newSeenEffectiveBalance / inclusionDistance; | ||
| if (score < minScore) { | ||
| minScore = score; | ||
| } | ||
| attestationsByScore.push({ | ||
| attestation, | ||
| score, | ||
| }); | ||
| } | ||
|
|
||
| // Stop accumulating attestations there are enough that may have good scoring | ||
| if (attestationsByScore.length >= MAX_ATTESTATIONS * 2) { | ||
| break slot; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const sortedAttestationsByScore = attestationsByScore.sort((a, b) => b.score - a.score); | ||
| const attestationsForBlock: phase0.Attestation[] = []; | ||
| for (const [i, attestationWithScore] of sortedAttestationsByScore.entries()) { | ||
| if (i >= MAX_ATTESTATIONS) { | ||
| break; | ||
| } | ||
| // attestations could be modified in this op pool, so we need to clone for block | ||
| attestationsForBlock.push(ssz.phase0.Attestation.clone(attestationWithScore.attestation)); | ||
| if (forkSeq < ForkSeq.electra) { | ||
| throw Error(`Not support producing block for fork ${fork} slot ${state.slot}`); | ||
| } | ||
| return attestationsForBlock; | ||
| return this.getAttestationsForBlockElectra(fork, forkChoice, state); |
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 change introduces a breaking behavior by throwing an error for pre-electra forks instead of handling them. Since this modifies the public API contract, it should be documented in the changelog to properly notify users of this backward-incompatible change. Consider adding a changelog entry that clearly communicates this interface change and provides migration guidance for users who might still be relying on pre-electra block production.
Spotted by Diamond (based on custom rules)
Is this helpful? React 👍 or 👎 to let us know.
|
| Benchmark suite | Current: 69fc83f | Previous: 48f2ff7 | Ratio |
|---|---|---|---|
| fastMsgIdFn h32 xxhash / 200 bytes | 616.00 ns/op | 205.00 ns/op | 3.00 |
| getUint32 - manual | 461.00 ns/op | 123.00 ns/op | 3.75 |
Full benchmark results
| Benchmark suite | Current: 69fc83f | Previous: 48f2ff7 | Ratio |
|---|---|---|---|
| getPubkeys - index2pubkey - req 1000 vs - 250000 vc | 805.82 us/op | 1.8660 ms/op | 0.43 |
| getPubkeys - validatorsArr - req 1000 vs - 250000 vc | 34.069 us/op | 33.965 us/op | 1.00 |
| BLS verify - blst | 917.47 us/op | 664.59 us/op | 1.38 |
| BLS verifyMultipleSignatures 3 - blst | 1.3387 ms/op | 1.1407 ms/op | 1.17 |
| BLS verifyMultipleSignatures 8 - blst | 2.1597 ms/op | 1.6177 ms/op | 1.34 |
| BLS verifyMultipleSignatures 32 - blst | 4.5137 ms/op | 4.8826 ms/op | 0.92 |
| BLS verifyMultipleSignatures 64 - blst | 8.5264 ms/op | 8.9955 ms/op | 0.95 |
| BLS verifyMultipleSignatures 128 - blst | 16.192 ms/op | 17.141 ms/op | 0.94 |
| BLS deserializing 10000 signatures | 633.21 ms/op | 665.46 ms/op | 0.95 |
| BLS deserializing 100000 signatures | 6.4346 s/op | 6.6532 s/op | 0.97 |
| BLS verifyMultipleSignatures - same message - 3 - blst | 901.15 us/op | 778.26 us/op | 1.16 |
| BLS verifyMultipleSignatures - same message - 8 - blst | 1.1665 ms/op | 905.94 us/op | 1.29 |
| BLS verifyMultipleSignatures - same message - 32 - blst | 1.7136 ms/op | 1.6162 ms/op | 1.06 |
| BLS verifyMultipleSignatures - same message - 64 - blst | 2.5274 ms/op | 2.5144 ms/op | 1.01 |
| BLS verifyMultipleSignatures - same message - 128 - blst | 4.2408 ms/op | 4.3552 ms/op | 0.97 |
| BLS aggregatePubkeys 32 - blst | 18.271 us/op | 18.926 us/op | 0.97 |
| BLS aggregatePubkeys 128 - blst | 63.880 us/op | 69.463 us/op | 0.92 |
| getSlashingsAndExits - default max | 50.288 us/op | 71.015 us/op | 0.71 |
| getSlashingsAndExits - 2k | 435.13 us/op | 281.04 us/op | 1.55 |
| isKnown best case - 1 super set check | 492.00 ns/op | 204.00 ns/op | 2.41 |
| isKnown normal case - 2 super set checks | 413.00 ns/op | 200.00 ns/op | 2.06 |
| isKnown worse case - 16 super set checks | 418.00 ns/op | 200.00 ns/op | 2.09 |
| InMemoryCheckpointStateCache - add get delete | 2.4750 us/op | 2.4000 us/op | 1.03 |
| validate api signedAggregateAndProof - struct | 1.4952 ms/op | 1.4320 ms/op | 1.04 |
| validate gossip signedAggregateAndProof - struct | 1.5530 ms/op | 1.4741 ms/op | 1.05 |
| batch validate gossip attestation - vc 640000 - chunk 32 | 111.03 us/op | 114.86 us/op | 0.97 |
| batch validate gossip attestation - vc 640000 - chunk 64 | 97.901 us/op | 101.98 us/op | 0.96 |
| batch validate gossip attestation - vc 640000 - chunk 128 | 89.462 us/op | 96.558 us/op | 0.93 |
| batch validate gossip attestation - vc 640000 - chunk 256 | 98.978 us/op | 94.162 us/op | 1.05 |
| pickEth1Vote - no votes | 817.12 us/op | 949.22 us/op | 0.86 |
| pickEth1Vote - max votes | 11.838 ms/op | 6.7969 ms/op | 1.74 |
| pickEth1Vote - Eth1Data hashTreeRoot value x2048 | 23.682 ms/op | 10.539 ms/op | 2.25 |
| pickEth1Vote - Eth1Data hashTreeRoot tree x2048 | 26.319 ms/op | 13.867 ms/op | 1.90 |
| pickEth1Vote - Eth1Data fastSerialize value x2048 | 615.17 us/op | 416.11 us/op | 1.48 |
| pickEth1Vote - Eth1Data fastSerialize tree x2048 | 4.1725 ms/op | 3.6444 ms/op | 1.14 |
| bytes32 toHexString | 586.00 ns/op | 360.00 ns/op | 1.63 |
| bytes32 Buffer.toString(hex) | 545.00 ns/op | 232.00 ns/op | 2.35 |
| bytes32 Buffer.toString(hex) from Uint8Array | 578.00 ns/op | 325.00 ns/op | 1.78 |
| bytes32 Buffer.toString(hex) + 0x | 426.00 ns/op | 236.00 ns/op | 1.81 |
| Object access 1 prop | 0.32100 ns/op | 0.12000 ns/op | 2.68 |
| Map access 1 prop | 0.32300 ns/op | 0.12500 ns/op | 2.58 |
| Object get x1000 | 5.1900 ns/op | 5.8580 ns/op | 0.89 |
| Map get x1000 | 5.8990 ns/op | 6.2350 ns/op | 0.95 |
| Object set x1000 | 21.923 ns/op | 29.064 ns/op | 0.75 |
| Map set x1000 | 19.133 ns/op | 19.603 ns/op | 0.98 |
| Return object 10000 times | 0.30150 ns/op | 0.34630 ns/op | 0.87 |
| Throw Error 10000 times | 3.7542 us/op | 4.3896 us/op | 0.86 |
| toHex | 99.432 ns/op | 125.81 ns/op | 0.79 |
| Buffer.from | 93.872 ns/op | 120.41 ns/op | 0.78 |
| shared Buffer | 97.789 ns/op | 77.562 ns/op | 1.26 |
| fastMsgIdFn sha256 / 200 bytes | 3.0380 us/op | 2.1450 us/op | 1.42 |
| fastMsgIdFn h32 xxhash / 200 bytes | 616.00 ns/op | 205.00 ns/op | 3.00 |
| fastMsgIdFn h64 xxhash / 200 bytes | 450.00 ns/op | 260.00 ns/op | 1.73 |
| fastMsgIdFn sha256 / 1000 bytes | 8.2770 us/op | 7.0970 us/op | 1.17 |
| fastMsgIdFn h32 xxhash / 1000 bytes | 587.00 ns/op | 328.00 ns/op | 1.79 |
| fastMsgIdFn h64 xxhash / 1000 bytes | 524.00 ns/op | 335.00 ns/op | 1.56 |
| fastMsgIdFn sha256 / 10000 bytes | 49.670 us/op | 64.398 us/op | 0.77 |
| fastMsgIdFn h32 xxhash / 10000 bytes | 1.9620 us/op | 1.8130 us/op | 1.08 |
| fastMsgIdFn h64 xxhash / 10000 bytes | 1.5400 us/op | 1.1950 us/op | 1.29 |
| send data - 1000 256B messages | 16.569 ms/op | 11.594 ms/op | 1.43 |
| send data - 1000 512B messages | 19.808 ms/op | 17.979 ms/op | 1.10 |
| send data - 1000 1024B messages | 30.936 ms/op | 26.070 ms/op | 1.19 |
| send data - 1000 1200B messages | 21.246 ms/op | 19.817 ms/op | 1.07 |
| send data - 1000 2048B messages | 30.296 ms/op | 21.026 ms/op | 1.44 |
| send data - 1000 4096B messages | 24.103 ms/op | 25.989 ms/op | 0.93 |
| send data - 1000 16384B messages | 50.436 ms/op | 72.915 ms/op | 0.69 |
| send data - 1000 65536B messages | 362.10 ms/op | 205.98 ms/op | 1.76 |
| enrSubnets - fastDeserialize 64 bits | 1.3770 us/op | 878.00 ns/op | 1.57 |
| enrSubnets - ssz BitVector 64 bits | 531.00 ns/op | 330.00 ns/op | 1.61 |
| enrSubnets - fastDeserialize 4 bits | 393.00 ns/op | 131.00 ns/op | 3.00 |
| enrSubnets - ssz BitVector 4 bits | 633.00 ns/op | 331.00 ns/op | 1.91 |
| prioritizePeers score -10:0 att 32-0.1 sync 2-0 | 142.08 us/op | 123.22 us/op | 1.15 |
| prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 | 134.90 us/op | 175.90 us/op | 0.77 |
| prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 | 336.41 us/op | 219.20 us/op | 1.53 |
| prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 | 365.84 us/op | 400.73 us/op | 0.91 |
| prioritizePeers score 0:0 att 64-1 sync 4-1 | 464.56 us/op | 485.19 us/op | 0.96 |
| array of 16000 items push then shift | 1.3523 us/op | 1.5842 us/op | 0.85 |
| LinkedList of 16000 items push then shift | 8.2330 ns/op | 6.8940 ns/op | 1.19 |
| array of 16000 items push then pop | 79.128 ns/op | 76.358 ns/op | 1.04 |
| LinkedList of 16000 items push then pop | 6.6930 ns/op | 6.9900 ns/op | 0.96 |
| array of 24000 items push then shift | 1.9584 us/op | 2.3434 us/op | 0.84 |
| LinkedList of 24000 items push then shift | 7.2700 ns/op | 7.2200 ns/op | 1.01 |
| array of 24000 items push then pop | 118.39 ns/op | 102.43 ns/op | 1.16 |
| LinkedList of 24000 items push then pop | 6.6420 ns/op | 6.7830 ns/op | 0.98 |
| intersect bitArray bitLen 8 | 5.6030 ns/op | 6.2380 ns/op | 0.90 |
| intersect array and set length 8 | 39.333 ns/op | 36.960 ns/op | 1.06 |
| intersect bitArray bitLen 128 | 27.150 ns/op | 29.181 ns/op | 0.93 |
| intersect array and set length 128 | 616.55 ns/op | 610.00 ns/op | 1.01 |
| bitArray.getTrueBitIndexes() bitLen 128 | 1.6900 us/op | 1.0960 us/op | 1.54 |
| bitArray.getTrueBitIndexes() bitLen 248 | 2.1460 us/op | 1.8820 us/op | 1.14 |
| bitArray.getTrueBitIndexes() bitLen 512 | 4.1920 us/op | 3.7790 us/op | 1.11 |
| Buffer.concat 32 items | 1.1620 us/op | 603.00 ns/op | 1.93 |
| Uint8Array.set 32 items | 1.4320 us/op | 893.00 ns/op | 1.60 |
| Buffer.copy | 2.2420 us/op | 1.9650 us/op | 1.14 |
| Uint8Array.set - with subarray | 2.6680 us/op | 1.5050 us/op | 1.77 |
| Uint8Array.set - without subarray | 1.7660 us/op | 833.00 ns/op | 2.12 |
| getUint32 - dataview | 587.00 ns/op | 200.00 ns/op | 2.94 |
| getUint32 - manual | 461.00 ns/op | 123.00 ns/op | 3.75 |
| Set add up to 64 items then delete first | 2.1077 us/op | 2.2366 us/op | 0.94 |
| OrderedSet add up to 64 items then delete first | 3.6627 us/op | 3.3015 us/op | 1.11 |
| Set add up to 64 items then delete last | 2.2597 us/op | 2.4931 us/op | 0.91 |
| OrderedSet add up to 64 items then delete last | 6.2203 us/op | 3.6049 us/op | 1.73 |
| Set add up to 64 items then delete middle | 3.2940 us/op | 2.2966 us/op | 1.43 |
| OrderedSet add up to 64 items then delete middle | 5.2149 us/op | 5.4516 us/op | 0.96 |
| Set add up to 128 items then delete first | 4.5422 us/op | 4.9763 us/op | 0.91 |
| OrderedSet add up to 128 items then delete first | 6.9594 us/op | 8.5510 us/op | 0.81 |
| Set add up to 128 items then delete last | 4.5858 us/op | 5.1367 us/op | 0.89 |
| OrderedSet add up to 128 items then delete last | 6.5346 us/op | 8.0294 us/op | 0.81 |
| Set add up to 128 items then delete middle | 4.4265 us/op | 5.4091 us/op | 0.82 |
| OrderedSet add up to 128 items then delete middle | 14.862 us/op | 13.930 us/op | 1.07 |
| Set add up to 256 items then delete first | 10.008 us/op | 10.657 us/op | 0.94 |
| OrderedSet add up to 256 items then delete first | 14.953 us/op | 16.880 us/op | 0.89 |
| Set add up to 256 items then delete last | 13.614 us/op | 9.8987 us/op | 1.38 |
| OrderedSet add up to 256 items then delete last | 15.336 us/op | 14.867 us/op | 1.03 |
| Set add up to 256 items then delete middle | 9.1818 us/op | 9.9286 us/op | 0.92 |
| OrderedSet add up to 256 items then delete middle | 41.499 us/op | 40.672 us/op | 1.02 |
| transfer serialized Status (84 B) | 2.5770 us/op | 2.1540 us/op | 1.20 |
| copy serialized Status (84 B) | 1.5900 us/op | 1.1110 us/op | 1.43 |
| transfer serialized SignedVoluntaryExit (112 B) | 2.0300 us/op | 2.1770 us/op | 0.93 |
| copy serialized SignedVoluntaryExit (112 B) | 1.6350 us/op | 1.1190 us/op | 1.46 |
| transfer serialized ProposerSlashing (416 B) | 2.1090 us/op | 2.9200 us/op | 0.72 |
| copy serialized ProposerSlashing (416 B) | 1.4660 us/op | 1.1780 us/op | 1.24 |
| transfer serialized Attestation (485 B) | 2.5280 us/op | 2.2610 us/op | 1.12 |
| copy serialized Attestation (485 B) | 2.0160 us/op | 1.4750 us/op | 1.37 |
| transfer serialized AttesterSlashing (33232 B) | 2.7710 us/op | 2.3700 us/op | 1.17 |
| copy serialized AttesterSlashing (33232 B) | 5.7140 us/op | 3.7290 us/op | 1.53 |
| transfer serialized Small SignedBeaconBlock (128000 B) | 4.2400 us/op | 3.0100 us/op | 1.41 |
| copy serialized Small SignedBeaconBlock (128000 B) | 15.961 us/op | 9.6410 us/op | 1.66 |
| transfer serialized Avg SignedBeaconBlock (200000 B) | 2.6190 us/op | 3.4070 us/op | 0.77 |
| copy serialized Avg SignedBeaconBlock (200000 B) | 11.307 us/op | 13.758 us/op | 0.82 |
| transfer serialized BlobsSidecar (524380 B) | 6.4090 us/op | 3.5620 us/op | 1.80 |
| copy serialized BlobsSidecar (524380 B) | 83.288 us/op | 102.01 us/op | 0.82 |
| transfer serialized Big SignedBeaconBlock (1000000 B) | 6.4030 us/op | 3.7790 us/op | 1.69 |
| copy serialized Big SignedBeaconBlock (1000000 B) | 144.24 us/op | 109.20 us/op | 1.32 |
| pass gossip attestations to forkchoice per slot | 2.4039 ms/op | 2.8361 ms/op | 0.85 |
| forkChoice updateHead vc 100000 bc 64 eq 0 | 373.01 us/op | 440.40 us/op | 0.85 |
| forkChoice updateHead vc 600000 bc 64 eq 0 | 2.6378 ms/op | 2.9016 ms/op | 0.91 |
| forkChoice updateHead vc 1000000 bc 64 eq 0 | 4.5208 ms/op | 4.7096 ms/op | 0.96 |
| forkChoice updateHead vc 600000 bc 320 eq 0 | 2.6727 ms/op | 2.7821 ms/op | 0.96 |
| forkChoice updateHead vc 600000 bc 1200 eq 0 | 2.6566 ms/op | 2.7521 ms/op | 0.97 |
| forkChoice updateHead vc 600000 bc 7200 eq 0 | 2.3994 ms/op | 3.3292 ms/op | 0.72 |
| forkChoice updateHead vc 600000 bc 64 eq 1000 | 9.5540 ms/op | 10.178 ms/op | 0.94 |
| forkChoice updateHead vc 600000 bc 64 eq 10000 | 9.4113 ms/op | 9.8606 ms/op | 0.95 |
| forkChoice updateHead vc 600000 bc 64 eq 300000 | 11.444 ms/op | 13.344 ms/op | 0.86 |
| computeDeltas 500000 validators 300 proto nodes | 3.2911 ms/op | 3.8161 ms/op | 0.86 |
| computeDeltas 500000 validators 1200 proto nodes | 3.4138 ms/op | 3.8445 ms/op | 0.89 |
| computeDeltas 500000 validators 7200 proto nodes | 3.4021 ms/op | 3.8557 ms/op | 0.88 |
| computeDeltas 750000 validators 300 proto nodes | 4.7261 ms/op | 5.6670 ms/op | 0.83 |
| computeDeltas 750000 validators 1200 proto nodes | 4.7538 ms/op | 5.6199 ms/op | 0.85 |
| computeDeltas 750000 validators 7200 proto nodes | 4.7543 ms/op | 5.6811 ms/op | 0.84 |
| computeDeltas 1400000 validators 300 proto nodes | 8.7928 ms/op | 10.466 ms/op | 0.84 |
| computeDeltas 1400000 validators 1200 proto nodes | 8.5562 ms/op | 10.662 ms/op | 0.80 |
| computeDeltas 1400000 validators 7200 proto nodes | 8.5289 ms/op | 10.553 ms/op | 0.81 |
| computeDeltas 2100000 validators 300 proto nodes | 12.950 ms/op | 15.826 ms/op | 0.82 |
| computeDeltas 2100000 validators 1200 proto nodes | 12.912 ms/op | 16.170 ms/op | 0.80 |
| computeDeltas 2100000 validators 7200 proto nodes | 12.945 ms/op | 16.637 ms/op | 0.78 |
| altair processAttestation - 250000 vs - 7PWei normalcase | 1.6481 ms/op | 2.2246 ms/op | 0.74 |
| altair processAttestation - 250000 vs - 7PWei worstcase | 2.5092 ms/op | 3.1564 ms/op | 0.79 |
| altair processAttestation - setStatus - 1/6 committees join | 96.520 us/op | 135.74 us/op | 0.71 |
| altair processAttestation - setStatus - 1/3 committees join | 185.45 us/op | 266.32 us/op | 0.70 |
| altair processAttestation - setStatus - 1/2 committees join | 277.22 us/op | 361.44 us/op | 0.77 |
| altair processAttestation - setStatus - 2/3 committees join | 340.76 us/op | 439.64 us/op | 0.78 |
| altair processAttestation - setStatus - 4/5 committees join | 524.99 us/op | 622.51 us/op | 0.84 |
| altair processAttestation - setStatus - 100% committees join | 583.19 us/op | 730.37 us/op | 0.80 |
| altair processBlock - 250000 vs - 7PWei normalcase | 4.1431 ms/op | 4.2329 ms/op | 0.98 |
| altair processBlock - 250000 vs - 7PWei normalcase hashState | 25.901 ms/op | 28.953 ms/op | 0.89 |
| altair processBlock - 250000 vs - 7PWei worstcase | 36.680 ms/op | 33.715 ms/op | 1.09 |
| altair processBlock - 250000 vs - 7PWei worstcase hashState | 75.672 ms/op | 75.227 ms/op | 1.01 |
| phase0 processBlock - 250000 vs - 7PWei normalcase | 1.6649 ms/op | 1.6539 ms/op | 1.01 |
| phase0 processBlock - 250000 vs - 7PWei worstcase | 23.423 ms/op | 20.732 ms/op | 1.13 |
| altair processEth1Data - 250000 vs - 7PWei normalcase | 287.57 us/op | 332.00 us/op | 0.87 |
| getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 | 7.9440 us/op | 5.4880 us/op | 1.45 |
| getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 | 34.261 us/op | 34.985 us/op | 0.98 |
| getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 | 8.9850 us/op | 9.5920 us/op | 0.94 |
| getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 | 5.5250 us/op | 6.0010 us/op | 0.92 |
| getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 | 143.68 us/op | 136.71 us/op | 1.05 |
| getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 | 1.3508 ms/op | 1.8305 ms/op | 0.74 |
| getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 | 1.7799 ms/op | 2.3180 ms/op | 0.77 |
| getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 | 1.6571 ms/op | 2.2031 ms/op | 0.75 |
| getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 | 3.2622 ms/op | 4.4093 ms/op | 0.74 |
| getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 | 1.7913 ms/op | 2.4270 ms/op | 0.74 |
| getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 | 3.3509 ms/op | 4.5886 ms/op | 0.73 |
| Tree 40 250000 create | 367.79 ms/op | 411.27 ms/op | 0.89 |
| Tree 40 250000 get(125000) | 113.66 ns/op | 135.21 ns/op | 0.84 |
| Tree 40 250000 set(125000) | 1.2676 us/op | 1.3516 us/op | 0.94 |
| Tree 40 250000 toArray() | 9.9637 ms/op | 14.773 ms/op | 0.67 |
| Tree 40 250000 iterate all - toArray() + loop | 9.9992 ms/op | 17.149 ms/op | 0.58 |
| Tree 40 250000 iterate all - get(i) | 37.080 ms/op | 51.127 ms/op | 0.73 |
| Array 250000 create | 2.3057 ms/op | 2.7495 ms/op | 0.84 |
| Array 250000 clone - spread | 613.25 us/op | 792.99 us/op | 0.77 |
| Array 250000 get(125000) | 0.57600 ns/op | 0.40500 ns/op | 1.42 |
| Array 250000 set(125000) | 0.58500 ns/op | 0.42700 ns/op | 1.37 |
| Array 250000 iterate all - loop | 76.094 us/op | 107.87 us/op | 0.71 |
| phase0 afterProcessEpoch - 250000 vs - 7PWei | 38.253 ms/op | 42.258 ms/op | 0.91 |
| Array.fill - length 1000000 | 2.3508 ms/op | 3.3026 ms/op | 0.71 |
| Array push - length 1000000 | 9.2182 ms/op | 12.692 ms/op | 0.73 |
| Array.get | 0.25693 ns/op | 0.27285 ns/op | 0.94 |
| Uint8Array.get | 0.33604 ns/op | 0.43654 ns/op | 0.77 |
| phase0 beforeProcessEpoch - 250000 vs - 7PWei | 11.784 ms/op | 16.142 ms/op | 0.73 |
| altair processEpoch - mainnet_e81889 | 273.71 ms/op | 250.44 ms/op | 1.09 |
| mainnet_e81889 - altair beforeProcessEpoch | 14.347 ms/op | 16.829 ms/op | 0.85 |
| mainnet_e81889 - altair processJustificationAndFinalization | 4.8320 us/op | 5.4100 us/op | 0.89 |
| mainnet_e81889 - altair processInactivityUpdates | 3.2133 ms/op | 4.1408 ms/op | 0.78 |
| mainnet_e81889 - altair processRewardsAndPenalties | 46.167 ms/op | 38.363 ms/op | 1.20 |
| mainnet_e81889 - altair processRegistryUpdates | 855.00 ns/op | 706.00 ns/op | 1.21 |
| mainnet_e81889 - altair processSlashings | 406.00 ns/op | 180.00 ns/op | 2.26 |
| mainnet_e81889 - altair processEth1DataReset | 396.00 ns/op | 177.00 ns/op | 2.24 |
| mainnet_e81889 - altair processEffectiveBalanceUpdates | 999.65 us/op | 1.1708 ms/op | 0.85 |
| mainnet_e81889 - altair processSlashingsReset | 977.00 ns/op | 876.00 ns/op | 1.12 |
| mainnet_e81889 - altair processRandaoMixesReset | 1.3190 us/op | 1.1260 us/op | 1.17 |
| mainnet_e81889 - altair processHistoricalRootsUpdate | 401.00 ns/op | 176.00 ns/op | 2.28 |
| mainnet_e81889 - altair processParticipationFlagUpdates | 686.00 ns/op | 505.00 ns/op | 1.36 |
| mainnet_e81889 - altair processSyncCommitteeUpdates | 363.00 ns/op | 139.00 ns/op | 2.61 |
| mainnet_e81889 - altair afterProcessEpoch | 37.933 ms/op | 44.186 ms/op | 0.86 |
| capella processEpoch - mainnet_e217614 | 875.33 ms/op | 847.93 ms/op | 1.03 |
| mainnet_e217614 - capella beforeProcessEpoch | 57.297 ms/op | 61.398 ms/op | 0.93 |
| mainnet_e217614 - capella processJustificationAndFinalization | 4.9600 us/op | 5.1280 us/op | 0.97 |
| mainnet_e217614 - capella processInactivityUpdates | 11.110 ms/op | 14.138 ms/op | 0.79 |
| mainnet_e217614 - capella processRewardsAndPenalties | 198.07 ms/op | 163.14 ms/op | 1.21 |
| mainnet_e217614 - capella processRegistryUpdates | 4.6920 us/op | 6.3720 us/op | 0.74 |
| mainnet_e217614 - capella processSlashings | 397.00 ns/op | 181.00 ns/op | 2.19 |
| mainnet_e217614 - capella processEth1DataReset | 393.00 ns/op | 178.00 ns/op | 2.21 |
| mainnet_e217614 - capella processEffectiveBalanceUpdates | 10.449 ms/op | 4.1396 ms/op | 2.52 |
| mainnet_e217614 - capella processSlashingsReset | 1.1100 us/op | 859.00 ns/op | 1.29 |
| mainnet_e217614 - capella processRandaoMixesReset | 1.4820 us/op | 1.1190 us/op | 1.32 |
| mainnet_e217614 - capella processHistoricalRootsUpdate | 400.00 ns/op | 176.00 ns/op | 2.27 |
| mainnet_e217614 - capella processParticipationFlagUpdates | 707.00 ns/op | 521.00 ns/op | 1.36 |
| mainnet_e217614 - capella afterProcessEpoch | 106.54 ms/op | 114.33 ms/op | 0.93 |
| phase0 processEpoch - mainnet_e58758 | 277.40 ms/op | 292.82 ms/op | 0.95 |
| mainnet_e58758 - phase0 beforeProcessEpoch | 62.790 ms/op | 74.213 ms/op | 0.85 |
| mainnet_e58758 - phase0 processJustificationAndFinalization | 4.6360 us/op | 5.7240 us/op | 0.81 |
| mainnet_e58758 - phase0 processRewardsAndPenalties | 35.357 ms/op | 34.121 ms/op | 1.04 |
| mainnet_e58758 - phase0 processRegistryUpdates | 2.5080 us/op | 3.0220 us/op | 0.83 |
| mainnet_e58758 - phase0 processSlashings | 407.00 ns/op | 178.00 ns/op | 2.29 |
| mainnet_e58758 - phase0 processEth1DataReset | 398.00 ns/op | 176.00 ns/op | 2.26 |
| mainnet_e58758 - phase0 processEffectiveBalanceUpdates | 920.55 us/op | 1.1634 ms/op | 0.79 |
| mainnet_e58758 - phase0 processSlashingsReset | 1.2020 us/op | 928.00 ns/op | 1.30 |
| mainnet_e58758 - phase0 processRandaoMixesReset | 1.4400 us/op | 1.1460 us/op | 1.26 |
| mainnet_e58758 - phase0 processHistoricalRootsUpdate | 397.00 ns/op | 180.00 ns/op | 2.21 |
| mainnet_e58758 - phase0 processParticipationRecordUpdates | 1.1480 us/op | 891.00 ns/op | 1.29 |
| mainnet_e58758 - phase0 afterProcessEpoch | 32.223 ms/op | 36.196 ms/op | 0.89 |
| phase0 processEffectiveBalanceUpdates - 250000 normalcase | 1.0709 ms/op | 1.3982 ms/op | 0.77 |
| phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 | 1.5578 ms/op | 2.1771 ms/op | 0.72 |
| altair processInactivityUpdates - 250000 normalcase | 16.840 ms/op | 17.277 ms/op | 0.97 |
| altair processInactivityUpdates - 250000 worstcase | 17.779 ms/op | 18.537 ms/op | 0.96 |
| phase0 processRegistryUpdates - 250000 normalcase | 5.3750 us/op | 6.7650 us/op | 0.79 |
| phase0 processRegistryUpdates - 250000 badcase_full_deposits | 248.47 us/op | 11.786 ms/op | 0.02 |
| phase0 processRegistryUpdates - 250000 worstcase 0.5 | 96.751 ms/op | 99.774 ms/op | 0.97 |
| altair processRewardsAndPenalties - 250000 normalcase | 30.315 ms/op | 27.563 ms/op | 1.10 |
| altair processRewardsAndPenalties - 250000 worstcase | 30.075 ms/op | 24.753 ms/op | 1.21 |
| phase0 getAttestationDeltas - 250000 normalcase | 4.8483 ms/op | 6.6780 ms/op | 0.73 |
| phase0 getAttestationDeltas - 250000 worstcase | 4.9416 ms/op | 5.9936 ms/op | 0.82 |
| phase0 processSlashings - 250000 worstcase | 56.834 us/op | 92.930 us/op | 0.61 |
| altair processSyncCommitteeUpdates - 250000 | 9.2149 ms/op | 10.979 ms/op | 0.84 |
| BeaconState.hashTreeRoot - No change | 519.00 ns/op | 219.00 ns/op | 2.37 |
| BeaconState.hashTreeRoot - 1 full validator | 68.272 us/op | 85.934 us/op | 0.79 |
| BeaconState.hashTreeRoot - 32 full validator | 623.73 us/op | 890.00 us/op | 0.70 |
| BeaconState.hashTreeRoot - 512 full validator | 9.5359 ms/op | 10.674 ms/op | 0.89 |
| BeaconState.hashTreeRoot - 1 validator.effectiveBalance | 103.17 us/op | 94.748 us/op | 1.09 |
| BeaconState.hashTreeRoot - 32 validator.effectiveBalance | 1.3361 ms/op | 1.4997 ms/op | 0.89 |
| BeaconState.hashTreeRoot - 512 validator.effectiveBalance | 25.072 ms/op | 31.353 ms/op | 0.80 |
| BeaconState.hashTreeRoot - 1 balances | 73.551 us/op | 71.148 us/op | 1.03 |
| BeaconState.hashTreeRoot - 32 balances | 761.56 us/op | 693.52 us/op | 1.10 |
| BeaconState.hashTreeRoot - 512 balances | 8.4828 ms/op | 8.2273 ms/op | 1.03 |
| BeaconState.hashTreeRoot - 250000 balances | 176.42 ms/op | 197.33 ms/op | 0.89 |
| aggregationBits - 2048 els - zipIndexesInBitList | 17.978 us/op | 22.305 us/op | 0.81 |
| byteArrayEquals 32 | 46.922 ns/op | 53.470 ns/op | 0.88 |
| Buffer.compare 32 | 16.708 ns/op | 16.878 ns/op | 0.99 |
| byteArrayEquals 1024 | 1.2439 us/op | 1.5745 us/op | 0.79 |
| Buffer.compare 1024 | 24.717 ns/op | 24.158 ns/op | 1.02 |
| byteArrayEquals 16384 | 19.028 us/op | 25.085 us/op | 0.76 |
| Buffer.compare 16384 | 188.23 ns/op | 200.04 ns/op | 0.94 |
| byteArrayEquals 123687377 | 153.29 ms/op | 189.60 ms/op | 0.81 |
| Buffer.compare 123687377 | 8.0870 ms/op | 6.6820 ms/op | 1.21 |
| byteArrayEquals 32 - diff last byte | 48.433 ns/op | 51.355 ns/op | 0.94 |
| Buffer.compare 32 - diff last byte | 16.707 ns/op | 16.810 ns/op | 0.99 |
| byteArrayEquals 1024 - diff last byte | 1.2900 us/op | 1.5646 us/op | 0.82 |
| Buffer.compare 1024 - diff last byte | 23.725 ns/op | 25.449 ns/op | 0.93 |
| byteArrayEquals 16384 - diff last byte | 20.530 us/op | 24.778 us/op | 0.83 |
| Buffer.compare 16384 - diff last byte | 167.10 ns/op | 173.49 ns/op | 0.96 |
| byteArrayEquals 123687377 - diff last byte | 154.12 ms/op | 189.13 ms/op | 0.81 |
| Buffer.compare 123687377 - diff last byte | 4.0722 ms/op | 7.7235 ms/op | 0.53 |
| byteArrayEquals 32 - random bytes | 4.7840 ns/op | 5.1370 ns/op | 0.93 |
| Buffer.compare 32 - random bytes | 16.633 ns/op | 17.204 ns/op | 0.97 |
| byteArrayEquals 1024 - random bytes | 4.8540 ns/op | 5.4480 ns/op | 0.89 |
| Buffer.compare 1024 - random bytes | 17.006 ns/op | 20.775 ns/op | 0.82 |
| byteArrayEquals 16384 - random bytes | 4.7360 ns/op | 5.0950 ns/op | 0.93 |
| Buffer.compare 16384 - random bytes | 14.637 ns/op | 17.102 ns/op | 0.86 |
| byteArrayEquals 123687377 - random bytes | 7.4800 ns/op | 6.3600 ns/op | 1.18 |
| Buffer.compare 123687377 - random bytes | 19.120 ns/op | 18.110 ns/op | 1.06 |
| regular array get 100000 times | 28.748 us/op | 32.807 us/op | 0.88 |
| wrappedArray get 100000 times | 28.975 us/op | 33.243 us/op | 0.87 |
| arrayWithProxy get 100000 times | 8.5345 ms/op | 13.473 ms/op | 0.63 |
| ssz.Root.equals | 42.252 ns/op | 48.364 ns/op | 0.87 |
| byteArrayEquals | 37.310 ns/op | 44.978 ns/op | 0.83 |
| Buffer.compare | 8.6520 ns/op | 10.175 ns/op | 0.85 |
| processSlot - 1 slots | 9.9740 us/op | 10.555 us/op | 0.94 |
| processSlot - 32 slots | 2.3934 ms/op | 1.8869 ms/op | 1.27 |
| getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei | 3.2243 ms/op | 2.9883 ms/op | 1.08 |
| getCommitteeAssignments - req 1 vs - 250000 vc | 1.7299 ms/op | 2.1127 ms/op | 0.82 |
| getCommitteeAssignments - req 100 vs - 250000 vc | 3.3122 ms/op | 4.0742 ms/op | 0.81 |
| getCommitteeAssignments - req 1000 vs - 250000 vc | 3.6306 ms/op | 4.3195 ms/op | 0.84 |
| findModifiedValidators - 10000 modified validators | 812.65 ms/op | 718.57 ms/op | 1.13 |
| findModifiedValidators - 1000 modified validators | 705.88 ms/op | 702.32 ms/op | 1.01 |
| findModifiedValidators - 100 modified validators | 174.63 ms/op | 273.80 ms/op | 0.64 |
| findModifiedValidators - 10 modified validators | 140.10 ms/op | 161.02 ms/op | 0.87 |
| findModifiedValidators - 1 modified validators | 168.58 ms/op | 140.21 ms/op | 1.20 |
| findModifiedValidators - no difference | 139.53 ms/op | 142.89 ms/op | 0.98 |
| compare ViewDUs | 6.1090 s/op | 6.0482 s/op | 1.01 |
| compare each validator Uint8Array | 1.9005 s/op | 1.0862 s/op | 1.75 |
| compare ViewDU to Uint8Array | 709.62 ms/op | 1.1006 s/op | 0.64 |
| migrate state 1000000 validators, 24 modified, 0 new | 769.07 ms/op | 971.38 ms/op | 0.79 |
| migrate state 1000000 validators, 1700 modified, 1000 new | 1.0699 s/op | 1.1350 s/op | 0.94 |
| migrate state 1000000 validators, 3400 modified, 2000 new | 1.2968 s/op | 1.1669 s/op | 1.11 |
| migrate state 1500000 validators, 24 modified, 0 new | 851.40 ms/op | 808.33 ms/op | 1.05 |
| migrate state 1500000 validators, 1700 modified, 1000 new | 1.0376 s/op | 1.0494 s/op | 0.99 |
| migrate state 1500000 validators, 3400 modified, 2000 new | 1.1461 s/op | 1.2294 s/op | 0.93 |
| RootCache.getBlockRootAtSlot - 250000 vs - 7PWei | 5.8400 ns/op | 4.2100 ns/op | 1.39 |
| state getBlockRootAtSlot - 250000 vs - 7PWei | 342.61 ns/op | 903.55 ns/op | 0.38 |
| naive computeProposerIndex 100000 validators | 40.685 ms/op | 52.801 ms/op | 0.77 |
| computeProposerIndex 100000 validators | 1.2696 ms/op | 1.5319 ms/op | 0.83 |
| naiveGetNextSyncCommitteeIndices 1000 validators | 6.3614 s/op | 7.6025 s/op | 0.84 |
| getNextSyncCommitteeIndices 1000 validators | 92.250 ms/op | 115.82 ms/op | 0.80 |
| naiveGetNextSyncCommitteeIndices 10000 validators | 5.8751 s/op | 8.2302 s/op | 0.71 |
| getNextSyncCommitteeIndices 10000 validators | 91.495 ms/op | 115.88 ms/op | 0.79 |
| naiveGetNextSyncCommitteeIndices 100000 validators | 5.9319 s/op | 8.1977 s/op | 0.72 |
| getNextSyncCommitteeIndices 100000 validators | 93.316 ms/op | 114.59 ms/op | 0.81 |
| naive computeShuffledIndex 100000 validators | 17.567 s/op | 23.854 s/op | 0.74 |
| cached computeShuffledIndex 100000 validators | 467.62 ms/op | 557.11 ms/op | 0.84 |
| naive computeShuffledIndex 2000000 validators | 438.81 s/op | 524.80 s/op | 0.84 |
| cached computeShuffledIndex 2000000 validators | 67.161 s/op | 53.496 s/op | 1.26 |
| computeProposers - vc 250000 | 574.41 us/op | 624.76 us/op | 0.92 |
| computeEpochShuffling - vc 250000 | 40.867 ms/op | 42.936 ms/op | 0.95 |
| getNextSyncCommittee - vc 250000 | 11.979 ms/op | 11.268 ms/op | 1.06 |
| computeSigningRoot for AttestationData | 20.697 us/op | 21.978 us/op | 0.94 |
| hash AttestationData serialized data then Buffer.toString(base64) | 1.2846 us/op | 1.6762 us/op | 0.77 |
| toHexString serialized data | 1.1654 us/op | 1.2615 us/op | 0.92 |
| Buffer.toString(base64) | 193.01 ns/op | 155.40 ns/op | 1.24 |
| nodejs block root to RootHex using toHex | 200.69 ns/op | 136.33 ns/op | 1.47 |
| nodejs block root to RootHex using toRootHex | 136.80 ns/op | 85.773 ns/op | 1.59 |
| browser block root to RootHex using the deprecated toHexString | 201.69 ns/op | 227.66 ns/op | 0.89 |
| browser block root to RootHex using toHex | 272.37 ns/op | 176.50 ns/op | 1.54 |
| browser block root to RootHex using toRootHex | 175.24 ns/op | 167.65 ns/op | 1.05 |
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.
stop support producing blocks pre-electra
I guess we can further clean up the block production path in next PRs eg. removing post-altair check to add sync aggregate, removing post-bellatrix check to activate the builder flow etc.
But we would need to remove/update all tests that produce altair block in this PR.
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.
We need to reconfigure our lodestar dev node to start from electra genesis to do this, not via passing config but rather default behavior, running a node via ./scripts/dev/node1.sh is pretty useful for quick testing but this no longer works if we merge this change which is also why many e2e tests are failing, and sim tests like multifork shouldn't pass either
|
converting this draft as there are a lot of modifications needed for it |
Motivation
Description
part of #8028