Skip to content

Commit

Permalink
feat: add endpoint to fetch blinded blocks (#6905)
Browse files Browse the repository at this point in the history
* feat: add endpoint to fetch blinded blocks

* Reorder test assertions
  • Loading branch information
nflaig authored Jun 24, 2024
1 parent f20ec4e commit b453b37
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 5 deletions.
25 changes: 24 additions & 1 deletion packages/api/src/beacon/routes/beacon/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
SignedBeaconBlockOrContents,
SignedBlindedBeaconBlock,
} from "@lodestar/types";
import {ForkName, ForkSeq} from "@lodestar/params";
import {ForkName, ForkPreExecution, ForkSeq, isForkExecution} from "@lodestar/params";
import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js";
import {EmptyMeta, EmptyResponseCodec, EmptyResponseData, WithVersion} from "../../../utils/codecs.js";
import {
Expand Down Expand Up @@ -88,6 +88,18 @@ export type Endpoints = {
ExecutionOptimisticFinalizedAndVersionMeta
>;

/**
* Get blinded block
* Retrieves blinded block for given block id.
*/
getBlindedBlock: Endpoint<
"GET",
BlockArgs,
{params: {block_id: string}},
SignedBlindedBeaconBlock | SignedBeaconBlock<ForkPreExecution>,
ExecutionOptimisticFinalizedAndVersionMeta
>;

/**
* Get block attestations
* Retrieves attestation included in requested block.
Expand Down Expand Up @@ -226,6 +238,17 @@ export function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoi
meta: ExecutionOptimisticFinalizedAndVersionCodec,
},
},
getBlindedBlock: {
url: "/eth/v1/beacon/blinded_blocks/{block_id}",
method: "GET",
req: blockIdOnlyReq,
resp: {
data: WithVersion((fork) =>
isForkExecution(fork) ? ssz[fork].SignedBlindedBeaconBlock : ssz[fork].SignedBeaconBlock
),
meta: ExecutionOptimisticFinalizedAndVersionCodec,
},
},
getBlockAttestations: {
url: "/eth/v1/beacon/blocks/{block_id}/attestations",
method: "GET",
Expand Down
1 change: 0 additions & 1 deletion packages/api/test/unit/beacon/oapiSpec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const testDatas = {
const ignoredOperations = [
/* missing route */
"getDepositSnapshot", // Won't fix for now, see https://github.com/ChainSafe/lodestar/issues/5697
"getBlindedBlock", // https://github.com/ChainSafe/lodestar/issues/5699
"getNextWithdrawals", // https://github.com/ChainSafe/lodestar/issues/5696
"getDebugForkChoice", // https://github.com/ChainSafe/lodestar/issues/5700
/* Must support ssz response body */
Expand Down
7 changes: 7 additions & 0 deletions packages/api/test/unit/beacon/testData/beacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export const testData: GenericServerTestCases<Endpoints> = {
meta: {executionOptimistic: true, finalized: false, version: ForkName.bellatrix},
},
},
getBlindedBlock: {
args: {blockId: "head"},
res: {
data: ssz.deneb.SignedBlindedBeaconBlock.defaultValue(),
meta: {executionOptimistic: true, finalized: false, version: ForkName.deneb},
},
},
getBlockAttestations: {
args: {blockId: "head"},
res: {data: [ssz.phase0.Attestation.defaultValue()], meta: {executionOptimistic: true, finalized: false}},
Expand Down
24 changes: 22 additions & 2 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import {routes} from "@lodestar/api";
import {ApplicationMethods} from "@lodestar/api/server";
import {computeEpochAtSlot, computeTimeAtSlot, reconstructFullBlockOrContents} from "@lodestar/state-transition";
import {SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
import {
computeEpochAtSlot,
computeTimeAtSlot,
reconstructFullBlockOrContents,
signedBeaconBlockToBlinded,
} from "@lodestar/state-transition";
import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution} from "@lodestar/params";
import {sleep, fromHex, toHex} from "@lodestar/utils";
import {
deneb,
Expand Down Expand Up @@ -385,6 +390,21 @@ export function getBeaconBlockApi({
};
},

async getBlindedBlock({blockId}) {
const {block, executionOptimistic, finalized} = await resolveBlockId(chain, blockId);
const fork = config.getForkName(block.message.slot);
return {
data: isForkExecution(fork)
? signedBeaconBlockToBlinded(config, block as SignedBeaconBlock<ForkExecution>)
: block,
meta: {
executionOptimistic,
finalized,
version: fork,
},
};
},

async getBlockAttestations({blockId}) {
const {block, executionOptimistic, finalized} = await resolveBlockId(chain, blockId);
return {
Expand Down
101 changes: 101 additions & 0 deletions packages/beacon-node/test/e2e/api/impl/beacon/block/endpoint.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import {describe, beforeAll, afterAll, it, expect, vi} from "vitest";
import {createBeaconConfig} from "@lodestar/config";
import {ApiClient, WireFormat, getClient} from "@lodestar/api";
import {
SignedBeaconBlock,
SignedBlindedBeaconBlock,
isBlindedExecutionPayload,
isBlindedSignedBeaconBlock,
isExecutionPayload,
} from "@lodestar/types";
import {ForkName} from "@lodestar/params";
import {LogLevel, testLogger} from "../../../../../utils/logger.js";
import {getDevBeaconNode} from "../../../../../utils/node/beacon.js";
import {BeaconNode} from "../../../../../../src/node/nodejs.js";
import {getConfig} from "../../../../../utils/config.js";

describe("beacon block api", function () {
vi.setConfig({testTimeout: 60_000, hookTimeout: 60_000});

const restPort = 9596;
const fork = ForkName.deneb;
const config = createBeaconConfig(getConfig(fork), Buffer.alloc(32, 0xaa));
const validatorCount = 8;

let bn: BeaconNode;
let client: ApiClient["beacon"];

beforeAll(async () => {
bn = await getDevBeaconNode({
params: config,
options: {
sync: {isSingleNode: true},
network: {allowPublishToZeroPeers: true},
api: {
rest: {
enabled: true,
port: restPort,
},
},
chain: {blsVerifyAllMainThread: true},
},
validatorCount,
logger: testLogger("Node-A", {level: LogLevel.info}),
});
client = getClient({baseUrl: `http://127.0.0.1:${restPort}`}, {config}).beacon;
});

afterAll(async () => {
await bn.close();
});

describe("getBlockV2", () => {
it("should return signed beacon block", async () => {
const res = await client.getBlockV2({blockId: "head"});

expect(res.meta().version).toBe(fork);
expect(res.wireFormat()).toBe(WireFormat.ssz);

const beaconBlock = res.value() as SignedBeaconBlock<typeof fork>;

expect(isBlindedSignedBeaconBlock(beaconBlock)).toBe(false);
expect(isExecutionPayload(beaconBlock.message.body.executionPayload)).toBe(true);
expect(beaconBlock.message.body).not.toHaveProperty("executionPayloadHeader");
});

it("should return 400 if block id is invalid", async () => {
const res = await client.getBlockV2({blockId: "current"});
expect(res.status).toBe(400);
});

it("should return 404 if block not found", async () => {
const res = await client.getBlockV2({blockId: 999});
expect(res.status).toBe(404);
});
});

describe("getBlindedBlock", () => {
it("should return signed blinded block", async () => {
const res = await client.getBlindedBlock({blockId: "head"});

expect(res.meta().version).toBe(fork);
expect(res.wireFormat()).toBe(WireFormat.ssz);

const blindedBlock = res.value() as SignedBlindedBeaconBlock<typeof fork>;

expect(isBlindedSignedBeaconBlock(blindedBlock)).toBe(true);
expect(isBlindedExecutionPayload(blindedBlock.message.body.executionPayloadHeader)).toBe(true);
expect(blindedBlock.message.body).not.toHaveProperty("executionPayload");
});

it("should return 400 if block id is invalid", async () => {
const res = await client.getBlindedBlock({blockId: "current"});
expect(res.status).toBe(400);
});

it("should return 404 if block not found", async () => {
const res = await client.getBlindedBlock({blockId: 999});
expect(res.status).toBe(404);
});
});
});
12 changes: 11 additions & 1 deletion packages/state-transition/src/util/blindedBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,20 @@ export function blindedOrFullBlockToHeader(
export function beaconBlockToBlinded(config: ChainForkConfig, block: BeaconBlock<ForkExecution>): BlindedBeaconBlock {
const fork = config.getForkName(block.slot);
const executionPayloadHeader = executionPayloadToPayloadHeader(ForkSeq[fork], block.body.executionPayload);
const blindedBlock = {...block, body: {...block.body, executionPayloadHeader}} as BlindedBeaconBlock;
const blindedBlock: BlindedBeaconBlock = {...block, body: {...block.body, executionPayloadHeader}};
return blindedBlock;
}

export function signedBeaconBlockToBlinded(
config: ChainForkConfig,
signedBlock: SignedBeaconBlock<ForkExecution>
): SignedBlindedBeaconBlock {
return {
message: beaconBlockToBlinded(config, signedBlock.message),
signature: signedBlock.signature,
};
}

export function signedBlindedBlockToFull(
signedBlindedBlock: SignedBlindedBeaconBlock,
executionPayload: ExecutionPayload | null
Expand Down

1 comment on commit b453b37

@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: b453b37 Previous: f20ec4e Ratio
getSlashingsAndExits - default max 293.00 us/op 77.878 us/op 3.76
Full benchmark results
Benchmark suite Current: b453b37 Previous: f20ec4e Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 658.32 us/op 424.97 us/op 1.55
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 54.602 us/op 47.419 us/op 1.15
BLS verify - blst-native 1.1267 ms/op 1.1772 ms/op 0.96
BLS verifyMultipleSignatures 3 - blst-native 2.3797 ms/op 2.4605 ms/op 0.97
BLS verifyMultipleSignatures 8 - blst-native 5.2725 ms/op 5.3790 ms/op 0.98
BLS verifyMultipleSignatures 32 - blst-native 19.188 ms/op 20.136 ms/op 0.95
BLS verifyMultipleSignatures 64 - blst-native 38.315 ms/op 39.682 ms/op 0.97
BLS verifyMultipleSignatures 128 - blst-native 75.555 ms/op 81.124 ms/op 0.93
BLS deserializing 10000 signatures 783.45 ms/op 815.32 ms/op 0.96
BLS deserializing 100000 signatures 8.1085 s/op 8.1938 s/op 0.99
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1523 ms/op 1.1609 ms/op 0.99
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.3145 ms/op 1.3088 ms/op 1.00
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.1771 ms/op 2.4518 ms/op 0.89
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.0612 ms/op 3.6495 ms/op 0.84
BLS verifyMultipleSignatures - same message - 128 - blst-native 7.1562 ms/op 5.0562 ms/op 1.42
BLS aggregatePubkeys 32 - blst-native 23.648 us/op 23.778 us/op 0.99
BLS aggregatePubkeys 128 - blst-native 91.190 us/op 91.414 us/op 1.00
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 71.384 ms/op 73.522 ms/op 0.97
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 52.130 ms/op 63.568 ms/op 0.82
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 35.542 ms/op 33.304 ms/op 1.07
getSlashingsAndExits - default max 293.00 us/op 77.878 us/op 3.76
getSlashingsAndExits - 2k 443.08 us/op 373.96 us/op 1.18
proposeBlockBody type=full, size=empty 5.3196 ms/op 5.5864 ms/op 0.95
isKnown best case - 1 super set check 692.00 ns/op 876.00 ns/op 0.79
isKnown normal case - 2 super set checks 901.00 ns/op 912.00 ns/op 0.99
isKnown worse case - 16 super set checks 652.00 ns/op 630.00 ns/op 1.03
InMemoryCheckpointStateCache - add get delete 6.1700 us/op 4.8440 us/op 1.27
validate api signedAggregateAndProof - struct 2.5964 ms/op 2.4744 ms/op 1.05
validate gossip signedAggregateAndProof - struct 2.5534 ms/op 2.4703 ms/op 1.03
validate gossip attestation - vc 640000 1.2239 ms/op 1.2179 ms/op 1.00
batch validate gossip attestation - vc 640000 - chunk 32 145.83 us/op 154.57 us/op 0.94
batch validate gossip attestation - vc 640000 - chunk 64 133.33 us/op 134.06 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 128 119.46 us/op 129.71 us/op 0.92
batch validate gossip attestation - vc 640000 - chunk 256 117.44 us/op 126.20 us/op 0.93
pickEth1Vote - no votes 966.14 us/op 930.10 us/op 1.04
pickEth1Vote - max votes 9.6171 ms/op 6.7806 ms/op 1.42
pickEth1Vote - Eth1Data hashTreeRoot value x2048 17.465 ms/op 13.577 ms/op 1.29
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.083 ms/op 18.586 ms/op 1.03
pickEth1Vote - Eth1Data fastSerialize value x2048 463.54 us/op 532.07 us/op 0.87
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.0862 ms/op 3.7577 ms/op 1.62
bytes32 toHexString 668.00 ns/op 644.00 ns/op 1.04
bytes32 Buffer.toString(hex) 477.00 ns/op 519.00 ns/op 0.92
bytes32 Buffer.toString(hex) from Uint8Array 600.00 ns/op 694.00 ns/op 0.86
bytes32 Buffer.toString(hex) + 0x 528.00 ns/op 470.00 ns/op 1.12
Object access 1 prop 0.37200 ns/op 0.36600 ns/op 1.02
Map access 1 prop 0.37100 ns/op 0.33100 ns/op 1.12
Object get x1000 5.2590 ns/op 5.2420 ns/op 1.00
Map get x1000 5.9220 ns/op 6.2760 ns/op 0.94
Object set x1000 26.256 ns/op 29.533 ns/op 0.89
Map set x1000 20.520 ns/op 21.018 ns/op 0.98
Return object 10000 times 0.31290 ns/op 0.31320 ns/op 1.00
Throw Error 10000 times 2.8357 us/op 2.9131 us/op 0.97
fastMsgIdFn sha256 / 200 bytes 2.1290 us/op 2.1860 us/op 0.97
fastMsgIdFn h32 xxhash / 200 bytes 492.00 ns/op 535.00 ns/op 0.92
fastMsgIdFn h64 xxhash / 200 bytes 520.00 ns/op 485.00 ns/op 1.07
fastMsgIdFn sha256 / 1000 bytes 6.2330 us/op 6.5600 us/op 0.95
fastMsgIdFn h32 xxhash / 1000 bytes 626.00 ns/op 679.00 ns/op 0.92
fastMsgIdFn h64 xxhash / 1000 bytes 591.00 ns/op 571.00 ns/op 1.04
fastMsgIdFn sha256 / 10000 bytes 51.580 us/op 54.164 us/op 0.95
fastMsgIdFn h32 xxhash / 10000 bytes 2.0540 us/op 2.0810 us/op 0.99
fastMsgIdFn h64 xxhash / 10000 bytes 1.4440 us/op 1.4250 us/op 1.01
send data - 1000 256B messages 12.970 ms/op 12.325 ms/op 1.05
send data - 1000 512B messages 17.875 ms/op 15.358 ms/op 1.16
send data - 1000 1024B messages 23.716 ms/op 27.626 ms/op 0.86
send data - 1000 1200B messages 27.804 ms/op 24.882 ms/op 1.12
send data - 1000 2048B messages 34.684 ms/op 33.777 ms/op 1.03
send data - 1000 4096B messages 29.824 ms/op 32.618 ms/op 0.91
send data - 1000 16384B messages 73.599 ms/op 69.315 ms/op 1.06
send data - 1000 65536B messages 275.86 ms/op 260.83 ms/op 1.06
enrSubnets - fastDeserialize 64 bits 1.2400 us/op 1.3840 us/op 0.90
enrSubnets - ssz BitVector 64 bits 610.00 ns/op 647.00 ns/op 0.94
enrSubnets - fastDeserialize 4 bits 392.00 ns/op 417.00 ns/op 0.94
enrSubnets - ssz BitVector 4 bits 594.00 ns/op 639.00 ns/op 0.93
prioritizePeers score -10:0 att 32-0.1 sync 2-0 130.25 us/op 168.13 us/op 0.77
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 154.85 us/op 158.48 us/op 0.98
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 378.14 us/op 290.56 us/op 1.30
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 487.11 us/op 500.41 us/op 0.97
prioritizePeers score 0:0 att 64-1 sync 4-1 859.30 us/op 809.68 us/op 1.06
array of 16000 items push then shift 1.2611 us/op 1.4203 us/op 0.89
LinkedList of 16000 items push then shift 7.6700 ns/op 7.1440 ns/op 1.07
array of 16000 items push then pop 119.13 ns/op 101.83 ns/op 1.17
LinkedList of 16000 items push then pop 7.2940 ns/op 6.7680 ns/op 1.08
array of 24000 items push then shift 1.9672 us/op 1.9511 us/op 1.01
LinkedList of 24000 items push then shift 10.311 ns/op 8.2200 ns/op 1.25
array of 24000 items push then pop 174.38 ns/op 166.10 ns/op 1.05
LinkedList of 24000 items push then pop 8.6510 ns/op 7.6740 ns/op 1.13
intersect bitArray bitLen 8 5.6820 ns/op 6.1300 ns/op 0.93
intersect array and set length 8 39.225 ns/op 39.750 ns/op 0.99
intersect bitArray bitLen 128 27.168 ns/op 29.145 ns/op 0.93
intersect array and set length 128 597.97 ns/op 757.71 ns/op 0.79
bitArray.getTrueBitIndexes() bitLen 128 2.1430 us/op 2.5600 us/op 0.84
bitArray.getTrueBitIndexes() bitLen 248 3.9540 us/op 4.5660 us/op 0.87
bitArray.getTrueBitIndexes() bitLen 512 7.5960 us/op 9.4860 us/op 0.80
Buffer.concat 32 items 1.0470 us/op 1.1520 us/op 0.91
Uint8Array.set 32 items 2.0220 us/op 1.7550 us/op 1.15
Buffer.copy 1.9230 us/op 1.9730 us/op 0.97
Uint8Array.set - with subarray 2.3970 us/op 3.1440 us/op 0.76
Uint8Array.set - without subarray 1.9670 us/op 1.7040 us/op 1.15
Set add up to 64 items then delete first 1.7929 us/op 2.7771 us/op 0.65
OrderedSet add up to 64 items then delete first 3.5153 us/op 3.9320 us/op 0.89
Set add up to 64 items then delete last 2.6028 us/op 2.9630 us/op 0.88
OrderedSet add up to 64 items then delete last 4.1265 us/op 3.6200 us/op 1.14
Set add up to 64 items then delete middle 2.1697 us/op 2.2682 us/op 0.96
OrderedSet add up to 64 items then delete middle 4.5579 us/op 4.6821 us/op 0.97
Set add up to 128 items then delete first 3.8012 us/op 4.2615 us/op 0.89
OrderedSet add up to 128 items then delete first 5.8772 us/op 6.7770 us/op 0.87
Set add up to 128 items then delete last 3.8227 us/op 4.0432 us/op 0.95
OrderedSet add up to 128 items then delete last 7.2650 us/op 6.2185 us/op 1.17
Set add up to 128 items then delete middle 4.1985 us/op 5.6844 us/op 0.74
OrderedSet add up to 128 items then delete middle 13.870 us/op 14.931 us/op 0.93
Set add up to 256 items then delete first 9.0318 us/op 12.667 us/op 0.71
OrderedSet add up to 256 items then delete first 12.140 us/op 18.670 us/op 0.65
Set add up to 256 items then delete last 7.9935 us/op 10.446 us/op 0.77
OrderedSet add up to 256 items then delete last 12.656 us/op 17.612 us/op 0.72
Set add up to 256 items then delete middle 7.9407 us/op 11.483 us/op 0.69
OrderedSet add up to 256 items then delete middle 38.267 us/op 41.843 us/op 0.91
transfer serialized Status (84 B) 1.5650 us/op 1.6130 us/op 0.97
copy serialized Status (84 B) 1.3310 us/op 1.4630 us/op 0.91
transfer serialized SignedVoluntaryExit (112 B) 1.5950 us/op 1.7530 us/op 0.91
copy serialized SignedVoluntaryExit (112 B) 1.3700 us/op 1.6760 us/op 0.82
transfer serialized ProposerSlashing (416 B) 2.0040 us/op 2.0660 us/op 0.97
copy serialized ProposerSlashing (416 B) 2.0570 us/op 2.0400 us/op 1.01
transfer serialized Attestation (485 B) 2.0750 us/op 2.1590 us/op 0.96
copy serialized Attestation (485 B) 1.9190 us/op 2.5350 us/op 0.76
transfer serialized AttesterSlashing (33232 B) 1.7270 us/op 2.6990 us/op 0.64
copy serialized AttesterSlashing (33232 B) 6.7130 us/op 4.5480 us/op 1.48
transfer serialized Small SignedBeaconBlock (128000 B) 2.3310 us/op 3.6800 us/op 0.63
copy serialized Small SignedBeaconBlock (128000 B) 20.562 us/op 15.911 us/op 1.29
transfer serialized Avg SignedBeaconBlock (200000 B) 2.6700 us/op 3.9970 us/op 0.67
copy serialized Avg SignedBeaconBlock (200000 B) 27.766 us/op 21.294 us/op 1.30
transfer serialized BlobsSidecar (524380 B) 3.5620 us/op 4.2740 us/op 0.83
copy serialized BlobsSidecar (524380 B) 80.890 us/op 112.93 us/op 0.72
transfer serialized Big SignedBeaconBlock (1000000 B) 3.8920 us/op 4.1190 us/op 0.94
copy serialized Big SignedBeaconBlock (1000000 B) 152.66 us/op 175.88 us/op 0.87
pass gossip attestations to forkchoice per slot 2.7295 ms/op 2.8373 ms/op 0.96
forkChoice updateHead vc 100000 bc 64 eq 0 414.36 us/op 472.43 us/op 0.88
forkChoice updateHead vc 600000 bc 64 eq 0 2.5271 ms/op 2.5121 ms/op 1.01
forkChoice updateHead vc 1000000 bc 64 eq 0 4.3049 ms/op 4.2503 ms/op 1.01
forkChoice updateHead vc 600000 bc 320 eq 0 2.8577 ms/op 2.5178 ms/op 1.13
forkChoice updateHead vc 600000 bc 1200 eq 0 2.8533 ms/op 2.6524 ms/op 1.08
forkChoice updateHead vc 600000 bc 7200 eq 0 3.3540 ms/op 3.4573 ms/op 0.97
forkChoice updateHead vc 600000 bc 64 eq 1000 10.272 ms/op 9.8541 ms/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 10000 9.7890 ms/op 9.7313 ms/op 1.01
forkChoice updateHead vc 600000 bc 64 eq 300000 16.815 ms/op 11.830 ms/op 1.42
computeDeltas 500000 validators 300 proto nodes 3.1160 ms/op 3.1451 ms/op 0.99
computeDeltas 500000 validators 1200 proto nodes 3.1583 ms/op 3.3009 ms/op 0.96
computeDeltas 500000 validators 7200 proto nodes 3.2830 ms/op 3.2418 ms/op 1.01
computeDeltas 750000 validators 300 proto nodes 4.8585 ms/op 4.8716 ms/op 1.00
computeDeltas 750000 validators 1200 proto nodes 4.5282 ms/op 4.6944 ms/op 0.96
computeDeltas 750000 validators 7200 proto nodes 4.6650 ms/op 4.6917 ms/op 0.99
computeDeltas 1400000 validators 300 proto nodes 8.6684 ms/op 8.4972 ms/op 1.02
computeDeltas 1400000 validators 1200 proto nodes 8.9272 ms/op 8.7250 ms/op 1.02
computeDeltas 1400000 validators 7200 proto nodes 9.0095 ms/op 9.2791 ms/op 0.97
computeDeltas 2100000 validators 300 proto nodes 12.992 ms/op 13.145 ms/op 0.99
computeDeltas 2100000 validators 1200 proto nodes 13.033 ms/op 13.772 ms/op 0.95
computeDeltas 2100000 validators 7200 proto nodes 13.231 ms/op 13.423 ms/op 0.99
altair processAttestation - 250000 vs - 7PWei normalcase 1.4902 ms/op 2.6939 ms/op 0.55
altair processAttestation - 250000 vs - 7PWei worstcase 3.0329 ms/op 2.7902 ms/op 1.09
altair processAttestation - setStatus - 1/6 committees join 101.94 us/op 88.032 us/op 1.16
altair processAttestation - setStatus - 1/3 committees join 187.10 us/op 176.53 us/op 1.06
altair processAttestation - setStatus - 1/2 committees join 274.85 us/op 220.67 us/op 1.25
altair processAttestation - setStatus - 2/3 committees join 352.09 us/op 358.85 us/op 0.98
altair processAttestation - setStatus - 4/5 committees join 483.46 us/op 494.72 us/op 0.98
altair processAttestation - setStatus - 100% committees join 602.71 us/op 570.33 us/op 1.06
altair processBlock - 250000 vs - 7PWei normalcase 4.4703 ms/op 4.5483 ms/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase hashState 26.201 ms/op 26.950 ms/op 0.97
altair processBlock - 250000 vs - 7PWei worstcase 40.399 ms/op 40.106 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase hashState 90.496 ms/op 79.920 ms/op 1.13
phase0 processBlock - 250000 vs - 7PWei normalcase 2.3496 ms/op 1.6843 ms/op 1.39
phase0 processBlock - 250000 vs - 7PWei worstcase 27.678 ms/op 26.917 ms/op 1.03
altair processEth1Data - 250000 vs - 7PWei normalcase 393.20 us/op 258.34 us/op 1.52
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.8040 us/op 5.5870 us/op 1.04
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 21.898 us/op 22.251 us/op 0.98
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 7.7660 us/op 8.1180 us/op 0.96
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 5.8330 us/op 5.1260 us/op 1.14
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 86.936 us/op 80.251 us/op 1.08
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 784.90 us/op 576.95 us/op 1.36
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 625.57 us/op 703.21 us/op 0.89
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0621 ms/op 1.0966 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 1.9918 ms/op 2.1009 ms/op 0.95
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.1960 ms/op 1.2499 ms/op 0.96
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.0949 ms/op 3.1317 ms/op 0.99
Tree 40 250000 create 199.96 ms/op 176.04 ms/op 1.14
Tree 40 250000 get(125000) 113.15 ns/op 116.79 ns/op 0.97
Tree 40 250000 set(125000) 597.53 ns/op 525.35 ns/op 1.14
Tree 40 250000 toArray() 15.011 ms/op 11.035 ms/op 1.36
Tree 40 250000 iterate all - toArray() + loop 10.583 ms/op 9.8233 ms/op 1.08
Tree 40 250000 iterate all - get(i) 44.477 ms/op 41.648 ms/op 1.07
MutableVector 250000 create 10.881 ms/op 8.8781 ms/op 1.23
MutableVector 250000 get(125000) 5.7450 ns/op 5.8840 ns/op 0.98
MutableVector 250000 set(125000) 187.91 ns/op 182.90 ns/op 1.03
MutableVector 250000 toArray() 3.7887 ms/op 2.7389 ms/op 1.38
MutableVector 250000 iterate all - toArray() + loop 3.5573 ms/op 2.8746 ms/op 1.24
MutableVector 250000 iterate all - get(i) 1.3876 ms/op 1.5148 ms/op 0.92
Array 250000 create 3.1705 ms/op 2.4981 ms/op 1.27
Array 250000 clone - spread 1.3699 ms/op 1.3614 ms/op 1.01
Array 250000 get(125000) 0.56300 ns/op 0.59900 ns/op 0.94
Array 250000 set(125000) 0.58000 ns/op 0.61000 ns/op 0.95
Array 250000 iterate all - loop 76.162 us/op 78.498 us/op 0.97
effectiveBalanceIncrements clone Uint8Array 300000 27.819 us/op 15.336 us/op 1.81
effectiveBalanceIncrements clone MutableVector 300000 298.00 ns/op 322.00 ns/op 0.93
effectiveBalanceIncrements rw all Uint8Array 300000 160.61 us/op 168.74 us/op 0.95
effectiveBalanceIncrements rw all MutableVector 300000 58.136 ms/op 55.204 ms/op 1.05
phase0 afterProcessEpoch - 250000 vs - 7PWei 72.907 ms/op 78.428 ms/op 0.93
phase0 beforeProcessEpoch - 250000 vs - 7PWei 47.600 ms/op 36.085 ms/op 1.32
altair processEpoch - mainnet_e81889 326.91 ms/op 346.19 ms/op 0.94
mainnet_e81889 - altair beforeProcessEpoch 60.616 ms/op 57.882 ms/op 1.05
mainnet_e81889 - altair processJustificationAndFinalization 15.392 us/op 13.729 us/op 1.12
mainnet_e81889 - altair processInactivityUpdates 4.7544 ms/op 6.1473 ms/op 0.77
mainnet_e81889 - altair processRewardsAndPenalties 47.817 ms/op 56.023 ms/op 0.85
mainnet_e81889 - altair processRegistryUpdates 2.7700 us/op 2.2480 us/op 1.23
mainnet_e81889 - altair processSlashings 775.00 ns/op 887.00 ns/op 0.87
mainnet_e81889 - altair processEth1DataReset 751.00 ns/op 914.00 ns/op 0.82
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.0632 ms/op 1.5192 ms/op 1.36
mainnet_e81889 - altair processSlashingsReset 2.6900 us/op 3.3320 us/op 0.81
mainnet_e81889 - altair processRandaoMixesReset 3.5690 us/op 8.6070 us/op 0.41
mainnet_e81889 - altair processHistoricalRootsUpdate 900.00 ns/op 1.1810 us/op 0.76
mainnet_e81889 - altair processParticipationFlagUpdates 3.0500 us/op 4.4140 us/op 0.69
mainnet_e81889 - altair processSyncCommitteeUpdates 951.00 ns/op 1.0870 us/op 0.87
mainnet_e81889 - altair afterProcessEpoch 82.632 ms/op 82.225 ms/op 1.00
capella processEpoch - mainnet_e217614 1.2488 s/op 1.2014 s/op 1.04
mainnet_e217614 - capella beforeProcessEpoch 248.27 ms/op 267.27 ms/op 0.93
mainnet_e217614 - capella processJustificationAndFinalization 16.316 us/op 12.924 us/op 1.26
mainnet_e217614 - capella processInactivityUpdates 18.443 ms/op 16.411 ms/op 1.12
mainnet_e217614 - capella processRewardsAndPenalties 247.65 ms/op 245.10 ms/op 1.01
mainnet_e217614 - capella processRegistryUpdates 14.351 us/op 12.433 us/op 1.15
mainnet_e217614 - capella processSlashings 798.00 ns/op 756.00 ns/op 1.06
mainnet_e217614 - capella processEth1DataReset 894.00 ns/op 769.00 ns/op 1.16
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.3211 ms/op 6.1670 ms/op 0.70
mainnet_e217614 - capella processSlashingsReset 8.1940 us/op 3.3630 us/op 2.44
mainnet_e217614 - capella processRandaoMixesReset 7.9030 us/op 5.0950 us/op 1.55
mainnet_e217614 - capella processHistoricalRootsUpdate 1.2450 us/op 909.00 ns/op 1.37
mainnet_e217614 - capella processParticipationFlagUpdates 2.6870 us/op 5.0620 us/op 0.53
mainnet_e217614 - capella afterProcessEpoch 216.65 ms/op 201.24 ms/op 1.08
phase0 processEpoch - mainnet_e58758 347.84 ms/op 366.08 ms/op 0.95
mainnet_e58758 - phase0 beforeProcessEpoch 99.582 ms/op 108.44 ms/op 0.92
mainnet_e58758 - phase0 processJustificationAndFinalization 13.753 us/op 11.246 us/op 1.22
mainnet_e58758 - phase0 processRewardsAndPenalties 31.336 ms/op 28.083 ms/op 1.12
mainnet_e58758 - phase0 processRegistryUpdates 7.7700 us/op 8.0650 us/op 0.96
mainnet_e58758 - phase0 processSlashings 880.00 ns/op 806.00 ns/op 1.09
mainnet_e58758 - phase0 processEth1DataReset 881.00 ns/op 790.00 ns/op 1.12
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1191 ms/op 1.1172 ms/op 1.00
mainnet_e58758 - phase0 processSlashingsReset 2.4370 us/op 3.7740 us/op 0.65
mainnet_e58758 - phase0 processRandaoMixesReset 3.7040 us/op 4.4310 us/op 0.84
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.2150 us/op 438.00 ns/op 2.77
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.3740 us/op 3.2880 us/op 1.63
mainnet_e58758 - phase0 afterProcessEpoch 69.226 ms/op 66.071 ms/op 1.05
phase0 processEffectiveBalanceUpdates - 250000 normalcase 797.54 us/op 764.65 us/op 1.04
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.3520 ms/op 1.5462 ms/op 0.87
altair processInactivityUpdates - 250000 normalcase 20.038 ms/op 17.476 ms/op 1.15
altair processInactivityUpdates - 250000 worstcase 19.397 ms/op 17.164 ms/op 1.13
phase0 processRegistryUpdates - 250000 normalcase 7.9990 us/op 3.1840 us/op 2.51
phase0 processRegistryUpdates - 250000 badcase_full_deposits 296.91 us/op 315.55 us/op 0.94
phase0 processRegistryUpdates - 250000 worstcase 0.5 118.92 ms/op 116.17 ms/op 1.02
altair processRewardsAndPenalties - 250000 normalcase 44.373 ms/op 43.047 ms/op 1.03
altair processRewardsAndPenalties - 250000 worstcase 36.372 ms/op 39.862 ms/op 0.91
phase0 getAttestationDeltas - 250000 normalcase 5.5580 ms/op 6.5683 ms/op 0.85
phase0 getAttestationDeltas - 250000 worstcase 5.8152 ms/op 8.0890 ms/op 0.72
phase0 processSlashings - 250000 worstcase 95.629 us/op 97.946 us/op 0.98
altair processSyncCommitteeUpdates - 250000 101.18 ms/op 107.00 ms/op 0.95
BeaconState.hashTreeRoot - No change 463.00 ns/op 647.00 ns/op 0.72
BeaconState.hashTreeRoot - 1 full validator 72.518 us/op 124.65 us/op 0.58
BeaconState.hashTreeRoot - 32 full validator 788.61 us/op 921.68 us/op 0.86
BeaconState.hashTreeRoot - 512 full validator 11.108 ms/op 8.5496 ms/op 1.30
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 117.39 us/op 135.78 us/op 0.86
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.7823 ms/op 1.9072 ms/op 0.93
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 27.865 ms/op 21.916 ms/op 1.27
BeaconState.hashTreeRoot - 1 balances 68.055 us/op 90.650 us/op 0.75
BeaconState.hashTreeRoot - 32 balances 757.75 us/op 894.05 us/op 0.85
BeaconState.hashTreeRoot - 512 balances 8.1983 ms/op 5.9461 ms/op 1.38
BeaconState.hashTreeRoot - 250000 balances 186.90 ms/op 131.30 ms/op 1.42
aggregationBits - 2048 els - zipIndexesInBitList 22.051 us/op 23.175 us/op 0.95
byteArrayEquals 32 48.457 ns/op 49.862 ns/op 0.97
Buffer.compare 32 15.590 ns/op 15.695 ns/op 0.99
byteArrayEquals 1024 1.2760 us/op 1.3248 us/op 0.96
Buffer.compare 1024 23.057 ns/op 23.735 ns/op 0.97
byteArrayEquals 16384 20.114 us/op 19.492 us/op 1.03
Buffer.compare 16384 179.31 ns/op 171.73 ns/op 1.04
byteArrayEquals 123687377 152.62 ms/op 157.68 ms/op 0.97
Buffer.compare 123687377 4.7024 ms/op 7.2530 ms/op 0.65
byteArrayEquals 32 - diff last byte 47.465 ns/op 45.812 ns/op 1.04
Buffer.compare 32 - diff last byte 16.269 ns/op 16.402 ns/op 0.99
byteArrayEquals 1024 - diff last byte 1.2599 us/op 1.3388 us/op 0.94
Buffer.compare 1024 - diff last byte 24.427 ns/op 24.544 ns/op 1.00
byteArrayEquals 16384 - diff last byte 20.109 us/op 20.484 us/op 0.98
Buffer.compare 16384 - diff last byte 175.00 ns/op 180.22 ns/op 0.97
byteArrayEquals 123687377 - diff last byte 155.50 ms/op 159.74 ms/op 0.97
Buffer.compare 123687377 - diff last byte 4.7768 ms/op 6.6422 ms/op 0.72
byteArrayEquals 32 - random bytes 4.9630 ns/op 5.1110 ns/op 0.97
Buffer.compare 32 - random bytes 15.830 ns/op 15.704 ns/op 1.01
byteArrayEquals 1024 - random bytes 4.9660 ns/op 4.9950 ns/op 0.99
Buffer.compare 1024 - random bytes 15.910 ns/op 15.344 ns/op 1.04
byteArrayEquals 16384 - random bytes 4.9990 ns/op 4.9430 ns/op 1.01
Buffer.compare 16384 - random bytes 15.862 ns/op 15.615 ns/op 1.02
byteArrayEquals 123687377 - random bytes 8.0000 ns/op 8.0500 ns/op 0.99
Buffer.compare 123687377 - random bytes 19.060 ns/op 18.530 ns/op 1.03
regular array get 100000 times 31.197 us/op 31.298 us/op 1.00
wrappedArray get 100000 times 31.146 us/op 31.324 us/op 0.99
arrayWithProxy get 100000 times 9.7112 ms/op 10.080 ms/op 0.96
ssz.Root.equals 44.153 ns/op 44.365 ns/op 1.00
byteArrayEquals 43.177 ns/op 43.921 ns/op 0.98
Buffer.compare 9.1970 ns/op 9.2880 ns/op 0.99
shuffle list - 16384 els 5.7497 ms/op 5.7417 ms/op 1.00
shuffle list - 250000 els 83.480 ms/op 84.113 ms/op 0.99
processSlot - 1 slots 9.6890 us/op 13.863 us/op 0.70
processSlot - 32 slots 1.8621 ms/op 3.5220 ms/op 0.53
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 39.255 ms/op 40.050 ms/op 0.98
getCommitteeAssignments - req 1 vs - 250000 vc 1.7610 ms/op 1.9210 ms/op 0.92
getCommitteeAssignments - req 100 vs - 250000 vc 3.4273 ms/op 3.6347 ms/op 0.94
getCommitteeAssignments - req 1000 vs - 250000 vc 3.8374 ms/op 3.9582 ms/op 0.97
findModifiedValidators - 10000 modified validators 242.44 ms/op 266.54 ms/op 0.91
findModifiedValidators - 1000 modified validators 184.57 ms/op 184.54 ms/op 1.00
findModifiedValidators - 100 modified validators 146.19 ms/op 167.44 ms/op 0.87
findModifiedValidators - 10 modified validators 142.93 ms/op 150.10 ms/op 0.95
findModifiedValidators - 1 modified validators 180.07 ms/op 188.15 ms/op 0.96
findModifiedValidators - no difference 135.66 ms/op 182.28 ms/op 0.74
compare ViewDUs 3.2527 s/op 2.9111 s/op 1.12
compare each validator Uint8Array 1.4118 s/op 1.7674 s/op 0.80
compare ViewDU to Uint8Array 785.34 ms/op 752.56 ms/op 1.04
migrate state 1000000 validators, 24 modified, 0 new 565.17 ms/op 522.52 ms/op 1.08
migrate state 1000000 validators, 1700 modified, 1000 new 761.83 ms/op 781.72 ms/op 0.97
migrate state 1000000 validators, 3400 modified, 2000 new 1.1310 s/op 1.0072 s/op 1.12
migrate state 1500000 validators, 24 modified, 0 new 582.13 ms/op 589.97 ms/op 0.99
migrate state 1500000 validators, 1700 modified, 1000 new 774.72 ms/op 816.93 ms/op 0.95
migrate state 1500000 validators, 3400 modified, 2000 new 893.68 ms/op 971.22 ms/op 0.92
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.1100 ns/op 6.6000 ns/op 0.93
state getBlockRootAtSlot - 250000 vs - 7PWei 872.53 ns/op 1.0604 us/op 0.82
computeProposers - vc 250000 5.5389 ms/op 6.5606 ms/op 0.84
computeEpochShuffling - vc 250000 81.252 ms/op 87.559 ms/op 0.93
getNextSyncCommittee - vc 250000 93.144 ms/op 119.60 ms/op 0.78
computeSigningRoot for AttestationData 19.558 us/op 19.670 us/op 0.99
hash AttestationData serialized data then Buffer.toString(base64) 1.2264 us/op 1.2445 us/op 0.99
toHexString serialized data 777.08 ns/op 787.36 ns/op 0.99
Buffer.toString(base64) 143.32 ns/op 142.20 ns/op 1.01

Please sign in to comment.