Skip to content

Commit

Permalink
refactor: move validator status type and util to @lodestar/types (#7140)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Oct 9, 2024
1 parent 955f456 commit 068fbae
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 153 deletions.
14 changes: 2 additions & 12 deletions packages/api/src/beacon/routes/beacon/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {ContainerType, ValueOf} from "@chainsafe/ssz";
import {ChainForkConfig} from "@lodestar/config";
import {MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params";
import {phase0, CommitteeIndex, Slot, Epoch, ssz, RootHex, StringType} from "@lodestar/types";
import {phase0, CommitteeIndex, Slot, Epoch, ssz, RootHex, StringType, ValidatorStatus} from "@lodestar/types";
import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js";
import {ArrayOf, JsonOnlyReq} from "../../../utils/codecs.js";
import {ExecutionOptimisticAndFinalizedCodec, ExecutionOptimisticAndFinalizedMeta} from "../../../utils/metadata.js";
Expand All @@ -24,17 +24,7 @@ export type StateArgs = {

export type ValidatorId = string | number;

export type ValidatorStatus =
| "active"
| "pending_initialized"
| "pending_queued"
| "active_ongoing"
| "active_exiting"
| "active_slashed"
| "exited_unslashed"
| "exited_slashed"
| "withdrawal_possible"
| "withdrawal_done";
export type {ValidatorStatus};

export const RandaoResponseType = new ContainerType({
randao: ssz.Root,
Expand Down
9 changes: 2 additions & 7 deletions packages/beacon-node/src/api/impl/beacon/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ import {
getRandaoMix,
} from "@lodestar/state-transition";
import {EPOCHS_PER_HISTORICAL_VECTOR} from "@lodestar/params";
import {getValidatorStatus} from "@lodestar/types";
import {fromHex} from "@lodestar/utils";
import {ApiError} from "../../errors.js";
import {ApiModules} from "../../types.js";
import {
filterStateValidatorsByStatus,
getStateValidatorIndex,
getValidatorStatus,
getStateResponse,
toValidatorResponse,
} from "./utils.js";
import {filterStateValidatorsByStatus, getStateValidatorIndex, getStateResponse, toValidatorResponse} from "./utils.js";

export function getBeaconStateApi({
chain,
Expand Down
36 changes: 2 additions & 34 deletions packages/beacon-node/src/api/impl/beacon/state/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
import {routes} from "@lodestar/api";
import {FAR_FUTURE_EPOCH, GENESIS_SLOT} from "@lodestar/params";
import {GENESIS_SLOT} from "@lodestar/params";
import {BeaconStateAllForks} from "@lodestar/state-transition";
import {BLSPubkey, Epoch, phase0, RootHex, Slot, ValidatorIndex} from "@lodestar/types";
import {BLSPubkey, Epoch, getValidatorStatus, phase0, RootHex, Slot, ValidatorIndex} from "@lodestar/types";
import {fromHex} from "@lodestar/utils";
import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
import {IBeaconChain} from "../../../../chain/index.js";
Expand Down Expand Up @@ -83,38 +83,6 @@ export async function getStateResponseWithRegen(
return res;
}

/**
* Get the status of the validator
* based on conditions outlined in https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ
*/
export function getValidatorStatus(validator: phase0.Validator, currentEpoch: Epoch): routes.beacon.ValidatorStatus {
// pending
if (validator.activationEpoch > currentEpoch) {
if (validator.activationEligibilityEpoch === FAR_FUTURE_EPOCH) {
return "pending_initialized";
} else if (validator.activationEligibilityEpoch < FAR_FUTURE_EPOCH) {
return "pending_queued";
}
}
// active
if (validator.activationEpoch <= currentEpoch && currentEpoch < validator.exitEpoch) {
if (validator.exitEpoch === FAR_FUTURE_EPOCH) {
return "active_ongoing";
} else if (validator.exitEpoch < FAR_FUTURE_EPOCH) {
return validator.slashed ? "active_slashed" : "active_exiting";
}
}
// exited
if (validator.exitEpoch <= currentEpoch && currentEpoch < validator.withdrawableEpoch) {
return validator.slashed ? "exited_slashed" : "exited_unslashed";
}
// withdrawal
if (validator.withdrawableEpoch <= currentEpoch) {
return validator.effectiveBalance !== 0 ? "withdrawal_possible" : "withdrawal_done";
}
throw new Error("ValidatorStatus unknown");
}

export function toValidatorResponse(
index: ValidatorIndex,
validator: phase0.Validator,
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
BeaconBlock,
BlockContents,
BlindedBeaconBlock,
getValidatorStatus,
} from "@lodestar/types";
import {ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice";
import {fromHex, toHex, resolveOrRacePromises, prettyWeiToEth, toRootHex} from "@lodestar/utils";
Expand All @@ -61,7 +62,6 @@ import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/va
import {CommitteeSubscription} from "../../../network/subnets/index.js";
import {ApiModules} from "../types.js";
import {RegenCaller} from "../../../chain/regen/index.js";
import {getValidatorStatus} from "../beacon/state/utils.js";
import {validateGossipFnRetryUnknownRoot} from "../../../network/processor/gossipHandlers.js";
import {SCHEDULER_LOOKAHEAD_FACTOR} from "../../../chain/prepareNextSlot.js";
import {ChainEvent, CheckpointHex, CommonBlockBody} from "../../../chain/index.js";
Expand Down
100 changes: 1 addition & 99 deletions packages/beacon-node/test/unit/api/impl/beacon/state/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,107 +1,9 @@
import {describe, it, expect} from "vitest";
import {toHexString} from "@chainsafe/ssz";
import {phase0} from "@lodestar/types";
import {getValidatorStatus, getStateValidatorIndex} from "../../../../../../src/api/impl/beacon/state/utils.js";
import {getStateValidatorIndex} from "../../../../../../src/api/impl/beacon/state/utils.js";
import {generateCachedAltairState} from "../../../../../utils/state.js";

describe("beacon state api utils", function () {
describe("getValidatorStatus", function () {
it("should return PENDING_INITIALIZED", function () {
const validator = {
activationEpoch: 1,
activationEligibilityEpoch: Infinity,
} as phase0.Validator;
const currentEpoch = 0;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("pending_initialized");
});
it("should return PENDING_QUEUED", function () {
const validator = {
activationEpoch: 1,
activationEligibilityEpoch: 101010101101010,
} as phase0.Validator;
const currentEpoch = 0;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("pending_queued");
});
it("should return ACTIVE_ONGOING", function () {
const validator = {
activationEpoch: 1,
exitEpoch: Infinity,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("active_ongoing");
});
it("should return ACTIVE_SLASHED", function () {
const validator = {
activationEpoch: 1,
exitEpoch: 101010101101010,
slashed: true,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("active_slashed");
});
it("should return ACTIVE_EXITING", function () {
const validator = {
activationEpoch: 1,
exitEpoch: 101010101101010,
slashed: false,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("active_exiting");
});
it("should return EXITED_SLASHED", function () {
const validator = {
exitEpoch: 1,
withdrawableEpoch: 3,
slashed: true,
} as phase0.Validator;
const currentEpoch = 2;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("exited_slashed");
});
it("should return EXITED_UNSLASHED", function () {
const validator = {
exitEpoch: 1,
withdrawableEpoch: 3,
slashed: false,
} as phase0.Validator;
const currentEpoch = 2;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("exited_unslashed");
});
it("should return WITHDRAWAL_POSSIBLE", function () {
const validator = {
withdrawableEpoch: 1,
effectiveBalance: 32,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("withdrawal_possible");
});
it("should return WITHDRAWAL_DONE", function () {
const validator = {
withdrawableEpoch: 1,
effectiveBalance: 0,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("withdrawal_done");
});
it("should error", function () {
const validator = {} as phase0.Validator;
const currentEpoch = 0;
try {
getValidatorStatus(validator, currentEpoch);
} catch (error) {
expect(error).toHaveProperty("message", "ValidatorStatus unknown");
}
});
});

describe("getStateValidatorIndex", () => {
const state = generateCachedAltairState();
const pubkey2index = state.epochCtx.pubkey2index;
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from "./utils/typeguards.js";
export {StringType, stringType} from "./utils/stringType.js";
// Container utils
export * from "./utils/container.js";
export * from "./utils/validatorStatus.js";
46 changes: 46 additions & 0 deletions packages/types/src/utils/validatorStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {FAR_FUTURE_EPOCH} from "@lodestar/params";
import {Epoch, phase0} from "../types.js";

export type ValidatorStatus =
| "active"
| "pending_initialized"
| "pending_queued"
| "active_ongoing"
| "active_exiting"
| "active_slashed"
| "exited_unslashed"
| "exited_slashed"
| "withdrawal_possible"
| "withdrawal_done";

/**
* Get the status of the validator
* based on conditions outlined in https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ
*/
export function getValidatorStatus(validator: phase0.Validator, currentEpoch: Epoch): ValidatorStatus {
// pending
if (validator.activationEpoch > currentEpoch) {
if (validator.activationEligibilityEpoch === FAR_FUTURE_EPOCH) {
return "pending_initialized";
} else if (validator.activationEligibilityEpoch < FAR_FUTURE_EPOCH) {
return "pending_queued";
}
}
// active
if (validator.activationEpoch <= currentEpoch && currentEpoch < validator.exitEpoch) {
if (validator.exitEpoch === FAR_FUTURE_EPOCH) {
return "active_ongoing";
} else if (validator.exitEpoch < FAR_FUTURE_EPOCH) {
return validator.slashed ? "active_slashed" : "active_exiting";
}
}
// exited
if (validator.exitEpoch <= currentEpoch && currentEpoch < validator.withdrawableEpoch) {
return validator.slashed ? "exited_slashed" : "exited_unslashed";
}
// withdrawal
if (validator.withdrawableEpoch <= currentEpoch) {
return validator.effectiveBalance !== 0 ? "withdrawal_possible" : "withdrawal_done";
}
throw new Error("ValidatorStatus unknown");
}
100 changes: 100 additions & 0 deletions packages/types/test/unit/validatorStatus.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import {describe, it, expect} from "vitest";
import {getValidatorStatus} from "../../src/utils/validatorStatus.js";
import {phase0} from "../../src/types.js";

describe("getValidatorStatus", function () {
it("should return PENDING_INITIALIZED", function () {
const validator = {
activationEpoch: 1,
activationEligibilityEpoch: Infinity,
} as phase0.Validator;
const currentEpoch = 0;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("pending_initialized");
});
it("should return PENDING_QUEUED", function () {
const validator = {
activationEpoch: 1,
activationEligibilityEpoch: 101010101101010,
} as phase0.Validator;
const currentEpoch = 0;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("pending_queued");
});
it("should return ACTIVE_ONGOING", function () {
const validator = {
activationEpoch: 1,
exitEpoch: Infinity,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("active_ongoing");
});
it("should return ACTIVE_SLASHED", function () {
const validator = {
activationEpoch: 1,
exitEpoch: 101010101101010,
slashed: true,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("active_slashed");
});
it("should return ACTIVE_EXITING", function () {
const validator = {
activationEpoch: 1,
exitEpoch: 101010101101010,
slashed: false,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("active_exiting");
});
it("should return EXITED_SLASHED", function () {
const validator = {
exitEpoch: 1,
withdrawableEpoch: 3,
slashed: true,
} as phase0.Validator;
const currentEpoch = 2;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("exited_slashed");
});
it("should return EXITED_UNSLASHED", function () {
const validator = {
exitEpoch: 1,
withdrawableEpoch: 3,
slashed: false,
} as phase0.Validator;
const currentEpoch = 2;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("exited_unslashed");
});
it("should return WITHDRAWAL_POSSIBLE", function () {
const validator = {
withdrawableEpoch: 1,
effectiveBalance: 32,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("withdrawal_possible");
});
it("should return WITHDRAWAL_DONE", function () {
const validator = {
withdrawableEpoch: 1,
effectiveBalance: 0,
} as phase0.Validator;
const currentEpoch = 1;
const status = getValidatorStatus(validator, currentEpoch);
expect(status).toBe("withdrawal_done");
});
it("should error", function () {
const validator = {} as phase0.Validator;
const currentEpoch = 0;
try {
getValidatorStatus(validator, currentEpoch);
} catch (error) {
expect(error).toHaveProperty("message", "ValidatorStatus unknown");
}
});
});

1 comment on commit 068fbae

@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: 068fbae Previous: 955f456 Ratio
Array push - length 1000000 63.623 ms/op 19.235 ms/op 3.31
Full benchmark results
Benchmark suite Current: 068fbae Previous: 955f456 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.1370 ms/op 2.6992 ms/op 0.79
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 49.291 us/op 83.623 us/op 0.59
BLS verify - blst 1.4424 ms/op 1.2138 ms/op 1.19
BLS verifyMultipleSignatures 3 - blst 1.2566 ms/op 1.6246 ms/op 0.77
BLS verifyMultipleSignatures 8 - blst 2.5203 ms/op 2.6909 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst 6.9366 ms/op 7.3591 ms/op 0.94
BLS verifyMultipleSignatures 64 - blst 11.122 ms/op 12.645 ms/op 0.88
BLS verifyMultipleSignatures 128 - blst 17.933 ms/op 21.444 ms/op 0.84
BLS deserializing 10000 signatures 697.34 ms/op 780.55 ms/op 0.89
BLS deserializing 100000 signatures 7.2298 s/op 7.5982 s/op 0.95
BLS verifyMultipleSignatures - same message - 3 - blst 1.1015 ms/op 982.25 us/op 1.12
BLS verifyMultipleSignatures - same message - 8 - blst 1.1840 ms/op 1.0561 ms/op 1.12
BLS verifyMultipleSignatures - same message - 32 - blst 1.8230 ms/op 1.8045 ms/op 1.01
BLS verifyMultipleSignatures - same message - 64 - blst 2.8011 ms/op 2.7555 ms/op 1.02
BLS verifyMultipleSignatures - same message - 128 - blst 4.8989 ms/op 5.0303 ms/op 0.97
BLS aggregatePubkeys 32 - blst 22.005 us/op 22.495 us/op 0.98
BLS aggregatePubkeys 128 - blst 76.488 us/op 78.506 us/op 0.97
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 77.844 ms/op 72.670 ms/op 1.07
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 58.941 ms/op 71.417 ms/op 0.83
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 40.060 ms/op 38.668 ms/op 1.04
getSlashingsAndExits - default max 143.51 us/op 136.74 us/op 1.05
getSlashingsAndExits - 2k 386.24 us/op 569.73 us/op 0.68
proposeBlockBody type=full, size=empty 7.7443 ms/op 6.9997 ms/op 1.11
isKnown best case - 1 super set check 629.00 ns/op 599.00 ns/op 1.05
isKnown normal case - 2 super set checks 763.00 ns/op 659.00 ns/op 1.16
isKnown worse case - 16 super set checks 815.00 ns/op 657.00 ns/op 1.24
InMemoryCheckpointStateCache - add get delete 4.1970 us/op 3.7290 us/op 1.13
updateUnfinalizedPubkeys - updating 10 pubkeys 1.5945 ms/op 1.5876 ms/op 1.00
updateUnfinalizedPubkeys - updating 100 pubkeys 5.4536 ms/op 5.5220 ms/op 0.99
updateUnfinalizedPubkeys - updating 1000 pubkeys 65.419 ms/op 71.001 ms/op 0.92
validate api signedAggregateAndProof - struct 1.9236 ms/op 1.7179 ms/op 1.12
validate gossip signedAggregateAndProof - struct 1.7809 ms/op 1.8043 ms/op 0.99
batch validate gossip attestation - vc 640000 - chunk 32 172.99 us/op 149.80 us/op 1.15
batch validate gossip attestation - vc 640000 - chunk 64 143.38 us/op 132.88 us/op 1.08
batch validate gossip attestation - vc 640000 - chunk 128 130.23 us/op 124.15 us/op 1.05
batch validate gossip attestation - vc 640000 - chunk 256 124.52 us/op 120.17 us/op 1.04
pickEth1Vote - no votes 1.2952 ms/op 1.2757 ms/op 1.02
pickEth1Vote - max votes 9.0634 ms/op 8.0565 ms/op 1.12
pickEth1Vote - Eth1Data hashTreeRoot value x2048 17.786 ms/op 18.072 ms/op 0.98
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 27.007 ms/op 21.410 ms/op 1.26
pickEth1Vote - Eth1Data fastSerialize value x2048 610.27 us/op 590.20 us/op 1.03
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.3980 ms/op 4.0914 ms/op 1.07
bytes32 toHexString 685.00 ns/op 580.00 ns/op 1.18
bytes32 Buffer.toString(hex) 302.00 ns/op 269.00 ns/op 1.12
bytes32 Buffer.toString(hex) from Uint8Array 523.00 ns/op 466.00 ns/op 1.12
bytes32 Buffer.toString(hex) + 0x 310.00 ns/op 269.00 ns/op 1.15
Object access 1 prop 0.20800 ns/op 0.19800 ns/op 1.05
Map access 1 prop 0.15700 ns/op 0.14300 ns/op 1.10
Object get x1000 7.1070 ns/op 6.2200 ns/op 1.14
Map get x1000 7.6480 ns/op 6.7160 ns/op 1.14
Object set x1000 48.064 ns/op 46.023 ns/op 1.04
Map set x1000 28.569 ns/op 31.104 ns/op 0.92
Return object 10000 times 0.32130 ns/op 0.31420 ns/op 1.02
Throw Error 10000 times 3.9245 us/op 3.5402 us/op 1.11
toHex 191.07 ns/op 192.93 ns/op 0.99
Buffer.from 171.29 ns/op 174.08 ns/op 0.98
shared Buffer 111.91 ns/op 101.89 ns/op 1.10
fastMsgIdFn sha256 / 200 bytes 2.5890 us/op 2.4260 us/op 1.07
fastMsgIdFn h32 xxhash / 200 bytes 311.00 ns/op 294.00 ns/op 1.06
fastMsgIdFn h64 xxhash / 200 bytes 303.00 ns/op 274.00 ns/op 1.11
fastMsgIdFn sha256 / 1000 bytes 8.3090 us/op 7.6810 us/op 1.08
fastMsgIdFn h32 xxhash / 1000 bytes 446.00 ns/op 432.00 ns/op 1.03
fastMsgIdFn h64 xxhash / 1000 bytes 387.00 ns/op 364.00 ns/op 1.06
fastMsgIdFn sha256 / 10000 bytes 73.349 us/op 66.101 us/op 1.11
fastMsgIdFn h32 xxhash / 10000 bytes 2.0520 us/op 1.9100 us/op 1.07
fastMsgIdFn h64 xxhash / 10000 bytes 1.3330 us/op 1.2340 us/op 1.08
send data - 1000 256B messages 15.425 ms/op 14.963 ms/op 1.03
send data - 1000 512B messages 20.121 ms/op 19.967 ms/op 1.01
send data - 1000 1024B messages 29.612 ms/op 33.145 ms/op 0.89
send data - 1000 1200B messages 27.503 ms/op 32.082 ms/op 0.86
send data - 1000 2048B messages 34.642 ms/op 36.532 ms/op 0.95
send data - 1000 4096B messages 32.127 ms/op 39.694 ms/op 0.81
send data - 1000 16384B messages 79.678 ms/op 82.822 ms/op 0.96
send data - 1000 65536B messages 236.58 ms/op 241.41 ms/op 0.98
enrSubnets - fastDeserialize 64 bits 1.3160 us/op 1.5430 us/op 0.85
enrSubnets - ssz BitVector 64 bits 452.00 ns/op 477.00 ns/op 0.95
enrSubnets - fastDeserialize 4 bits 186.00 ns/op 212.00 ns/op 0.88
enrSubnets - ssz BitVector 4 bits 464.00 ns/op 481.00 ns/op 0.96
prioritizePeers score -10:0 att 32-0.1 sync 2-0 177.71 us/op 206.39 us/op 0.86
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 232.98 us/op 232.66 us/op 1.00
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 351.90 us/op 312.48 us/op 1.13
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 524.77 us/op 516.73 us/op 1.02
prioritizePeers score 0:0 att 64-1 sync 4-1 934.84 us/op 931.36 us/op 1.00
array of 16000 items push then shift 1.7718 us/op 1.7495 us/op 1.01
LinkedList of 16000 items push then shift 8.4690 ns/op 8.3800 ns/op 1.01
array of 16000 items push then pop 143.39 ns/op 140.97 ns/op 1.02
LinkedList of 16000 items push then pop 8.0260 ns/op 7.6830 ns/op 1.04
array of 24000 items push then shift 2.6293 us/op 2.5900 us/op 1.02
LinkedList of 24000 items push then shift 8.0790 ns/op 8.4230 ns/op 0.96
array of 24000 items push then pop 186.62 ns/op 196.82 ns/op 0.95
LinkedList of 24000 items push then pop 7.8020 ns/op 8.5480 ns/op 0.91
intersect bitArray bitLen 8 6.7130 ns/op 6.7910 ns/op 0.99
intersect array and set length 8 56.580 ns/op 68.412 ns/op 0.83
intersect bitArray bitLen 128 31.262 ns/op 31.175 ns/op 1.00
intersect array and set length 128 891.02 ns/op 978.64 ns/op 0.91
bitArray.getTrueBitIndexes() bitLen 128 2.2070 us/op 2.3820 us/op 0.93
bitArray.getTrueBitIndexes() bitLen 248 4.2670 us/op 4.5330 us/op 0.94
bitArray.getTrueBitIndexes() bitLen 512 10.341 us/op 10.675 us/op 0.97
Buffer.concat 32 items 1.0630 us/op 1.1300 us/op 0.94
Uint8Array.set 32 items 1.7670 us/op 1.7500 us/op 1.01
Buffer.copy 2.1580 us/op 1.9550 us/op 1.10
Uint8Array.set - with subarray 3.6500 us/op 3.0170 us/op 1.21
Uint8Array.set - without subarray 1.8400 us/op 1.5520 us/op 1.19
getUint32 - dataview 322.00 ns/op 301.00 ns/op 1.07
getUint32 - manual 279.00 ns/op 216.00 ns/op 1.29
Set add up to 64 items then delete first 3.0391 us/op 2.7978 us/op 1.09
OrderedSet add up to 64 items then delete first 4.6066 us/op 4.2687 us/op 1.08
Set add up to 64 items then delete last 3.2731 us/op 3.2033 us/op 1.02
OrderedSet add up to 64 items then delete last 5.2249 us/op 4.6594 us/op 1.12
Set add up to 64 items then delete middle 3.3645 us/op 3.2741 us/op 1.03
OrderedSet add up to 64 items then delete middle 7.0069 us/op 6.5774 us/op 1.07
Set add up to 128 items then delete first 7.2213 us/op 6.5325 us/op 1.11
OrderedSet add up to 128 items then delete first 12.323 us/op 10.231 us/op 1.20
Set add up to 128 items then delete last 7.2096 us/op 6.4133 us/op 1.12
OrderedSet add up to 128 items then delete last 10.607 us/op 9.7123 us/op 1.09
Set add up to 128 items then delete middle 6.5897 us/op 6.1692 us/op 1.07
OrderedSet add up to 128 items then delete middle 17.277 us/op 16.703 us/op 1.03
Set add up to 256 items then delete first 12.972 us/op 13.521 us/op 0.96
OrderedSet add up to 256 items then delete first 19.595 us/op 21.222 us/op 0.92
Set add up to 256 items then delete last 11.484 us/op 12.403 us/op 0.93
OrderedSet add up to 256 items then delete last 17.774 us/op 16.901 us/op 1.05
Set add up to 256 items then delete middle 12.202 us/op 11.884 us/op 1.03
OrderedSet add up to 256 items then delete middle 50.190 us/op 47.955 us/op 1.05
transfer serialized Status (84 B) 1.4280 us/op 1.5470 us/op 0.92
copy serialized Status (84 B) 1.2920 us/op 1.3170 us/op 0.98
transfer serialized SignedVoluntaryExit (112 B) 1.5410 us/op 1.6140 us/op 0.95
copy serialized SignedVoluntaryExit (112 B) 1.3460 us/op 1.3850 us/op 0.97
transfer serialized ProposerSlashing (416 B) 1.7710 us/op 2.1460 us/op 0.83
copy serialized ProposerSlashing (416 B) 1.8660 us/op 1.8480 us/op 1.01
transfer serialized Attestation (485 B) 1.8200 us/op 2.1090 us/op 0.86
copy serialized Attestation (485 B) 1.8430 us/op 1.9650 us/op 0.94
transfer serialized AttesterSlashing (33232 B) 1.8310 us/op 2.0930 us/op 0.87
copy serialized AttesterSlashing (33232 B) 6.3230 us/op 10.179 us/op 0.62
transfer serialized Small SignedBeaconBlock (128000 B) 2.5660 us/op 3.9160 us/op 0.66
copy serialized Small SignedBeaconBlock (128000 B) 20.631 us/op 26.182 us/op 0.79
transfer serialized Avg SignedBeaconBlock (200000 B) 2.9840 us/op 3.9210 us/op 0.76
copy serialized Avg SignedBeaconBlock (200000 B) 33.559 us/op 30.642 us/op 1.10
transfer serialized BlobsSidecar (524380 B) 3.3430 us/op 5.5580 us/op 0.60
copy serialized BlobsSidecar (524380 B) 90.240 us/op 228.31 us/op 0.40
transfer serialized Big SignedBeaconBlock (1000000 B) 3.3380 us/op 5.5020 us/op 0.61
copy serialized Big SignedBeaconBlock (1000000 B) 174.70 us/op 201.94 us/op 0.87
pass gossip attestations to forkchoice per slot 3.0905 ms/op 3.1845 ms/op 0.97
forkChoice updateHead vc 100000 bc 64 eq 0 618.07 us/op 541.70 us/op 1.14
forkChoice updateHead vc 600000 bc 64 eq 0 3.8137 ms/op 5.2734 ms/op 0.72
forkChoice updateHead vc 1000000 bc 64 eq 0 5.8579 ms/op 6.2213 ms/op 0.94
forkChoice updateHead vc 600000 bc 320 eq 0 3.6566 ms/op 3.4941 ms/op 1.05
forkChoice updateHead vc 600000 bc 1200 eq 0 3.6498 ms/op 3.8238 ms/op 0.95
forkChoice updateHead vc 600000 bc 7200 eq 0 5.3050 ms/op 4.1405 ms/op 1.28
forkChoice updateHead vc 600000 bc 64 eq 1000 12.482 ms/op 11.632 ms/op 1.07
forkChoice updateHead vc 600000 bc 64 eq 10000 12.271 ms/op 11.876 ms/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 300000 23.995 ms/op 21.898 ms/op 1.10
computeDeltas 500000 validators 300 proto nodes 4.2318 ms/op 3.9925 ms/op 1.06
computeDeltas 500000 validators 1200 proto nodes 4.4475 ms/op 3.8194 ms/op 1.16
computeDeltas 500000 validators 7200 proto nodes 4.6504 ms/op 3.8255 ms/op 1.22
computeDeltas 750000 validators 300 proto nodes 7.7081 ms/op 5.6028 ms/op 1.38
computeDeltas 750000 validators 1200 proto nodes 7.3604 ms/op 5.2703 ms/op 1.40
computeDeltas 750000 validators 7200 proto nodes 7.4995 ms/op 5.4725 ms/op 1.37
computeDeltas 1400000 validators 300 proto nodes 12.589 ms/op 11.326 ms/op 1.11
computeDeltas 1400000 validators 1200 proto nodes 12.562 ms/op 11.345 ms/op 1.11
computeDeltas 1400000 validators 7200 proto nodes 12.818 ms/op 10.578 ms/op 1.21
computeDeltas 2100000 validators 300 proto nodes 19.283 ms/op 18.161 ms/op 1.06
computeDeltas 2100000 validators 1200 proto nodes 18.749 ms/op 20.763 ms/op 0.90
computeDeltas 2100000 validators 7200 proto nodes 17.583 ms/op 19.405 ms/op 0.91
altair processAttestation - 250000 vs - 7PWei normalcase 1.8844 ms/op 2.0769 ms/op 0.91
altair processAttestation - 250000 vs - 7PWei worstcase 3.0727 ms/op 2.9500 ms/op 1.04
altair processAttestation - setStatus - 1/6 committees join 101.70 us/op 89.186 us/op 1.14
altair processAttestation - setStatus - 1/3 committees join 235.00 us/op 197.81 us/op 1.19
altair processAttestation - setStatus - 1/2 committees join 352.44 us/op 273.77 us/op 1.29
altair processAttestation - setStatus - 2/3 committees join 450.49 us/op 372.59 us/op 1.21
altair processAttestation - setStatus - 4/5 committees join 656.32 us/op 503.82 us/op 1.30
altair processAttestation - setStatus - 100% committees join 854.94 us/op 606.59 us/op 1.41
altair processBlock - 250000 vs - 7PWei normalcase 6.6742 ms/op 4.6375 ms/op 1.44
altair processBlock - 250000 vs - 7PWei normalcase hashState 35.947 ms/op 28.975 ms/op 1.24
altair processBlock - 250000 vs - 7PWei worstcase 47.348 ms/op 44.338 ms/op 1.07
altair processBlock - 250000 vs - 7PWei worstcase hashState 108.19 ms/op 73.275 ms/op 1.48
phase0 processBlock - 250000 vs - 7PWei normalcase 3.4151 ms/op 1.9194 ms/op 1.78
phase0 processBlock - 250000 vs - 7PWei worstcase 36.032 ms/op 23.576 ms/op 1.53
altair processEth1Data - 250000 vs - 7PWei normalcase 678.75 us/op 321.73 us/op 2.11
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 10.451 us/op 4.2930 us/op 2.43
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 50.228 us/op 45.727 us/op 1.10
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 17.566 us/op 10.883 us/op 1.61
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 11.774 us/op 5.3800 us/op 2.19
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 183.43 us/op 194.82 us/op 0.94
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.7031 ms/op 2.1534 ms/op 0.79
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.6780 ms/op 2.1520 ms/op 1.24
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.6434 ms/op 2.3633 ms/op 1.12
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 8.4853 ms/op 3.6653 ms/op 2.32
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.3037 ms/op 2.3727 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.1309 ms/op 4.0687 ms/op 1.51
Tree 40 250000 create 544.34 ms/op 255.35 ms/op 2.13
Tree 40 250000 get(125000) 249.06 ns/op 147.71 ns/op 1.69
Tree 40 250000 set(125000) 1.4101 us/op 725.67 ns/op 1.94
Tree 40 250000 toArray() 26.994 ms/op 20.899 ms/op 1.29
Tree 40 250000 iterate all - toArray() + loop 26.904 ms/op 20.446 ms/op 1.32
Tree 40 250000 iterate all - get(i) 79.074 ms/op 63.814 ms/op 1.24
Array 250000 create 4.7643 ms/op 3.4939 ms/op 1.36
Array 250000 clone - spread 4.1554 ms/op 1.6056 ms/op 2.59
Array 250000 get(125000) 0.55000 ns/op 0.44100 ns/op 1.25
Array 250000 set(125000) 0.62900 ns/op 0.44900 ns/op 1.40
Array 250000 iterate all - loop 167.14 us/op 107.96 us/op 1.55
phase0 afterProcessEpoch - 250000 vs - 7PWei 133.02 ms/op 103.03 ms/op 1.29
Array.fill - length 1000000 8.9296 ms/op 3.9829 ms/op 2.24
Array push - length 1000000 63.623 ms/op 19.235 ms/op 3.31
Array.get 0.39023 ns/op 0.30119 ns/op 1.30
Uint8Array.get 0.63510 ns/op 0.46587 ns/op 1.36
phase0 beforeProcessEpoch - 250000 vs - 7PWei 34.205 ms/op 21.443 ms/op 1.60
altair processEpoch - mainnet_e81889 536.93 ms/op 383.45 ms/op 1.40
mainnet_e81889 - altair beforeProcessEpoch 38.521 ms/op 21.916 ms/op 1.76
mainnet_e81889 - altair processJustificationAndFinalization 33.230 us/op 17.536 us/op 1.89
mainnet_e81889 - altair processInactivityUpdates 11.125 ms/op 6.3149 ms/op 1.76
mainnet_e81889 - altair processRewardsAndPenalties 62.127 ms/op 46.394 ms/op 1.34
mainnet_e81889 - altair processRegistryUpdates 5.0650 us/op 2.0400 us/op 2.48
mainnet_e81889 - altair processSlashings 1.1460 us/op 496.00 ns/op 2.31
mainnet_e81889 - altair processEth1DataReset 931.00 ns/op 366.00 ns/op 2.54
mainnet_e81889 - altair processEffectiveBalanceUpdates 3.0305 ms/op 1.9469 ms/op 1.56
mainnet_e81889 - altair processSlashingsReset 8.6610 us/op 5.6070 us/op 1.54
mainnet_e81889 - altair processRandaoMixesReset 11.607 us/op 6.7980 us/op 1.71
mainnet_e81889 - altair processHistoricalRootsUpdate 1.7460 us/op 786.00 ns/op 2.22
mainnet_e81889 - altair processParticipationFlagUpdates 7.5050 us/op 2.4910 us/op 3.01
mainnet_e81889 - altair processSyncCommitteeUpdates 1.5010 us/op 692.00 ns/op 2.17
mainnet_e81889 - altair afterProcessEpoch 155.45 ms/op 100.12 ms/op 1.55
capella processEpoch - mainnet_e217614 2.2566 s/op 1.3787 s/op 1.64
mainnet_e217614 - capella beforeProcessEpoch 103.24 ms/op 89.419 ms/op 1.15
mainnet_e217614 - capella processJustificationAndFinalization 39.977 us/op 36.957 us/op 1.08
mainnet_e217614 - capella processInactivityUpdates 28.251 ms/op 22.899 ms/op 1.23
mainnet_e217614 - capella processRewardsAndPenalties 319.79 ms/op 260.52 ms/op 1.23
mainnet_e217614 - capella processRegistryUpdates 20.583 us/op 21.824 us/op 0.94
mainnet_e217614 - capella processSlashings 1.5940 us/op 847.00 ns/op 1.88
mainnet_e217614 - capella processEth1DataReset 1.0800 us/op 781.00 ns/op 1.38
mainnet_e217614 - capella processEffectiveBalanceUpdates 20.929 ms/op 19.327 ms/op 1.08
mainnet_e217614 - capella processSlashingsReset 7.6460 us/op 13.662 us/op 0.56
mainnet_e217614 - capella processRandaoMixesReset 14.611 us/op 11.736 us/op 1.24
mainnet_e217614 - capella processHistoricalRootsUpdate 2.7440 us/op 1.2010 us/op 2.28
mainnet_e217614 - capella processParticipationFlagUpdates 7.8320 us/op 5.2070 us/op 1.50
mainnet_e217614 - capella afterProcessEpoch 356.34 ms/op 299.55 ms/op 1.19
phase0 processEpoch - mainnet_e58758 535.50 ms/op 619.57 ms/op 0.86
mainnet_e58758 - phase0 beforeProcessEpoch 121.37 ms/op 149.90 ms/op 0.81
mainnet_e58758 - phase0 processJustificationAndFinalization 36.523 us/op 35.665 us/op 1.02
mainnet_e58758 - phase0 processRewardsAndPenalties 42.942 ms/op 53.966 ms/op 0.80
mainnet_e58758 - phase0 processRegistryUpdates 15.604 us/op 21.931 us/op 0.71
mainnet_e58758 - phase0 processSlashings 925.00 ns/op 1.1580 us/op 0.80
mainnet_e58758 - phase0 processEth1DataReset 1.0690 us/op 891.00 ns/op 1.20
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.0448 ms/op 2.0086 ms/op 1.02
mainnet_e58758 - phase0 processSlashingsReset 13.080 us/op 7.8480 us/op 1.67
mainnet_e58758 - phase0 processRandaoMixesReset 17.792 us/op 18.442 us/op 0.96
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.5560 us/op 1.3150 us/op 1.18
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.0000 us/op 11.698 us/op 0.68
mainnet_e58758 - phase0 afterProcessEpoch 122.09 ms/op 108.20 ms/op 1.13
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.3308 ms/op 2.9970 ms/op 0.78
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.5034 ms/op 4.3195 ms/op 0.81
altair processInactivityUpdates - 250000 normalcase 28.109 ms/op 27.712 ms/op 1.01
altair processInactivityUpdates - 250000 worstcase 26.714 ms/op 30.270 ms/op 0.88
phase0 processRegistryUpdates - 250000 normalcase 18.825 us/op 17.334 us/op 1.09
phase0 processRegistryUpdates - 250000 badcase_full_deposits 431.15 us/op 482.31 us/op 0.89
phase0 processRegistryUpdates - 250000 worstcase 0.5 186.56 ms/op 281.47 ms/op 0.66
altair processRewardsAndPenalties - 250000 normalcase 56.661 ms/op 55.808 ms/op 1.02
altair processRewardsAndPenalties - 250000 worstcase 57.215 ms/op 49.132 ms/op 1.16
phase0 getAttestationDeltas - 250000 normalcase 12.956 ms/op 10.406 ms/op 1.25
phase0 getAttestationDeltas - 250000 worstcase 9.6158 ms/op 9.6373 ms/op 1.00
phase0 processSlashings - 250000 worstcase 127.36 us/op 118.56 us/op 1.07
altair processSyncCommitteeUpdates - 250000 185.89 ms/op 157.93 ms/op 1.18
BeaconState.hashTreeRoot - No change 423.00 ns/op 271.00 ns/op 1.56
BeaconState.hashTreeRoot - 1 full validator 140.12 us/op 146.61 us/op 0.96
BeaconState.hashTreeRoot - 32 full validator 1.5895 ms/op 1.3878 ms/op 1.15
BeaconState.hashTreeRoot - 512 full validator 18.574 ms/op 14.720 ms/op 1.26
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 287.75 us/op 175.66 us/op 1.64
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.1773 ms/op 2.5143 ms/op 1.26
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 37.254 ms/op 37.911 ms/op 0.98
BeaconState.hashTreeRoot - 1 balances 155.09 us/op 166.37 us/op 0.93
BeaconState.hashTreeRoot - 32 balances 1.5585 ms/op 1.2470 ms/op 1.25
BeaconState.hashTreeRoot - 512 balances 13.291 ms/op 13.686 ms/op 0.97
BeaconState.hashTreeRoot - 250000 balances 331.16 ms/op 259.81 ms/op 1.27
aggregationBits - 2048 els - zipIndexesInBitList 47.475 us/op 42.815 us/op 1.11
byteArrayEquals 32 75.946 ns/op 61.558 ns/op 1.23
Buffer.compare 32 24.263 ns/op 20.071 ns/op 1.21
byteArrayEquals 1024 2.4135 us/op 1.7422 us/op 1.39
Buffer.compare 1024 31.331 ns/op 31.362 ns/op 1.00
byteArrayEquals 16384 35.043 us/op 29.834 us/op 1.17
Buffer.compare 16384 262.56 ns/op 249.29 ns/op 1.05
byteArrayEquals 123687377 260.59 ms/op 232.09 ms/op 1.12
Buffer.compare 123687377 14.292 ms/op 12.033 ms/op 1.19
byteArrayEquals 32 - diff last byte 78.835 ns/op 58.707 ns/op 1.34
Buffer.compare 32 - diff last byte 29.238 ns/op 19.520 ns/op 1.50
byteArrayEquals 1024 - diff last byte 2.3001 us/op 1.8377 us/op 1.25
Buffer.compare 1024 - diff last byte 42.527 ns/op 32.649 ns/op 1.30
byteArrayEquals 16384 - diff last byte 33.951 us/op 29.322 us/op 1.16
Buffer.compare 16384 - diff last byte 332.30 ns/op 232.58 ns/op 1.43
byteArrayEquals 123687377 - diff last byte 261.19 ms/op 206.71 ms/op 1.26
Buffer.compare 123687377 - diff last byte 10.329 ms/op 8.6365 ms/op 1.20
byteArrayEquals 32 - random bytes 7.6630 ns/op 5.6910 ns/op 1.35
Buffer.compare 32 - random bytes 22.203 ns/op 19.325 ns/op 1.15
byteArrayEquals 1024 - random bytes 6.1140 ns/op 5.5020 ns/op 1.11
Buffer.compare 1024 - random bytes 21.113 ns/op 18.968 ns/op 1.11
byteArrayEquals 16384 - random bytes 7.0970 ns/op 5.4570 ns/op 1.30
Buffer.compare 16384 - random bytes 21.497 ns/op 18.556 ns/op 1.16
byteArrayEquals 123687377 - random bytes 8.4000 ns/op 6.8000 ns/op 1.24
Buffer.compare 123687377 - random bytes 24.180 ns/op 20.330 ns/op 1.19
regular array get 100000 times 59.113 us/op 34.977 us/op 1.69
wrappedArray get 100000 times 44.780 us/op 34.533 us/op 1.30
arrayWithProxy get 100000 times 15.978 ms/op 14.612 ms/op 1.09
ssz.Root.equals 54.089 ns/op 50.925 ns/op 1.06
byteArrayEquals 54.947 ns/op 50.450 ns/op 1.09
Buffer.compare 12.978 ns/op 11.439 ns/op 1.13
shuffle list - 16384 els 8.0369 ms/op 6.8278 ms/op 1.18
shuffle list - 250000 els 121.33 ms/op 101.76 ms/op 1.19
processSlot - 1 slots 17.062 us/op 14.441 us/op 1.18
processSlot - 32 slots 3.5118 ms/op 3.6121 ms/op 0.97
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 43.407 ms/op 37.794 ms/op 1.15
getCommitteeAssignments - req 1 vs - 250000 vc 2.6905 ms/op 2.2400 ms/op 1.20
getCommitteeAssignments - req 100 vs - 250000 vc 5.3951 ms/op 4.3516 ms/op 1.24
getCommitteeAssignments - req 1000 vs - 250000 vc 5.6410 ms/op 4.6781 ms/op 1.21
findModifiedValidators - 10000 modified validators 417.68 ms/op 260.21 ms/op 1.61
findModifiedValidators - 1000 modified validators 277.09 ms/op 193.68 ms/op 1.43
findModifiedValidators - 100 modified validators 306.05 ms/op 222.48 ms/op 1.38
findModifiedValidators - 10 modified validators 243.98 ms/op 203.71 ms/op 1.20
findModifiedValidators - 1 modified validators 249.30 ms/op 181.92 ms/op 1.37
findModifiedValidators - no difference 232.73 ms/op 161.48 ms/op 1.44
compare ViewDUs 4.2862 s/op 3.1113 s/op 1.38
compare each validator Uint8Array 1.6307 s/op 1.3995 s/op 1.17
compare ViewDU to Uint8Array 1.6861 s/op 1.0815 s/op 1.56
migrate state 1000000 validators, 24 modified, 0 new 1.2479 s/op 896.31 ms/op 1.39
migrate state 1000000 validators, 1700 modified, 1000 new 1.7961 s/op 1.0928 s/op 1.64
migrate state 1000000 validators, 3400 modified, 2000 new 1.7993 s/op 1.3073 s/op 1.38
migrate state 1500000 validators, 24 modified, 0 new 1.1705 s/op 953.91 ms/op 1.23
migrate state 1500000 validators, 1700 modified, 1000 new 1.4496 s/op 1.1992 s/op 1.21
migrate state 1500000 validators, 3400 modified, 2000 new 1.6513 s/op 1.4831 s/op 1.11
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.9200 ns/op 5.1000 ns/op 1.16
state getBlockRootAtSlot - 250000 vs - 7PWei 676.79 ns/op 693.59 ns/op 0.98
computeProposers - vc 250000 9.1278 ms/op 8.4409 ms/op 1.08
computeEpochShuffling - vc 250000 117.77 ms/op 105.68 ms/op 1.11
getNextSyncCommittee - vc 250000 153.29 ms/op 146.38 ms/op 1.05
computeSigningRoot for AttestationData 25.422 us/op 26.228 us/op 0.97
hash AttestationData serialized data then Buffer.toString(base64) 1.9145 us/op 1.7090 us/op 1.12
toHexString serialized data 1.1226 us/op 1.1483 us/op 0.98
Buffer.toString(base64) 236.84 ns/op 247.35 ns/op 0.96
nodejs block root to RootHex using toHex 206.29 ns/op 194.47 ns/op 1.06
nodejs block root to RootHex using toRootHex 115.95 ns/op 117.65 ns/op 0.99
browser block root to RootHex using the deprecated toHexString 306.16 ns/op 299.25 ns/op 1.02
browser block root to RootHex using toHex 238.16 ns/op 271.23 ns/op 0.88
browser block root to RootHex using toRootHex 189.35 ns/op 187.71 ns/op 1.01

Please sign in to comment.