Skip to content

Commit

Permalink
feat: add blob_sidecar sse event (#6044)
Browse files Browse the repository at this point in the history
* feat: add blob_sidecar sse event

* fix tests

* fix

* apply feedback
  • Loading branch information
g11tech authored Oct 20, 2023
1 parent a9223cf commit 4a25589
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
21 changes: 19 additions & 2 deletions packages/api/src/beacon/routes/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ContainerType} from "@chainsafe/ssz";
import {ContainerType, ValueOf} from "@chainsafe/ssz";
import {Epoch, phase0, capella, Slot, ssz, StringType, RootHex, altair, UintNum64, allForks} from "@lodestar/types";
import {ChainForkConfig} from "@lodestar/config";
import {isForkExecution, ForkName} from "@lodestar/params";
Expand All @@ -7,6 +7,19 @@ import {RouteDef, TypeJson, WithVersion} from "../../utils/index.js";
import {HttpStatusCode} from "../../utils/client/httpStatusCode.js";
import {ApiClientResponse} from "../../interfaces.js";

const stringType = new StringType();
export const blobSidecarSSE = new ContainerType(
{
blockRoot: stringType,
index: ssz.BlobIndex,
slot: ssz.Slot,
kzgCommitment: stringType,
versionedHash: stringType,
},
{typeName: "BlobSidecarSSE", jsonCase: "eth2"}
);
type BlobSidecarSSE = ValueOf<typeof blobSidecarSSE>;

// See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes

export enum EventType {
Expand Down Expand Up @@ -39,6 +52,8 @@ export enum EventType {
lightClientUpdate = "light_client_update",
/** Payload attributes for block proposal */
payloadAttributes = "payload_attributes",
/** The node has received a valid blobSidecar (from P2P or API) */
blobSidecar = "blob_sidecar",
}

export const eventTypes: {[K in EventType]: K} = {
Expand All @@ -54,6 +69,7 @@ export const eventTypes: {[K in EventType]: K} = {
[EventType.lightClientFinalityUpdate]: EventType.lightClientFinalityUpdate,
[EventType.lightClientUpdate]: EventType.lightClientUpdate,
[EventType.payloadAttributes]: EventType.payloadAttributes,
[EventType.blobSidecar]: EventType.blobSidecar,
};

export type EventData = {
Expand Down Expand Up @@ -95,6 +111,7 @@ export type EventData = {
[EventType.lightClientFinalityUpdate]: allForks.LightClientFinalityUpdate;
[EventType.lightClientUpdate]: allForks.LightClientUpdate;
[EventType.payloadAttributes]: {version: ForkName; data: allForks.SSEPayloadAttributes};
[EventType.blobSidecar]: BlobSidecarSSE;
};

export type BeaconEvent = {[K in EventType]: {type: K; message: EventData[K]}}[EventType];
Expand Down Expand Up @@ -130,7 +147,6 @@ export type ReqTypes = {
// The request is very simple: (topics) => {query: {topics}}, and the test will ensure compatibility server - client

export function getTypeByEvent(config: ChainForkConfig): {[K in EventType]: TypeJson<EventData[K]>} {
const stringType = new StringType();
const getLightClientTypeFromHeader = (data: allForks.LightClientHeader): allForks.AllForksLightClientSSZTypes => {
return config.getLightClientForkTypes(data.beacon.slot);
};
Expand Down Expand Up @@ -190,6 +206,7 @@ export function getTypeByEvent(config: ChainForkConfig): {[K in EventType]: Type
[EventType.payloadAttributes]: WithVersion((fork) =>
isForkExecution(fork) ? ssz.allForksExecution[fork].SSEPayloadAttributes : ssz.bellatrix.SSEPayloadAttributes
),
[EventType.blobSidecar]: blobSidecarSSE,

[EventType.lightClientOptimisticUpdate]: {
toJson: (data) =>
Expand Down
3 changes: 2 additions & 1 deletion packages/api/test/unit/beacon/testData/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ssz} from "@lodestar/types";
import {ForkName} from "@lodestar/params";
import {Api, EventData, EventType} from "../../../../src/beacon/routes/events.js";
import {Api, EventData, EventType, blobSidecarSSE} from "../../../../src/beacon/routes/events.js";
import {GenericServerTestCases} from "../../../utils/genericServerTest.js";

const abortController = new AbortController();
Expand Down Expand Up @@ -109,4 +109,5 @@ export const eventTestData: EventData = {
version: ForkName.bellatrix,
data: ssz.bellatrix.SSEPayloadAttributes.defaultValue(),
},
[EventType.blobSidecar]: blobSidecarSSE.defaultValue(),
};
22 changes: 19 additions & 3 deletions packages/beacon-node/src/chain/blocks/importBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
computeStartSlotAtEpoch,
isStateValidatorsNodesPopulated,
RootCache,
kzgCommitmentToVersionedHash,
} from "@lodestar/state-transition";
import {routes} from "@lodestar/api";
import {ForkChoiceError, ForkChoiceErrorCode, EpochDifference, AncestorStatus} from "@lodestar/fork-choice";
Expand All @@ -18,7 +19,7 @@ import {isQueueErrorAborted} from "../../util/queue/index.js";
import {ChainEvent, ReorgEventData} from "../emitter.js";
import {REPROCESS_MIN_TIME_TO_NEXT_SLOT_SEC} from "../reprocess.js";
import type {BeaconChain} from "../chain.js";
import {FullyVerifiedBlock, ImportBlockOpts, AttestationImportOpt} from "./types.js";
import {FullyVerifiedBlock, ImportBlockOpts, AttestationImportOpt, BlockInputType} from "./types.js";
import {getCheckpointFromState} from "./utils/checkpoint.js";
import {writeBlockInputToDb} from "./writeBlockInputToDb.js";

Expand Down Expand Up @@ -89,13 +90,28 @@ export async function importBlock(

this.metrics?.importBlock.bySource.inc({source});
this.logger.verbose("Added block to forkchoice and state cache", {slot: block.message.slot, root: blockRootHex});

// We want to import block asap so call all event handler in the next event loop
setTimeout(() => {
const slot = block.message.slot;
this.emitter.emit(routes.events.EventType.block, {
block: toHexString(this.config.getForkTypes(block.message.slot).BeaconBlock.hashTreeRoot(block.message)),
slot: block.message.slot,
block: blockRootHex,
slot,
executionOptimistic: blockSummary != null && isOptimisticBlock(blockSummary),
});

if (blockInput.type === BlockInputType.postDeneb) {
for (const blobSidecar of blockInput.blobs) {
const {index, kzgCommitment} = blobSidecar;
this.emitter.emit(routes.events.EventType.blobSidecar, {
blockRoot: blockRootHex,
slot,
index,
kzgCommitment: toHexString(kzgCommitment),
versionedHash: toHexString(kzgCommitmentToVersionedHash(kzgCommitment)),
});
}
}
}, 0);

// 3. Import attestations to fork choice
Expand Down

1 comment on commit 4a25589

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 4a25589 Previous: a9223cf Ratio
BLS verifyMultipleSignatures - same message - 32 - blst-native 7.2732 ms/op 2.3546 ms/op 3.09
isKnown normal case - 2 super set checks 1.0540 us/op 321.00 ns/op 3.28
isKnown worse case - 16 super set checks 1.1950 us/op 308.00 ns/op 3.88
Map access 1 prop 0.51100 ns/op 0.15700 ns/op 3.25
Object get x1000 28.598 ns/op 7.6210 ns/op 3.75
send data - 1000 256B messages 61.897 ms/op 20.117 ms/op 3.08
send data - 1000 1200B messages 73.775 ms/op 23.392 ms/op 3.15
enrSubnets - fastDeserialize 4 bits 723.00 ns/op 168.00 ns/op 4.30
enrSubnets - ssz BitVector 4 bits 1.5030 us/op 418.00 ns/op 3.60
prioritizePeers score -10:0 att 32-0.1 sync 2-0 334.81 us/op 104.14 us/op 3.21
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 553.53 us/op 163.07 us/op 3.39
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 940.15 us/op 305.13 us/op 3.08
prioritizePeers score 0:0 att 64-1 sync 4-1 1.1644 ms/op 359.18 us/op 3.24
bitArray.getTrueBitIndexes() bitLen 128 5.3660 us/op 1.7090 us/op 3.14
bitArray.getTrueBitIndexes() bitLen 248 9.2740 us/op 2.5960 us/op 3.57
bitArray.getTrueBitIndexes() bitLen 512 17.359 us/op 5.3240 us/op 3.26
Buffer.concat 32 items 3.5590 us/op 998.00 ns/op 3.57
Set add up to 64 items then delete first 14.131 us/op 4.5550 us/op 3.10
OrderedSet add up to 64 items then delete first 20.195 us/op 5.6906 us/op 3.55
Set add up to 64 items then delete last 16.527 us/op 4.6241 us/op 3.57
OrderedSet add up to 64 items then delete last 29.191 us/op 5.8256 us/op 5.01
Set add up to 64 items then delete middle 15.922 us/op 4.6566 us/op 3.42
OrderedSet add up to 64 items then delete middle 26.598 us/op 7.1025 us/op 3.74
Set add up to 128 items then delete first 34.719 us/op 9.4913 us/op 3.66
OrderedSet add up to 128 items then delete first 41.297 us/op 12.305 us/op 3.36
Set add up to 128 items then delete last 32.312 us/op 9.2701 us/op 3.49
OrderedSet add up to 128 items then delete last 43.207 us/op 11.895 us/op 3.63
Set add up to 128 items then delete middle 32.710 us/op 9.0306 us/op 3.62
OrderedSet add up to 128 items then delete middle 67.695 us/op 16.707 us/op 4.05
Set add up to 256 items then delete first 57.767 us/op 18.777 us/op 3.08
OrderedSet add up to 256 items then delete first 80.380 us/op 25.545 us/op 3.15
Set add up to 256 items then delete last 61.085 us/op 19.673 us/op 3.11
OrderedSet add up to 256 items then delete last 79.586 us/op 24.824 us/op 3.21
Set add up to 256 items then delete middle 65.970 us/op 18.805 us/op 3.51
OrderedSet add up to 256 items then delete middle 149.07 us/op 47.212 us/op 3.16
pass gossip attestations to forkchoice per slot 14.791 ms/op 3.6632 ms/op 4.04
forkChoice updateHead vc 100000 bc 64 eq 0 2.4895 ms/op 779.95 us/op 3.19
forkChoice updateHead vc 600000 bc 64 eq 0 19.544 ms/op 5.3099 ms/op 3.68
forkChoice updateHead vc 1000000 bc 64 eq 0 27.691 ms/op 7.0969 ms/op 3.90
forkChoice updateHead vc 600000 bc 320 eq 0 16.346 ms/op 4.2708 ms/op 3.83
forkChoice updateHead vc 600000 bc 1200 eq 0 17.588 ms/op 4.4575 ms/op 3.95
forkChoice updateHead vc 600000 bc 7200 eq 0 19.541 ms/op 5.8609 ms/op 3.33
forkChoice updateHead vc 600000 bc 64 eq 1000 47.842 ms/op 11.705 ms/op 4.09
forkChoice updateHead vc 600000 bc 64 eq 300000 79.599 ms/op 18.968 ms/op 4.20
computeDeltas 500000 validators 300 proto nodes 22.522 ms/op 6.4903 ms/op 3.47
computeDeltas 500000 validators 1200 proto nodes 22.887 ms/op 6.4131 ms/op 3.57
computeDeltas 500000 validators 7200 proto nodes 22.695 ms/op 6.4149 ms/op 3.54
computeDeltas 750000 validators 300 proto nodes 31.669 ms/op 9.8666 ms/op 3.21
computeDeltas 750000 validators 1200 proto nodes 30.853 ms/op 9.8003 ms/op 3.15
computeDeltas 750000 validators 7200 proto nodes 31.217 ms/op 9.7840 ms/op 3.19
computeDeltas 1400000 validators 300 proto nodes 62.425 ms/op 18.307 ms/op 3.41
Full benchmark results
Benchmark suite Current: 4a25589 Previous: a9223cf Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.1041 ms/op 666.47 us/op 1.66
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 198.62 us/op 88.862 us/op 2.24
BLS verify - blst-native 1.9438 ms/op 1.3319 ms/op 1.46
BLS verifyMultipleSignatures 3 - blst-native 6.2808 ms/op 2.7283 ms/op 2.30
BLS verifyMultipleSignatures 8 - blst-native 9.9002 ms/op 6.0960 ms/op 1.62
BLS verifyMultipleSignatures 32 - blst-native 47.573 ms/op 21.987 ms/op 2.16
BLS verifyMultipleSignatures 64 - blst-native 116.21 ms/op 43.822 ms/op 2.65
BLS verifyMultipleSignatures 128 - blst-native 169.88 ms/op 86.774 ms/op 1.96
BLS deserializing 10000 signatures 2.1073 s/op 905.33 ms/op 2.33
BLS deserializing 100000 signatures 19.991 s/op 9.0557 s/op 2.21
BLS verifyMultipleSignatures - same message - 3 - blst-native 2.2447 ms/op 1.4439 ms/op 1.55
BLS verifyMultipleSignatures - same message - 8 - blst-native 4.5707 ms/op 1.5278 ms/op 2.99
BLS verifyMultipleSignatures - same message - 32 - blst-native 7.2732 ms/op 2.3546 ms/op 3.09
BLS verifyMultipleSignatures - same message - 64 - blst-native 10.453 ms/op 3.9631 ms/op 2.64
BLS verifyMultipleSignatures - same message - 128 - blst-native 16.758 ms/op 5.6791 ms/op 2.95
BLS aggregatePubkeys 32 - blst-native 77.569 us/op 26.029 us/op 2.98
BLS aggregatePubkeys 128 - blst-native 266.00 us/op 102.50 us/op 2.60
getAttestationsForBlock 89.628 ms/op 44.770 ms/op 2.00
isKnown best case - 1 super set check 937.00 ns/op 339.00 ns/op 2.76
isKnown normal case - 2 super set checks 1.0540 us/op 321.00 ns/op 3.28
isKnown worse case - 16 super set checks 1.1950 us/op 308.00 ns/op 3.88
CheckpointStateCache - add get delete 17.112 us/op 5.3620 us/op 3.19
validate api signedAggregateAndProof - struct 7.3153 ms/op 2.8677 ms/op 2.55
validate gossip signedAggregateAndProof - struct 7.6843 ms/op 2.8458 ms/op 2.70
validate gossip attestation - vc 640000 2.7473 ms/op 1.4269 ms/op 1.93
batch validate gossip attestation - vc 640000 - chunk 32 474.09 us/op 175.65 us/op 2.70
batch validate gossip attestation - vc 640000 - chunk 64 283.68 us/op 148.59 us/op 1.91
batch validate gossip attestation - vc 640000 - chunk 128 342.98 us/op 141.03 us/op 2.43
batch validate gossip attestation - vc 640000 - chunk 256 330.95 us/op 129.13 us/op 2.56
pickEth1Vote - no votes 2.0825 ms/op 1.2462 ms/op 1.67
pickEth1Vote - max votes 28.216 ms/op 9.4183 ms/op 3.00
pickEth1Vote - Eth1Data hashTreeRoot value x2048 47.506 ms/op 16.408 ms/op 2.90
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 70.733 ms/op 26.386 ms/op 2.68
pickEth1Vote - Eth1Data fastSerialize value x2048 1.8490 ms/op 574.81 us/op 3.22
pickEth1Vote - Eth1Data fastSerialize tree x2048 14.132 ms/op 8.0658 ms/op 1.75
bytes32 toHexString 1.4640 us/op 504.00 ns/op 2.90
bytes32 Buffer.toString(hex) 816.00 ns/op 295.00 ns/op 2.77
bytes32 Buffer.toString(hex) from Uint8Array 1.1900 us/op 479.00 ns/op 2.48
bytes32 Buffer.toString(hex) + 0x 820.00 ns/op 313.00 ns/op 2.62
Object access 1 prop 0.50100 ns/op 0.17500 ns/op 2.86
Map access 1 prop 0.51100 ns/op 0.15700 ns/op 3.25
Object get x1000 28.598 ns/op 7.6210 ns/op 3.75
Map get x1000 1.8770 ns/op 0.65800 ns/op 2.85
Object set x1000 137.08 ns/op 50.786 ns/op 2.70
Map set x1000 100.69 ns/op 39.729 ns/op 2.53
Return object 10000 times 0.54670 ns/op 0.24940 ns/op 2.19
Throw Error 10000 times 9.2674 us/op 3.9145 us/op 2.37
fastMsgIdFn sha256 / 200 bytes 9.2160 us/op 3.3790 us/op 2.73
fastMsgIdFn h32 xxhash / 200 bytes 548.00 ns/op 272.00 ns/op 2.01
fastMsgIdFn h64 xxhash / 200 bytes 907.00 ns/op 344.00 ns/op 2.64
fastMsgIdFn sha256 / 1000 bytes 29.551 us/op 11.515 us/op 2.57
fastMsgIdFn h32 xxhash / 1000 bytes 1.0050 us/op 424.00 ns/op 2.37
fastMsgIdFn h64 xxhash / 1000 bytes 854.00 ns/op 425.00 ns/op 2.01
fastMsgIdFn sha256 / 10000 bytes 234.20 us/op 106.44 us/op 2.20
fastMsgIdFn h32 xxhash / 10000 bytes 3.1340 us/op 1.9950 us/op 1.57
fastMsgIdFn h64 xxhash / 10000 bytes 3.4830 us/op 1.3880 us/op 2.51
send data - 1000 256B messages 61.897 ms/op 20.117 ms/op 3.08
send data - 1000 512B messages 76.662 ms/op 27.772 ms/op 2.76
send data - 1000 1024B messages 111.96 ms/op 42.306 ms/op 2.65
send data - 1000 1200B messages 73.775 ms/op 23.392 ms/op 3.15
send data - 1000 2048B messages 88.440 ms/op 31.773 ms/op 2.78
send data - 1000 4096B messages 86.129 ms/op 35.380 ms/op 2.43
send data - 1000 16384B messages 217.78 ms/op 77.795 ms/op 2.80
send data - 1000 65536B messages 772.14 ms/op 318.05 ms/op 2.43
enrSubnets - fastDeserialize 64 bits 3.4140 us/op 1.2860 us/op 2.65
enrSubnets - ssz BitVector 64 bits 1.2170 us/op 434.00 ns/op 2.80
enrSubnets - fastDeserialize 4 bits 723.00 ns/op 168.00 ns/op 4.30
enrSubnets - ssz BitVector 4 bits 1.5030 us/op 418.00 ns/op 3.60
prioritizePeers score -10:0 att 32-0.1 sync 2-0 334.81 us/op 104.14 us/op 3.21
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 339.03 us/op 130.87 us/op 2.59
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 553.53 us/op 163.07 us/op 3.39
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 940.15 us/op 305.13 us/op 3.08
prioritizePeers score 0:0 att 64-1 sync 4-1 1.1644 ms/op 359.18 us/op 3.24
array of 16000 items push then shift 5.2946 us/op 1.6409 us/op 3.23
LinkedList of 16000 items push then shift 31.167 ns/op 9.5150 ns/op 3.28
array of 16000 items push then pop 245.06 ns/op 86.505 ns/op 2.83
LinkedList of 16000 items push then pop 29.901 ns/op 8.9340 ns/op 3.35
array of 24000 items push then shift 6.2624 us/op 2.6808 us/op 2.34
LinkedList of 24000 items push then shift 29.014 ns/op 9.7030 ns/op 2.99
array of 24000 items push then pop 517.28 ns/op 107.36 ns/op 4.82
LinkedList of 24000 items push then pop 26.618 ns/op 9.0130 ns/op 2.95
intersect bitArray bitLen 8 23.675 ns/op 6.9840 ns/op 3.39
intersect array and set length 8 208.21 ns/op 55.527 ns/op 3.75
intersect bitArray bitLen 128 104.68 ns/op 32.369 ns/op 3.23
intersect array and set length 128 2.8105 us/op 854.18 ns/op 3.29
bitArray.getTrueBitIndexes() bitLen 128 5.3660 us/op 1.7090 us/op 3.14
bitArray.getTrueBitIndexes() bitLen 248 9.2740 us/op 2.5960 us/op 3.57
bitArray.getTrueBitIndexes() bitLen 512 17.359 us/op 5.3240 us/op 3.26
Buffer.concat 32 items 3.5590 us/op 998.00 ns/op 3.57
Uint8Array.set 32 items 5.6920 us/op 2.0280 us/op 2.81
Set add up to 64 items then delete first 14.131 us/op 4.5550 us/op 3.10
OrderedSet add up to 64 items then delete first 20.195 us/op 5.6906 us/op 3.55
Set add up to 64 items then delete last 16.527 us/op 4.6241 us/op 3.57
OrderedSet add up to 64 items then delete last 29.191 us/op 5.8256 us/op 5.01
Set add up to 64 items then delete middle 15.922 us/op 4.6566 us/op 3.42
OrderedSet add up to 64 items then delete middle 26.598 us/op 7.1025 us/op 3.74
Set add up to 128 items then delete first 34.719 us/op 9.4913 us/op 3.66
OrderedSet add up to 128 items then delete first 41.297 us/op 12.305 us/op 3.36
Set add up to 128 items then delete last 32.312 us/op 9.2701 us/op 3.49
OrderedSet add up to 128 items then delete last 43.207 us/op 11.895 us/op 3.63
Set add up to 128 items then delete middle 32.710 us/op 9.0306 us/op 3.62
OrderedSet add up to 128 items then delete middle 67.695 us/op 16.707 us/op 4.05
Set add up to 256 items then delete first 57.767 us/op 18.777 us/op 3.08
OrderedSet add up to 256 items then delete first 80.380 us/op 25.545 us/op 3.15
Set add up to 256 items then delete last 61.085 us/op 19.673 us/op 3.11
OrderedSet add up to 256 items then delete last 79.586 us/op 24.824 us/op 3.21
Set add up to 256 items then delete middle 65.970 us/op 18.805 us/op 3.51
OrderedSet add up to 256 items then delete middle 149.07 us/op 47.212 us/op 3.16
transfer serialized Status (84 B) 9.5090 us/op 1.8020 us/op 5.28
copy serialized Status (84 B) 6.6230 us/op 1.5180 us/op 4.36
transfer serialized SignedVoluntaryExit (112 B) 9.3730 us/op 2.0520 us/op 4.57
copy serialized SignedVoluntaryExit (112 B) 6.8200 us/op 1.5830 us/op 4.31
transfer serialized ProposerSlashing (416 B) 8.4600 us/op 2.1450 us/op 3.94
copy serialized ProposerSlashing (416 B) 8.0040 us/op 1.9170 us/op 4.18
transfer serialized Attestation (485 B) 9.9890 us/op 2.1310 us/op 4.69
copy serialized Attestation (485 B) 8.5540 us/op 1.9550 us/op 4.38
transfer serialized AttesterSlashing (33232 B) 9.3170 us/op 2.1600 us/op 4.31
copy serialized AttesterSlashing (33232 B) 19.449 us/op 4.6700 us/op 4.16
transfer serialized Small SignedBeaconBlock (128000 B) 10.209 us/op 2.4200 us/op 4.22
copy serialized Small SignedBeaconBlock (128000 B) 44.542 us/op 12.384 us/op 3.60
transfer serialized Avg SignedBeaconBlock (200000 B) 11.679 us/op 2.7760 us/op 4.21
copy serialized Avg SignedBeaconBlock (200000 B) 62.540 us/op 17.259 us/op 3.62
transfer serialized BlobsSidecar (524380 B) 11.520 us/op 2.7530 us/op 4.18
copy serialized BlobsSidecar (524380 B) 168.08 us/op 74.893 us/op 2.24
transfer serialized Big SignedBeaconBlock (1000000 B) 17.169 us/op 2.8250 us/op 6.08
copy serialized Big SignedBeaconBlock (1000000 B) 686.63 us/op 154.22 us/op 4.45
pass gossip attestations to forkchoice per slot 14.791 ms/op 3.6632 ms/op 4.04
forkChoice updateHead vc 100000 bc 64 eq 0 2.4895 ms/op 779.95 us/op 3.19
forkChoice updateHead vc 600000 bc 64 eq 0 19.544 ms/op 5.3099 ms/op 3.68
forkChoice updateHead vc 1000000 bc 64 eq 0 27.691 ms/op 7.0969 ms/op 3.90
forkChoice updateHead vc 600000 bc 320 eq 0 16.346 ms/op 4.2708 ms/op 3.83
forkChoice updateHead vc 600000 bc 1200 eq 0 17.588 ms/op 4.4575 ms/op 3.95
forkChoice updateHead vc 600000 bc 7200 eq 0 19.541 ms/op 5.8609 ms/op 3.33
forkChoice updateHead vc 600000 bc 64 eq 1000 47.842 ms/op 11.705 ms/op 4.09
forkChoice updateHead vc 600000 bc 64 eq 10000 36.289 ms/op 12.500 ms/op 2.90
forkChoice updateHead vc 600000 bc 64 eq 300000 79.599 ms/op 18.968 ms/op 4.20
computeDeltas 500000 validators 300 proto nodes 22.522 ms/op 6.4903 ms/op 3.47
computeDeltas 500000 validators 1200 proto nodes 22.887 ms/op 6.4131 ms/op 3.57
computeDeltas 500000 validators 7200 proto nodes 22.695 ms/op 6.4149 ms/op 3.54
computeDeltas 750000 validators 300 proto nodes 31.669 ms/op 9.8666 ms/op 3.21
computeDeltas 750000 validators 1200 proto nodes 30.853 ms/op 9.8003 ms/op 3.15
computeDeltas 750000 validators 7200 proto nodes 31.217 ms/op 9.7840 ms/op 3.19
computeDeltas 1400000 validators 300 proto nodes 62.425 ms/op 18.307 ms/op 3.41
computeDeltas 1400000 validators 1200 proto nodes 52.236 ms/op 18.357 ms/op 2.85
computeDeltas 1400000 validators 7200 proto nodes 42.111 ms/op 17.977 ms/op 2.34
computeDeltas 2100000 validators 300 proto nodes 72.438 ms/op 27.082 ms/op 2.67
computeDeltas 2100000 validators 1200 proto nodes 78.636 ms/op 27.150 ms/op 2.90
computeDeltas 2100000 validators 7200 proto nodes 59.380 ms/op 26.916 ms/op 2.21
computeProposerBoostScoreFromBalances 500000 validators 4.8497 ms/op 3.2503 ms/op 1.49
computeProposerBoostScoreFromBalances 750000 validators 6.5643 ms/op 3.2587 ms/op 2.01
computeProposerBoostScoreFromBalances 1400000 validators 4.9377 ms/op 3.2116 ms/op 1.54
computeProposerBoostScoreFromBalances 2100000 validators 5.6660 ms/op 3.2132 ms/op 1.76
altair processAttestation - 250000 vs - 7PWei normalcase 3.2763 ms/op 2.0881 ms/op 1.57
altair processAttestation - 250000 vs - 7PWei worstcase 6.3837 ms/op 3.2425 ms/op 1.97
altair processAttestation - setStatus - 1/6 committees join 362.29 us/op 177.84 us/op 2.04
altair processAttestation - setStatus - 1/3 committees join 754.60 us/op 338.79 us/op 2.23
altair processAttestation - setStatus - 1/2 committees join 661.66 us/op 474.16 us/op 1.40
altair processAttestation - setStatus - 2/3 committees join 1.0380 ms/op 569.95 us/op 1.82
altair processAttestation - setStatus - 4/5 committees join 1.2855 ms/op 792.21 us/op 1.62
altair processAttestation - setStatus - 100% committees join 1.9656 ms/op 911.00 us/op 2.16
altair processBlock - 250000 vs - 7PWei normalcase 14.263 ms/op 9.1605 ms/op 1.56
altair processBlock - 250000 vs - 7PWei normalcase hashState 37.946 ms/op 34.387 ms/op 1.10
altair processBlock - 250000 vs - 7PWei worstcase 55.900 ms/op 40.252 ms/op 1.39
altair processBlock - 250000 vs - 7PWei worstcase hashState 104.90 ms/op 97.498 ms/op 1.08
phase0 processBlock - 250000 vs - 7PWei normalcase 3.3020 ms/op 3.4023 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei worstcase 35.513 ms/op 30.106 ms/op 1.18
altair processEth1Data - 250000 vs - 7PWei normalcase 775.12 us/op 485.13 us/op 1.60
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 12.339 us/op 14.586 us/op 0.85
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 71.464 us/op 76.067 us/op 0.94
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 12.649 us/op 23.830 us/op 0.53
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 15.697 us/op 15.936 us/op 0.99
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 231.86 us/op 235.74 us/op 0.98
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.6368 ms/op 2.0484 ms/op 1.29
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.0873 ms/op 2.1221 ms/op 0.98
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 3.3884 ms/op 1.9090 ms/op 1.77
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.9968 ms/op 3.6711 ms/op 1.36
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 3.6669 ms/op 2.4126 ms/op 1.52
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 8.6373 ms/op 4.5844 ms/op 1.88
Tree 40 250000 create 535.34 ms/op 319.75 ms/op 1.67
Tree 40 250000 get(125000) 319.81 ns/op 196.70 ns/op 1.63
Tree 40 250000 set(125000) 1.2010 us/op 866.88 ns/op 1.39
Tree 40 250000 toArray() 24.950 ms/op 17.259 ms/op 1.45
Tree 40 250000 iterate all - toArray() + loop 28.238 ms/op 17.164 ms/op 1.65
Tree 40 250000 iterate all - get(i) 95.816 ms/op 65.921 ms/op 1.45
MutableVector 250000 create 22.673 ms/op 16.211 ms/op 1.40
MutableVector 250000 get(125000) 10.317 ns/op 6.6550 ns/op 1.55
MutableVector 250000 set(125000) 477.49 ns/op 269.34 ns/op 1.77
MutableVector 250000 toArray() 4.8284 ms/op 2.9301 ms/op 1.65
MutableVector 250000 iterate all - toArray() + loop 4.5750 ms/op 3.3895 ms/op 1.35
MutableVector 250000 iterate all - get(i) 2.0193 ms/op 1.5191 ms/op 1.33
Array 250000 create 4.1255 ms/op 2.6295 ms/op 1.57
Array 250000 clone - spread 1.1379 ms/op 968.59 us/op 1.17
Array 250000 get(125000) 0.62300 ns/op 0.48300 ns/op 1.29
Array 250000 set(125000) 0.72600 ns/op 0.56200 ns/op 1.29
Array 250000 iterate all - loop 106.15 us/op 82.587 us/op 1.29
effectiveBalanceIncrements clone Uint8Array 300000 31.093 us/op 22.280 us/op 1.40
effectiveBalanceIncrements clone MutableVector 300000 326.00 ns/op 251.00 ns/op 1.30
effectiveBalanceIncrements rw all Uint8Array 300000 236.93 us/op 174.90 us/op 1.35
effectiveBalanceIncrements rw all MutableVector 300000 101.25 ms/op 73.927 ms/op 1.37
phase0 afterProcessEpoch - 250000 vs - 7PWei 147.75 ms/op 113.61 ms/op 1.30
phase0 beforeProcessEpoch - 250000 vs - 7PWei 45.510 ms/op 41.431 ms/op 1.10
altair processEpoch - mainnet_e81889 590.66 ms/op 457.44 ms/op 1.29
mainnet_e81889 - altair beforeProcessEpoch 99.211 ms/op 64.706 ms/op 1.53
mainnet_e81889 - altair processJustificationAndFinalization 19.050 us/op 19.978 us/op 0.95
mainnet_e81889 - altair processInactivityUpdates 6.5187 ms/op 5.6770 ms/op 1.15
mainnet_e81889 - altair processRewardsAndPenalties 83.111 ms/op 71.719 ms/op 1.16
mainnet_e81889 - altair processRegistryUpdates 2.4810 us/op 3.9050 us/op 0.64
mainnet_e81889 - altair processSlashings 473.00 ns/op 695.00 ns/op 0.68
mainnet_e81889 - altair processEth1DataReset 662.00 ns/op 774.00 ns/op 0.86
mainnet_e81889 - altair processEffectiveBalanceUpdates 3.3453 ms/op 2.3892 ms/op 1.40
mainnet_e81889 - altair processSlashingsReset 4.6120 us/op 3.9640 us/op 1.16
mainnet_e81889 - altair processRandaoMixesReset 6.8720 us/op 4.8990 us/op 1.40
mainnet_e81889 - altair processHistoricalRootsUpdate 625.00 ns/op 1.8500 us/op 0.34
mainnet_e81889 - altair processParticipationFlagUpdates 2.1020 us/op 2.2270 us/op 0.94
mainnet_e81889 - altair processSyncCommitteeUpdates 1.2920 us/op 1.1680 us/op 1.11
mainnet_e81889 - altair afterProcessEpoch 258.77 ms/op 136.47 ms/op 1.90
capella processEpoch - mainnet_e217614 3.8858 s/op 1.6142 s/op 2.41
mainnet_e217614 - capella beforeProcessEpoch 556.57 ms/op 251.49 ms/op 2.21
mainnet_e217614 - capella processJustificationAndFinalization 38.643 us/op 16.636 us/op 2.32
mainnet_e217614 - capella processInactivityUpdates 40.694 ms/op 17.241 ms/op 2.36
mainnet_e217614 - capella processRewardsAndPenalties 644.10 ms/op 335.01 ms/op 1.92
mainnet_e217614 - capella processRegistryUpdates 82.449 us/op 29.010 us/op 2.84
mainnet_e217614 - capella processSlashings 1.6880 us/op 726.00 ns/op 2.33
mainnet_e217614 - capella processEth1DataReset 1.1790 us/op 687.00 ns/op 1.72
mainnet_e217614 - capella processEffectiveBalanceUpdates 10.190 ms/op 4.1761 ms/op 2.44
mainnet_e217614 - capella processSlashingsReset 12.428 us/op 3.5510 us/op 3.50
mainnet_e217614 - capella processRandaoMixesReset 14.059 us/op 8.2750 us/op 1.70
mainnet_e217614 - capella processHistoricalRootsUpdate 3.1540 us/op 1.3130 us/op 2.40
mainnet_e217614 - capella processParticipationFlagUpdates 9.1570 us/op 3.0470 us/op 3.01
mainnet_e217614 - capella afterProcessEpoch 798.61 ms/op 324.35 ms/op 2.46
phase0 processEpoch - mainnet_e58758 883.01 ms/op 463.29 ms/op 1.91
mainnet_e58758 - phase0 beforeProcessEpoch 198.93 ms/op 124.89 ms/op 1.59
mainnet_e58758 - phase0 processJustificationAndFinalization 18.248 us/op 16.844 us/op 1.08
mainnet_e58758 - phase0 processRewardsAndPenalties 116.37 ms/op 61.392 ms/op 1.90
mainnet_e58758 - phase0 processRegistryUpdates 30.754 us/op 12.605 us/op 2.44
mainnet_e58758 - phase0 processSlashings 1.3360 us/op 497.00 ns/op 2.69
mainnet_e58758 - phase0 processEth1DataReset 816.00 ns/op 446.00 ns/op 1.83
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.3315 ms/op 1.2822 ms/op 1.82
mainnet_e58758 - phase0 processSlashingsReset 4.4760 us/op 2.7060 us/op 1.65
mainnet_e58758 - phase0 processRandaoMixesReset 6.3690 us/op 5.0410 us/op 1.26
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.0390 us/op 534.00 ns/op 1.95
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.5050 us/op 4.5140 us/op 1.22
mainnet_e58758 - phase0 afterProcessEpoch 156.41 ms/op 122.78 ms/op 1.27
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.5628 ms/op 1.7001 ms/op 0.92
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.7511 ms/op 1.9391 ms/op 0.90
altair processInactivityUpdates - 250000 normalcase 36.979 ms/op 29.066 ms/op 1.27
altair processInactivityUpdates - 250000 worstcase 34.746 ms/op 28.217 ms/op 1.23
phase0 processRegistryUpdates - 250000 normalcase 13.441 us/op 12.049 us/op 1.12
phase0 processRegistryUpdates - 250000 badcase_full_deposits 569.68 us/op 434.54 us/op 1.31
phase0 processRegistryUpdates - 250000 worstcase 0.5 190.30 ms/op 136.34 ms/op 1.40
altair processRewardsAndPenalties - 250000 normalcase 106.98 ms/op 82.466 ms/op 1.30
altair processRewardsAndPenalties - 250000 worstcase 49.377 ms/op 76.624 ms/op 0.64
phase0 getAttestationDeltas - 250000 normalcase 14.123 ms/op 8.1518 ms/op 1.73
phase0 getAttestationDeltas - 250000 worstcase 11.436 ms/op 8.7465 ms/op 1.31
phase0 processSlashings - 250000 worstcase 3.8860 ms/op 2.4185 ms/op 1.61
altair processSyncCommitteeUpdates - 250000 245.09 ms/op 152.68 ms/op 1.61
BeaconState.hashTreeRoot - No change 380.00 ns/op 265.00 ns/op 1.43
BeaconState.hashTreeRoot - 1 full validator 141.95 us/op 147.88 us/op 0.96
BeaconState.hashTreeRoot - 32 full validator 3.0959 ms/op 1.4049 ms/op 2.20
BeaconState.hashTreeRoot - 512 full validator 24.140 ms/op 16.566 ms/op 1.46
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 278.47 us/op 218.19 us/op 1.28
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.4514 ms/op 2.1564 ms/op 1.60
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 42.065 ms/op 30.757 ms/op 1.37
BeaconState.hashTreeRoot - 1 balances 154.71 us/op 154.87 us/op 1.00
BeaconState.hashTreeRoot - 32 balances 1.5375 ms/op 1.2961 ms/op 1.19
BeaconState.hashTreeRoot - 512 balances 15.980 ms/op 10.943 ms/op 1.46
BeaconState.hashTreeRoot - 250000 balances 271.14 ms/op 201.05 ms/op 1.35
aggregationBits - 2048 els - zipIndexesInBitList 19.657 us/op 15.290 us/op 1.29
regular array get 100000 times 42.038 us/op 33.606 us/op 1.25
wrappedArray get 100000 times 38.182 us/op 33.610 us/op 1.14
arrayWithProxy get 100000 times 16.474 ms/op 14.662 ms/op 1.12
ssz.Root.equals 246.00 ns/op 208.00 ns/op 1.18
byteArrayEquals 227.00 ns/op 200.00 ns/op 1.14
shuffle list - 16384 els 8.5472 ms/op 6.9610 ms/op 1.23
shuffle list - 250000 els 124.02 ms/op 103.84 ms/op 1.19
processSlot - 1 slots 19.154 us/op 13.978 us/op 1.37
processSlot - 32 slots 3.8925 ms/op 3.2973 ms/op 1.18
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 59.981 ms/op 58.261 ms/op 1.03
getCommitteeAssignments - req 1 vs - 250000 vc 4.5120 ms/op 2.5897 ms/op 1.74
getCommitteeAssignments - req 100 vs - 250000 vc 4.2585 ms/op 3.8809 ms/op 1.10
getCommitteeAssignments - req 1000 vs - 250000 vc 4.5729 ms/op 4.2107 ms/op 1.09
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 7.0800 ns/op 5.1000 ns/op 1.39
state getBlockRootAtSlot - 250000 vs - 7PWei 611.03 ns/op 770.88 ns/op 0.79
computeProposers - vc 250000 10.525 ms/op 9.5114 ms/op 1.11
computeEpochShuffling - vc 250000 116.04 ms/op 108.26 ms/op 1.07
getNextSyncCommittee - vc 250000 151.99 ms/op 158.87 ms/op 0.96
computeSigningRoot for AttestationData 30.163 us/op 23.869 us/op 1.26
hash AttestationData serialized data then Buffer.toString(base64) 2.4992 us/op 2.3967 us/op 1.04
toHexString serialized data 1.2166 us/op 1.1672 us/op 1.04
Buffer.toString(base64) 244.60 ns/op 246.72 ns/op 0.99

Please sign in to comment.