Skip to content

Commit

Permalink
feat: move requests from execution payload to beacon block body (#7094)
Browse files Browse the repository at this point in the history
* Move requests from payload to block body

* Lint

* Add execution requests to engine api

* Remove engine_getPayloadBodies*V2

* Update spec test version

* Lint

* Fix unit test and polish

* Remove todo
  • Loading branch information
ensi321 authored Sep 25, 2024
1 parent d0ba6bc commit ad4ec77
Show file tree
Hide file tree
Showing 20 changed files with 160 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
isMergeTransitionBlock as isMergeTransitionBlockFn,
isExecutionEnabled,
} from "@lodestar/state-transition";
import {bellatrix, Slot, deneb, SignedBeaconBlock} from "@lodestar/types";
import {bellatrix, Slot, deneb, SignedBeaconBlock, electra} from "@lodestar/types";
import {
IForkChoice,
assertValidTerminalPowBlock,
Expand Down Expand Up @@ -302,14 +302,17 @@ export async function verifyBlockExecutionPayload(
? (block.message.body as deneb.BeaconBlockBody).blobKzgCommitments.map(kzgCommitmentToVersionedHash)
: undefined;
const parentBlockRoot = ForkSeq[fork] >= ForkSeq.deneb ? block.message.parentRoot : undefined;
const executionRequests =
ForkSeq[fork] >= ForkSeq.electra ? (block.message.body as electra.BeaconBlockBody).executionRequests : undefined;

const logCtx = {slot: block.message.slot, executionBlock: executionPayloadEnabled.blockNumber};
chain.logger.debug("Call engine api newPayload", logCtx);
const execResult = await chain.executionEngine.notifyNewPayload(
fork,
executionPayloadEnabled,
versionedHashes,
parentBlockRoot
parentBlockRoot,
executionRequests
);
chain.logger.debug("Receive engine api newPayload result", {...logCtx, status: execResult.status});

Expand Down
10 changes: 9 additions & 1 deletion packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
BlindedBeaconBlockBody,
BlindedBeaconBlock,
sszTypesFor,
electra,
} from "@lodestar/types";
import {
CachedBeaconStateAllForks,
Expand Down Expand Up @@ -258,7 +259,7 @@ export async function produceBlockBody<T extends BlockType>(
}

const engineRes = await this.executionEngine.getPayload(fork, payloadId);
const {executionPayload, blobsBundle} = engineRes;
const {executionPayload, blobsBundle, executionRequests} = engineRes;
shouldOverrideBuilder = engineRes.shouldOverrideBuilder;

(blockBody as BeaconBlockBody<ForkExecution>).executionPayload = executionPayload;
Expand Down Expand Up @@ -298,6 +299,13 @@ export async function produceBlockBody<T extends BlockType>(
} else {
blobsResult = {type: BlobsResultType.preDeneb};
}

if (ForkSeq[fork] >= ForkSeq.electra) {
if (executionRequests === undefined) {
throw Error(`Missing executionRequests response from getPayload at fork=${fork}`);
}
(blockBody as electra.BeaconBlockBody).executionRequests = executionRequests;
}
}
} catch (e) {
this.metrics?.blockPayload.payloadFetchErrors.inc();
Expand Down
41 changes: 29 additions & 12 deletions packages/beacon-node/src/execution/engine/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ExecutionPayload, Root, RootHex, Wei} from "@lodestar/types";
import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types";
import {SLOTS_PER_EPOCH, ForkName, ForkSeq} from "@lodestar/params";
import {Logger} from "@lodestar/logger";
import {
Expand Down Expand Up @@ -37,6 +37,7 @@ import {
ExecutionPayloadBody,
assertReqSizeLimit,
deserializeExecutionPayloadBody,
serializeExecutionRequests,
} from "./types.js";
import {getExecutionEngineState} from "./utils.js";

Expand Down Expand Up @@ -195,7 +196,8 @@ export class ExecutionEngineHttp implements IExecutionEngine {
fork: ForkName,
executionPayload: ExecutionPayload,
versionedHashes?: VersionedHashes,
parentBlockRoot?: Root
parentBlockRoot?: Root,
executionRequests?: ExecutionRequests
): Promise<ExecutePayloadResponse> {
const method =
ForkSeq[fork] >= ForkSeq.electra
Expand All @@ -220,12 +222,28 @@ export class ExecutionEngineHttp implements IExecutionEngine {
const serializedVersionedHashes = serializeVersionedHashes(versionedHashes);
const parentBeaconBlockRoot = serializeBeaconBlockRoot(parentBlockRoot);

const method = ForkSeq[fork] >= ForkSeq.electra ? "engine_newPayloadV4" : "engine_newPayloadV3";
engineRequest = {
method,
params: [serializedExecutionPayload, serializedVersionedHashes, parentBeaconBlockRoot],
methodOpts: notifyNewPayloadOpts,
};
if (ForkSeq[fork] >= ForkSeq.electra) {
if (executionRequests === undefined) {
throw Error(`executionRequests required in notifyNewPayload for fork=${fork}`);
}
const serializedExecutionRequests = serializeExecutionRequests(executionRequests);
engineRequest = {
method: "engine_newPayloadV4",
params: [
serializedExecutionPayload,
serializedVersionedHashes,
parentBeaconBlockRoot,
serializedExecutionRequests,
],
methodOpts: notifyNewPayloadOpts,
};
} else {
engineRequest = {
method: "engine_newPayloadV3",
params: [serializedExecutionPayload, serializedVersionedHashes, parentBeaconBlockRoot],
methodOpts: notifyNewPayloadOpts,
};
}
} else {
const method = ForkSeq[fork] >= ForkSeq.capella ? "engine_newPayloadV2" : "engine_newPayloadV1";
engineRequest = {
Expand Down Expand Up @@ -391,6 +409,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
executionPayload: ExecutionPayload;
executionPayloadValue: Wei;
blobsBundle?: BlobsBundle;
executionRequests?: ExecutionRequests;
shouldOverrideBuilder?: boolean;
}> {
const method =
Expand Down Expand Up @@ -419,8 +438,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
}

async getPayloadBodiesByHash(fork: ForkName, blockHashes: RootHex[]): Promise<(ExecutionPayloadBody | null)[]> {
const method =
ForkSeq[fork] >= ForkSeq.electra ? "engine_getPayloadBodiesByHashV2" : "engine_getPayloadBodiesByHashV1";
const method = "engine_getPayloadBodiesByHashV1";
assertReqSizeLimit(blockHashes.length, 32);
const response = await this.rpc.fetchWithRetries<
EngineApiRpcReturnTypes[typeof method],
Expand All @@ -434,8 +452,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
startBlockNumber: number,
blockCount: number
): Promise<(ExecutionPayloadBody | null)[]> {
const method =
ForkSeq[fork] >= ForkSeq.electra ? "engine_getPayloadBodiesByRangeV2" : "engine_getPayloadBodiesByRangeV1";
const method = "engine_getPayloadBodiesByRangeV1";
assertReqSizeLimit(blockCount, 32);
const start = numToQuantity(startBlockNumber);
const count = numToQuantity(blockCount);
Expand Down
10 changes: 6 additions & 4 deletions packages/beacon-node/src/execution/engine/interface.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {ForkName} from "@lodestar/params";
import {KZGCommitment, Blob, KZGProof} from "@lodestar/types/deneb";
import {Root, RootHex, capella, Wei, ExecutionPayload} from "@lodestar/types";
import {Root, RootHex, capella, Wei, ExecutionPayload, ExecutionRequests} from "@lodestar/types";

import {DATA} from "../../eth1/provider/utils.js";
import {PayloadIdCache, PayloadId, WithdrawalV1, DepositRequestV1} from "./payloadIdCache.js";
import {PayloadIdCache, PayloadId, WithdrawalV1} from "./payloadIdCache.js";
import {ExecutionPayloadBody} from "./types.js";

export {PayloadIdCache, type PayloadId, type WithdrawalV1, type DepositRequestV1};
export {PayloadIdCache, type PayloadId, type WithdrawalV1};

export enum ExecutionPayloadStatus {
/** given payload is valid */
Expand Down Expand Up @@ -134,7 +134,8 @@ export interface IExecutionEngine {
fork: ForkName,
executionPayload: ExecutionPayload,
versionedHashes?: VersionedHashes,
parentBeaconBlockRoot?: Root
parentBeaconBlockRoot?: Root,
executionRequests?: ExecutionRequests
): Promise<ExecutePayloadResponse>;

/**
Expand Down Expand Up @@ -171,6 +172,7 @@ export interface IExecutionEngine {
executionPayload: ExecutionPayload;
executionPayloadValue: Wei;
blobsBundle?: BlobsBundle;
executionRequests?: ExecutionRequests;
shouldOverrideBuilder?: boolean;
}>;

Expand Down
2 changes: 0 additions & 2 deletions packages/beacon-node/src/execution/engine/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
engine_getPayloadV3: this.getPayload.bind(this),
engine_getPayloadV4: this.getPayload.bind(this),
engine_getPayloadBodiesByHashV1: this.getPayloadBodiesByHash.bind(this),
engine_getPayloadBodiesByHashV2: this.getPayloadBodiesByHash.bind(this),
engine_getPayloadBodiesByRangeV1: this.getPayloadBodiesByRange.bind(this),
engine_getClientVersionV1: this.getClientVersionV1.bind(this),
engine_getPayloadBodiesByRangeV2: this.getPayloadBodiesByRange.bind(this),
};
}

Expand Down
20 changes: 0 additions & 20 deletions packages/beacon-node/src/execution/engine/payloadIdCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@ export type WithdrawalV1 = {
amount: QUANTITY;
};

export type DepositRequestV1 = {
pubkey: DATA;
withdrawalCredentials: DATA;
amount: QUANTITY;
signature: DATA;
index: QUANTITY;
};

export type WithdrawalRequestV1 = {
sourceAddress: DATA;
validatorPubkey: DATA;
amount: QUANTITY;
};

export type ConsolidationRequestV1 = {
sourceAddress: DATA;
sourcePubkey: DATA;
targetPubkey: DATA;
};

type FcuAttributes = {headBlockHash: DATA; finalizedBlockHash: DATA} & Omit<PayloadAttributesRpc, "withdrawals">;

export class PayloadIdCache {
Expand Down
Loading

1 comment on commit ad4ec77

@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: ad4ec77 Previous: d0ba6bc Ratio
phase0 processEpoch - mainnet_e58758 1.1300 s/op 366.46 ms/op 3.08
phase0 processEffectiveBalanceUpdates - 250000 normalcase 3.4186 ms/op 958.26 us/op 3.57
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 5.0776 ms/op 1.4877 ms/op 3.41
phase0 getAttestationDeltas - 250000 normalcase 18.886 ms/op 6.1857 ms/op 3.05
Full benchmark results
Benchmark suite Current: ad4ec77 Previous: d0ba6bc Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.9501 ms/op 1.8246 ms/op 1.07
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 50.224 us/op 39.484 us/op 1.27
BLS verify - blst 827.53 us/op 862.76 us/op 0.96
BLS verifyMultipleSignatures 3 - blst 2.5308 ms/op 1.3026 ms/op 1.94
BLS verifyMultipleSignatures 8 - blst 2.2683 ms/op 2.0187 ms/op 1.12
BLS verifyMultipleSignatures 32 - blst 6.9331 ms/op 4.5021 ms/op 1.54
BLS verifyMultipleSignatures 64 - blst 11.030 ms/op 8.3073 ms/op 1.33
BLS verifyMultipleSignatures 128 - blst 18.012 ms/op 16.029 ms/op 1.12
BLS deserializing 10000 signatures 701.15 ms/op 613.18 ms/op 1.14
BLS deserializing 100000 signatures 6.9664 s/op 6.1956 s/op 1.12
BLS verifyMultipleSignatures - same message - 3 - blst 1.1606 ms/op 935.53 us/op 1.24
BLS verifyMultipleSignatures - same message - 8 - blst 1.1206 ms/op 1.1021 ms/op 1.02
BLS verifyMultipleSignatures - same message - 32 - blst 1.7464 ms/op 1.6972 ms/op 1.03
BLS verifyMultipleSignatures - same message - 64 - blst 2.8032 ms/op 2.4111 ms/op 1.16
BLS verifyMultipleSignatures - same message - 128 - blst 4.5110 ms/op 3.9896 ms/op 1.13
BLS aggregatePubkeys 32 - blst 20.539 us/op 18.562 us/op 1.11
BLS aggregatePubkeys 128 - blst 71.549 us/op 64.596 us/op 1.11
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 79.517 ms/op 59.752 ms/op 1.33
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 76.245 ms/op 46.264 ms/op 1.65
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 46.836 ms/op 30.865 ms/op 1.52
getSlashingsAndExits - default max 87.538 us/op 68.761 us/op 1.27
getSlashingsAndExits - 2k 259.79 us/op 272.14 us/op 0.95
proposeBlockBody type=full, size=empty 5.8706 ms/op 5.1558 ms/op 1.14
isKnown best case - 1 super set check 283.00 ns/op 447.00 ns/op 0.63
isKnown normal case - 2 super set checks 264.00 ns/op 445.00 ns/op 0.59
isKnown worse case - 16 super set checks 269.00 ns/op 443.00 ns/op 0.61
InMemoryCheckpointStateCache - add get delete 2.6630 us/op 2.5840 us/op 1.03
updateUnfinalizedPubkeys - updating 10 pubkeys 945.88 us/op 1.0883 ms/op 0.87
updateUnfinalizedPubkeys - updating 100 pubkeys 3.6376 ms/op 2.7963 ms/op 1.30
updateUnfinalizedPubkeys - updating 1000 pubkeys 50.886 ms/op 37.082 ms/op 1.37
validate api signedAggregateAndProof - struct 2.5933 ms/op 1.8902 ms/op 1.37
validate gossip signedAggregateAndProof - struct 2.5950 ms/op 1.9869 ms/op 1.31
validate gossip attestation - vc 640000 1.2759 ms/op 968.93 us/op 1.32
batch validate gossip attestation - vc 640000 - chunk 32 136.42 us/op 116.35 us/op 1.17
batch validate gossip attestation - vc 640000 - chunk 64 121.25 us/op 103.07 us/op 1.18
batch validate gossip attestation - vc 640000 - chunk 128 112.64 us/op 98.654 us/op 1.14
batch validate gossip attestation - vc 640000 - chunk 256 106.54 us/op 97.880 us/op 1.09
pickEth1Vote - no votes 1.0675 ms/op 891.61 us/op 1.20
pickEth1Vote - max votes 7.9230 ms/op 5.6914 ms/op 1.39
pickEth1Vote - Eth1Data hashTreeRoot value x2048 17.009 ms/op 11.896 ms/op 1.43
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 25.354 ms/op 17.517 ms/op 1.45
pickEth1Vote - Eth1Data fastSerialize value x2048 492.63 us/op 385.90 us/op 1.28
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.5457 ms/op 2.9183 ms/op 1.21
bytes32 toHexString 442.00 ns/op 639.00 ns/op 0.69
bytes32 Buffer.toString(hex) 254.00 ns/op 481.00 ns/op 0.53
bytes32 Buffer.toString(hex) from Uint8Array 381.00 ns/op 536.00 ns/op 0.71
bytes32 Buffer.toString(hex) + 0x 257.00 ns/op 439.00 ns/op 0.59
Object access 1 prop 0.14600 ns/op 0.32500 ns/op 0.45
Map access 1 prop 0.13800 ns/op 0.32400 ns/op 0.43
Object get x1000 5.9480 ns/op 5.3870 ns/op 1.10
Map get x1000 6.6250 ns/op 5.9850 ns/op 1.11
Object set x1000 32.532 ns/op 26.993 ns/op 1.21
Map set x1000 22.713 ns/op 18.711 ns/op 1.21
Return object 10000 times 0.28870 ns/op 0.31260 ns/op 0.92
Throw Error 10000 times 3.3407 us/op 2.8628 us/op 1.17
toHex 145.69 ns/op 117.44 ns/op 1.24
Buffer.from 133.04 ns/op 111.69 ns/op 1.19
shared Buffer 88.086 ns/op 74.682 ns/op 1.18
fastMsgIdFn sha256 / 200 bytes 2.2570 us/op 2.0760 us/op 1.09
fastMsgIdFn h32 xxhash / 200 bytes 231.00 ns/op 439.00 ns/op 0.53
fastMsgIdFn h64 xxhash / 200 bytes 280.00 ns/op 491.00 ns/op 0.57
fastMsgIdFn sha256 / 1000 bytes 7.3690 us/op 5.9220 us/op 1.24
fastMsgIdFn h32 xxhash / 1000 bytes 360.00 ns/op 517.00 ns/op 0.70
fastMsgIdFn h64 xxhash / 1000 bytes 352.00 ns/op 509.00 ns/op 0.69
fastMsgIdFn sha256 / 10000 bytes 65.054 us/op 49.076 us/op 1.33
fastMsgIdFn h32 xxhash / 10000 bytes 1.8790 us/op 1.9590 us/op 0.96
fastMsgIdFn h64 xxhash / 10000 bytes 1.2430 us/op 1.3170 us/op 0.94
send data - 1000 256B messages 12.382 ms/op 11.083 ms/op 1.12
send data - 1000 512B messages 17.594 ms/op 13.596 ms/op 1.29
send data - 1000 1024B messages 26.565 ms/op 20.457 ms/op 1.30
send data - 1000 1200B messages 26.676 ms/op 24.838 ms/op 1.07
send data - 1000 2048B messages 31.738 ms/op 28.896 ms/op 1.10
send data - 1000 4096B messages 29.363 ms/op 26.751 ms/op 1.10
send data - 1000 16384B messages 73.864 ms/op 65.090 ms/op 1.13
send data - 1000 65536B messages 200.68 ms/op 237.16 ms/op 0.85
enrSubnets - fastDeserialize 64 bits 1.1040 us/op 1.1080 us/op 1.00
enrSubnets - ssz BitVector 64 bits 351.00 ns/op 499.00 ns/op 0.70
enrSubnets - fastDeserialize 4 bits 156.00 ns/op 330.00 ns/op 0.47
enrSubnets - ssz BitVector 4 bits 351.00 ns/op 509.00 ns/op 0.69
prioritizePeers score -10:0 att 32-0.1 sync 2-0 146.32 us/op 120.39 us/op 1.22
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 195.30 us/op 158.04 us/op 1.24
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 281.40 us/op 266.04 us/op 1.06
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 684.86 us/op 486.61 us/op 1.41
prioritizePeers score 0:0 att 64-1 sync 4-1 921.94 us/op 486.85 us/op 1.89
array of 16000 items push then shift 1.6637 us/op 1.2139 us/op 1.37
LinkedList of 16000 items push then shift 7.1550 ns/op 7.1630 ns/op 1.00
array of 16000 items push then pop 97.842 ns/op 85.684 ns/op 1.14
LinkedList of 16000 items push then pop 7.0660 ns/op 6.3320 ns/op 1.12
array of 24000 items push then shift 2.4581 us/op 1.7962 us/op 1.37
LinkedList of 24000 items push then shift 7.1250 ns/op 6.8420 ns/op 1.04
array of 24000 items push then pop 133.24 ns/op 129.04 ns/op 1.03
LinkedList of 24000 items push then pop 7.0110 ns/op 6.1520 ns/op 1.14
intersect bitArray bitLen 8 6.4530 ns/op 5.2640 ns/op 1.23
intersect array and set length 8 46.877 ns/op 38.338 ns/op 1.22
intersect bitArray bitLen 128 30.156 ns/op 25.628 ns/op 1.18
intersect array and set length 128 681.55 ns/op 555.47 ns/op 1.23
bitArray.getTrueBitIndexes() bitLen 128 2.7190 us/op 1.6720 us/op 1.63
bitArray.getTrueBitIndexes() bitLen 248 3.6530 us/op 2.7580 us/op 1.32
bitArray.getTrueBitIndexes() bitLen 512 9.5700 us/op 6.9320 us/op 1.38
Buffer.concat 32 items 1.0330 us/op 991.00 ns/op 1.04
Uint8Array.set 32 items 1.7630 us/op 1.6060 us/op 1.10
Buffer.copy 2.0490 us/op 1.7380 us/op 1.18
Uint8Array.set - with subarray 2.9930 us/op 2.1860 us/op 1.37
Uint8Array.set - without subarray 1.6560 us/op 1.6750 us/op 0.99
getUint32 - dataview 263.00 ns/op 433.00 ns/op 0.61
getUint32 - manual 160.00 ns/op 348.00 ns/op 0.46
Set add up to 64 items then delete first 2.2280 us/op 1.7323 us/op 1.29
OrderedSet add up to 64 items then delete first 3.2979 us/op 2.7074 us/op 1.22
Set add up to 64 items then delete last 2.5788 us/op 2.0101 us/op 1.28
OrderedSet add up to 64 items then delete last 3.9188 us/op 3.0933 us/op 1.27
Set add up to 64 items then delete middle 2.5525 us/op 2.2252 us/op 1.15
OrderedSet add up to 64 items then delete middle 5.4074 us/op 4.5639 us/op 1.18
Set add up to 128 items then delete first 5.0349 us/op 4.0241 us/op 1.25
OrderedSet add up to 128 items then delete first 7.4439 us/op 5.9425 us/op 1.25
Set add up to 128 items then delete last 5.0911 us/op 3.9572 us/op 1.29
OrderedSet add up to 128 items then delete last 7.7845 us/op 6.1667 us/op 1.26
Set add up to 128 items then delete middle 4.9347 us/op 3.9726 us/op 1.24
OrderedSet add up to 128 items then delete middle 14.115 us/op 11.667 us/op 1.21
Set add up to 256 items then delete first 9.9835 us/op 7.8250 us/op 1.28
OrderedSet add up to 256 items then delete first 14.862 us/op 12.455 us/op 1.19
Set add up to 256 items then delete last 10.048 us/op 7.8511 us/op 1.28
OrderedSet add up to 256 items then delete last 15.746 us/op 12.920 us/op 1.22
Set add up to 256 items then delete middle 10.078 us/op 7.8068 us/op 1.29
OrderedSet add up to 256 items then delete middle 40.896 us/op 34.384 us/op 1.19
transfer serialized Status (84 B) 1.5540 us/op 1.3430 us/op 1.16
copy serialized Status (84 B) 1.2770 us/op 1.1930 us/op 1.07
transfer serialized SignedVoluntaryExit (112 B) 1.7650 us/op 1.4530 us/op 1.21
copy serialized SignedVoluntaryExit (112 B) 1.3860 us/op 1.2500 us/op 1.11
transfer serialized ProposerSlashing (416 B) 2.1060 us/op 1.9640 us/op 1.07
copy serialized ProposerSlashing (416 B) 2.0780 us/op 1.4530 us/op 1.43
transfer serialized Attestation (485 B) 2.2760 us/op 1.5470 us/op 1.47
copy serialized Attestation (485 B) 2.0250 us/op 1.3100 us/op 1.55
transfer serialized AttesterSlashing (33232 B) 2.4490 us/op 1.8490 us/op 1.32
copy serialized AttesterSlashing (33232 B) 5.8070 us/op 4.0820 us/op 1.42
transfer serialized Small SignedBeaconBlock (128000 B) 3.7490 us/op 1.7360 us/op 2.16
copy serialized Small SignedBeaconBlock (128000 B) 16.298 us/op 8.9870 us/op 1.81
transfer serialized Avg SignedBeaconBlock (200000 B) 4.1930 us/op 1.9060 us/op 2.20
copy serialized Avg SignedBeaconBlock (200000 B) 23.067 us/op 12.098 us/op 1.91
transfer serialized BlobsSidecar (524380 B) 3.4430 us/op 2.1440 us/op 1.61
copy serialized BlobsSidecar (524380 B) 154.22 us/op 102.50 us/op 1.50
transfer serialized Big SignedBeaconBlock (1000000 B) 3.1410 us/op 2.8200 us/op 1.11
copy serialized Big SignedBeaconBlock (1000000 B) 161.32 us/op 138.42 us/op 1.17
pass gossip attestations to forkchoice per slot 2.8771 ms/op 2.5122 ms/op 1.15
forkChoice updateHead vc 100000 bc 64 eq 0 541.27 us/op 624.42 us/op 0.87
forkChoice updateHead vc 600000 bc 64 eq 0 3.1069 ms/op 2.6399 ms/op 1.18
forkChoice updateHead vc 1000000 bc 64 eq 0 5.4551 ms/op 4.8231 ms/op 1.13
forkChoice updateHead vc 600000 bc 320 eq 0 3.0965 ms/op 2.6680 ms/op 1.16
forkChoice updateHead vc 600000 bc 1200 eq 0 3.1378 ms/op 2.7462 ms/op 1.14
forkChoice updateHead vc 600000 bc 7200 eq 0 3.6403 ms/op 3.3419 ms/op 1.09
forkChoice updateHead vc 600000 bc 64 eq 1000 11.313 ms/op 9.7921 ms/op 1.16
forkChoice updateHead vc 600000 bc 64 eq 10000 10.895 ms/op 9.5702 ms/op 1.14
forkChoice updateHead vc 600000 bc 64 eq 300000 14.660 ms/op 12.258 ms/op 1.20
computeDeltas 500000 validators 300 proto nodes 3.5772 ms/op 3.2164 ms/op 1.11
computeDeltas 500000 validators 1200 proto nodes 3.6434 ms/op 3.2430 ms/op 1.12
computeDeltas 500000 validators 7200 proto nodes 3.6837 ms/op 3.2622 ms/op 1.13
computeDeltas 750000 validators 300 proto nodes 5.5141 ms/op 5.0388 ms/op 1.09
computeDeltas 750000 validators 1200 proto nodes 5.5944 ms/op 4.6802 ms/op 1.20
computeDeltas 750000 validators 7200 proto nodes 5.5464 ms/op 4.7731 ms/op 1.16
computeDeltas 1400000 validators 300 proto nodes 10.226 ms/op 8.5260 ms/op 1.20
computeDeltas 1400000 validators 1200 proto nodes 11.228 ms/op 8.4091 ms/op 1.34
computeDeltas 1400000 validators 7200 proto nodes 12.255 ms/op 8.6127 ms/op 1.42
computeDeltas 2100000 validators 300 proto nodes 18.686 ms/op 13.579 ms/op 1.38
computeDeltas 2100000 validators 1200 proto nodes 21.374 ms/op 13.226 ms/op 1.62
computeDeltas 2100000 validators 7200 proto nodes 21.740 ms/op 12.912 ms/op 1.68
altair processAttestation - 250000 vs - 7PWei normalcase 3.0531 ms/op 2.0391 ms/op 1.50
altair processAttestation - 250000 vs - 7PWei worstcase 4.6790 ms/op 2.7321 ms/op 1.71
altair processAttestation - setStatus - 1/6 committees join 175.49 us/op 72.093 us/op 2.43
altair processAttestation - setStatus - 1/3 committees join 333.91 us/op 147.63 us/op 2.26
altair processAttestation - setStatus - 1/2 committees join 413.75 us/op 209.94 us/op 1.97
altair processAttestation - setStatus - 2/3 committees join 551.04 us/op 279.21 us/op 1.97
altair processAttestation - setStatus - 4/5 committees join 951.70 us/op 409.59 us/op 2.32
altair processAttestation - setStatus - 100% committees join 1.1084 ms/op 484.35 us/op 2.29
altair processBlock - 250000 vs - 7PWei normalcase 8.1806 ms/op 5.0885 ms/op 1.61
altair processBlock - 250000 vs - 7PWei normalcase hashState 49.672 ms/op 27.937 ms/op 1.78
altair processBlock - 250000 vs - 7PWei worstcase 62.955 ms/op 36.435 ms/op 1.73
altair processBlock - 250000 vs - 7PWei worstcase hashState 130.08 ms/op 80.202 ms/op 1.62
phase0 processBlock - 250000 vs - 7PWei normalcase 4.2790 ms/op 2.0246 ms/op 2.11
phase0 processBlock - 250000 vs - 7PWei worstcase 43.392 ms/op 22.982 ms/op 1.89
altair processEth1Data - 250000 vs - 7PWei normalcase 586.51 us/op 253.96 us/op 2.31
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.4450 us/op 5.0870 us/op 1.66
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 50.562 us/op 29.546 us/op 1.71
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 15.088 us/op 5.0970 us/op 2.96
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 9.1610 us/op 5.3260 us/op 1.72
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 207.78 us/op 126.42 us/op 1.64
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.6493 ms/op 802.19 us/op 2.06
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.6131 ms/op 1.1703 ms/op 2.23
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.3558 ms/op 1.1073 ms/op 2.13
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 6.7542 ms/op 2.8483 ms/op 2.37
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.5803 ms/op 1.2553 ms/op 2.06
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 7.7101 ms/op 3.0827 ms/op 2.50
Tree 40 250000 create 444.25 ms/op 191.97 ms/op 2.31
Tree 40 250000 get(125000) 323.11 ns/op 124.31 ns/op 2.60
Tree 40 250000 set(125000) 1.2928 us/op 558.10 ns/op 2.32
Tree 40 250000 toArray() 31.511 ms/op 18.663 ms/op 1.69
Tree 40 250000 iterate all - toArray() + loop 29.790 ms/op 19.214 ms/op 1.55
Tree 40 250000 iterate all - get(i) 102.45 ms/op 49.217 ms/op 2.08
Array 250000 create 6.0243 ms/op 3.1645 ms/op 1.90
Array 250000 clone - spread 2.5110 ms/op 1.3737 ms/op 1.83
Array 250000 get(125000) 0.73900 ns/op 0.58400 ns/op 1.27
Array 250000 set(125000) 0.78200 ns/op 0.59200 ns/op 1.32
Array 250000 iterate all - loop 129.54 us/op 76.486 us/op 1.69
phase0 afterProcessEpoch - 250000 vs - 7PWei 169.93 ms/op 74.446 ms/op 2.28
Array.fill - length 1000000 6.8550 ms/op 2.6543 ms/op 2.58
Array push - length 1000000 29.742 ms/op 15.628 ms/op 1.90
Array.get 0.50197 ns/op 0.25966 ns/op 1.93
Uint8Array.get 0.78375 ns/op 0.34707 ns/op 2.26
phase0 beforeProcessEpoch - 250000 vs - 7PWei 24.823 ms/op 19.495 ms/op 1.27
altair processEpoch - mainnet_e81889 620.13 ms/op 332.71 ms/op 1.86
mainnet_e81889 - altair beforeProcessEpoch 30.922 ms/op 19.183 ms/op 1.61
mainnet_e81889 - altair processJustificationAndFinalization 20.389 us/op 13.294 us/op 1.53
mainnet_e81889 - altair processInactivityUpdates 9.9956 ms/op 6.2201 ms/op 1.61
mainnet_e81889 - altair processRewardsAndPenalties 59.859 ms/op 45.542 ms/op 1.31
mainnet_e81889 - altair processRegistryUpdates 3.5520 us/op 1.8170 us/op 1.95
mainnet_e81889 - altair processSlashings 656.00 ns/op 741.00 ns/op 0.89
mainnet_e81889 - altair processEth1DataReset 787.00 ns/op 733.00 ns/op 1.07
mainnet_e81889 - altair processEffectiveBalanceUpdates 5.0686 ms/op 1.7048 ms/op 2.97
mainnet_e81889 - altair processSlashingsReset 11.092 us/op 2.3920 us/op 4.64
mainnet_e81889 - altair processRandaoMixesReset 9.8090 us/op 2.8090 us/op 3.49
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1190 us/op 724.00 ns/op 1.55
mainnet_e81889 - altair processParticipationFlagUpdates 11.772 us/op 1.5670 us/op 7.51
mainnet_e81889 - altair processSyncCommitteeUpdates 1.4600 us/op 647.00 ns/op 2.26
mainnet_e81889 - altair afterProcessEpoch 171.31 ms/op 74.468 ms/op 2.30
capella processEpoch - mainnet_e217614 2.7132 s/op 911.27 ms/op 2.98
mainnet_e217614 - capella beforeProcessEpoch 159.46 ms/op 68.158 ms/op 2.34
mainnet_e217614 - capella processJustificationAndFinalization 29.822 us/op 7.3050 us/op 4.08
mainnet_e217614 - capella processInactivityUpdates 34.514 ms/op 17.477 ms/op 1.97
mainnet_e217614 - capella processRewardsAndPenalties 486.93 ms/op 255.18 ms/op 1.91
mainnet_e217614 - capella processRegistryUpdates 50.394 us/op 15.542 us/op 3.24
mainnet_e217614 - capella processSlashings 1.8730 us/op 841.00 ns/op 2.23
mainnet_e217614 - capella processEth1DataReset 700.00 ns/op 743.00 ns/op 0.94
mainnet_e217614 - capella processEffectiveBalanceUpdates 14.266 ms/op 14.588 ms/op 0.98
mainnet_e217614 - capella processSlashingsReset 15.480 us/op 2.8900 us/op 5.36
mainnet_e217614 - capella processRandaoMixesReset 18.586 us/op 3.0550 us/op 6.08
mainnet_e217614 - capella processHistoricalRootsUpdate 1.3960 us/op 808.00 ns/op 1.73
mainnet_e217614 - capella processParticipationFlagUpdates 8.3350 us/op 1.7010 us/op 4.90
mainnet_e217614 - capella afterProcessEpoch 790.57 ms/op 198.36 ms/op 3.99
phase0 processEpoch - mainnet_e58758 1.1300 s/op 366.46 ms/op 3.08
mainnet_e58758 - phase0 beforeProcessEpoch 185.32 ms/op 76.598 ms/op 2.42
mainnet_e58758 - phase0 processJustificationAndFinalization 79.095 us/op 12.620 us/op 6.27
mainnet_e58758 - phase0 processRewardsAndPenalties 67.429 ms/op 25.463 ms/op 2.65
mainnet_e58758 - phase0 processRegistryUpdates 17.184 us/op 6.1270 us/op 2.80
mainnet_e58758 - phase0 processSlashings 966.00 ns/op 486.00 ns/op 1.99
mainnet_e58758 - phase0 processEth1DataReset 3.1630 us/op 649.00 ns/op 4.87
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 3.1494 ms/op 1.3694 ms/op 2.30
mainnet_e58758 - phase0 processSlashingsReset 6.4920 us/op 2.4050 us/op 2.70
mainnet_e58758 - phase0 processRandaoMixesReset 11.552 us/op 2.8900 us/op 4.00
mainnet_e58758 - phase0 processHistoricalRootsUpdate 761.00 ns/op 562.00 ns/op 1.35
mainnet_e58758 - phase0 processParticipationRecordUpdates 7.8960 us/op 2.1610 us/op 3.65
mainnet_e58758 - phase0 afterProcessEpoch 131.99 ms/op 64.993 ms/op 2.03
phase0 processEffectiveBalanceUpdates - 250000 normalcase 3.4186 ms/op 958.26 us/op 3.57
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 5.0776 ms/op 1.4877 ms/op 3.41
altair processInactivityUpdates - 250000 normalcase 36.131 ms/op 17.715 ms/op 2.04
altair processInactivityUpdates - 250000 worstcase 36.927 ms/op 15.975 ms/op 2.31
phase0 processRegistryUpdates - 250000 normalcase 10.274 us/op 5.4890 us/op 1.87
phase0 processRegistryUpdates - 250000 badcase_full_deposits 496.67 us/op 308.70 us/op 1.61
phase0 processRegistryUpdates - 250000 worstcase 0.5 310.30 ms/op 118.30 ms/op 2.62
altair processRewardsAndPenalties - 250000 normalcase 122.81 ms/op 43.533 ms/op 2.82
altair processRewardsAndPenalties - 250000 worstcase 113.15 ms/op 44.119 ms/op 2.56
phase0 getAttestationDeltas - 250000 normalcase 18.886 ms/op 6.1857 ms/op 3.05
phase0 getAttestationDeltas - 250000 worstcase 15.163 ms/op 6.5742 ms/op 2.31
phase0 processSlashings - 250000 worstcase 135.64 us/op 91.062 us/op 1.49
altair processSyncCommitteeUpdates - 250000 273.86 ms/op 102.93 ms/op 2.66
BeaconState.hashTreeRoot - No change 528.00 ns/op 450.00 ns/op 1.17
BeaconState.hashTreeRoot - 1 full validator 212.48 us/op 121.83 us/op 1.74
BeaconState.hashTreeRoot - 32 full validator 2.2519 ms/op 1.0620 ms/op 2.12
BeaconState.hashTreeRoot - 512 full validator 23.356 ms/op 11.434 ms/op 2.04
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 244.07 us/op 131.66 us/op 1.85
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.4675 ms/op 1.9370 ms/op 1.79
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 46.628 ms/op 25.958 ms/op 1.80
BeaconState.hashTreeRoot - 1 balances 215.25 us/op 111.31 us/op 1.93
BeaconState.hashTreeRoot - 32 balances 1.9426 ms/op 1.1280 ms/op 1.72
BeaconState.hashTreeRoot - 512 balances 18.070 ms/op 9.1153 ms/op 1.98
BeaconState.hashTreeRoot - 250000 balances 288.14 ms/op 162.15 ms/op 1.78
aggregationBits - 2048 els - zipIndexesInBitList 45.931 us/op 22.568 us/op 2.04
byteArrayEquals 32 97.563 ns/op 47.099 ns/op 2.07
Buffer.compare 32 30.400 ns/op 15.478 ns/op 1.96
byteArrayEquals 1024 2.7967 us/op 1.2566 us/op 2.23
Buffer.compare 1024 45.033 ns/op 22.460 ns/op 2.01
byteArrayEquals 16384 44.303 us/op 20.004 us/op 2.21
Buffer.compare 16384 361.19 ns/op 201.08 ns/op 1.80
byteArrayEquals 123687377 288.96 ms/op 151.81 ms/op 1.90
Buffer.compare 123687377 6.2905 ms/op 3.9301 ms/op 1.60
byteArrayEquals 32 - diff last byte 67.512 ns/op 48.517 ns/op 1.39
Buffer.compare 32 - diff last byte 21.242 ns/op 16.285 ns/op 1.30
byteArrayEquals 1024 - diff last byte 1.8260 us/op 1.2505 us/op 1.46
Buffer.compare 1024 - diff last byte 30.765 ns/op 24.611 ns/op 1.25
byteArrayEquals 16384 - diff last byte 30.405 us/op 19.926 us/op 1.53
Buffer.compare 16384 - diff last byte 240.75 ns/op 192.08 ns/op 1.25
byteArrayEquals 123687377 - diff last byte 219.41 ms/op 150.69 ms/op 1.46
Buffer.compare 123687377 - diff last byte 6.7517 ms/op 4.5768 ms/op 1.48
byteArrayEquals 32 - random bytes 6.1980 ns/op 4.9410 ns/op 1.25
Buffer.compare 32 - random bytes 20.215 ns/op 16.792 ns/op 1.20
byteArrayEquals 1024 - random bytes 6.1590 ns/op 4.9260 ns/op 1.25
Buffer.compare 1024 - random bytes 20.034 ns/op 16.712 ns/op 1.20
byteArrayEquals 16384 - random bytes 5.8190 ns/op 4.9000 ns/op 1.19
Buffer.compare 16384 - random bytes 19.867 ns/op 16.695 ns/op 1.19
byteArrayEquals 123687377 - random bytes 6.8900 ns/op 7.8000 ns/op 0.88
Buffer.compare 123687377 - random bytes 20.040 ns/op 19.870 ns/op 1.01
regular array get 100000 times 34.322 us/op 30.779 us/op 1.12
wrappedArray get 100000 times 34.264 us/op 30.658 us/op 1.12
arrayWithProxy get 100000 times 14.340 ms/op 10.122 ms/op 1.42
ssz.Root.equals 49.132 ns/op 42.902 ns/op 1.15
byteArrayEquals 48.231 ns/op 42.165 ns/op 1.14
Buffer.compare 11.269 ns/op 9.7320 ns/op 1.16
shuffle list - 16384 els 6.7992 ms/op 5.4261 ms/op 1.25
shuffle list - 250000 els 100.31 ms/op 79.110 ms/op 1.27
processSlot - 1 slots 15.658 us/op 11.417 us/op 1.37
processSlot - 32 slots 3.7654 ms/op 2.3281 ms/op 1.62
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 43.308 ms/op 38.398 ms/op 1.13
getCommitteeAssignments - req 1 vs - 250000 vc 2.5013 ms/op 1.8116 ms/op 1.38
getCommitteeAssignments - req 100 vs - 250000 vc 4.6619 ms/op 3.5327 ms/op 1.32
getCommitteeAssignments - req 1000 vs - 250000 vc 5.7165 ms/op 3.8903 ms/op 1.47
findModifiedValidators - 10000 modified validators 269.04 ms/op 242.13 ms/op 1.11
findModifiedValidators - 1000 modified validators 214.74 ms/op 144.83 ms/op 1.48
findModifiedValidators - 100 modified validators 205.88 ms/op 148.85 ms/op 1.38
findModifiedValidators - 10 modified validators 166.01 ms/op 136.43 ms/op 1.22
findModifiedValidators - 1 modified validators 178.27 ms/op 131.78 ms/op 1.35
findModifiedValidators - no difference 185.52 ms/op 157.90 ms/op 1.17
compare ViewDUs 3.3685 s/op 3.0253 s/op 1.11
compare each validator Uint8Array 1.4752 s/op 1.6100 s/op 0.92
compare ViewDU to Uint8Array 1.2608 s/op 960.44 ms/op 1.31
migrate state 1000000 validators, 24 modified, 0 new 1.0006 s/op 804.28 ms/op 1.24
migrate state 1000000 validators, 1700 modified, 1000 new 1.5480 s/op 979.91 ms/op 1.58
migrate state 1000000 validators, 3400 modified, 2000 new 1.9752 s/op 1.2813 s/op 1.54
migrate state 1500000 validators, 24 modified, 0 new 1.4120 s/op 831.87 ms/op 1.70
migrate state 1500000 validators, 1700 modified, 1000 new 1.7550 s/op 1.0307 s/op 1.70
migrate state 1500000 validators, 3400 modified, 2000 new 2.0674 s/op 1.1981 s/op 1.73
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.4700 ns/op 6.1400 ns/op 1.05
state getBlockRootAtSlot - 250000 vs - 7PWei 856.23 ns/op 778.52 ns/op 1.10
computeProposers - vc 250000 11.267 ms/op 6.1904 ms/op 1.82
computeEpochShuffling - vc 250000 115.33 ms/op 79.667 ms/op 1.45
getNextSyncCommittee - vc 250000 165.33 ms/op 103.99 ms/op 1.59
computeSigningRoot for AttestationData 33.037 us/op 16.058 us/op 2.06
hash AttestationData serialized data then Buffer.toString(base64) 2.2376 us/op 1.1216 us/op 2.00
toHexString serialized data 1.2925 us/op 742.26 ns/op 1.74
Buffer.toString(base64) 314.94 ns/op 123.68 ns/op 2.55
nodejs block root to RootHex using toHex 258.32 ns/op 108.31 ns/op 2.39
nodejs block root to RootHex using toRootHex 149.82 ns/op 71.957 ns/op 2.08
browser block root to RootHex using the deprecated toHexString 355.88 ns/op 204.22 ns/op 1.74
browser block root to RootHex using toHex 350.13 ns/op 164.03 ns/op 2.13
browser block root to RootHex using toRootHex 280.05 ns/op 145.51 ns/op 1.92

Please sign in to comment.