Skip to content

Commit

Permalink
feat: add call support to verified requests for prover (#5462)
Browse files Browse the repository at this point in the history
* Update the readme with details

* Restructure utility methods to make consistent pattern

* Add call support for verified requests

* Update the evm logic

* Update the logger data type

* Add more structured tests

* Move e2e tests to mainnet to make them stable for now till setup CI

* Update readme

* Fix a typo
  • Loading branch information
nazarhussain committed May 15, 2023
1 parent 249aa75 commit 375d660
Show file tree
Hide file tree
Showing 43 changed files with 19,248 additions and 1,841 deletions.
77 changes: 70 additions & 7 deletions packages/prover/README.md
Expand Up @@ -18,12 +18,14 @@ import Web3 from "web3";
import {createVerifiedExecutionProvider, LCTransport} from "@lodestar/prover";

const {provider, proofProvider} = createVerifiedExecutionProvider(
new Web3.providers.HttpProvider("https://lodestar-sepoliarpc.chainsafe.io"), {
transport: LCTransport.Rest,
urls: ["https://lodestar-sepolia.chainsafe.io"],
network: "sepolia",
wsCheckpoint: "trusted-checkpoint"
});
new Web3.providers.HttpProvider("https://lodestar-sepoliarpc.chainsafe.io"),
{
transport: LCTransport.Rest,
urls: ["https://lodestar-sepolia.chainsafe.io"],
network: "sepolia",
wsCheckpoint: "trusted-checkpoint",
}
);

const web3 = new Web3(provider);

Expand All @@ -35,7 +37,7 @@ console.log({balance, address});
You can also invoke the package as binary.

```bash
npm -i g @lodestar/prover
npm -i g @lodestar/prover

lodestar-prover start \
--network sepolia \
Expand All @@ -45,6 +47,67 @@ lodestar-prover start \
--port 8080
```

## Supported Web3 Methods

✅ - Completed

⌛ - Todo

➡️ - Request will be forward to EL without any intermediary manipulations.

| Group | Method | Status | Version |
| ----------------- | --------------------------------------- | ------ | ------- |
| Block | eth_getBlockByHash || v0 |
| | eth_getBlockByNumber || v0 |
| | eth_getBlockTransactionCountByHash || v2 |
| | eth_getBlockTransactionCountByNumber || v2 |
| | eth_getUncleCountByBlockHash || v2 |
| | eth_getUncleCountByBlockNumber || v2 |
| Chain/Network | eth_chainId | ➡️ |
| | eth_syncing || v1 |
| | eth_coinbase || v2 |
| | eth_accounts | ➡️ |
| | eth_blockNumber | ➡️ |
| Call and Estimate | eth_call || v0 |
| | eth_estimateGas || v0 |
| | eth_createAccessList || v2 |
| | eth_gasPrice || v1 |
| | eth_maxPriorityFeePerGas || v1 |
| | eth_feeHistory || v2 |
| Filters | eth_newFilter || v2 |
| | eth_newBlockFilter || v2 |
| | eth_newPendingTransactionFilter || v2 |
| | eth_uninstallFilter || v2 |
| | eth_getFilterChanges || v2 |
| | eth_getFilterLogs || v2 |
| | eth_getLogs || v1 |
| Mining | eth_mining | ➡️ |
| | eth_hashrate | ➡️ |
| | eth_getWork | ➡️ |
| | eth_submitWork | ➡️ |
| | eth_submitHashrate | ➡️ |
| Signing | eth_sign | ➡️ |
| | eth_signTransaction | ➡️ |
| State | eth_getBalance || v0 |
| | eth_getStorageAt || v1 |
| | eth_getTransactionCount || v2 |
| | eth_getCode || v0 |
| | eth_getProof | ➡️ |
| Transactions | eth_sendTransaction | ➡️ |
| | eth_sendRawTransaction | ➡️ |
| | eth_getTransactionByHash || v2 |
| | eth_getTransactionByBlockHashAndIndex || v2 |
| | eth_getTransactionByBlockNumberAndIndex || v2 |
| | eth_getTransactionReceipt || v2 |

## Non-supported features

- Currently does not support batch requests.

## Warnings

- To use this prover the ehtereum provider must support the `eth_getProof` method. Unfortunately, Infura does not currently support this endpoint. As an alternative, we suggest using Alchemy.

## Prerequisites

- [Lerna](https://github.com/lerna/lerna)
Expand Down
10 changes: 6 additions & 4 deletions packages/prover/package.json
Expand Up @@ -58,11 +58,13 @@
"generate-fixtures": "npx ts-node --esm scripts/generate_fixtures.ts"
},
"dependencies": {
"@ethereumjs/block": "^4.2.1",
"@ethereumjs/common": "^3.1.1",
"@ethereumjs/block": "^4.2.2",
"@ethereumjs/common": "^3.1.2",
"@ethereumjs/rlp": "^4.0.1",
"@ethereumjs/trie": "^5.0.4",
"@ethereumjs/util": "^8.0.5",
"@ethereumjs/trie": "^5.0.5",
"@ethereumjs/util": "^8.0.6",
"@ethereumjs/vm": "^6.4.2",
"@ethereumjs/blockchain": "^6.2.2",
"@lodestar/api": "^1.8.0",
"@lodestar/config": "^1.8.0",
"@lodestar/light-client": "^1.8.0",
Expand Down
223 changes: 161 additions & 62 deletions packages/prover/scripts/generate_fixtures.ts
Expand Up @@ -23,41 +23,104 @@ const networkURLs: Record<NETWORK, {beacon: string; rpc: string}> = {

let idIndex = Math.floor(Math.random() * 1000000);

async function rawEth(network: NETWORK, payload: Record<string, unknown>): Promise<Record<string, unknown>> {
return (await axios({url: networkURLs[network].rpc, method: "post", data: payload, responseType: "json"}))
.data as Record<string, unknown>;
async function rawEth(
network: NETWORK,
method: string,
params: unknown[]
): Promise<{payload: Record<string, unknown>; response: Record<string, unknown>}> {
const payload = {id: idIndex++, jsonrpc: "2.0", method, params};

const response = (
await axios({
url: networkURLs[network].rpc,
method: "post",
data: payload,
responseType: "json",
})
).data as Record<string, unknown>;

return {payload, response};
}

async function rawBeacon(network: NETWORK, path: string): Promise<Record<string, unknown>> {
return (await axios.get(`${networkURLs[network].beacon}/${path}`)).data as Record<string, unknown>;
}

async function generateFixture(
label: string,
{method, params}: {method: string; params: unknown[]},
{slot}: {slot: number | string},
network: NETWORK = "sepolia"
): Promise<void> {
const request = {id: idIndex++, jsonrpc: "2.0", method, params};
const response = await rawEth(network, request);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
const executionPayload: unknown = ((await rawBeacon(network, `eth/v2/beacon/blocks/${slot}`)) as any).data.message
.body.execution_payload;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
const headers: unknown = ((await rawBeacon(network, `eth/v1/beacon/headers/${slot}`)) as any).data;
type Generator = (opts: {latest: string; finalized: string}) => {
request: {method: string; params: unknown[]};
slot: number | string;
dependentRequests?: {method: string; params: unknown[]}[];
};

type Block = {hash: string; number: string};

const getBlockByNumber = async (network: NETWORK, number: string | number, dehydrate = false): Promise<Block> => {
const {response} = await rawEth(network, "eth_getBlockByNumber", [number, dehydrate]);

if (response.error || !response.result) {
throw new Error("Invalid response" + JSON.stringify(response));
}

return response.result as Block;
};

const getBlockByHash = async (network: NETWORK, hash: string | number, dehydrate = false): Promise<Block> => {
const {response} = await rawEth(network, "eth_getBlockByHash", [hash, dehydrate]);

if (response.error || !response.result) {
throw new Error("Invalid response" + JSON.stringify(response));
}

return response.result as Block;
};

async function generateFixture(label: string, generator: Generator, network: NETWORK = "sepolia"): Promise<void> {
const latest = await getBlockByNumber(network, "latest");
const finalized = await getBlockByNumber(network, "finalized");

const opts = generator({latest: latest.hash, finalized: finalized.hash});
const slot = opts.slot;
const {payload: request, response} = await rawEth(network, opts.request.method, opts.request.params);
if (response.error || !response.result) {
throw new Error("Invalid response" + JSON.stringify(response));
}

const beacon = {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
executionPayload: ((await rawBeacon(network, `eth/v2/beacon/blocks/${slot}`)) as any).data.message.body
.execution_payload,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
headers: ((await rawBeacon(network, `eth/v1/beacon/headers/${slot}`)) as any).data,
};

const payloadBlock = await getBlockByHash(
network,
// eslint-disable-next-line @typescript-eslint/naming-convention
(beacon.executionPayload as {block_hash: string}).block_hash,
true
);

const execution = {
block: payloadBlock,
};

const dependentRequests = [];
for (const {method, params} of opts.dependentRequests ?? []) {
const {payload, response} = await rawEth(network, method, params);
if (response.error || !response.result) {
throw new Error("Invalid response" + JSON.stringify(response));
}
dependentRequests.push({payload, response});
}

const fixture = {
label,
network,
request,
response,
executionPayload,
headers,
beacon,
execution,
dependentRequests,
};

const dir = path.join(__dirname, "..", "test/fixtures", network);
Expand All @@ -67,56 +130,92 @@ async function generateFixture(
console.info("Generated fixture:", label);
}

await generateFixture(
"eth_getBlock_with_no_accessList",
{
await generateFixture("eth_getBlock_with_no_accessList", () => ({
request: {
method: "eth_getBlockByHash",
params: ["0x75b10426177f0f4bd8683999e2c7c597007c6e7c4551d6336c0f880b12c6f3bf", true],
},
{slot: 2144468}
);
slot: 2144468,
}));

await generateFixture(
"eth_getBlock_with_contractCreation",
{
await generateFixture("eth_getBlock_with_contractCreation", () => ({
request: {
method: "eth_getBlockByHash",
params: ["0x3a0225b38d5927a37cc95fd48254e83c4e9b70115918a103d9fd7e36464030d4", true],
},
{slot: 625024}
);

await generateFixture(
"eth_getBalance_eoa",
{method: "eth_getBalance", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", "latest"]},
{slot: "head"}
);

await generateFixture(
"eth_getBalance_eoa",
{method: "eth_getBalance", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", "latest"]},
{slot: "head"}
);

await generateFixture(
"eth_getBalance_eoa_proof",
{method: "eth_getProof", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", [], "latest"]},
{slot: "head"}
);

await generateFixture(
"eth_getBalance_contract",
{method: "eth_getBalance", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", "latest"]},
{slot: "head"}
);

await generateFixture(
"eth_getBalance_contract_proof",
{method: "eth_getProof", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", [], "latest"]},
{slot: "head"}
);
slot: 625024,
}));

await generateFixture("eth_getBalance_eoa", ({latest}) => ({
request: {method: "eth_getBalance", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", latest]},
slot: "head",
dependentRequests: [{method: "eth_getProof", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", [], latest]}],
}));

await generateFixture("eth_getBalance_contract", ({latest}) => ({
request: {method: "eth_getBalance", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", latest]},
slot: "head",
dependentRequests: [{method: "eth_getProof", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", [], latest]}],
}));

await generateFixture("eth_getCode", ({latest}) => ({
request: {method: "eth_getCode", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", latest]},
slot: "head",
dependentRequests: [{method: "eth_getProof", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", [], latest]}],
}));

await generateFixture("eth_getTransactionCount", ({latest}) => ({
request: {method: "eth_getTransactionCount", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", latest]},
slot: "head",
dependentRequests: [{method: "eth_getProof", params: ["0xC4bFccB1668d6E464F33a76baDD8C8D7D341e04A", [], latest]}],
}));

await generateFixture(
"eth_getCode",
{method: "eth_getCode", params: ["0xa54aeF0dAB669e8e1A164BCcB323549a818a0497", "latest"]},
{slot: "head"}
"eth_call",
({latest}) => ({
request: {
method: "eth_call",
params: [
{
data: "0xe6cb901300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005",
to: "0xade2a9c8b033d60ffcdb8cfc974dd87b2a9c1f27",
},
latest,
],
},
slot: "head",
dependentRequests: [
{
method: "eth_createAccessList",
params: [
{
to: "0xade2a9c8b033d60ffcdb8cfc974dd87b2a9c1f27",
from: "0x0000000000000000000000000000000000000000",
data: "0xe6cb901300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005",
value: undefined,
gas: "0x1c9c380",
gasPrice: "0x0",
},
latest,
],
},
{
method: "eth_getProof",
params: ["0x0000000000000000000000000000000000000000", [], latest],
},
{
method: "eth_getCode",
params: ["0x0000000000000000000000000000000000000000", latest],
},
{
method: "eth_getProof",
params: ["0xade2a9c8b033d60ffcdb8cfc974dd87b2a9c1f27", [], latest],
},
{
method: "eth_getCode",
params: ["0xade2a9c8b033d60ffcdb8cfc974dd87b2a9c1f27", latest],
},
],
}),
"mainnet"
);
1 change: 1 addition & 0 deletions packages/prover/src/constants.ts
Expand Up @@ -2,3 +2,4 @@
export const MAX_REQUEST_LIGHT_CLIENT_UPDATES = 128;
export const MAX_PAYLOAD_HISTORY = 32;
export const UNVERIFIED_RESPONSE_CODE = -33091;
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
3 changes: 3 additions & 0 deletions packages/prover/src/interfaces.ts
Expand Up @@ -22,6 +22,9 @@ export type ELRequestHandler<Params = unknown[], Response = unknown> = (
payload: ELRequestPayload<Params>
) => Promise<ELResponse<Response> | undefined>;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ELRequestHandlerAny = ELRequestHandler<any, any>;

// Modern providers uses this structure e.g. Web3 4.x
export interface EIP1193Provider {
request: (payload: ELRequestPayload) => Promise<ELResponse>;
Expand Down
2 changes: 2 additions & 0 deletions packages/prover/src/proof_provider/payload_store.ts
Expand Up @@ -100,6 +100,8 @@ export class PayloadStore {
if (latestPayload && latestPayload.blockNumber < payload.blockNumber) {
this.latestBlockRoot = blockRoot;
}
} else {
this.latestBlockRoot = blockRoot;
}

if (finalized) {
Expand Down

1 comment on commit 375d660

@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: 375d660 Previous: 249aa75 Ratio
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 26.357 us/op 8.6320 us/op 3.05
Full benchmark results
Benchmark suite Current: 375d660 Previous: 249aa75 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 752.81 us/op 767.08 us/op 0.98
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 60.505 us/op 55.714 us/op 1.09
BLS verify - blst-native 1.5040 ms/op 1.2538 ms/op 1.20
BLS verifyMultipleSignatures 3 - blst-native 3.1998 ms/op 2.6353 ms/op 1.21
BLS verifyMultipleSignatures 8 - blst-native 6.7037 ms/op 5.4448 ms/op 1.23
BLS verifyMultipleSignatures 32 - blst-native 23.022 ms/op 19.671 ms/op 1.17
BLS aggregatePubkeys 32 - blst-native 33.855 us/op 26.821 us/op 1.26
BLS aggregatePubkeys 128 - blst-native 139.90 us/op 108.08 us/op 1.29
getAttestationsForBlock 73.019 ms/op 62.112 ms/op 1.18
isKnown best case - 1 super set check 325.00 ns/op 268.00 ns/op 1.21
isKnown normal case - 2 super set checks 319.00 ns/op 270.00 ns/op 1.18
isKnown worse case - 16 super set checks 323.00 ns/op 269.00 ns/op 1.20
CheckpointStateCache - add get delete 6.7300 us/op 5.8000 us/op 1.16
validate gossip signedAggregateAndProof - struct 3.6397 ms/op 2.8873 ms/op 1.26
validate gossip attestation - struct 1.7337 ms/op 1.3734 ms/op 1.26
pickEth1Vote - no votes 1.7695 ms/op 1.5082 ms/op 1.17
pickEth1Vote - max votes 16.093 ms/op 12.197 ms/op 1.32
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.222 ms/op 9.4682 ms/op 1.40
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 23.535 ms/op 16.096 ms/op 1.46
pickEth1Vote - Eth1Data fastSerialize value x2048 1.1204 ms/op 753.95 us/op 1.49
pickEth1Vote - Eth1Data fastSerialize tree x2048 12.452 ms/op 4.9307 ms/op 2.53
bytes32 toHexString 1.1140 us/op 602.00 ns/op 1.85
bytes32 Buffer.toString(hex) 646.00 ns/op 410.00 ns/op 1.58
bytes32 Buffer.toString(hex) from Uint8Array 948.00 ns/op 614.00 ns/op 1.54
bytes32 Buffer.toString(hex) + 0x 604.00 ns/op 386.00 ns/op 1.56
Object access 1 prop 0.31600 ns/op 0.18900 ns/op 1.67
Map access 1 prop 0.25500 ns/op 0.17400 ns/op 1.47
Object get x1000 9.0110 ns/op 7.9190 ns/op 1.14
Map get x1000 0.82400 ns/op 0.67900 ns/op 1.21
Object set x1000 93.274 ns/op 62.245 ns/op 1.50
Map set x1000 79.895 ns/op 48.739 ns/op 1.64
Return object 10000 times 0.35970 ns/op 0.24970 ns/op 1.44
Throw Error 10000 times 7.3116 us/op 4.5009 us/op 1.62
fastMsgIdFn sha256 / 200 bytes 5.9260 us/op 3.7160 us/op 1.59
fastMsgIdFn h32 xxhash / 200 bytes 592.00 ns/op 326.00 ns/op 1.82
fastMsgIdFn h64 xxhash / 200 bytes 810.00 ns/op 476.00 ns/op 1.70
fastMsgIdFn sha256 / 1000 bytes 18.302 us/op 12.397 us/op 1.48
fastMsgIdFn h32 xxhash / 1000 bytes 796.00 ns/op 451.00 ns/op 1.76
fastMsgIdFn h64 xxhash / 1000 bytes 901.00 ns/op 555.00 ns/op 1.62
fastMsgIdFn sha256 / 10000 bytes 197.24 us/op 110.89 us/op 1.78
fastMsgIdFn h32 xxhash / 10000 bytes 3.2980 us/op 2.0220 us/op 1.63
fastMsgIdFn h64 xxhash / 10000 bytes 2.1170 us/op 1.5010 us/op 1.41
enrSubnets - fastDeserialize 64 bits 2.2780 us/op 1.6390 us/op 1.39
enrSubnets - ssz BitVector 64 bits 977.00 ns/op 611.00 ns/op 1.60
enrSubnets - fastDeserialize 4 bits 339.00 ns/op 200.00 ns/op 1.70
enrSubnets - ssz BitVector 4 bits 882.00 ns/op 616.00 ns/op 1.43
prioritizePeers score -10:0 att 32-0.1 sync 2-0 158.12 us/op 118.54 us/op 1.33
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 221.86 us/op 160.48 us/op 1.38
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 281.96 us/op 203.78 us/op 1.38
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 453.68 us/op 364.62 us/op 1.24
prioritizePeers score 0:0 att 64-1 sync 4-1 611.17 us/op 449.09 us/op 1.36
array of 16000 items push then shift 2.2235 us/op 1.7531 us/op 1.27
LinkedList of 16000 items push then shift 14.840 ns/op 9.4100 ns/op 1.58
array of 16000 items push then pop 163.16 ns/op 120.01 ns/op 1.36
LinkedList of 16000 items push then pop 13.328 ns/op 9.3810 ns/op 1.42
array of 24000 items push then shift 3.5349 us/op 2.5025 us/op 1.41
LinkedList of 24000 items push then shift 14.996 ns/op 9.5020 ns/op 1.58
array of 24000 items push then pop 137.18 ns/op 88.790 ns/op 1.54
LinkedList of 24000 items push then pop 15.093 ns/op 9.0710 ns/op 1.66
intersect bitArray bitLen 8 26.373 ns/op 14.122 ns/op 1.87
intersect array and set length 8 163.81 ns/op 91.444 ns/op 1.79
intersect bitArray bitLen 128 83.397 ns/op 46.028 ns/op 1.81
intersect array and set length 128 2.2549 us/op 1.2753 us/op 1.77
Buffer.concat 32 items 8.7940 us/op 3.1030 us/op 2.83
Uint8Array.set 32 items 5.5360 us/op 2.3740 us/op 2.33
pass gossip attestations to forkchoice per slot 7.0707 ms/op 2.4598 ms/op 2.87
computeDeltas 4.5268 ms/op 3.0013 ms/op 1.51
computeProposerBoostScoreFromBalances 2.4601 ms/op 1.7880 ms/op 1.38
altair processAttestation - 250000 vs - 7PWei normalcase 4.4702 ms/op 2.1488 ms/op 2.08
altair processAttestation - 250000 vs - 7PWei worstcase 6.0162 ms/op 3.3242 ms/op 1.81
altair processAttestation - setStatus - 1/6 committees join 186.26 us/op 139.96 us/op 1.33
altair processAttestation - setStatus - 1/3 committees join 405.26 us/op 271.27 us/op 1.49
altair processAttestation - setStatus - 1/2 committees join 531.52 us/op 371.38 us/op 1.43
altair processAttestation - setStatus - 2/3 committees join 731.32 us/op 467.43 us/op 1.56
altair processAttestation - setStatus - 4/5 committees join 1.1391 ms/op 653.73 us/op 1.74
altair processAttestation - setStatus - 100% committees join 1.1466 ms/op 761.75 us/op 1.51
altair processBlock - 250000 vs - 7PWei normalcase 23.531 ms/op 18.679 ms/op 1.26
altair processBlock - 250000 vs - 7PWei normalcase hashState 34.223 ms/op 27.098 ms/op 1.26
altair processBlock - 250000 vs - 7PWei worstcase 75.717 ms/op 58.388 ms/op 1.30
altair processBlock - 250000 vs - 7PWei worstcase hashState 117.58 ms/op 67.174 ms/op 1.75
phase0 processBlock - 250000 vs - 7PWei normalcase 4.6955 ms/op 2.0371 ms/op 2.30
phase0 processBlock - 250000 vs - 7PWei worstcase 64.170 ms/op 28.044 ms/op 2.29
altair processEth1Data - 250000 vs - 7PWei normalcase 1.1716 ms/op 476.12 us/op 2.46
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 17.187 us/op 6.6060 us/op 2.60
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 46.738 us/op 19.379 us/op 2.41
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 26.357 us/op 8.6320 us/op 3.05
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 18.549 us/op 6.4580 us/op 2.87
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 155.89 us/op 74.294 us/op 2.10
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 1.2712 ms/op 611.17 us/op 2.08
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 1.6664 ms/op 891.99 us/op 1.87
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 1.6199 ms/op 848.71 us/op 1.91
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 5.5304 ms/op 2.2238 ms/op 2.49
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 3.9118 ms/op 1.4505 ms/op 2.70
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 10.075 ms/op 3.7170 ms/op 2.71
Tree 40 250000 create 778.28 ms/op 308.38 ms/op 2.52
Tree 40 250000 get(125000) 408.95 ns/op 178.50 ns/op 2.29
Tree 40 250000 set(125000) 2.8884 us/op 923.91 ns/op 3.13
Tree 40 250000 toArray() 34.735 ms/op 16.933 ms/op 2.05
Tree 40 250000 iterate all - toArray() + loop 39.184 ms/op 18.083 ms/op 2.17
Tree 40 250000 iterate all - get(i) 151.51 ms/op 64.993 ms/op 2.33
MutableVector 250000 create 24.511 ms/op 10.010 ms/op 2.45
MutableVector 250000 get(125000) 15.719 ns/op 6.1880 ns/op 2.54
MutableVector 250000 set(125000) 565.71 ns/op 244.04 ns/op 2.32
MutableVector 250000 toArray() 5.8773 ms/op 2.7391 ms/op 2.15
MutableVector 250000 iterate all - toArray() + loop 6.6243 ms/op 2.8564 ms/op 2.32
MutableVector 250000 iterate all - get(i) 3.6345 ms/op 1.5009 ms/op 2.42
Array 250000 create 6.0320 ms/op 2.5208 ms/op 2.39
Array 250000 clone - spread 1.9081 ms/op 1.1692 ms/op 1.63
Array 250000 get(125000) 1.3690 ns/op 0.56500 ns/op 2.42
Array 250000 set(125000) 1.6990 ns/op 0.65400 ns/op 2.60
Array 250000 iterate all - loop 187.49 us/op 103.72 us/op 1.81
effectiveBalanceIncrements clone Uint8Array 300000 61.113 us/op 25.396 us/op 2.41
effectiveBalanceIncrements clone MutableVector 300000 863.00 ns/op 367.00 ns/op 2.35
effectiveBalanceIncrements rw all Uint8Array 300000 473.81 us/op 165.48 us/op 2.86
effectiveBalanceIncrements rw all MutableVector 300000 209.34 ms/op 79.850 ms/op 2.62
phase0 afterProcessEpoch - 250000 vs - 7PWei 244.27 ms/op 112.56 ms/op 2.17
phase0 beforeProcessEpoch - 250000 vs - 7PWei 70.196 ms/op 37.762 ms/op 1.86
altair processEpoch - mainnet_e81889 517.11 ms/op 320.00 ms/op 1.62
mainnet_e81889 - altair beforeProcessEpoch 101.18 ms/op 66.565 ms/op 1.52
mainnet_e81889 - altair processJustificationAndFinalization 19.481 us/op 15.850 us/op 1.23
mainnet_e81889 - altair processInactivityUpdates 6.4742 ms/op 5.4161 ms/op 1.20
mainnet_e81889 - altair processRewardsAndPenalties 60.342 ms/op 52.212 ms/op 1.16
mainnet_e81889 - altair processRegistryUpdates 2.8900 us/op 2.5210 us/op 1.15
mainnet_e81889 - altair processSlashings 608.00 ns/op 525.00 ns/op 1.16
mainnet_e81889 - altair processEth1DataReset 880.00 ns/op 518.00 ns/op 1.70
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4987 ms/op 1.2283 ms/op 1.22
mainnet_e81889 - altair processSlashingsReset 5.2330 us/op 3.8820 us/op 1.35
mainnet_e81889 - altair processRandaoMixesReset 8.7850 us/op 4.7960 us/op 1.83
mainnet_e81889 - altair processHistoricalRootsUpdate 1.2360 us/op 888.00 ns/op 1.39
mainnet_e81889 - altair processParticipationFlagUpdates 2.8730 us/op 2.0250 us/op 1.42
mainnet_e81889 - altair processSyncCommitteeUpdates 730.00 ns/op 488.00 ns/op 1.50
mainnet_e81889 - altair afterProcessEpoch 164.97 ms/op 125.47 ms/op 1.31
phase0 processEpoch - mainnet_e58758 523.54 ms/op 366.89 ms/op 1.43
mainnet_e58758 - phase0 beforeProcessEpoch 184.08 ms/op 130.36 ms/op 1.41
mainnet_e58758 - phase0 processJustificationAndFinalization 23.094 us/op 16.855 us/op 1.37
mainnet_e58758 - phase0 processRewardsAndPenalties 85.300 ms/op 61.940 ms/op 1.38
mainnet_e58758 - phase0 processRegistryUpdates 13.897 us/op 8.3080 us/op 1.67
mainnet_e58758 - phase0 processSlashings 1.0450 us/op 547.00 ns/op 1.91
mainnet_e58758 - phase0 processEth1DataReset 623.00 ns/op 647.00 ns/op 0.96
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2777 ms/op 1.0090 ms/op 1.27
mainnet_e58758 - phase0 processSlashingsReset 4.8240 us/op 4.1030 us/op 1.18
mainnet_e58758 - phase0 processRandaoMixesReset 7.4650 us/op 4.2380 us/op 1.76
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1230 us/op 502.00 ns/op 2.24
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.6270 us/op 3.8240 us/op 1.21
mainnet_e58758 - phase0 afterProcessEpoch 132.22 ms/op 97.126 ms/op 1.36
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4953 ms/op 1.3192 ms/op 1.13
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9508 ms/op 1.5238 ms/op 1.28
altair processInactivityUpdates - 250000 normalcase 23.393 ms/op 25.709 ms/op 0.91
altair processInactivityUpdates - 250000 worstcase 31.626 ms/op 26.729 ms/op 1.18
phase0 processRegistryUpdates - 250000 normalcase 8.0960 us/op 7.5890 us/op 1.07
phase0 processRegistryUpdates - 250000 badcase_full_deposits 284.06 us/op 279.55 us/op 1.02
phase0 processRegistryUpdates - 250000 worstcase 0.5 167.53 ms/op 132.00 ms/op 1.27
altair processRewardsAndPenalties - 250000 normalcase 78.735 ms/op 67.449 ms/op 1.17
altair processRewardsAndPenalties - 250000 worstcase 81.399 ms/op 72.059 ms/op 1.13
phase0 getAttestationDeltas - 250000 normalcase 9.0219 ms/op 9.1573 ms/op 0.99
phase0 getAttestationDeltas - 250000 worstcase 8.7328 ms/op 7.5671 ms/op 1.15
phase0 processSlashings - 250000 worstcase 4.3722 ms/op 3.5897 ms/op 1.22
altair processSyncCommitteeUpdates - 250000 228.31 ms/op 193.03 ms/op 1.18
BeaconState.hashTreeRoot - No change 437.00 ns/op 368.00 ns/op 1.19
BeaconState.hashTreeRoot - 1 full validator 66.213 us/op 56.431 us/op 1.17
BeaconState.hashTreeRoot - 32 full validator 654.21 us/op 569.31 us/op 1.15
BeaconState.hashTreeRoot - 512 full validator 7.7053 ms/op 5.3264 ms/op 1.45
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 76.942 us/op 73.595 us/op 1.05
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1298 ms/op 1.0017 ms/op 1.13
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.021 ms/op 13.765 ms/op 1.09
BeaconState.hashTreeRoot - 1 balances 65.406 us/op 63.082 us/op 1.04
BeaconState.hashTreeRoot - 32 balances 631.45 us/op 521.69 us/op 1.21
BeaconState.hashTreeRoot - 512 balances 5.5009 ms/op 4.7801 ms/op 1.15
BeaconState.hashTreeRoot - 250000 balances 94.457 ms/op 107.91 ms/op 0.88
aggregationBits - 2048 els - zipIndexesInBitList 20.521 us/op 34.900 us/op 0.59
regular array get 100000 times 53.642 us/op 56.202 us/op 0.95
wrappedArray get 100000 times 41.048 us/op 46.538 us/op 0.88
arrayWithProxy get 100000 times 19.278 ms/op 19.956 ms/op 0.97
ssz.Root.equals 665.00 ns/op 685.00 ns/op 0.97
byteArrayEquals 656.00 ns/op 677.00 ns/op 0.97
shuffle list - 16384 els 8.5828 ms/op 7.6510 ms/op 1.12
shuffle list - 250000 els 122.99 ms/op 113.92 ms/op 1.08
processSlot - 1 slots 10.142 us/op 11.271 us/op 0.90
processSlot - 32 slots 1.5981 ms/op 1.6053 ms/op 1.00
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 40.253 ms/op 40.172 ms/op 1.00
getCommitteeAssignments - req 1 vs - 250000 vc 3.2567 ms/op 3.4038 ms/op 0.96
getCommitteeAssignments - req 100 vs - 250000 vc 4.5735 ms/op 4.7318 ms/op 0.97
getCommitteeAssignments - req 1000 vs - 250000 vc 5.0065 ms/op 4.8857 ms/op 1.02
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.9600 ns/op 5.5300 ns/op 0.90
state getBlockRootAtSlot - 250000 vs - 7PWei 858.98 ns/op 1.1219 us/op 0.77
computeProposers - vc 250000 11.542 ms/op 11.916 ms/op 0.97
computeEpochShuffling - vc 250000 108.21 ms/op 110.30 ms/op 0.98
getNextSyncCommittee - vc 250000 188.58 ms/op 194.58 ms/op 0.97
computeSigningRoot for AttestationData 14.593 us/op 16.018 us/op 0.91
hash AttestationData serialized data then Buffer.toString(base64) 2.5411 us/op 2.8537 us/op 0.89
toHexString serialized data 1.1612 us/op 1.1880 us/op 0.98
Buffer.toString(base64) 330.24 ns/op 368.56 ns/op 0.90

Please sign in to comment.