Skip to content

Commit

Permalink
feat: track block production selection results and payload values (#7203
Browse files Browse the repository at this point in the history
)

* feat: track block production selection source and reason

* Rename reason to builder_censorship

* Fix metric name

* Add metric to track execution payload value

* Update metric descriptions

* Remove ETH suffix from payload values

* Rename metric

* Update import path

* Return block selection result

* Reorder if statements
  • Loading branch information
nflaig authored Oct 29, 2024
1 parent e31d535 commit 558ec2f
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 11 deletions.
81 changes: 79 additions & 2 deletions packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ import {
getValidatorStatus,
} from "@lodestar/types";
import {ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice";
import {fromHex, toHex, resolveOrRacePromises, prettyWeiToEth, toRootHex} from "@lodestar/utils";
import {
fromHex,
toHex,
resolveOrRacePromises,
prettyWeiToEth,
toRootHex,
TimeoutError,
formatWeiToEth,
} from "@lodestar/utils";
import {
AttestationError,
AttestationErrorCode,
Expand Down Expand Up @@ -115,6 +123,41 @@ type ProduceFullOrBlindedBlockOrContentsRes = {executionPayloadSource: ProducedB
| (ProduceBlindedBlockRes & {executionPayloadBlinded: true})
);

/**
* Engine block selection reasons tracked in metrics
*/
export enum EngineBlockSelectionReason {
BuilderDisabled = "builder_disabled",
BuilderError = "builder_error",
BuilderTimeout = "builder_timeout",
BuilderPending = "builder_pending",
BuilderNoBid = "builder_no_bid",
BuilderCensorship = "builder_censorship",
BlockValue = "block_value",
EnginePreferred = "engine_preferred",
}

/**
* Builder block selection reasons tracked in metrics
*/
export enum BuilderBlockSelectionReason {
EngineDisabled = "engine_disabled",
EngineError = "engine_error",
EnginePending = "engine_pending",
BlockValue = "block_value",
BuilderPreferred = "builder_preferred",
}

export type BlockSelectionResult =
| {
source: ProducedBlockSource.engine;
reason: EngineBlockSelectionReason;
}
| {
source: ProducedBlockSource.builder;
reason: BuilderBlockSelectionReason;
};

/**
* Server implementation for handling validator duties.
* See `@lodestar/validator/src/api` for the client implementation).
Expand Down Expand Up @@ -417,6 +460,7 @@ export function getValidatorApi(

metrics?.blockProductionSuccess.inc({source});
metrics?.blockProductionNumAggregated.observe({source}, block.body.attestations.length);
metrics?.blockProductionExecutionPayloadValue.observe({source}, Number(formatWeiToEth(executionPayloadValue)));
logger.verbose("Produced blinded block", {
slot,
executionPayloadValue,
Expand Down Expand Up @@ -491,6 +535,7 @@ export function getValidatorApi(

metrics?.blockProductionSuccess.inc({source});
metrics?.blockProductionNumAggregated.observe({source}, block.body.attestations.length);
metrics?.blockProductionExecutionPayloadValue.observe({source}, Number(formatWeiToEth(executionPayloadValue)));
logger.verbose("Produced execution block", {
slot,
executionPayloadValue,
Expand Down Expand Up @@ -694,6 +739,11 @@ export function getValidatorApi(
...getBlockValueLogInfo(engine.value),
});

metrics?.blockProductionSelectionResults.inc({
source: ProducedBlockSource.engine,
reason: EngineBlockSelectionReason.BuilderCensorship,
});

return {...engine.value, executionPayloadBlinded: false, executionPayloadSource: ProducedBlockSource.engine};
}

Expand All @@ -704,6 +754,16 @@ export function getValidatorApi(
...getBlockValueLogInfo(builder.value),
});

metrics?.blockProductionSelectionResults.inc({
source: ProducedBlockSource.builder,
reason:
isEngineEnabled === false
? BuilderBlockSelectionReason.EngineDisabled
: engine.status === "pending"
? BuilderBlockSelectionReason.EnginePending
: BuilderBlockSelectionReason.EngineError,
});

return {...builder.value, executionPayloadBlinded: true, executionPayloadSource: ProducedBlockSource.builder};
}

Expand All @@ -714,16 +774,33 @@ export function getValidatorApi(
...getBlockValueLogInfo(engine.value),
});

metrics?.blockProductionSelectionResults.inc({
source: ProducedBlockSource.engine,
reason:
isBuilderEnabled === false
? EngineBlockSelectionReason.BuilderDisabled
: builder.status === "pending"
? EngineBlockSelectionReason.BuilderPending
: builder.reason instanceof NoBidReceived
? EngineBlockSelectionReason.BuilderNoBid
: builder.reason instanceof TimeoutError
? EngineBlockSelectionReason.BuilderTimeout
: EngineBlockSelectionReason.BuilderError,
});

return {...engine.value, executionPayloadBlinded: false, executionPayloadSource: ProducedBlockSource.engine};
}

if (engine.status === "fulfilled" && builder.status === "fulfilled") {
const executionPayloadSource = selectBlockProductionSource({
const result = selectBlockProductionSource({
builderBlockValue: builder.value.executionPayloadValue + builder.value.consensusBlockValue,
engineBlockValue: engine.value.executionPayloadValue + engine.value.consensusBlockValue,
builderBoostFactor,
builderSelection,
});
const executionPayloadSource = result.source;

metrics?.blockProductionSelectionResults.inc(result);

logger.info(`Selected ${executionPayloadSource} block`, {
...loggerContext,
Expand Down
27 changes: 19 additions & 8 deletions packages/beacon-node/src/api/impl/validator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {ATTESTATION_SUBNET_COUNT} from "@lodestar/params";
import {routes} from "@lodestar/api";
import {BLSPubkey, CommitteeIndex, ProducedBlockSource, Slot, ValidatorIndex} from "@lodestar/types";
import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator";
import {BlockSelectionResult, BuilderBlockSelectionReason, EngineBlockSelectionReason} from "./index.js";

export function computeSubnetForCommitteesAtSlot(
slot: Slot,
Expand Down Expand Up @@ -54,21 +55,31 @@ export function selectBlockProductionSource({
engineBlockValue: bigint;
builderBlockValue: bigint;
builderBoostFactor: bigint;
}): ProducedBlockSource {
}): BlockSelectionResult {
switch (builderSelection) {
case routes.validator.BuilderSelection.ExecutionAlways:
case routes.validator.BuilderSelection.ExecutionOnly:
return ProducedBlockSource.engine;
return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.EnginePreferred};

case routes.validator.BuilderSelection.Default:
case routes.validator.BuilderSelection.MaxProfit:
return builderBoostFactor !== MAX_BUILDER_BOOST_FACTOR &&
(builderBoostFactor === BigInt(0) || engineBlockValue >= (builderBlockValue * builderBoostFactor) / BigInt(100))
? ProducedBlockSource.engine
: ProducedBlockSource.builder;
case routes.validator.BuilderSelection.MaxProfit: {
if (builderBoostFactor === BigInt(0)) {
return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.EnginePreferred};
}

if (builderBoostFactor === MAX_BUILDER_BOOST_FACTOR) {
return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BuilderPreferred};
}

if (engineBlockValue >= (builderBlockValue * builderBoostFactor) / BigInt(100)) {
return {source: ProducedBlockSource.engine, reason: EngineBlockSelectionReason.BlockValue};
}

return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BlockValue};
}

case routes.validator.BuilderSelection.BuilderAlways:
case routes.validator.BuilderSelection.BuilderOnly:
return ProducedBlockSource.builder;
return {source: ProducedBlockSource.builder, reason: BuilderBlockSelectionReason.BuilderPreferred};
}
}
16 changes: 16 additions & 0 deletions packages/beacon-node/src/metrics/metrics/beacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {NotReorgedReason} from "@lodestar/fork-choice/lib/forkChoice/interface.j
import {UpdateHeadOpt} from "@lodestar/fork-choice";
import {RegistryMetricCreator} from "../utils/registryMetricCreator.js";
import {BlockProductionStep, PayloadPreparationType} from "../../chain/produceBlock/index.js";
import {
BlockSelectionResult,
BuilderBlockSelectionReason,
EngineBlockSelectionReason,
} from "../../api/impl/validator/index.js";

export type BeaconMetrics = ReturnType<typeof createBeaconMetrics>;

Expand Down Expand Up @@ -160,12 +165,23 @@ export function createBeaconMetrics(register: RegistryMetricCreator) {
help: "Count of blocks successfully produced",
labelNames: ["source"],
}),
blockProductionSelectionResults: register.gauge<BlockSelectionResult>({
name: "beacon_block_production_selection_results_total",
help: "Count of all block production selection results",
labelNames: ["source", "reason"],
}),
blockProductionNumAggregated: register.histogram<{source: ProducedBlockSource}>({
name: "beacon_block_production_num_aggregated_total",
help: "Count of all aggregated attestations in our produced block",
buckets: [32, 64, 96, 128],
labelNames: ["source"],
}),
blockProductionExecutionPayloadValue: register.histogram<{source: ProducedBlockSource}>({
name: "beacon_block_production_execution_payload_value",
help: "Execution payload value denominated in ETH of produced blocks",
buckets: [0.001, 0.005, 0.01, 0.03, 0.05, 0.07, 0.1, 0.3, 0.5, 1],
labelNames: ["source"],
}),

blockProductionCaches: {
producedBlockRoot: register.gauge({
Expand Down
9 changes: 8 additions & 1 deletion packages/utils/src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ export function formatBigDecimal(numerator: bigint, denominator: bigint, maxDeci
// display upto 5 decimal places
const MAX_DECIMAL_FACTOR = BigInt("100000");

/**
* Format wei as ETH, with up to 5 decimals
*/
export function formatWeiToEth(wei: bigint): string {
return formatBigDecimal(wei, ETH_TO_WEI, MAX_DECIMAL_FACTOR);
}

/**
* Format wei as ETH, with up to 5 decimals and append ' ETH'
*/
export function prettyWeiToEth(wei: bigint): string {
return `${formatBigDecimal(wei, ETH_TO_WEI, MAX_DECIMAL_FACTOR)} ETH`;
return `${formatWeiToEth(wei)} ETH`;
}

/**
Expand Down

1 comment on commit 558ec2f

@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: 558ec2f Previous: e31d535 Ratio
forkChoice updateHead vc 600000 bc 64 eq 300000 51.362 ms/op 16.480 ms/op 3.12
Full benchmark results
Benchmark suite Current: 558ec2f Previous: e31d535 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8128 ms/op 1.8643 ms/op 0.97
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 48.881 us/op 63.491 us/op 0.77
BLS verify - blst 834.47 us/op 1.0412 ms/op 0.80
BLS verifyMultipleSignatures 3 - blst 1.2204 ms/op 1.5194 ms/op 0.80
BLS verifyMultipleSignatures 8 - blst 1.6628 ms/op 2.1562 ms/op 0.77
BLS verifyMultipleSignatures 32 - blst 4.8985 ms/op 5.6267 ms/op 0.87
BLS verifyMultipleSignatures 64 - blst 8.8855 ms/op 9.2408 ms/op 0.96
BLS verifyMultipleSignatures 128 - blst 17.142 ms/op 17.529 ms/op 0.98
BLS deserializing 10000 signatures 681.01 ms/op 695.08 ms/op 0.98
BLS deserializing 100000 signatures 6.9392 s/op 7.1611 s/op 0.97
BLS verifyMultipleSignatures - same message - 3 - blst 944.15 us/op 1.0295 ms/op 0.92
BLS verifyMultipleSignatures - same message - 8 - blst 1.1259 ms/op 1.1646 ms/op 0.97
BLS verifyMultipleSignatures - same message - 32 - blst 1.8836 ms/op 1.8586 ms/op 1.01
BLS verifyMultipleSignatures - same message - 64 - blst 2.7701 ms/op 2.6936 ms/op 1.03
BLS verifyMultipleSignatures - same message - 128 - blst 4.4765 ms/op 4.5283 ms/op 0.99
BLS aggregatePubkeys 32 - blst 20.853 us/op 20.415 us/op 1.02
BLS aggregatePubkeys 128 - blst 72.497 us/op 71.454 us/op 1.01
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 57.309 ms/op 90.143 ms/op 0.64
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 57.738 ms/op 64.858 ms/op 0.89
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 52.412 ms/op 50.049 ms/op 1.05
getSlashingsAndExits - default max 106.19 us/op 108.92 us/op 0.97
getSlashingsAndExits - 2k 328.95 us/op 365.21 us/op 0.90
proposeBlockBody type=full, size=empty 7.6912 ms/op 6.5426 ms/op 1.18
isKnown best case - 1 super set check 491.00 ns/op 392.00 ns/op 1.25
isKnown normal case - 2 super set checks 447.00 ns/op 375.00 ns/op 1.19
isKnown worse case - 16 super set checks 477.00 ns/op 345.00 ns/op 1.38
InMemoryCheckpointStateCache - add get delete 3.4140 us/op 3.1480 us/op 1.08
updateUnfinalizedPubkeys - updating 10 pubkeys 1.4364 ms/op 1.5430 ms/op 0.93
updateUnfinalizedPubkeys - updating 100 pubkeys 3.8202 ms/op 4.1302 ms/op 0.92
updateUnfinalizedPubkeys - updating 1000 pubkeys 58.064 ms/op 58.568 ms/op 0.99
validate api signedAggregateAndProof - struct 1.5093 ms/op 1.4634 ms/op 1.03
validate gossip signedAggregateAndProof - struct 1.5061 ms/op 1.5285 ms/op 0.99
batch validate gossip attestation - vc 640000 - chunk 32 156.58 us/op 143.13 us/op 1.09
batch validate gossip attestation - vc 640000 - chunk 64 143.72 us/op 127.61 us/op 1.13
batch validate gossip attestation - vc 640000 - chunk 128 136.83 us/op 123.46 us/op 1.11
batch validate gossip attestation - vc 640000 - chunk 256 134.85 us/op 123.17 us/op 1.09
pickEth1Vote - no votes 1.3662 ms/op 1.5972 ms/op 0.86
pickEth1Vote - max votes 8.8989 ms/op 9.0493 ms/op 0.98
pickEth1Vote - Eth1Data hashTreeRoot value x2048 21.928 ms/op 16.230 ms/op 1.35
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 32.162 ms/op 26.054 ms/op 1.23
pickEth1Vote - Eth1Data fastSerialize value x2048 605.68 us/op 611.54 us/op 0.99
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.4028 ms/op 5.1366 ms/op 0.66
bytes32 toHexString 649.00 ns/op 634.00 ns/op 1.02
bytes32 Buffer.toString(hex) 302.00 ns/op 259.00 ns/op 1.17
bytes32 Buffer.toString(hex) from Uint8Array 519.00 ns/op 478.00 ns/op 1.09
bytes32 Buffer.toString(hex) + 0x 289.00 ns/op 270.00 ns/op 1.07
Object access 1 prop 0.19700 ns/op 0.19700 ns/op 1.00
Map access 1 prop 0.16300 ns/op 0.14700 ns/op 1.11
Object get x1000 7.3500 ns/op 6.7410 ns/op 1.09
Map get x1000 7.0140 ns/op 7.2610 ns/op 0.97
Object set x1000 56.050 ns/op 48.895 ns/op 1.15
Map set x1000 40.295 ns/op 32.440 ns/op 1.24
Return object 10000 times 0.35680 ns/op 0.30600 ns/op 1.17
Throw Error 10000 times 4.4255 us/op 3.4664 us/op 1.28
toHex 224.74 ns/op 168.03 ns/op 1.34
Buffer.from 197.41 ns/op 163.97 ns/op 1.20
shared Buffer 113.30 ns/op 102.87 ns/op 1.10
fastMsgIdFn sha256 / 200 bytes 2.6630 us/op 2.4610 us/op 1.08
fastMsgIdFn h32 xxhash / 200 bytes 330.00 ns/op 295.00 ns/op 1.12
fastMsgIdFn h64 xxhash / 200 bytes 317.00 ns/op 290.00 ns/op 1.09
fastMsgIdFn sha256 / 1000 bytes 8.5910 us/op 7.9650 us/op 1.08
fastMsgIdFn h32 xxhash / 1000 bytes 474.00 ns/op 481.00 ns/op 0.99
fastMsgIdFn h64 xxhash / 1000 bytes 386.00 ns/op 370.00 ns/op 1.04
fastMsgIdFn sha256 / 10000 bytes 74.776 us/op 68.373 us/op 1.09
fastMsgIdFn h32 xxhash / 10000 bytes 2.0920 us/op 2.0450 us/op 1.02
fastMsgIdFn h64 xxhash / 10000 bytes 1.3560 us/op 1.2770 us/op 1.06
send data - 1000 256B messages 16.075 ms/op 14.442 ms/op 1.11
send data - 1000 512B messages 22.137 ms/op 19.225 ms/op 1.15
send data - 1000 1024B messages 35.662 ms/op 31.627 ms/op 1.13
send data - 1000 1200B messages 35.352 ms/op 33.476 ms/op 1.06
send data - 1000 2048B messages 39.380 ms/op 24.840 ms/op 1.59
send data - 1000 4096B messages 40.439 ms/op 33.861 ms/op 1.19
send data - 1000 16384B messages 100.88 ms/op 86.538 ms/op 1.17
send data - 1000 65536B messages 280.37 ms/op 225.43 ms/op 1.24
enrSubnets - fastDeserialize 64 bits 1.6020 us/op 1.2030 us/op 1.33
enrSubnets - ssz BitVector 64 bits 578.00 ns/op 393.00 ns/op 1.47
enrSubnets - fastDeserialize 4 bits 272.00 ns/op 156.00 ns/op 1.74
enrSubnets - ssz BitVector 4 bits 561.00 ns/op 368.00 ns/op 1.52
prioritizePeers score -10:0 att 32-0.1 sync 2-0 222.93 us/op 186.68 us/op 1.19
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 222.18 us/op 168.89 us/op 1.32
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 439.87 us/op 390.94 us/op 1.13
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 476.52 us/op 552.98 us/op 0.86
prioritizePeers score 0:0 att 64-1 sync 4-1 1.0838 ms/op 905.17 us/op 1.20
array of 16000 items push then shift 1.8060 us/op 1.7439 us/op 1.04
LinkedList of 16000 items push then shift 10.100 ns/op 8.1180 ns/op 1.24
array of 16000 items push then pop 199.87 ns/op 144.32 ns/op 1.38
LinkedList of 16000 items push then pop 13.962 ns/op 7.6730 ns/op 1.82
array of 24000 items push then shift 2.9061 us/op 2.6117 us/op 1.11
LinkedList of 24000 items push then shift 13.565 ns/op 8.9750 ns/op 1.51
array of 24000 items push then pop 223.89 ns/op 221.51 ns/op 1.01
LinkedList of 24000 items push then pop 11.656 ns/op 9.0360 ns/op 1.29
intersect bitArray bitLen 8 10.494 ns/op 7.1870 ns/op 1.46
intersect array and set length 8 117.79 ns/op 81.923 ns/op 1.44
intersect bitArray bitLen 128 38.758 ns/op 32.363 ns/op 1.20
intersect array and set length 128 1.0739 us/op 1.1142 us/op 0.96
bitArray.getTrueBitIndexes() bitLen 128 2.8400 us/op 3.3910 us/op 0.84
bitArray.getTrueBitIndexes() bitLen 248 5.2560 us/op 5.6550 us/op 0.93
bitArray.getTrueBitIndexes() bitLen 512 12.385 us/op 11.749 us/op 1.05
Buffer.concat 32 items 1.2090 us/op 1.0970 us/op 1.10
Uint8Array.set 32 items 2.0270 us/op 1.7490 us/op 1.16
Buffer.copy 2.4230 us/op 2.0310 us/op 1.19
Uint8Array.set - with subarray 4.2350 us/op 2.9510 us/op 1.44
Uint8Array.set - without subarray 2.0910 us/op 1.6140 us/op 1.30
getUint32 - dataview 389.00 ns/op 310.00 ns/op 1.25
getUint32 - manual 346.00 ns/op 264.00 ns/op 1.31
Set add up to 64 items then delete first 4.2833 us/op 2.9342 us/op 1.46
OrderedSet add up to 64 items then delete first 6.6868 us/op 4.5476 us/op 1.47
Set add up to 64 items then delete last 4.2365 us/op 3.3722 us/op 1.26
OrderedSet add up to 64 items then delete last 6.4645 us/op 5.1247 us/op 1.26
Set add up to 64 items then delete middle 4.2279 us/op 3.0967 us/op 1.37
OrderedSet add up to 64 items then delete middle 7.8873 us/op 6.5689 us/op 1.20
Set add up to 128 items then delete first 8.0824 us/op 6.6376 us/op 1.22
OrderedSet add up to 128 items then delete first 13.715 us/op 9.2540 us/op 1.48
Set add up to 128 items then delete last 8.2653 us/op 6.1391 us/op 1.35
OrderedSet add up to 128 items then delete last 12.790 us/op 9.1129 us/op 1.40
Set add up to 128 items then delete middle 8.6188 us/op 5.8529 us/op 1.47
OrderedSet add up to 128 items then delete middle 20.475 us/op 16.062 us/op 1.27
Set add up to 256 items then delete first 16.423 us/op 12.426 us/op 1.32
OrderedSet add up to 256 items then delete first 26.977 us/op 20.780 us/op 1.30
Set add up to 256 items then delete last 17.403 us/op 11.202 us/op 1.55
OrderedSet add up to 256 items then delete last 27.114 us/op 19.349 us/op 1.40
Set add up to 256 items then delete middle 16.606 us/op 13.603 us/op 1.22
OrderedSet add up to 256 items then delete middle 55.088 us/op 49.147 us/op 1.12
transfer serialized Status (84 B) 1.8380 us/op 1.4460 us/op 1.27
copy serialized Status (84 B) 1.6270 us/op 1.2050 us/op 1.35
transfer serialized SignedVoluntaryExit (112 B) 1.9820 us/op 1.6920 us/op 1.17
copy serialized SignedVoluntaryExit (112 B) 1.6490 us/op 1.3670 us/op 1.21
transfer serialized ProposerSlashing (416 B) 2.5680 us/op 2.7720 us/op 0.93
copy serialized ProposerSlashing (416 B) 2.5680 us/op 2.5430 us/op 1.01
transfer serialized Attestation (485 B) 2.2250 us/op 1.9890 us/op 1.12
copy serialized Attestation (485 B) 2.2090 us/op 2.3410 us/op 0.94
transfer serialized AttesterSlashing (33232 B) 2.4770 us/op 2.3230 us/op 1.07
copy serialized AttesterSlashing (33232 B) 14.131 us/op 6.5940 us/op 2.14
transfer serialized Small SignedBeaconBlock (128000 B) 3.6240 us/op 2.5030 us/op 1.45
copy serialized Small SignedBeaconBlock (128000 B) 48.689 us/op 17.490 us/op 2.78
transfer serialized Avg SignedBeaconBlock (200000 B) 4.7570 us/op 3.1900 us/op 1.49
copy serialized Avg SignedBeaconBlock (200000 B) 47.247 us/op 25.975 us/op 1.82
transfer serialized BlobsSidecar (524380 B) 4.6720 us/op 3.4580 us/op 1.35
copy serialized BlobsSidecar (524380 B) 182.30 us/op 123.51 us/op 1.48
transfer serialized Big SignedBeaconBlock (1000000 B) 12.202 us/op 2.9610 us/op 4.12
copy serialized Big SignedBeaconBlock (1000000 B) 322.74 us/op 153.92 us/op 2.10
pass gossip attestations to forkchoice per slot 3.7746 ms/op 3.0024 ms/op 1.26
forkChoice updateHead vc 100000 bc 64 eq 0 658.45 us/op 480.48 us/op 1.37
forkChoice updateHead vc 600000 bc 64 eq 0 4.6199 ms/op 3.6366 ms/op 1.27
forkChoice updateHead vc 1000000 bc 64 eq 0 7.3518 ms/op 5.2992 ms/op 1.39
forkChoice updateHead vc 600000 bc 320 eq 0 4.2606 ms/op 3.2369 ms/op 1.32
forkChoice updateHead vc 600000 bc 1200 eq 0 5.0303 ms/op 3.1908 ms/op 1.58
forkChoice updateHead vc 600000 bc 7200 eq 0 5.8325 ms/op 4.1123 ms/op 1.42
forkChoice updateHead vc 600000 bc 64 eq 1000 11.727 ms/op 10.896 ms/op 1.08
forkChoice updateHead vc 600000 bc 64 eq 10000 12.161 ms/op 10.738 ms/op 1.13
forkChoice updateHead vc 600000 bc 64 eq 300000 51.362 ms/op 16.480 ms/op 3.12
computeDeltas 500000 validators 300 proto nodes 5.7635 ms/op 4.5967 ms/op 1.25
computeDeltas 500000 validators 1200 proto nodes 4.5034 ms/op 4.6185 ms/op 0.98
computeDeltas 500000 validators 7200 proto nodes 4.3393 ms/op 5.9533 ms/op 0.73
computeDeltas 750000 validators 300 proto nodes 6.3750 ms/op 6.7112 ms/op 0.95
computeDeltas 750000 validators 1200 proto nodes 6.2290 ms/op 6.7185 ms/op 0.93
computeDeltas 750000 validators 7200 proto nodes 6.2800 ms/op 7.3523 ms/op 0.85
computeDeltas 1400000 validators 300 proto nodes 11.346 ms/op 14.314 ms/op 0.79
computeDeltas 1400000 validators 1200 proto nodes 11.980 ms/op 14.282 ms/op 0.84
computeDeltas 1400000 validators 7200 proto nodes 11.762 ms/op 13.509 ms/op 0.87
computeDeltas 2100000 validators 300 proto nodes 16.862 ms/op 20.520 ms/op 0.82
computeDeltas 2100000 validators 1200 proto nodes 17.571 ms/op 20.708 ms/op 0.85
computeDeltas 2100000 validators 7200 proto nodes 17.535 ms/op 20.869 ms/op 0.84
altair processAttestation - 250000 vs - 7PWei normalcase 2.0283 ms/op 3.0707 ms/op 0.66
altair processAttestation - 250000 vs - 7PWei worstcase 3.9519 ms/op 3.9727 ms/op 0.99
altair processAttestation - setStatus - 1/6 committees join 106.39 us/op 106.03 us/op 1.00
altair processAttestation - setStatus - 1/3 committees join 180.57 us/op 201.07 us/op 0.90
altair processAttestation - setStatus - 1/2 committees join 255.89 us/op 260.63 us/op 0.98
altair processAttestation - setStatus - 2/3 committees join 363.91 us/op 351.00 us/op 1.04
altair processAttestation - setStatus - 4/5 committees join 492.84 us/op 494.44 us/op 1.00
altair processAttestation - setStatus - 100% committees join 607.37 us/op 627.72 us/op 0.97
altair processBlock - 250000 vs - 7PWei normalcase 8.5337 ms/op 6.1418 ms/op 1.39
altair processBlock - 250000 vs - 7PWei normalcase hashState 28.307 ms/op 30.310 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase 42.287 ms/op 40.382 ms/op 1.05
altair processBlock - 250000 vs - 7PWei worstcase hashState 77.951 ms/op 81.148 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei normalcase 2.1719 ms/op 2.7157 ms/op 0.80
phase0 processBlock - 250000 vs - 7PWei worstcase 23.994 ms/op 29.586 ms/op 0.81
altair processEth1Data - 250000 vs - 7PWei normalcase 509.83 us/op 646.76 us/op 0.79
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.7840 us/op 11.902 us/op 0.65
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 48.967 us/op 61.609 us/op 0.79
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.586 us/op 16.127 us/op 0.72
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.5950 us/op 9.5710 us/op 0.90
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 171.23 us/op 207.59 us/op 0.82
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.2241 ms/op 1.5946 ms/op 0.77
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.6217 ms/op 2.0450 ms/op 0.79
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.6701 ms/op 1.9876 ms/op 0.84
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.1393 ms/op 4.8668 ms/op 0.85
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.6666 ms/op 1.9986 ms/op 0.83
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.2471 ms/op 4.9579 ms/op 0.86
Tree 40 250000 create 272.95 ms/op 423.23 ms/op 0.64
Tree 40 250000 get(125000) 163.93 ns/op 165.95 ns/op 0.99
Tree 40 250000 set(125000) 747.66 ns/op 800.73 ns/op 0.93
Tree 40 250000 toArray() 22.922 ms/op 23.039 ms/op 0.99
Tree 40 250000 iterate all - toArray() + loop 23.477 ms/op 22.462 ms/op 1.05
Tree 40 250000 iterate all - get(i) 65.546 ms/op 66.650 ms/op 0.98
Array 250000 create 4.0295 ms/op 4.0566 ms/op 0.99
Array 250000 clone - spread 1.8829 ms/op 1.5670 ms/op 1.20
Array 250000 get(125000) 0.48300 ns/op 0.49400 ns/op 0.98
Array 250000 set(125000) 0.49400 ns/op 0.50700 ns/op 0.97
Array 250000 iterate all - loop 117.91 us/op 116.85 us/op 1.01
phase0 afterProcessEpoch - 250000 vs - 7PWei 56.505 ms/op 56.659 ms/op 1.00
Array.fill - length 1000000 4.5277 ms/op 4.8184 ms/op 0.94
Array push - length 1000000 19.962 ms/op 24.995 ms/op 0.80
Array.get 0.30565 ns/op 0.31676 ns/op 0.96
Uint8Array.get 0.47308 ns/op 0.47874 ns/op 0.99
phase0 beforeProcessEpoch - 250000 vs - 7PWei 21.472 ms/op 23.591 ms/op 0.91
altair processEpoch - mainnet_e81889 336.82 ms/op 297.39 ms/op 1.13
mainnet_e81889 - altair beforeProcessEpoch 23.500 ms/op 20.694 ms/op 1.14
mainnet_e81889 - altair processJustificationAndFinalization 18.573 us/op 14.037 us/op 1.32
mainnet_e81889 - altair processInactivityUpdates 7.2852 ms/op 7.8967 ms/op 0.92
mainnet_e81889 - altair processRewardsAndPenalties 43.194 ms/op 53.437 ms/op 0.81
mainnet_e81889 - altair processRegistryUpdates 2.5270 us/op 5.1530 us/op 0.49
mainnet_e81889 - altair processSlashings 516.00 ns/op 626.00 ns/op 0.82
mainnet_e81889 - altair processEth1DataReset 548.00 ns/op 864.00 ns/op 0.63
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5290 ms/op 7.3277 ms/op 0.21
mainnet_e81889 - altair processSlashingsReset 5.5320 us/op 8.5920 us/op 0.64
mainnet_e81889 - altair processRandaoMixesReset 11.046 us/op 11.857 us/op 0.93
mainnet_e81889 - altair processHistoricalRootsUpdate 755.00 ns/op 845.00 ns/op 0.89
mainnet_e81889 - altair processParticipationFlagUpdates 3.9910 us/op 5.8230 us/op 0.69
mainnet_e81889 - altair processSyncCommitteeUpdates 836.00 ns/op 1.2420 us/op 0.67
mainnet_e81889 - altair afterProcessEpoch 54.902 ms/op 58.809 ms/op 0.93
capella processEpoch - mainnet_e217614 1.1815 s/op 1.0876 s/op 1.09
mainnet_e217614 - capella beforeProcessEpoch 81.092 ms/op 88.855 ms/op 0.91
mainnet_e217614 - capella processJustificationAndFinalization 19.352 us/op 14.863 us/op 1.30
mainnet_e217614 - capella processInactivityUpdates 19.617 ms/op 18.654 ms/op 1.05
mainnet_e217614 - capella processRewardsAndPenalties 255.82 ms/op 252.58 ms/op 1.01
mainnet_e217614 - capella processRegistryUpdates 22.312 us/op 13.253 us/op 1.68
mainnet_e217614 - capella processSlashings 1.1270 us/op 811.00 ns/op 1.39
mainnet_e217614 - capella processEth1DataReset 719.00 ns/op 572.00 ns/op 1.26
mainnet_e217614 - capella processEffectiveBalanceUpdates 18.669 ms/op 17.460 ms/op 1.07
mainnet_e217614 - capella processSlashingsReset 6.0880 us/op 3.9040 us/op 1.56
mainnet_e217614 - capella processRandaoMixesReset 12.248 us/op 9.8660 us/op 1.24
mainnet_e217614 - capella processHistoricalRootsUpdate 1.1470 us/op 1.0310 us/op 1.11
mainnet_e217614 - capella processParticipationFlagUpdates 3.5780 us/op 2.2980 us/op 1.56
mainnet_e217614 - capella afterProcessEpoch 131.83 ms/op 127.04 ms/op 1.04
phase0 processEpoch - mainnet_e58758 367.03 ms/op 358.01 ms/op 1.03
mainnet_e58758 - phase0 beforeProcessEpoch 102.91 ms/op 80.565 ms/op 1.28
mainnet_e58758 - phase0 processJustificationAndFinalization 22.999 us/op 24.101 us/op 0.95
mainnet_e58758 - phase0 processRewardsAndPenalties 30.964 ms/op 37.786 ms/op 0.82
mainnet_e58758 - phase0 processRegistryUpdates 12.023 us/op 6.7820 us/op 1.77
mainnet_e58758 - phase0 processSlashings 600.00 ns/op 379.00 ns/op 1.58
mainnet_e58758 - phase0 processEth1DataReset 1.4260 us/op 440.00 ns/op 3.24
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4508 ms/op 1.6200 ms/op 0.90
mainnet_e58758 - phase0 processSlashingsReset 5.7440 us/op 5.5490 us/op 1.04
mainnet_e58758 - phase0 processRandaoMixesReset 8.4070 us/op 5.0600 us/op 1.66
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1300 us/op 386.00 ns/op 2.93
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.4070 us/op 3.9960 us/op 1.60
mainnet_e58758 - phase0 afterProcessEpoch 49.570 ms/op 45.190 ms/op 1.10
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.7527 ms/op 1.9441 ms/op 0.90
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.2092 ms/op 2.7186 ms/op 0.81
altair processInactivityUpdates - 250000 normalcase 19.631 ms/op 18.766 ms/op 1.05
altair processInactivityUpdates - 250000 worstcase 20.415 ms/op 20.122 ms/op 1.01
phase0 processRegistryUpdates - 250000 normalcase 12.897 us/op 7.5670 us/op 1.70
phase0 processRegistryUpdates - 250000 badcase_full_deposits 356.66 us/op 409.73 us/op 0.87
phase0 processRegistryUpdates - 250000 worstcase 0.5 122.76 ms/op 133.74 ms/op 0.92
altair processRewardsAndPenalties - 250000 normalcase 44.413 ms/op 42.536 ms/op 1.04
altair processRewardsAndPenalties - 250000 worstcase 51.845 ms/op 43.526 ms/op 1.19
phase0 getAttestationDeltas - 250000 normalcase 9.8066 ms/op 7.9553 ms/op 1.23
phase0 getAttestationDeltas - 250000 worstcase 10.437 ms/op 7.8388 ms/op 1.33
phase0 processSlashings - 250000 worstcase 121.22 us/op 104.26 us/op 1.16
altair processSyncCommitteeUpdates - 250000 178.84 ms/op 133.78 ms/op 1.34
BeaconState.hashTreeRoot - No change 401.00 ns/op 275.00 ns/op 1.46
BeaconState.hashTreeRoot - 1 full validator 136.48 us/op 109.20 us/op 1.25
BeaconState.hashTreeRoot - 32 full validator 1.2506 ms/op 1.2863 ms/op 0.97
BeaconState.hashTreeRoot - 512 full validator 12.324 ms/op 11.447 ms/op 1.08
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 151.26 us/op 148.23 us/op 1.02
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.7160 ms/op 2.2841 ms/op 0.75
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 22.434 ms/op 24.419 ms/op 0.92
BeaconState.hashTreeRoot - 1 balances 107.03 us/op 102.56 us/op 1.04
BeaconState.hashTreeRoot - 32 balances 1.3836 ms/op 1.0993 ms/op 1.26
BeaconState.hashTreeRoot - 512 balances 9.8484 ms/op 9.4847 ms/op 1.04
BeaconState.hashTreeRoot - 250000 balances 161.79 ms/op 203.26 ms/op 0.80
aggregationBits - 2048 els - zipIndexesInBitList 32.695 us/op 31.293 us/op 1.04
byteArrayEquals 32 58.961 ns/op 56.280 ns/op 1.05
Buffer.compare 32 19.646 ns/op 17.786 ns/op 1.10
byteArrayEquals 1024 1.7849 us/op 1.6445 us/op 1.09
Buffer.compare 1024 27.787 ns/op 25.934 ns/op 1.07
byteArrayEquals 16384 27.154 us/op 26.456 us/op 1.03
Buffer.compare 16384 216.25 ns/op 212.53 ns/op 1.02
byteArrayEquals 123687377 195.98 ms/op 207.72 ms/op 0.94
Buffer.compare 123687377 7.8371 ms/op 9.2970 ms/op 0.84
byteArrayEquals 32 - diff last byte 53.895 ns/op 55.497 ns/op 0.97
Buffer.compare 32 - diff last byte 17.629 ns/op 18.237 ns/op 0.97
byteArrayEquals 1024 - diff last byte 1.6263 us/op 1.6361 us/op 0.99
Buffer.compare 1024 - diff last byte 26.045 ns/op 26.661 ns/op 0.98
byteArrayEquals 16384 - diff last byte 25.868 us/op 26.644 us/op 0.97
Buffer.compare 16384 - diff last byte 185.91 ns/op 194.55 ns/op 0.96
byteArrayEquals 123687377 - diff last byte 194.06 ms/op 226.53 ms/op 0.86
Buffer.compare 123687377 - diff last byte 6.8421 ms/op 10.253 ms/op 0.67
byteArrayEquals 32 - random bytes 5.3570 ns/op 5.8580 ns/op 0.91
Buffer.compare 32 - random bytes 17.470 ns/op 19.958 ns/op 0.88
byteArrayEquals 1024 - random bytes 5.5210 ns/op 5.7870 ns/op 0.95
Buffer.compare 1024 - random bytes 17.806 ns/op 19.369 ns/op 0.92
byteArrayEquals 16384 - random bytes 5.3590 ns/op 5.6930 ns/op 0.94
Buffer.compare 16384 - random bytes 17.769 ns/op 19.978 ns/op 0.89
byteArrayEquals 123687377 - random bytes 6.7500 ns/op 8.0600 ns/op 0.84
Buffer.compare 123687377 - random bytes 19.060 ns/op 23.260 ns/op 0.82
regular array get 100000 times 45.107 us/op 41.363 us/op 1.09
wrappedArray get 100000 times 33.966 us/op 39.165 us/op 0.87
arrayWithProxy get 100000 times 15.348 ms/op 15.087 ms/op 1.02
ssz.Root.equals 48.114 ns/op 54.844 ns/op 0.88
byteArrayEquals 46.071 ns/op 49.743 ns/op 0.93
Buffer.compare 10.431 ns/op 11.336 ns/op 0.92
processSlot - 1 slots 16.621 us/op 21.197 us/op 0.78
processSlot - 32 slots 3.0612 ms/op 4.2545 ms/op 0.72
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.334 ms/op 42.710 ms/op 0.90
getCommitteeAssignments - req 1 vs - 250000 vc 2.2818 ms/op 2.2958 ms/op 0.99
getCommitteeAssignments - req 100 vs - 250000 vc 4.3758 ms/op 4.4652 ms/op 0.98
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6412 ms/op 4.8483 ms/op 0.96
findModifiedValidators - 10000 modified validators 287.27 ms/op 349.56 ms/op 0.82
findModifiedValidators - 1000 modified validators 204.34 ms/op 223.65 ms/op 0.91
findModifiedValidators - 100 modified validators 205.72 ms/op 184.36 ms/op 1.12
findModifiedValidators - 10 modified validators 215.93 ms/op 169.37 ms/op 1.27
findModifiedValidators - 1 modified validators 195.48 ms/op 188.94 ms/op 1.03
findModifiedValidators - no difference 198.21 ms/op 184.61 ms/op 1.07
compare ViewDUs 3.4022 s/op 3.4213 s/op 0.99
compare each validator Uint8Array 1.5343 s/op 1.6916 s/op 0.91
compare ViewDU to Uint8Array 1.2391 s/op 1.2000 s/op 1.03
migrate state 1000000 validators, 24 modified, 0 new 760.93 ms/op 814.47 ms/op 0.93
migrate state 1000000 validators, 1700 modified, 1000 new 952.66 ms/op 1.2471 s/op 0.76
migrate state 1000000 validators, 3400 modified, 2000 new 1.1375 s/op 1.3889 s/op 0.82
migrate state 1500000 validators, 24 modified, 0 new 707.30 ms/op 873.05 ms/op 0.81
migrate state 1500000 validators, 1700 modified, 1000 new 862.99 ms/op 1.3284 s/op 0.65
migrate state 1500000 validators, 3400 modified, 2000 new 981.79 ms/op 1.3977 s/op 0.70
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.4300 ns/op 5.2100 ns/op 0.85
state getBlockRootAtSlot - 250000 vs - 7PWei 586.48 ns/op 1.1801 us/op 0.50
computeProposers - vc 250000 7.1967 ms/op 9.1240 ms/op 0.79
computeEpochShuffling - vc 250000 42.083 ms/op 47.541 ms/op 0.89
getNextSyncCommittee - vc 250000 123.04 ms/op 163.27 ms/op 0.75
computeSigningRoot for AttestationData 23.016 us/op 25.930 us/op 0.89
hash AttestationData serialized data then Buffer.toString(base64) 1.5359 us/op 1.8563 us/op 0.83
toHexString serialized data 871.52 ns/op 1.3802 us/op 0.63
Buffer.toString(base64) 171.00 ns/op 221.50 ns/op 0.77
nodejs block root to RootHex using toHex 164.45 ns/op 193.93 ns/op 0.85
nodejs block root to RootHex using toRootHex 92.257 ns/op 116.92 ns/op 0.79
browser block root to RootHex using the deprecated toHexString 225.50 ns/op 355.79 ns/op 0.63
browser block root to RootHex using toHex 186.09 ns/op 265.71 ns/op 0.70
browser block root to RootHex using toRootHex 160.59 ns/op 194.81 ns/op 0.82

Please sign in to comment.