这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@wemeetagain
Copy link
Member

Motivation

Description

  • use datastore-level by default, only use datastore-fs in bun

@wemeetagain wemeetagain requested a review from a team as a code owner October 6, 2025 15:47
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @wemeetagain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a regression by restoring datastore-level as the primary storage mechanism for peer data, which was inadvertently replaced by datastore-fs in a prior update. It introduces a conditional import strategy, allowing the system to leverage datastore-fs specifically when operating within the Bun runtime, thereby maintaining compatibility and performance across different environments.

Highlights

  • Datastore Default Reversion: The default datastore implementation has been reverted from datastore-fs back to datastore-level to address a regression identified after reviewing metrics from a previous change.
  • Bun-Specific Datastore: A conditional export has been introduced to ensure that datastore-fs is still utilized when the application is running in the Bun runtime environment, aliased as LevelDatastore.
  • Dependency Update: The datastore-level package has been added as a direct dependency, and yarn.lock has been updated to reflect this and other related dependency changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a performance regression by switching the default datastore implementation from datastore-fs to datastore-level, while retaining datastore-fs for the Bun environment. This is achieved through conditional exports in package.json, which is a clean approach. The changes in datastore.ts are consistent with this new abstraction.

My review includes a suggestion to improve the clarity of the new Bun-specific wrapper file. More importantly, I've identified that the unit tests for Eth2PeerDataStore have not been updated to reflect the change in the underlying datastore dependency. This is a high-priority issue that should be addressed to ensure the correctness and reliability of the code.

*/
export class Eth2PeerDataStore extends BaseDatastore {
private _dbDatastore: FsDatastore;
private _dbDatastore: LevelDatastore;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The unit tests for Eth2PeerDataStore in datastore.test.ts appear to be outdated after this change. They still mock datastore-fs and use FsDatastore, but the code under test now uses #datastore-wrapper, which resolves to datastore-level in the test environment (Node.js). The tests should be updated to mock #datastore-wrapper and use the correct LevelDatastore type to ensure the component is tested correctly with its new dependency.

Comment on lines +1 to +3
import {FsDatastore} from "datastore-fs";

export const LevelDatastore = FsDatastore;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better maintainability and to avoid confusion, it would be helpful to add a file-level comment explaining why FsDatastore is being re-exported as LevelDatastore. This file acts as a compatibility layer for the Bun environment, and a comment would clarify its purpose.

Suggested change
import {FsDatastore} from "datastore-fs";
export const LevelDatastore = FsDatastore;
/**
* In the Bun environment, `datastore-fs` is used for performance reasons.
* This module re-exports `FsDatastore` as `LevelDatastore` to provide a
* consistent interface for `Eth2PeerDataStore`, which expects `LevelDatastore`.
* The default Node.js environment uses the actual `datastore-level`.
*/
import {FsDatastore} from "datastore-fs";
export const LevelDatastore = FsDatastore;

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 7a0689e Previous: f45a2be Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0113 ms/op 988.18 us/op 1.02
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 37.183 us/op 36.574 us/op 1.02
BLS verify - blst 879.21 us/op 804.06 us/op 1.09
BLS verifyMultipleSignatures 3 - blst 1.2661 ms/op 1.2222 ms/op 1.04
BLS verifyMultipleSignatures 8 - blst 1.9115 ms/op 1.6792 ms/op 1.14
BLS verifyMultipleSignatures 32 - blst 5.6717 ms/op 4.9399 ms/op 1.15
BLS verifyMultipleSignatures 64 - blst 10.846 ms/op 9.2800 ms/op 1.17
BLS verifyMultipleSignatures 128 - blst 17.670 ms/op 17.813 ms/op 0.99
BLS deserializing 10000 signatures 703.03 ms/op 701.61 ms/op 1.00
BLS deserializing 100000 signatures 7.1358 s/op 7.0019 s/op 1.02
BLS verifyMultipleSignatures - same message - 3 - blst 1.0045 ms/op 947.08 us/op 1.06
BLS verifyMultipleSignatures - same message - 8 - blst 1.0874 ms/op 1.0765 ms/op 1.01
BLS verifyMultipleSignatures - same message - 32 - blst 1.7777 ms/op 1.7795 ms/op 1.00
BLS verifyMultipleSignatures - same message - 64 - blst 2.8913 ms/op 2.6508 ms/op 1.09
BLS verifyMultipleSignatures - same message - 128 - blst 4.4601 ms/op 4.4076 ms/op 1.01
BLS aggregatePubkeys 32 - blst 22.107 us/op 19.449 us/op 1.14
BLS aggregatePubkeys 128 - blst 70.176 us/op 69.414 us/op 1.01
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 65.586 ms/op 52.246 ms/op 1.26
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 54.318 ms/op 49.580 ms/op 1.10
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 39.658 ms/op 39.347 ms/op 1.01
getSlashingsAndExits - default max 73.983 us/op 75.688 us/op 0.98
getSlashingsAndExits - 2k 381.01 us/op 314.96 us/op 1.21
isKnown best case - 1 super set check 219.00 ns/op 213.00 ns/op 1.03
isKnown normal case - 2 super set checks 213.00 ns/op 209.00 ns/op 1.02
isKnown worse case - 16 super set checks 213.00 ns/op 208.00 ns/op 1.02
InMemoryCheckpointStateCache - add get delete 2.5280 us/op 2.4830 us/op 1.02
validate api signedAggregateAndProof - struct 1.5210 ms/op 1.5278 ms/op 1.00
validate gossip signedAggregateAndProof - struct 1.5844 ms/op 1.5571 ms/op 1.02
batch validate gossip attestation - vc 640000 - chunk 32 130.71 us/op 119.24 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 64 114.19 us/op 103.64 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 128 108.27 us/op 96.883 us/op 1.12
batch validate gossip attestation - vc 640000 - chunk 256 109.54 us/op 99.596 us/op 1.10
pickEth1Vote - no votes 1.0564 ms/op 978.34 us/op 1.08
pickEth1Vote - max votes 7.1799 ms/op 6.6401 ms/op 1.08
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.976 ms/op 11.470 ms/op 1.04
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 21.923 ms/op 16.314 ms/op 1.34
pickEth1Vote - Eth1Data fastSerialize value x2048 466.77 us/op 445.86 us/op 1.05
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.8692 ms/op 2.1891 ms/op 1.77
bytes32 toHexString 373.00 ns/op 367.00 ns/op 1.02
bytes32 Buffer.toString(hex) 262.00 ns/op 256.00 ns/op 1.02
bytes32 Buffer.toString(hex) from Uint8Array 364.00 ns/op 344.00 ns/op 1.06
bytes32 Buffer.toString(hex) + 0x 250.00 ns/op 252.00 ns/op 0.99
Object access 1 prop 0.11500 ns/op 0.11600 ns/op 0.99
Map access 1 prop 0.12000 ns/op 0.12300 ns/op 0.98
Object get x1000 6.0790 ns/op 6.2390 ns/op 0.97
Map get x1000 6.6320 ns/op 6.7200 ns/op 0.99
Object set x1000 30.713 ns/op 32.369 ns/op 0.95
Map set x1000 20.607 ns/op 20.694 ns/op 1.00
Return object 10000 times 0.29530 ns/op 0.29390 ns/op 1.00
Throw Error 10000 times 4.5496 us/op 4.4609 us/op 1.02
toHex 145.77 ns/op 136.13 ns/op 1.07
Buffer.from 134.40 ns/op 124.98 ns/op 1.08
shared Buffer 89.734 ns/op 81.434 ns/op 1.10
fastMsgIdFn sha256 / 200 bytes 2.4850 us/op 2.2320 us/op 1.11
fastMsgIdFn h32 xxhash / 200 bytes 208.00 ns/op 195.00 ns/op 1.07
fastMsgIdFn h64 xxhash / 200 bytes 266.00 ns/op 250.00 ns/op 1.06
fastMsgIdFn sha256 / 1000 bytes 7.7210 us/op 7.3020 us/op 1.06
fastMsgIdFn h32 xxhash / 1000 bytes 374.00 ns/op 344.00 ns/op 1.09
fastMsgIdFn h64 xxhash / 1000 bytes 369.00 ns/op 325.00 ns/op 1.14
fastMsgIdFn sha256 / 10000 bytes 66.695 us/op 65.838 us/op 1.01
fastMsgIdFn h32 xxhash / 10000 bytes 2.0190 us/op 2.1890 us/op 0.92
fastMsgIdFn h64 xxhash / 10000 bytes 1.2340 us/op 1.2410 us/op 0.99
send data - 1000 256B messages 17.877 ms/op 17.548 ms/op 1.02
send data - 1000 512B messages 21.451 ms/op 21.658 ms/op 0.99
send data - 1000 1024B messages 29.614 ms/op 29.511 ms/op 1.00
send data - 1000 1200B messages 27.833 ms/op 24.526 ms/op 1.13
send data - 1000 2048B messages 28.387 ms/op 25.293 ms/op 1.12
send data - 1000 4096B messages 34.923 ms/op 31.307 ms/op 1.12
send data - 1000 16384B messages 52.079 ms/op 48.485 ms/op 1.07
send data - 1000 65536B messages 120.95 ms/op 120.78 ms/op 1.00
enrSubnets - fastDeserialize 64 bits 914.00 ns/op 944.00 ns/op 0.97
enrSubnets - ssz BitVector 64 bits 366.00 ns/op 317.00 ns/op 1.15
enrSubnets - fastDeserialize 4 bits 133.00 ns/op 125.00 ns/op 1.06
enrSubnets - ssz BitVector 4 bits 385.00 ns/op 314.00 ns/op 1.23
prioritizePeers score -10:0 att 32-0.1 sync 2-0 319.96 us/op 248.67 us/op 1.29
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 352.86 us/op 268.89 us/op 1.31
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 504.04 us/op 387.04 us/op 1.30
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 955.70 us/op 732.56 us/op 1.30
prioritizePeers score 0:0 att 64-1 sync 4-1 1.1447 ms/op 875.83 us/op 1.31
array of 16000 items push then shift 1.6857 us/op 1.6453 us/op 1.02
LinkedList of 16000 items push then shift 8.4960 ns/op 7.6750 ns/op 1.11
array of 16000 items push then pop 82.056 ns/op 80.978 ns/op 1.01
LinkedList of 16000 items push then pop 7.7120 ns/op 7.4790 ns/op 1.03
array of 24000 items push then shift 2.4545 us/op 2.4906 us/op 0.99
LinkedList of 24000 items push then shift 8.3790 ns/op 7.4770 ns/op 1.12
array of 24000 items push then pop 124.32 ns/op 111.96 ns/op 1.11
LinkedList of 24000 items push then pop 7.7190 ns/op 7.4640 ns/op 1.03
intersect bitArray bitLen 8 6.5270 ns/op 7.1580 ns/op 0.91
intersect array and set length 8 40.167 ns/op 40.327 ns/op 1.00
intersect bitArray bitLen 128 30.220 ns/op 36.973 ns/op 0.82
intersect array and set length 128 628.87 ns/op 625.20 ns/op 1.01
bitArray.getTrueBitIndexes() bitLen 128 1.7320 us/op 1.0580 us/op 1.64
bitArray.getTrueBitIndexes() bitLen 248 2.3200 us/op 1.8010 us/op 1.29
bitArray.getTrueBitIndexes() bitLen 512 4.8230 us/op 3.7120 us/op 1.30
Buffer.concat 32 items 625.00 ns/op 606.00 ns/op 1.03
Uint8Array.set 32 items 1.5050 us/op 1.0090 us/op 1.49
Buffer.copy 3.2630 us/op 2.1520 us/op 1.52
Uint8Array.set - with subarray 2.1500 us/op 1.7910 us/op 1.20
Uint8Array.set - without subarray 1.0910 us/op 1.3980 us/op 0.78
getUint32 - dataview 203.00 ns/op 180.00 ns/op 1.13
getUint32 - manual 136.00 ns/op 122.00 ns/op 1.11
Set add up to 64 items then delete first 2.3307 us/op 2.2721 us/op 1.03
OrderedSet add up to 64 items then delete first 3.6643 us/op 3.8439 us/op 0.95
Set add up to 64 items then delete last 2.7850 us/op 2.4226 us/op 1.15
OrderedSet add up to 64 items then delete last 4.5598 us/op 4.1580 us/op 1.10
Set add up to 64 items then delete middle 2.4416 us/op 2.9422 us/op 0.83
OrderedSet add up to 64 items then delete middle 5.8613 us/op 5.9110 us/op 0.99
Set add up to 128 items then delete first 5.6313 us/op 6.3133 us/op 0.89
OrderedSet add up to 128 items then delete first 8.5737 us/op 9.5521 us/op 0.90
Set add up to 128 items then delete last 5.7024 us/op 5.7832 us/op 0.99
OrderedSet add up to 128 items then delete last 9.3746 us/op 8.8908 us/op 1.05
Set add up to 128 items then delete middle 5.1332 us/op 5.5262 us/op 0.93
OrderedSet add up to 128 items then delete middle 15.266 us/op 14.663 us/op 1.04
Set add up to 256 items then delete first 10.392 us/op 11.267 us/op 0.92
OrderedSet add up to 256 items then delete first 15.835 us/op 16.514 us/op 0.96
Set add up to 256 items then delete last 10.774 us/op 11.665 us/op 0.92
OrderedSet add up to 256 items then delete last 17.693 us/op 16.879 us/op 1.05
Set add up to 256 items then delete middle 11.285 us/op 9.8617 us/op 1.14
OrderedSet add up to 256 items then delete middle 46.786 us/op 42.605 us/op 1.10
transfer serialized Status (84 B) 2.2870 us/op 2.2820 us/op 1.00
copy serialized Status (84 B) 1.2350 us/op 1.1620 us/op 1.06
transfer serialized SignedVoluntaryExit (112 B) 2.4600 us/op 2.2810 us/op 1.08
copy serialized SignedVoluntaryExit (112 B) 1.2980 us/op 1.3260 us/op 0.98
transfer serialized ProposerSlashing (416 B) 2.3790 us/op 2.3510 us/op 1.01
copy serialized ProposerSlashing (416 B) 1.5640 us/op 1.2700 us/op 1.23
transfer serialized Attestation (485 B) 2.7870 us/op 2.3010 us/op 1.21
copy serialized Attestation (485 B) 1.5070 us/op 1.2490 us/op 1.21
transfer serialized AttesterSlashing (33232 B) 2.5160 us/op 2.6090 us/op 0.96
copy serialized AttesterSlashing (33232 B) 3.5770 us/op 3.8720 us/op 0.92
transfer serialized Small SignedBeaconBlock (128000 B) 3.1260 us/op 3.3980 us/op 0.92
copy serialized Small SignedBeaconBlock (128000 B) 10.960 us/op 10.085 us/op 1.09
transfer serialized Avg SignedBeaconBlock (200000 B) 3.5280 us/op 3.8030 us/op 0.93
copy serialized Avg SignedBeaconBlock (200000 B) 14.949 us/op 14.195 us/op 1.05
transfer serialized BlobsSidecar (524380 B) 3.3560 us/op 3.6840 us/op 0.91
copy serialized BlobsSidecar (524380 B) 66.834 us/op 92.903 us/op 0.72
transfer serialized Big SignedBeaconBlock (1000000 B) 3.5540 us/op 4.0310 us/op 0.88
copy serialized Big SignedBeaconBlock (1000000 B) 116.05 us/op 113.83 us/op 1.02
pass gossip attestations to forkchoice per slot 2.7962 ms/op 2.7671 ms/op 1.01
forkChoice updateHead vc 100000 bc 64 eq 0 471.04 us/op 456.25 us/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 0 2.9486 ms/op 2.8136 ms/op 1.05
forkChoice updateHead vc 1000000 bc 64 eq 0 4.9048 ms/op 4.8696 ms/op 1.01
forkChoice updateHead vc 600000 bc 320 eq 0 2.9357 ms/op 2.8049 ms/op 1.05
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9264 ms/op 2.8911 ms/op 1.01
forkChoice updateHead vc 600000 bc 7200 eq 0 3.1450 ms/op 3.3990 ms/op 0.93
forkChoice updateHead vc 600000 bc 64 eq 1000 10.516 ms/op 10.480 ms/op 1.00
forkChoice updateHead vc 600000 bc 64 eq 10000 10.486 ms/op 10.396 ms/op 1.01
forkChoice updateHead vc 600000 bc 64 eq 300000 13.702 ms/op 13.409 ms/op 1.02
computeDeltas 500000 validators 300 proto nodes 4.0393 ms/op 3.9645 ms/op 1.02
computeDeltas 500000 validators 1200 proto nodes 4.0865 ms/op 3.9792 ms/op 1.03
computeDeltas 500000 validators 7200 proto nodes 4.0653 ms/op 4.0193 ms/op 1.01
computeDeltas 750000 validators 300 proto nodes 6.0201 ms/op 5.9191 ms/op 1.02
computeDeltas 750000 validators 1200 proto nodes 5.9350 ms/op 5.8672 ms/op 1.01
computeDeltas 750000 validators 7200 proto nodes 5.9575 ms/op 6.2258 ms/op 0.96
computeDeltas 1400000 validators 300 proto nodes 11.120 ms/op 10.969 ms/op 1.01
computeDeltas 1400000 validators 1200 proto nodes 11.221 ms/op 11.122 ms/op 1.01
computeDeltas 1400000 validators 7200 proto nodes 11.102 ms/op 11.234 ms/op 0.99
computeDeltas 2100000 validators 300 proto nodes 16.804 ms/op 17.043 ms/op 0.99
computeDeltas 2100000 validators 1200 proto nodes 16.907 ms/op 16.736 ms/op 1.01
computeDeltas 2100000 validators 7200 proto nodes 16.765 ms/op 16.482 ms/op 1.02
altair processAttestation - 250000 vs - 7PWei normalcase 2.0810 ms/op 2.0048 ms/op 1.04
altair processAttestation - 250000 vs - 7PWei worstcase 3.0449 ms/op 3.0343 ms/op 1.00
altair processAttestation - setStatus - 1/6 committees join 126.27 us/op 126.88 us/op 1.00
altair processAttestation - setStatus - 1/3 committees join 257.12 us/op 235.09 us/op 1.09
altair processAttestation - setStatus - 1/2 committees join 356.39 us/op 335.84 us/op 1.06
altair processAttestation - setStatus - 2/3 committees join 451.04 us/op 429.79 us/op 1.05
altair processAttestation - setStatus - 4/5 committees join 627.72 us/op 594.81 us/op 1.06
altair processAttestation - setStatus - 100% committees join 725.76 us/op 719.11 us/op 1.01
altair processBlock - 250000 vs - 7PWei normalcase 5.7772 ms/op 4.6394 ms/op 1.25
altair processBlock - 250000 vs - 7PWei normalcase hashState 43.766 ms/op 29.461 ms/op 1.49
altair processBlock - 250000 vs - 7PWei worstcase 43.692 ms/op 34.671 ms/op 1.26
altair processBlock - 250000 vs - 7PWei worstcase hashState 90.196 ms/op 76.855 ms/op 1.17
phase0 processBlock - 250000 vs - 7PWei normalcase 1.7867 ms/op 1.6182 ms/op 1.10
phase0 processBlock - 250000 vs - 7PWei worstcase 29.514 ms/op 20.306 ms/op 1.45
altair processEth1Data - 250000 vs - 7PWei normalcase 352.60 us/op 339.12 us/op 1.04
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 9.7390 us/op 6.2260 us/op 1.56
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 58.852 us/op 44.929 us/op 1.31
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.586 us/op 9.7980 us/op 1.08
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 10.661 us/op 6.1590 us/op 1.73
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 250.84 us/op 154.08 us/op 1.63
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.9270 ms/op 1.8969 ms/op 1.02
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4657 ms/op 2.3725 ms/op 1.04
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.4977 ms/op 2.3786 ms/op 1.05
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.8554 ms/op 4.4826 ms/op 1.08
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.4867 ms/op 2.4187 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.7627 ms/op 4.5597 ms/op 1.04
Tree 40 250000 create 442.40 ms/op 403.62 ms/op 1.10
Tree 40 250000 get(125000) 143.39 ns/op 141.70 ns/op 1.01
Tree 40 250000 set(125000) 1.5637 us/op 1.3814 us/op 1.13
Tree 40 250000 toArray() 19.574 ms/op 15.402 ms/op 1.27
Tree 40 250000 iterate all - toArray() + loop 18.918 ms/op 16.128 ms/op 1.17
Tree 40 250000 iterate all - get(i) 57.858 ms/op 53.256 ms/op 1.09
Array 250000 create 2.5393 ms/op 2.3253 ms/op 1.09
Array 250000 clone - spread 840.28 us/op 789.49 us/op 1.06
Array 250000 get(125000) 0.43800 ns/op 0.39600 ns/op 1.11
Array 250000 set(125000) 0.44300 ns/op 0.41500 ns/op 1.07
Array 250000 iterate all - loop 93.579 us/op 109.24 us/op 0.86
phase0 afterProcessEpoch - 250000 vs - 7PWei 42.216 ms/op 41.451 ms/op 1.02
Array.fill - length 1000000 3.4273 ms/op 3.4460 ms/op 0.99
Array push - length 1000000 14.158 ms/op 12.082 ms/op 1.17
Array.get 0.27431 ns/op 0.27119 ns/op 1.01
Uint8Array.get 0.43779 ns/op 0.43752 ns/op 1.00
phase0 beforeProcessEpoch - 250000 vs - 7PWei 17.906 ms/op 18.768 ms/op 0.95
altair processEpoch - mainnet_e81889 260.57 ms/op 268.00 ms/op 0.97
mainnet_e81889 - altair beforeProcessEpoch 18.575 ms/op 16.574 ms/op 1.12
mainnet_e81889 - altair processJustificationAndFinalization 5.2440 us/op 5.3790 us/op 0.97
mainnet_e81889 - altair processInactivityUpdates 5.1932 ms/op 4.1138 ms/op 1.26
mainnet_e81889 - altair processRewardsAndPenalties 42.012 ms/op 39.426 ms/op 1.07
mainnet_e81889 - altair processRegistryUpdates 758.00 ns/op 685.00 ns/op 1.11
mainnet_e81889 - altair processSlashings 180.00 ns/op 174.00 ns/op 1.03
mainnet_e81889 - altair processEth1DataReset 176.00 ns/op 168.00 ns/op 1.05
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2151 ms/op 1.1826 ms/op 1.03
mainnet_e81889 - altair processSlashingsReset 1.1790 us/op 849.00 ns/op 1.39
mainnet_e81889 - altair processRandaoMixesReset 1.2870 us/op 1.0900 us/op 1.18
mainnet_e81889 - altair processHistoricalRootsUpdate 183.00 ns/op 170.00 ns/op 1.08
mainnet_e81889 - altair processParticipationFlagUpdates 535.00 ns/op 498.00 ns/op 1.07
mainnet_e81889 - altair processSyncCommitteeUpdates 140.00 ns/op 135.00 ns/op 1.04
mainnet_e81889 - altair afterProcessEpoch 44.220 ms/op 43.598 ms/op 1.01
capella processEpoch - mainnet_e217614 948.37 ms/op 898.20 ms/op 1.06
mainnet_e217614 - capella beforeProcessEpoch 68.829 ms/op 61.536 ms/op 1.12
mainnet_e217614 - capella processJustificationAndFinalization 5.2860 us/op 5.2470 us/op 1.01
mainnet_e217614 - capella processInactivityUpdates 14.506 ms/op 13.948 ms/op 1.04
mainnet_e217614 - capella processRewardsAndPenalties 198.30 ms/op 179.97 ms/op 1.10
mainnet_e217614 - capella processRegistryUpdates 6.9290 us/op 6.2800 us/op 1.10
mainnet_e217614 - capella processSlashings 205.00 ns/op 170.00 ns/op 1.21
mainnet_e217614 - capella processEth1DataReset 192.00 ns/op 168.00 ns/op 1.14
mainnet_e217614 - capella processEffectiveBalanceUpdates 14.081 ms/op 4.0747 ms/op 3.46
mainnet_e217614 - capella processSlashingsReset 1.0030 us/op 840.00 ns/op 1.19
mainnet_e217614 - capella processRandaoMixesReset 1.1650 us/op 1.1180 us/op 1.04
mainnet_e217614 - capella processHistoricalRootsUpdate 187.00 ns/op 170.00 ns/op 1.10
mainnet_e217614 - capella processParticipationFlagUpdates 583.00 ns/op 512.00 ns/op 1.14
mainnet_e217614 - capella afterProcessEpoch 115.02 ms/op 110.44 ms/op 1.04
phase0 processEpoch - mainnet_e58758 339.59 ms/op 307.33 ms/op 1.10
mainnet_e58758 - phase0 beforeProcessEpoch 80.788 ms/op 77.990 ms/op 1.04
mainnet_e58758 - phase0 processJustificationAndFinalization 9.0510 us/op 5.4430 us/op 1.66
mainnet_e58758 - phase0 processRewardsAndPenalties 48.527 ms/op 36.287 ms/op 1.34
mainnet_e58758 - phase0 processRegistryUpdates 3.0330 us/op 3.0620 us/op 0.99
mainnet_e58758 - phase0 processSlashings 176.00 ns/op 175.00 ns/op 1.01
mainnet_e58758 - phase0 processEth1DataReset 171.00 ns/op 167.00 ns/op 1.02
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1815 ms/op 1.1943 ms/op 0.99
mainnet_e58758 - phase0 processSlashingsReset 925.00 ns/op 895.00 ns/op 1.03
mainnet_e58758 - phase0 processRandaoMixesReset 1.5410 us/op 1.1290 us/op 1.36
mainnet_e58758 - phase0 processHistoricalRootsUpdate 178.00 ns/op 171.00 ns/op 1.04
mainnet_e58758 - phase0 processParticipationRecordUpdates 891.00 ns/op 892.00 ns/op 1.00
mainnet_e58758 - phase0 afterProcessEpoch 36.040 ms/op 34.665 ms/op 1.04
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.8508 ms/op 1.3110 ms/op 1.41
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.8821 ms/op 1.9451 ms/op 0.97
altair processInactivityUpdates - 250000 normalcase 19.422 ms/op 17.220 ms/op 1.13
altair processInactivityUpdates - 250000 worstcase 21.593 ms/op 18.237 ms/op 1.18
phase0 processRegistryUpdates - 250000 normalcase 11.051 us/op 5.3140 us/op 2.08
phase0 processRegistryUpdates - 250000 badcase_full_deposits 450.75 us/op 233.61 us/op 1.93
phase0 processRegistryUpdates - 250000 worstcase 0.5 115.55 ms/op 106.77 ms/op 1.08
altair processRewardsAndPenalties - 250000 normalcase 32.977 ms/op 25.786 ms/op 1.28
altair processRewardsAndPenalties - 250000 worstcase 36.030 ms/op 26.385 ms/op 1.37
phase0 getAttestationDeltas - 250000 normalcase 12.505 ms/op 6.9417 ms/op 1.80
phase0 getAttestationDeltas - 250000 worstcase 7.8126 ms/op 6.4235 ms/op 1.22
phase0 processSlashings - 250000 worstcase 122.61 us/op 77.452 us/op 1.58
altair processSyncCommitteeUpdates - 250000 11.797 ms/op 10.729 ms/op 1.10
BeaconState.hashTreeRoot - No change 227.00 ns/op 210.00 ns/op 1.08
BeaconState.hashTreeRoot - 1 full validator 89.271 us/op 85.922 us/op 1.04
BeaconState.hashTreeRoot - 32 full validator 886.20 us/op 890.80 us/op 0.99
BeaconState.hashTreeRoot - 512 full validator 10.205 ms/op 10.866 ms/op 0.94
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 115.97 us/op 111.00 us/op 1.04
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.8145 ms/op 1.4294 ms/op 1.27
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 23.018 ms/op 21.341 ms/op 1.08
BeaconState.hashTreeRoot - 1 balances 97.246 us/op 88.715 us/op 1.10
BeaconState.hashTreeRoot - 32 balances 651.87 us/op 856.06 us/op 0.76
BeaconState.hashTreeRoot - 512 balances 7.6834 ms/op 8.5153 ms/op 0.90
BeaconState.hashTreeRoot - 250000 balances 209.21 ms/op 156.64 ms/op 1.34
aggregationBits - 2048 els - zipIndexesInBitList 22.203 us/op 21.158 us/op 1.05
byteArrayEquals 32 54.239 ns/op 52.834 ns/op 1.03
Buffer.compare 32 19.809 ns/op 16.925 ns/op 1.17
byteArrayEquals 1024 1.6017 us/op 1.5740 us/op 1.02
Buffer.compare 1024 28.075 ns/op 24.398 ns/op 1.15
byteArrayEquals 16384 26.075 us/op 25.089 us/op 1.04
Buffer.compare 16384 185.49 ns/op 182.55 ns/op 1.02
byteArrayEquals 123687377 195.20 ms/op 188.99 ms/op 1.03
Buffer.compare 123687377 7.5902 ms/op 7.1497 ms/op 1.06
byteArrayEquals 32 - diff last byte 54.448 ns/op 52.523 ns/op 1.04
Buffer.compare 32 - diff last byte 17.723 ns/op 17.184 ns/op 1.03
byteArrayEquals 1024 - diff last byte 1.6166 us/op 1.5859 us/op 1.02
Buffer.compare 1024 - diff last byte 27.103 ns/op 25.041 ns/op 1.08
byteArrayEquals 16384 - diff last byte 25.601 us/op 25.239 us/op 1.01
Buffer.compare 16384 - diff last byte 200.45 ns/op 186.77 ns/op 1.07
byteArrayEquals 123687377 - diff last byte 195.29 ms/op 198.57 ms/op 0.98
Buffer.compare 123687377 - diff last byte 7.9172 ms/op 17.204 ms/op 0.46
byteArrayEquals 32 - random bytes 5.2000 ns/op 5.8880 ns/op 0.88
Buffer.compare 32 - random bytes 20.054 ns/op 23.719 ns/op 0.85
byteArrayEquals 1024 - random bytes 5.1790 ns/op 5.8650 ns/op 0.88
Buffer.compare 1024 - random bytes 19.979 ns/op 24.440 ns/op 0.82
byteArrayEquals 16384 - random bytes 5.1600 ns/op 5.7210 ns/op 0.90
Buffer.compare 16384 - random bytes 27.612 ns/op 23.845 ns/op 1.16
byteArrayEquals 123687377 - random bytes 7.0900 ns/op 7.8800 ns/op 0.90
Buffer.compare 123687377 - random bytes 21.890 ns/op 18.880 ns/op 1.16
regular array get 100000 times 34.081 us/op 37.545 us/op 0.91
wrappedArray get 100000 times 34.078 us/op 35.873 us/op 0.95
arrayWithProxy get 100000 times 13.228 ms/op 15.715 ms/op 0.84
ssz.Root.equals 47.849 ns/op 66.663 ns/op 0.72
byteArrayEquals 46.939 ns/op 50.042 ns/op 0.94
Buffer.compare 10.747 ns/op 13.793 ns/op 0.78
processSlot - 1 slots 11.137 us/op 15.027 us/op 0.74
processSlot - 32 slots 2.1602 ms/op 4.9489 ms/op 0.44
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 3.3801 ms/op 8.5184 ms/op 0.40
getCommitteeAssignments - req 1 vs - 250000 vc 2.1848 ms/op 2.3205 ms/op 0.94
getCommitteeAssignments - req 100 vs - 250000 vc 4.2191 ms/op 4.9106 ms/op 0.86
getCommitteeAssignments - req 1000 vs - 250000 vc 4.5148 ms/op 4.8610 ms/op 0.93
findModifiedValidators - 10000 modified validators 765.46 ms/op 996.39 ms/op 0.77
findModifiedValidators - 1000 modified validators 700.02 ms/op 905.56 ms/op 0.77
findModifiedValidators - 100 modified validators 262.50 ms/op 383.91 ms/op 0.68
findModifiedValidators - 10 modified validators 173.10 ms/op 277.27 ms/op 0.62
findModifiedValidators - 1 modified validators 143.26 ms/op 365.29 ms/op 0.39
findModifiedValidators - no difference 273.43 ms/op 337.92 ms/op 0.81
compare ViewDUs 6.6029 s/op 8.6982 s/op 0.76
compare each validator Uint8Array 1.5991 s/op 1.6984 s/op 0.94
compare ViewDU to Uint8Array 1.0117 s/op 1.4890 s/op 0.68
migrate state 1000000 validators, 24 modified, 0 new 865.05 ms/op 1.0918 s/op 0.79
migrate state 1000000 validators, 1700 modified, 1000 new 1.1479 s/op 1.6247 s/op 0.71
migrate state 1000000 validators, 3400 modified, 2000 new 1.3996 s/op 1.7804 s/op 0.79
migrate state 1500000 validators, 24 modified, 0 new 904.75 ms/op 1.1132 s/op 0.81
migrate state 1500000 validators, 1700 modified, 1000 new 1.1065 s/op 1.4553 s/op 0.76
migrate state 1500000 validators, 3400 modified, 2000 new 1.3149 s/op 1.3988 s/op 0.94
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.2000 ns/op 4.4000 ns/op 0.95
state getBlockRootAtSlot - 250000 vs - 7PWei 381.52 ns/op 585.92 ns/op 0.65
naive computeProposerIndex 100000 validators 50.309 ms/op 51.460 ms/op 0.98
computeProposerIndex 100000 validators 1.5120 ms/op 1.4985 ms/op 1.01
naiveGetNextSyncCommitteeIndices 1000 validators 7.6464 s/op 7.3722 s/op 1.04
getNextSyncCommitteeIndices 1000 validators 112.19 ms/op 116.37 ms/op 0.96
naiveGetNextSyncCommitteeIndices 10000 validators 7.7454 s/op 7.4228 s/op 1.04
getNextSyncCommitteeIndices 10000 validators 113.89 ms/op 114.87 ms/op 0.99
naiveGetNextSyncCommitteeIndices 100000 validators 7.9003 s/op 7.8617 s/op 1.00
getNextSyncCommitteeIndices 100000 validators 113.84 ms/op 113.07 ms/op 1.01
naive computeShuffledIndex 100000 validators 24.496 s/op 24.250 s/op 1.01
cached computeShuffledIndex 100000 validators 557.64 ms/op 570.99 ms/op 0.98
naive computeShuffledIndex 2000000 validators 531.16 s/op 547.44 s/op 0.97
cached computeShuffledIndex 2000000 validators 32.319 s/op 59.430 s/op 0.54
computeProposers - vc 250000 611.35 us/op 641.12 us/op 0.95
computeEpochShuffling - vc 250000 41.560 ms/op 45.491 ms/op 0.91
getNextSyncCommittee - vc 250000 10.305 ms/op 13.188 ms/op 0.78
computeSigningRoot for AttestationData 19.177 us/op 41.759 us/op 0.46
hash AttestationData serialized data then Buffer.toString(base64) 1.5717 us/op 1.8152 us/op 0.87
toHexString serialized data 1.1632 us/op 2.8017 us/op 0.42
Buffer.toString(base64) 150.99 ns/op 180.84 ns/op 0.83
nodejs block root to RootHex using toHex 135.06 ns/op 161.51 ns/op 0.84
nodejs block root to RootHex using toRootHex 93.912 ns/op 134.99 ns/op 0.70
nodejs fromhex(blob) 116.31 ms/op 137.90 ms/op 0.84
nodejs fromHexInto(blob) 94.962 ms/op 104.16 ms/op 0.91
browser block root to RootHex using the deprecated toHexString 216.08 ns/op 261.05 ns/op 0.83
browser block root to RootHex using toHex 170.42 ns/op 249.68 ns/op 0.68
browser block root to RootHex using toRootHex 159.75 ns/op 175.16 ns/op 0.91
browser fromHexInto(blob) 820.57 us/op 928.74 us/op 0.88
browser fromHex(blob) 791.65 ms/op 962.90 ms/op 0.82

by benchmarkbot/action

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 52.23%. Comparing base (f45a2be) to head (3bfcab0).
⚠️ Report is 3 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8503      +/-   ##
============================================
- Coverage     52.24%   52.23%   -0.02%     
============================================
  Files           852      852              
  Lines         65004    65004              
  Branches       4774     4771       -3     
============================================
- Hits          33962    33955       -7     
- Misses        30973    30980       +7     
  Partials         69       69              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wemeetagain wemeetagain merged commit 497d67c into unstable Oct 6, 2025
36 of 39 checks passed
@wemeetagain wemeetagain deleted the cayman/datastore-level branch October 6, 2025 19:51
@wemeetagain
Copy link
Member Author

🎉 This PR is included in v1.35.0 🎉

AbolareRoheemah pushed a commit to AbolareRoheemah/lodestar that referenced this pull request Oct 14, 2025
**Motivation**

- Review of ChainSafe#8468 metrics
- In ChainSafe#8449, use of
`datastore-level` was unilaterally removed in favor of the bun-supported
`datastore-fs`
- This caused a regression

**Description**
- use `datastore-level` by default, only use `datastore-fs` in bun

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants