Skip to content

Commit

Permalink
chore: enable nHistoricalStates e2e test (#6867)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Jun 10, 2024
1 parent f8593a9 commit 90b053c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {waitForEvent} from "../../../utils/events/resolver.js";
import {ChainEvent, ReorgEventData} from "../../../../src/chain/emitter.js";
import {connect, onPeerConnect} from "../../../utils/network.js";
import {CacheItemType} from "../../../../src/chain/stateCache/types.js";
import {ReorgedForkChoice} from "../../../mocks/forkchoice.js";
import {ReorgedForkChoice} from "../../../mocks/fork-choice/reorg.js";

/**
* Test different reorg scenarios to make sure the StateCache implementations are correct.
Expand Down Expand Up @@ -249,8 +249,6 @@ describe(
// chain is not finalized, epoch 4 is in-memory so CP state at epoch 0 1 2 3 are persisted
numEpochsPersisted: 4,
// chain is NOT finalized end of test
// TODO: remove this after proposer boost reorg is fully implemented
skip: true,
},
];

Expand Down Expand Up @@ -295,6 +293,8 @@ describe(
chain: {
blsVerifyAllMainThread: true,
forkchoiceConstructor: ReorgedForkChoice,
// this node does not need to reload state
nHistoricalStates: false,
proposerBoost: true,
},
},
Expand All @@ -315,6 +315,7 @@ describe(
chain: {
blsVerifyAllMainThread: true,
forkchoiceConstructor: ReorgedForkChoice,
// this node can follow with nHistoricalStates flag and it has to reload state
nHistoricalStates: true,
maxBlockStates,
maxCPStateEpochsInMemory,
Expand Down Expand Up @@ -347,9 +348,16 @@ describe(
afterEachCallbacks.push(() => Promise.all(validators.map((v) => v.close())));

// wait for checkpoint 3 at slot 24, both nodes should reach same checkpoint
const cpEpoch = 3;
const cpSlot = 3 * SLOTS_PER_EPOCH;
const checkpoints = await Promise.all(
[reorgedBn, followupBn].map((bn) =>
waitForEvent<phase0.Checkpoint>(bn.chain.emitter, ChainEvent.checkpoint, 240000, (cp) => cp.epoch === 3)
waitForEvent<phase0.Checkpoint>(
bn.chain.emitter,
ChainEvent.checkpoint,
(cpSlot + genesisSlotsDelay + 1) * testParams.SECONDS_PER_SLOT * 1000,
(cp) => cp.epoch === cpEpoch
)
)
);
expect(checkpoints[0]).toEqual(checkpoints[1]);
Expand All @@ -369,7 +377,8 @@ describe(
waitForEvent<ReorgEventData>(
bn.chain.emitter,
routes.events.EventType.chainReorg,
240000,
// reorged event happens at reorgedSlot + 1
(reorgedSlot + 1 - cpSlot + 1) * testParams.SECONDS_PER_SLOT * 1000,
(reorgData) => reorgData.slot === reorgedSlot + 1
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {ChainForkConfig} from "@lodestar/config";
import {ForkChoice, ForkChoiceOpts, IForkChoiceStore, ProtoArray, ProtoBlock} from "@lodestar/fork-choice";
import {NotReorgedReason} from "@lodestar/fork-choice/lib/forkChoice/interface.js";
import {Slot} from "@lodestar/types";

/**
Expand All @@ -22,10 +23,6 @@ export class ReorgedForkChoice extends ForkChoice {
reorgedSlot: Slot | undefined;
reorgDistance: number | undefined;
private readonly _fcStore: IForkChoiceStore;
// these flags to mark if the current call of getHead() is to produce a block
// the other way to check this is to check the n-th call of getHead() in the same slot, but this is easier
private calledUpdateHead = false;
private calledUpdateTime = false;

constructor(
config: ChainForkConfig,
Expand All @@ -38,33 +35,40 @@ export class ReorgedForkChoice extends ForkChoice {
this._fcStore = fcStore;
}

/**
* Override to trigger reorged event at `reorgedSlot + 1`
*/
getProposerHead(
headBlock: ProtoBlock,
secFromSlot: number,
slot: Slot
): {proposerHead: ProtoBlock; isHeadTimely: boolean; notReorgedReason?: NotReorgedReason} {
const currentSlot = this._fcStore.currentSlot;
if (this.reorgedSlot !== undefined && this.reorgDistance !== undefined && currentSlot === this.reorgedSlot + 1) {
const nodes = super.getAllNodes();
const headSlot = currentSlot - this.reorgDistance;
const headNode = nodes.find((node) => node.slot === headSlot);
if (headNode !== undefined) {
return {proposerHead: headNode, isHeadTimely: true};
}
}

return super.getProposerHead(headBlock, secFromSlot, slot);
}

/**
* Override the getHead() method
* - produceBlock: to reorg at a given slot and distance.
* - produceAttestation: to build on the latest node after the reorged slot
* - importBlock: to return the old branch at the reorged slot to produce the reorg event
*/
getHead = (): ProtoBlock => {
const currentSlot = this._fcStore.currentSlot;
const producingBlock = this.calledUpdateHead && this.calledUpdateTime;
if (this.reorgedSlot === undefined || this.reorgDistance === undefined) {
return super.getHead();
}

this.calledUpdateTime = false;
this.calledUpdateHead = false;

// produceBlock: at reorgedSlot + 1, build new branch
if (currentSlot === this.reorgedSlot + 1 && producingBlock) {
const nodes = super.getAllNodes();
const headSlot = currentSlot - this.reorgDistance;
const headNode = nodes.find((node) => node.slot === headSlot);
if (headNode !== undefined) {
return headNode;
}
}

// this is mainly for producing attestations + produceBlock for latter slots
// at `reorgedSlot + 1` should return the old head to trigger reorg event
if (currentSlot > this.reorgedSlot + 1) {
// from now on build on latest node which reorged at the given slot
const nodes = super.getAllNodes();
Expand All @@ -75,12 +79,6 @@ export class ReorgedForkChoice extends ForkChoice {
return super.getHead();
};

updateTime(currentSlot: Slot): void {
// set flag to signal produceBlock flow
this.calledUpdateTime = true;
super.updateTime(currentSlot);
}

/**
* Override this function to:
* - produceBlock flow: mark flags to indicate that the current call of getHead() is to produce a block
Expand All @@ -90,10 +88,6 @@ export class ReorgedForkChoice extends ForkChoice {
if (this.reorgedSlot === undefined || this.reorgDistance === undefined) {
return super.updateHead();
}
// in all produce blocks flow, it always call updateTime() first then recomputeForkChoiceHead()
if (this.calledUpdateTime) {
this.calledUpdateHead = true;
}
const currentSlot = this._fcStore.currentSlot;
if (currentSlot <= this.reorgedSlot) {
return super.updateHead();
Expand Down

1 comment on commit 90b053c

@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: 90b053c Previous: 14855ea Ratio
isKnown normal case - 2 super set checks 905.00 ns/op 265.00 ns/op 3.42
isKnown worse case - 16 super set checks 953.00 ns/op 260.00 ns/op 3.67
send data - 1000 1200B messages 60.189 ms/op 18.455 ms/op 3.26
Full benchmark results
Benchmark suite Current: 90b053c Previous: 14855ea Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 596.27 us/op 842.05 us/op 0.71
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 82.764 us/op 49.203 us/op 1.68
BLS verify - blst-native 1.4161 ms/op 1.2079 ms/op 1.17
BLS verifyMultipleSignatures 3 - blst-native 2.9336 ms/op 2.5709 ms/op 1.14
BLS verifyMultipleSignatures 8 - blst-native 6.7791 ms/op 5.6705 ms/op 1.20
BLS verifyMultipleSignatures 32 - blst-native 23.571 ms/op 20.917 ms/op 1.13
BLS verifyMultipleSignatures 64 - blst-native 46.039 ms/op 41.047 ms/op 1.12
BLS verifyMultipleSignatures 128 - blst-native 89.453 ms/op 81.417 ms/op 1.10
BLS deserializing 10000 signatures 987.46 ms/op 841.72 ms/op 1.17
BLS deserializing 100000 signatures 10.326 s/op 8.4261 s/op 1.23
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.4355 ms/op 1.2146 ms/op 1.18
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.6264 ms/op 1.3729 ms/op 1.18
BLS verifyMultipleSignatures - same message - 32 - blst-native 3.0332 ms/op 2.1451 ms/op 1.41
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.7887 ms/op 3.5655 ms/op 1.06
BLS verifyMultipleSignatures - same message - 128 - blst-native 8.1344 ms/op 5.3018 ms/op 1.53
BLS aggregatePubkeys 32 - blst-native 31.392 us/op 24.034 us/op 1.31
BLS aggregatePubkeys 128 - blst-native 125.53 us/op 94.785 us/op 1.32
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 82.255 ms/op 61.503 ms/op 1.34
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 96.586 ms/op 46.955 ms/op 2.06
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 39.796 ms/op 28.615 ms/op 1.39
getSlashingsAndExits - default max 152.70 us/op 74.700 us/op 2.04
getSlashingsAndExits - 2k 539.51 us/op 254.20 us/op 2.12
proposeBlockBody type=full, size=empty 7.6382 ms/op 4.9966 ms/op 1.53
isKnown best case - 1 super set check 812.00 ns/op 276.00 ns/op 2.94
isKnown normal case - 2 super set checks 905.00 ns/op 265.00 ns/op 3.42
isKnown worse case - 16 super set checks 953.00 ns/op 260.00 ns/op 3.67
InMemoryCheckpointStateCache - add get delete 11.679 us/op 4.2220 us/op 2.77
validate api signedAggregateAndProof - struct 3.0013 ms/op 2.5720 ms/op 1.17
validate gossip signedAggregateAndProof - struct 2.9563 ms/op 2.5780 ms/op 1.15
validate gossip attestation - vc 640000 1.4763 ms/op 1.2431 ms/op 1.19
batch validate gossip attestation - vc 640000 - chunk 32 179.56 us/op 144.93 us/op 1.24
batch validate gossip attestation - vc 640000 - chunk 64 154.57 us/op 129.23 us/op 1.20
batch validate gossip attestation - vc 640000 - chunk 128 147.96 us/op 124.97 us/op 1.18
batch validate gossip attestation - vc 640000 - chunk 256 136.54 us/op 116.21 us/op 1.17
pickEth1Vote - no votes 2.0080 ms/op 1.0583 ms/op 1.90
pickEth1Vote - max votes 12.881 ms/op 6.3184 ms/op 2.04
pickEth1Vote - Eth1Data hashTreeRoot value x2048 25.877 ms/op 11.337 ms/op 2.28
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 30.888 ms/op 14.968 ms/op 2.06
pickEth1Vote - Eth1Data fastSerialize value x2048 727.37 us/op 490.61 us/op 1.48
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.4538 ms/op 6.7930 ms/op 0.95
bytes32 toHexString 793.00 ns/op 433.00 ns/op 1.83
bytes32 Buffer.toString(hex) 355.00 ns/op 245.00 ns/op 1.45
bytes32 Buffer.toString(hex) from Uint8Array 730.00 ns/op 355.00 ns/op 2.06
bytes32 Buffer.toString(hex) + 0x 451.00 ns/op 248.00 ns/op 1.82
Object access 1 prop 0.26300 ns/op 0.14700 ns/op 1.79
Map access 1 prop 0.17000 ns/op 0.13900 ns/op 1.22
Object get x1000 7.9030 ns/op 6.1760 ns/op 1.28
Map get x1000 8.1070 ns/op 6.6220 ns/op 1.22
Object set x1000 72.821 ns/op 33.838 ns/op 2.15
Map set x1000 49.542 ns/op 22.413 ns/op 2.21
Return object 10000 times 0.40300 ns/op 0.29050 ns/op 1.39
Throw Error 10000 times 4.9392 us/op 3.4325 us/op 1.44
fastMsgIdFn sha256 / 200 bytes 3.4410 us/op 2.1930 us/op 1.57
fastMsgIdFn h32 xxhash / 200 bytes 532.00 ns/op 231.00 ns/op 2.30
fastMsgIdFn h64 xxhash / 200 bytes 411.00 ns/op 271.00 ns/op 1.52
fastMsgIdFn sha256 / 1000 bytes 10.921 us/op 7.4330 us/op 1.47
fastMsgIdFn h32 xxhash / 1000 bytes 701.00 ns/op 358.00 ns/op 1.96
fastMsgIdFn h64 xxhash / 1000 bytes 506.00 ns/op 342.00 ns/op 1.48
fastMsgIdFn sha256 / 10000 bytes 74.312 us/op 64.252 us/op 1.16
fastMsgIdFn h32 xxhash / 10000 bytes 2.0980 us/op 1.8140 us/op 1.16
fastMsgIdFn h64 xxhash / 10000 bytes 1.3620 us/op 1.1930 us/op 1.14
send data - 1000 256B messages 18.943 ms/op 11.535 ms/op 1.64
send data - 1000 512B messages 24.351 ms/op 16.518 ms/op 1.47
send data - 1000 1024B messages 35.663 ms/op 25.909 ms/op 1.38
send data - 1000 1200B messages 60.189 ms/op 18.455 ms/op 3.26
send data - 1000 2048B messages 53.920 ms/op 31.063 ms/op 1.74
send data - 1000 4096B messages 45.397 ms/op 30.323 ms/op 1.50
send data - 1000 16384B messages 120.33 ms/op 68.164 ms/op 1.77
send data - 1000 65536B messages 277.36 ms/op 200.62 ms/op 1.38
enrSubnets - fastDeserialize 64 bits 1.6310 us/op 1.1120 us/op 1.47
enrSubnets - ssz BitVector 64 bits 491.00 ns/op 360.00 ns/op 1.36
enrSubnets - fastDeserialize 4 bits 231.00 ns/op 149.00 ns/op 1.55
enrSubnets - ssz BitVector 4 bits 515.00 ns/op 364.00 ns/op 1.41
prioritizePeers score -10:0 att 32-0.1 sync 2-0 210.34 us/op 138.86 us/op 1.51
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 236.74 us/op 170.04 us/op 1.39
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 382.82 us/op 236.54 us/op 1.62
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 467.95 us/op 385.47 us/op 1.21
prioritizePeers score 0:0 att 64-1 sync 4-1 927.76 us/op 585.45 us/op 1.58
array of 16000 items push then shift 1.7865 us/op 1.6180 us/op 1.10
LinkedList of 16000 items push then shift 11.155 ns/op 7.2190 ns/op 1.55
array of 16000 items push then pop 167.88 ns/op 107.70 ns/op 1.56
LinkedList of 16000 items push then pop 9.3020 ns/op 7.1720 ns/op 1.30
array of 24000 items push then shift 2.9293 us/op 2.4083 us/op 1.22
LinkedList of 24000 items push then shift 11.934 ns/op 7.3280 ns/op 1.63
array of 24000 items push then pop 223.96 ns/op 136.41 ns/op 1.64
LinkedList of 24000 items push then pop 10.652 ns/op 7.2260 ns/op 1.47
intersect bitArray bitLen 8 7.1590 ns/op 6.4330 ns/op 1.11
intersect array and set length 8 88.913 ns/op 46.472 ns/op 1.91
intersect bitArray bitLen 128 33.326 ns/op 30.107 ns/op 1.11
intersect array and set length 128 1.0047 us/op 681.46 ns/op 1.47
bitArray.getTrueBitIndexes() bitLen 128 3.2190 us/op 1.6820 us/op 1.91
bitArray.getTrueBitIndexes() bitLen 248 5.8700 us/op 3.0670 us/op 1.91
bitArray.getTrueBitIndexes() bitLen 512 10.760 us/op 6.1270 us/op 1.76
Buffer.concat 32 items 1.3380 us/op 943.00 ns/op 1.42
Uint8Array.set 32 items 3.0950 us/op 2.2540 us/op 1.37
Buffer.copy 3.4290 us/op 2.4630 us/op 1.39
Uint8Array.set - with subarray 5.5610 us/op 2.7140 us/op 2.05
Uint8Array.set - without subarray 2.7720 us/op 1.4970 us/op 1.85
Set add up to 64 items then delete first 3.2251 us/op 2.1437 us/op 1.50
OrderedSet add up to 64 items then delete first 5.7977 us/op 3.2881 us/op 1.76
Set add up to 64 items then delete last 3.9529 us/op 2.4138 us/op 1.64
OrderedSet add up to 64 items then delete last 5.9957 us/op 3.5351 us/op 1.70
Set add up to 64 items then delete middle 4.3047 us/op 2.4498 us/op 1.76
OrderedSet add up to 64 items then delete middle 8.3007 us/op 5.1130 us/op 1.62
Set add up to 128 items then delete first 8.3992 us/op 4.9645 us/op 1.69
OrderedSet add up to 128 items then delete first 13.409 us/op 7.7510 us/op 1.73
Set add up to 128 items then delete last 8.4641 us/op 4.7724 us/op 1.77
OrderedSet add up to 128 items then delete last 14.205 us/op 7.0127 us/op 2.03
Set add up to 128 items then delete middle 7.8915 us/op 4.7167 us/op 1.67
OrderedSet add up to 128 items then delete middle 19.972 us/op 13.335 us/op 1.50
Set add up to 256 items then delete first 16.589 us/op 10.034 us/op 1.65
OrderedSet add up to 256 items then delete first 29.567 us/op 15.631 us/op 1.89
Set add up to 256 items then delete last 15.159 us/op 9.5107 us/op 1.59
OrderedSet add up to 256 items then delete last 20.236 us/op 14.207 us/op 1.42
Set add up to 256 items then delete middle 13.360 us/op 9.4065 us/op 1.42
OrderedSet add up to 256 items then delete middle 50.479 us/op 40.149 us/op 1.26
transfer serialized Status (84 B) 1.5420 us/op 1.4640 us/op 1.05
copy serialized Status (84 B) 1.3620 us/op 1.1640 us/op 1.17
transfer serialized SignedVoluntaryExit (112 B) 1.5750 us/op 1.6410 us/op 0.96
copy serialized SignedVoluntaryExit (112 B) 1.4270 us/op 1.2030 us/op 1.19
transfer serialized ProposerSlashing (416 B) 1.9550 us/op 2.0550 us/op 0.95
copy serialized ProposerSlashing (416 B) 1.9240 us/op 1.5090 us/op 1.28
transfer serialized Attestation (485 B) 2.4040 us/op 1.6050 us/op 1.50
copy serialized Attestation (485 B) 2.2290 us/op 1.5750 us/op 1.42
transfer serialized AttesterSlashing (33232 B) 3.1030 us/op 2.0270 us/op 1.53
copy serialized AttesterSlashing (33232 B) 8.1530 us/op 4.8730 us/op 1.67
transfer serialized Small SignedBeaconBlock (128000 B) 3.0700 us/op 2.7450 us/op 1.12
copy serialized Small SignedBeaconBlock (128000 B) 21.159 us/op 14.011 us/op 1.51
transfer serialized Avg SignedBeaconBlock (200000 B) 3.1510 us/op 3.3640 us/op 0.94
copy serialized Avg SignedBeaconBlock (200000 B) 32.876 us/op 21.251 us/op 1.55
transfer serialized BlobsSidecar (524380 B) 3.5320 us/op 3.1320 us/op 1.13
copy serialized BlobsSidecar (524380 B) 128.66 us/op 88.126 us/op 1.46
transfer serialized Big SignedBeaconBlock (1000000 B) 4.1450 us/op 3.0010 us/op 1.38
copy serialized Big SignedBeaconBlock (1000000 B) 220.66 us/op 143.00 us/op 1.54
pass gossip attestations to forkchoice per slot 3.5479 ms/op 2.9812 ms/op 1.19
forkChoice updateHead vc 100000 bc 64 eq 0 531.78 us/op 487.16 us/op 1.09
forkChoice updateHead vc 600000 bc 64 eq 0 3.9995 ms/op 3.0584 ms/op 1.31
forkChoice updateHead vc 1000000 bc 64 eq 0 6.2675 ms/op 5.2555 ms/op 1.19
forkChoice updateHead vc 600000 bc 320 eq 0 3.7308 ms/op 3.5567 ms/op 1.05
forkChoice updateHead vc 600000 bc 1200 eq 0 3.5922 ms/op 3.0360 ms/op 1.18
forkChoice updateHead vc 600000 bc 7200 eq 0 4.0172 ms/op 3.4649 ms/op 1.16
forkChoice updateHead vc 600000 bc 64 eq 1000 11.368 ms/op 10.461 ms/op 1.09
forkChoice updateHead vc 600000 bc 64 eq 10000 11.410 ms/op 10.841 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 300000 19.859 ms/op 14.722 ms/op 1.35
computeDeltas 500000 validators 300 proto nodes 4.3136 ms/op 3.4851 ms/op 1.24
computeDeltas 500000 validators 1200 proto nodes 4.0817 ms/op 3.5093 ms/op 1.16
computeDeltas 500000 validators 7200 proto nodes 4.2033 ms/op 3.5005 ms/op 1.20
computeDeltas 750000 validators 300 proto nodes 6.0761 ms/op 5.1852 ms/op 1.17
computeDeltas 750000 validators 1200 proto nodes 6.1059 ms/op 5.1219 ms/op 1.19
computeDeltas 750000 validators 7200 proto nodes 6.2699 ms/op 5.1559 ms/op 1.22
computeDeltas 1400000 validators 300 proto nodes 12.519 ms/op 9.5973 ms/op 1.30
computeDeltas 1400000 validators 1200 proto nodes 12.376 ms/op 9.8207 ms/op 1.26
computeDeltas 1400000 validators 7200 proto nodes 12.091 ms/op 9.7398 ms/op 1.24
computeDeltas 2100000 validators 300 proto nodes 17.738 ms/op 14.557 ms/op 1.22
computeDeltas 2100000 validators 1200 proto nodes 18.852 ms/op 14.673 ms/op 1.28
computeDeltas 2100000 validators 7200 proto nodes 18.164 ms/op 14.723 ms/op 1.23
altair processAttestation - 250000 vs - 7PWei normalcase 2.6188 ms/op 1.7706 ms/op 1.48
altair processAttestation - 250000 vs - 7PWei worstcase 3.6751 ms/op 2.4851 ms/op 1.48
altair processAttestation - setStatus - 1/6 committees join 121.20 us/op 93.452 us/op 1.30
altair processAttestation - setStatus - 1/3 committees join 211.10 us/op 176.08 us/op 1.20
altair processAttestation - setStatus - 1/2 committees join 289.43 us/op 254.38 us/op 1.14
altair processAttestation - setStatus - 2/3 committees join 379.43 us/op 327.96 us/op 1.16
altair processAttestation - setStatus - 4/5 committees join 585.91 us/op 526.38 us/op 1.11
altair processAttestation - setStatus - 100% committees join 671.39 us/op 589.53 us/op 1.14
altair processBlock - 250000 vs - 7PWei normalcase 5.7973 ms/op 5.2086 ms/op 1.11
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.900 ms/op 26.457 ms/op 1.17
altair processBlock - 250000 vs - 7PWei worstcase 51.975 ms/op 46.450 ms/op 1.12
altair processBlock - 250000 vs - 7PWei worstcase hashState 93.751 ms/op 90.511 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei normalcase 2.6716 ms/op 2.3637 ms/op 1.13
phase0 processBlock - 250000 vs - 7PWei worstcase 31.359 ms/op 30.508 ms/op 1.03
altair processEth1Data - 250000 vs - 7PWei normalcase 410.86 us/op 418.59 us/op 0.98
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.5360 us/op 8.3980 us/op 1.02
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 43.078 us/op 35.366 us/op 1.22
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 12.104 us/op 13.356 us/op 0.91
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.3820 us/op 9.6500 us/op 0.87
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 108.22 us/op 141.66 us/op 0.76
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 763.96 us/op 762.32 us/op 1.00
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.0600 ms/op 1.0140 ms/op 1.05
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0059 ms/op 949.03 us/op 1.06
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 6.2293 ms/op 2.5009 ms/op 2.49
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.9910 ms/op 1.8269 ms/op 1.09
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.7784 ms/op 4.3170 ms/op 1.11
Tree 40 250000 create 407.12 ms/op 279.38 ms/op 1.46
Tree 40 250000 get(125000) 170.61 ns/op 162.63 ns/op 1.05
Tree 40 250000 set(125000) 1.5170 us/op 924.03 ns/op 1.64
Tree 40 250000 toArray() 26.410 ms/op 22.598 ms/op 1.17
Tree 40 250000 iterate all - toArray() + loop 26.312 ms/op 22.773 ms/op 1.16
Tree 40 250000 iterate all - get(i) 67.861 ms/op 61.348 ms/op 1.11
MutableVector 250000 create 12.253 ms/op 9.2495 ms/op 1.32
MutableVector 250000 get(125000) 6.8100 ns/op 6.5090 ns/op 1.05
MutableVector 250000 set(125000) 358.60 ns/op 278.30 ns/op 1.29
MutableVector 250000 toArray() 4.7524 ms/op 5.0603 ms/op 0.94
MutableVector 250000 iterate all - toArray() + loop 5.0765 ms/op 5.2390 ms/op 0.97
MutableVector 250000 iterate all - get(i) 1.7155 ms/op 1.7054 ms/op 1.01
Array 250000 create 4.1211 ms/op 4.5569 ms/op 0.90
Array 250000 clone - spread 1.6903 ms/op 2.0674 ms/op 0.82
Array 250000 get(125000) 0.46700 ns/op 0.45300 ns/op 1.03
Array 250000 set(125000) 0.52100 ns/op 0.47900 ns/op 1.09
Array 250000 iterate all - loop 123.07 us/op 92.013 us/op 1.34
effectiveBalanceIncrements clone Uint8Array 300000 76.473 us/op 61.230 us/op 1.25
effectiveBalanceIncrements clone MutableVector 300000 264.00 ns/op 129.00 ns/op 2.05
effectiveBalanceIncrements rw all Uint8Array 300000 401.03 us/op 210.89 us/op 1.90
effectiveBalanceIncrements rw all MutableVector 300000 301.40 ms/op 105.54 ms/op 2.86
phase0 afterProcessEpoch - 250000 vs - 7PWei 132.95 ms/op 92.492 ms/op 1.44
phase0 beforeProcessEpoch - 250000 vs - 7PWei 102.69 ms/op 46.613 ms/op 2.20
altair processEpoch - mainnet_e81889 732.38 ms/op 392.78 ms/op 1.86
mainnet_e81889 - altair beforeProcessEpoch 131.01 ms/op 61.640 ms/op 2.13
mainnet_e81889 - altair processJustificationAndFinalization 33.510 us/op 21.905 us/op 1.53
mainnet_e81889 - altair processInactivityUpdates 13.208 ms/op 7.5334 ms/op 1.75
mainnet_e81889 - altair processRewardsAndPenalties 73.428 ms/op 45.497 ms/op 1.61
mainnet_e81889 - altair processRegistryUpdates 6.6290 us/op 2.5480 us/op 2.60
mainnet_e81889 - altair processSlashings 1.4680 us/op 530.00 ns/op 2.77
mainnet_e81889 - altair processEth1DataReset 1.3470 us/op 608.00 ns/op 2.22
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3625 ms/op 1.1493 ms/op 2.06
mainnet_e81889 - altair processSlashingsReset 10.360 us/op 3.1740 us/op 3.26
mainnet_e81889 - altair processRandaoMixesReset 19.296 us/op 5.5650 us/op 3.47
mainnet_e81889 - altair processHistoricalRootsUpdate 1.6210 us/op 783.00 ns/op 2.07
mainnet_e81889 - altair processParticipationFlagUpdates 7.0050 us/op 3.1410 us/op 2.23
mainnet_e81889 - altair processSyncCommitteeUpdates 1.4270 us/op 549.00 ns/op 2.60
mainnet_e81889 - altair afterProcessEpoch 119.06 ms/op 92.816 ms/op 1.28
capella processEpoch - mainnet_e217614 1.3963 s/op 1.2345 s/op 1.13
mainnet_e217614 - capella beforeProcessEpoch 279.24 ms/op 236.79 ms/op 1.18
mainnet_e217614 - capella processJustificationAndFinalization 19.770 us/op 11.829 us/op 1.67
mainnet_e217614 - capella processInactivityUpdates 20.342 ms/op 15.970 ms/op 1.27
mainnet_e217614 - capella processRewardsAndPenalties 232.50 ms/op 227.46 ms/op 1.02
mainnet_e217614 - capella processRegistryUpdates 17.274 us/op 12.385 us/op 1.39
mainnet_e217614 - capella processSlashings 452.00 ns/op 369.00 ns/op 1.22
mainnet_e217614 - capella processEth1DataReset 520.00 ns/op 300.00 ns/op 1.73
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.0428 ms/op 10.264 ms/op 0.39
mainnet_e217614 - capella processSlashingsReset 4.2890 us/op 4.0940 us/op 1.05
mainnet_e217614 - capella processRandaoMixesReset 5.2490 us/op 4.3870 us/op 1.20
mainnet_e217614 - capella processHistoricalRootsUpdate 507.00 ns/op 545.00 ns/op 0.93
mainnet_e217614 - capella processParticipationFlagUpdates 2.2530 us/op 2.0690 us/op 1.09
mainnet_e217614 - capella afterProcessEpoch 291.80 ms/op 273.22 ms/op 1.07
phase0 processEpoch - mainnet_e58758 390.53 ms/op 354.60 ms/op 1.10
mainnet_e58758 - phase0 beforeProcessEpoch 144.18 ms/op 110.45 ms/op 1.31
mainnet_e58758 - phase0 processJustificationAndFinalization 24.772 us/op 13.981 us/op 1.77
mainnet_e58758 - phase0 processRewardsAndPenalties 42.437 ms/op 34.802 ms/op 1.22
mainnet_e58758 - phase0 processRegistryUpdates 14.827 us/op 7.3380 us/op 2.02
mainnet_e58758 - phase0 processSlashings 665.00 ns/op 383.00 ns/op 1.74
mainnet_e58758 - phase0 processEth1DataReset 588.00 ns/op 329.00 ns/op 1.79
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2514 ms/op 956.28 us/op 1.31
mainnet_e58758 - phase0 processSlashingsReset 5.9920 us/op 2.3900 us/op 2.51
mainnet_e58758 - phase0 processRandaoMixesReset 6.1980 us/op 3.6900 us/op 1.68
mainnet_e58758 - phase0 processHistoricalRootsUpdate 908.00 ns/op 318.00 ns/op 2.86
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.0500 us/op 2.5460 us/op 2.38
mainnet_e58758 - phase0 afterProcessEpoch 87.073 ms/op 74.238 ms/op 1.17
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.7327 ms/op 1.4607 ms/op 1.19
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.4616 ms/op 2.0003 ms/op 1.23
altair processInactivityUpdates - 250000 normalcase 21.785 ms/op 15.835 ms/op 1.38
altair processInactivityUpdates - 250000 worstcase 21.202 ms/op 16.143 ms/op 1.31
phase0 processRegistryUpdates - 250000 normalcase 11.060 us/op 6.3070 us/op 1.75
phase0 processRegistryUpdates - 250000 badcase_full_deposits 406.86 us/op 231.80 us/op 1.76
phase0 processRegistryUpdates - 250000 worstcase 0.5 137.71 ms/op 116.32 ms/op 1.18
altair processRewardsAndPenalties - 250000 normalcase 49.068 ms/op 37.578 ms/op 1.31
altair processRewardsAndPenalties - 250000 worstcase 44.127 ms/op 41.204 ms/op 1.07
phase0 getAttestationDeltas - 250000 normalcase 8.1993 ms/op 6.7671 ms/op 1.21
phase0 getAttestationDeltas - 250000 worstcase 9.2125 ms/op 6.9649 ms/op 1.32
phase0 processSlashings - 250000 worstcase 115.11 us/op 73.997 us/op 1.56
altair processSyncCommitteeUpdates - 250000 148.31 ms/op 125.84 ms/op 1.18
BeaconState.hashTreeRoot - No change 259.00 ns/op 255.00 ns/op 1.02
BeaconState.hashTreeRoot - 1 full validator 153.97 us/op 126.88 us/op 1.21
BeaconState.hashTreeRoot - 32 full validator 1.7371 ms/op 1.2624 ms/op 1.38
BeaconState.hashTreeRoot - 512 full validator 16.329 ms/op 10.467 ms/op 1.56
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 145.79 us/op 135.96 us/op 1.07
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.1700 ms/op 1.8717 ms/op 1.16
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 28.621 ms/op 23.458 ms/op 1.22
BeaconState.hashTreeRoot - 1 balances 135.41 us/op 106.47 us/op 1.27
BeaconState.hashTreeRoot - 32 balances 1.4373 ms/op 1.1359 ms/op 1.27
BeaconState.hashTreeRoot - 512 balances 12.887 ms/op 7.7953 ms/op 1.65
BeaconState.hashTreeRoot - 250000 balances 170.64 ms/op 176.76 ms/op 0.97
aggregationBits - 2048 els - zipIndexesInBitList 29.703 us/op 23.203 us/op 1.28
byteArrayEquals 32 56.291 ns/op 53.282 ns/op 1.06
Buffer.compare 32 47.899 ns/op 45.654 ns/op 1.05
byteArrayEquals 1024 1.7086 us/op 1.5768 us/op 1.08
Buffer.compare 1024 58.069 ns/op 54.460 ns/op 1.07
byteArrayEquals 16384 26.616 us/op 25.061 us/op 1.06
Buffer.compare 16384 254.54 ns/op 223.47 ns/op 1.14
byteArrayEquals 123687377 206.50 ms/op 189.06 ms/op 1.09
Buffer.compare 123687377 8.3255 ms/op 6.0588 ms/op 1.37
byteArrayEquals 32 - diff last byte 56.417 ns/op 52.127 ns/op 1.08
Buffer.compare 32 - diff last byte 53.316 ns/op 46.241 ns/op 1.15
byteArrayEquals 1024 - diff last byte 1.6787 us/op 1.5704 us/op 1.07
Buffer.compare 1024 - diff last byte 60.491 ns/op 53.448 ns/op 1.13
byteArrayEquals 16384 - diff last byte 28.639 us/op 25.051 us/op 1.14
Buffer.compare 16384 - diff last byte 265.77 ns/op 241.30 ns/op 1.10
byteArrayEquals 123687377 - diff last byte 205.41 ms/op 189.00 ms/op 1.09
Buffer.compare 123687377 - diff last byte 9.0579 ms/op 6.2463 ms/op 1.45
byteArrayEquals 32 - random bytes 5.6350 ns/op 5.1380 ns/op 1.10
Buffer.compare 32 - random bytes 55.239 ns/op 47.990 ns/op 1.15
byteArrayEquals 1024 - random bytes 5.5470 ns/op 5.0880 ns/op 1.09
Buffer.compare 1024 - random bytes 51.420 ns/op 45.994 ns/op 1.12
byteArrayEquals 16384 - random bytes 5.6840 ns/op 5.1110 ns/op 1.11
Buffer.compare 16384 - random bytes 50.158 ns/op 46.084 ns/op 1.09
byteArrayEquals 123687377 - random bytes 7.1700 ns/op 6.3300 ns/op 1.13
Buffer.compare 123687377 - random bytes 53.300 ns/op 47.340 ns/op 1.13
regular array get 100000 times 38.736 us/op 35.354 us/op 1.10
wrappedArray get 100000 times 39.015 us/op 32.711 us/op 1.19
arrayWithProxy get 100000 times 16.388 ms/op 12.692 ms/op 1.29
ssz.Root.equals 59.585 ns/op 45.640 ns/op 1.31
byteArrayEquals 52.050 ns/op 44.980 ns/op 1.16
Buffer.compare 11.956 ns/op 10.348 ns/op 1.16
shuffle list - 16384 els 7.3553 ms/op 6.1637 ms/op 1.19
shuffle list - 250000 els 110.87 ms/op 89.758 ms/op 1.24
processSlot - 1 slots 15.506 us/op 13.595 us/op 1.14
processSlot - 32 slots 3.1464 ms/op 2.7954 ms/op 1.13
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.754 ms/op 37.215 ms/op 1.04
getCommitteeAssignments - req 1 vs - 250000 vc 2.2652 ms/op 2.1280 ms/op 1.06
getCommitteeAssignments - req 100 vs - 250000 vc 4.4104 ms/op 4.1202 ms/op 1.07
getCommitteeAssignments - req 1000 vs - 250000 vc 4.9652 ms/op 4.3665 ms/op 1.14
findModifiedValidators - 10000 modified validators 370.57 ms/op 254.87 ms/op 1.45
findModifiedValidators - 1000 modified validators 263.35 ms/op 173.24 ms/op 1.52
findModifiedValidators - 100 modified validators 215.40 ms/op 152.58 ms/op 1.41
findModifiedValidators - 10 modified validators 200.69 ms/op 147.90 ms/op 1.36
findModifiedValidators - 1 modified validators 230.90 ms/op 156.53 ms/op 1.48
findModifiedValidators - no difference 195.13 ms/op 144.44 ms/op 1.35
compare ViewDUs 3.3811 s/op 2.9063 s/op 1.16
compare each validator Uint8Array 1.2623 s/op 1.5876 s/op 0.80
compare ViewDU to Uint8Array 1.3111 s/op 1.0114 s/op 1.30
migrate state 1000000 validators, 24 modified, 0 new 600.42 ms/op 596.63 ms/op 1.01
migrate state 1000000 validators, 1700 modified, 1000 new 856.98 ms/op 798.65 ms/op 1.07
migrate state 1000000 validators, 3400 modified, 2000 new 1.0114 s/op 1.0478 s/op 0.97
migrate state 1500000 validators, 24 modified, 0 new 583.05 ms/op 626.04 ms/op 0.93
migrate state 1500000 validators, 1700 modified, 1000 new 802.38 ms/op 861.33 ms/op 0.93
migrate state 1500000 validators, 3400 modified, 2000 new 992.45 ms/op 1.0388 s/op 0.96
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.3500 ns/op 4.3000 ns/op 1.01
state getBlockRootAtSlot - 250000 vs - 7PWei 478.92 ns/op 496.24 ns/op 0.97
computeProposers - vc 250000 6.9068 ms/op 8.4079 ms/op 0.82
computeEpochShuffling - vc 250000 92.558 ms/op 97.198 ms/op 0.95
getNextSyncCommittee - vc 250000 123.51 ms/op 141.07 ms/op 0.88
computeSigningRoot for AttestationData 20.686 us/op 23.717 us/op 0.87
hash AttestationData serialized data then Buffer.toString(base64) 1.4984 us/op 1.5014 us/op 1.00
toHexString serialized data 904.17 ns/op 898.40 ns/op 1.01
Buffer.toString(base64) 176.61 ns/op 195.60 ns/op 0.90

Please sign in to comment.