From d25d57e688de44a86f5c0d956055caca62fcf438 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 11:31:37 +0200 Subject: [PATCH 1/9] chore(deps-dev): bump electron from 26.2.2 to 26.2.4 (#6023) Bumps [electron](https://github.com/electron/electron) from 26.2.2 to 26.2.4. - [Release notes](https://github.com/electron/electron/releases) - [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md) - [Commits](https://github.com/electron/electron/compare/v26.2.2...v26.2.4) --- updated-dependencies: - dependency-name: electron dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index 03c4f41a0ba9..ad25e99d2a72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2971,10 +2971,10 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@>=10.0.0", "@types/node@>=13.7.0": - version "20.4.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.2.tgz#129cc9ae69f93824f92fac653eebfb4812ab4af9" - integrity sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw== +"@types/node@*", "@types/node@>=10.0.0", "@types/node@>=13.7.0", "@types/node@^20.6.5": + version "20.6.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.5.tgz#4c6a79adf59a8e8193ac87a0e522605b16587258" + integrity sha512-2qGq5LAOTh9izcc0+F+dToFigBWiK1phKPt7rNhOqJSr35y8rlIBjDwGtFSgAI6MGIhjwOVNSQZVdJsZJ2uR1w== "@types/node@11.11.6": version "11.11.6" @@ -2991,11 +2991,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.14.tgz#a621ad26e7eb076d6846dd3d39557ddf9d89f04b" integrity sha512-ZE/5aB73CyGqgQULkLG87N9GnyGe5TcQjv34pwS8tfBs1IkCh0ASM69mydb2znqd6v0eX+9Ytvk6oQRqu8T1Vw== -"@types/node@^20.6.5": - version "20.6.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.5.tgz#4c6a79adf59a8e8193ac87a0e522605b16587258" - integrity sha512-2qGq5LAOTh9izcc0+F+dToFigBWiK1phKPt7rNhOqJSr35y8rlIBjDwGtFSgAI6MGIhjwOVNSQZVdJsZJ2uR1w== - "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" @@ -5719,9 +5714,9 @@ electron-to-chromium@^1.4.188: integrity sha512-nPyI7oHc8T64oSqRXrAt99gNMpk0SAgPHw/o+hkNKyb5+bcdnFtZcSO9FUJES5cVkVZvo8u4qiZ1gQILl8UXsA== electron@^26.2.2: - version "26.2.2" - resolved "https://registry.yarnpkg.com/electron/-/electron-26.2.2.tgz#d465b7b5ead240448c131208631d172a45ae4953" - integrity sha512-Ihb3Zt4XYnHF52DYSq17ySkgFqJV4OT0VnfhUYZASAql7Vembz3VsAq7mB3OALBHXltAW34P8BxTIwTqZaMS3g== + version "26.2.4" + resolved "https://registry.yarnpkg.com/electron/-/electron-26.2.4.tgz#36616b2386b083c13ae9188f2d8ccf233c23404a" + integrity sha512-weMUSMyDho5E0DPQ3breba3D96IxwNvtYHjMd/4/wNN3BdI5s3+0orNnPVGJFcLhSvKoxuKUqdVonUocBPwlQA== dependencies: "@electron/get" "^2.0.0" "@types/node" "^18.11.18" From 3affade6b245db6ccfe6fb094f9da7fe055f9ea8 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 6 Oct 2023 21:53:43 +0200 Subject: [PATCH 2/9] chore: remove unconfigured panels in dashboards (#6025) --- dashboards/lodestar_rest_api.json | 130 +++++++++++++++++------------- dashboards/lodestar_summary.json | 118 +++++++++++---------------- package.json | 2 +- 3 files changed, 124 insertions(+), 126 deletions(-) diff --git a/dashboards/lodestar_rest_api.json b/dashboards/lodestar_rest_api.json index 2ae05cfa6cff..6445873f4dc5 100644 --- a/dashboards/lodestar_rest_api.json +++ b/dashboards/lodestar_rest_api.json @@ -13,7 +13,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -32,7 +35,6 @@ "fiscalYearStartMonth": 0, "graphTooltip": 1, "id": null, - "iteration": 1661342552530, "links": [ { "asDropdown": true, @@ -53,6 +55,10 @@ "panels": [ { "collapsed": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "gridPos": { "h": 1, "w": 24, @@ -61,16 +67,31 @@ }, "id": 86, "panels": [], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "refId": "A" + } + ], "title": "REST API", "type": "row" }, { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -82,6 +103,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 0, @@ -114,7 +136,8 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -140,12 +163,18 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -157,6 +186,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 1, @@ -190,7 +220,8 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "multi", @@ -215,12 +246,18 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -232,6 +269,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -264,7 +302,8 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -300,12 +339,18 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -317,6 +362,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -348,7 +394,8 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -372,12 +419,18 @@ "type": "timeseries" }, { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, @@ -389,6 +442,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -420,7 +474,8 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom" + "placement": "bottom", + "showLegend": true }, "tooltip": { "mode": "single", @@ -444,42 +499,9 @@ "type": "timeseries" }, { - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [] - }, - "overrides": [] + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 8, @@ -489,16 +511,15 @@ }, "id": 517, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "content": "", + "mode": "markdown" }, + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -512,11 +533,12 @@ "refId": "A" } ], - "type": "timeseries" + "title": "-", + "type": "text" } ], "refresh": "10s", - "schemaVersion": 35, + "schemaVersion": 38, "style": "dark", "tags": [ "lodestar" @@ -657,7 +679,7 @@ }, "timezone": "utc", "title": "Lodestar - REST API", - "uid": "Lodestar_rest_api", + "uid": "lodestar_rest_api", "version": 2, "weekStart": "monday" } diff --git a/dashboards/lodestar_summary.json b/dashboards/lodestar_summary.json index 7b45fdf4a38d..5e8773c05d4e 100644 --- a/dashboards/lodestar_summary.json +++ b/dashboards/lodestar_summary.json @@ -118,6 +118,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -353,7 +354,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -403,7 +404,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -452,7 +453,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -501,7 +502,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -554,7 +555,7 @@ "text": {}, "textMode": "value" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -605,7 +606,7 @@ "text": {}, "textMode": "value" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -656,7 +657,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -726,7 +727,7 @@ "text": {}, "textMode": "value" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -778,7 +779,7 @@ "text": {}, "textMode": "name" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -834,7 +835,7 @@ "text": {}, "textMode": "name" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -890,7 +891,7 @@ "text": {}, "textMode": "name" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -932,6 +933,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1026,6 +1028,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 4, @@ -1133,6 +1136,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1227,6 +1231,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1321,7 +1326,7 @@ }, "textMode": "value_and_name" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -1363,6 +1368,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1516,6 +1522,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1596,6 +1603,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1675,6 +1683,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1840,7 +1849,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -1892,7 +1901,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -1944,7 +1953,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -1996,7 +2005,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -2048,7 +2057,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -2113,7 +2122,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -2154,6 +2163,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2288,7 +2298,7 @@ "unit": "short" } }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "reverseYBuckets": false, "targets": [ { @@ -2400,7 +2410,7 @@ "unit": "short" } }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "reverseYBuckets": false, "targets": [ { @@ -2434,44 +2444,9 @@ "yBucketBound": "auto" }, { - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [] - }, - "overrides": [] + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "gridPos": { "h": 8, @@ -2481,19 +2456,17 @@ }, "id": 497, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "content": "", + "mode": "markdown" }, - "title": "Panel Title", - "type": "timeseries" + "pluginVersion": "10.1.1", + "title": "-", + "type": "text" }, { "collapsed": false, @@ -2546,6 +2519,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2631,6 +2605,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineStyle": { "fill": "solid" @@ -2740,6 +2715,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2820,7 +2796,7 @@ "content": "", "mode": "markdown" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -2842,7 +2818,7 @@ ], "refresh": "10s", "revision": 1, - "schemaVersion": 37, + "schemaVersion": 38, "style": "dark", "tags": [ "lodestar" diff --git a/package.json b/package.json index 06afdc19bb99..00942f6719c4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "lint:fix": "yarn lint --fix", "lint-docs": "prettier '**/*.md' --check", "lint-docs:fix": "prettier '**/*.md' --write", - "lint-dashboards": "scripts/validate-grafana-dashboards.sh", + "lint-dashboards": "node scripts/lint-grafana-dashboards.mjs ./dashboards", "check-build": "lerna run check-build", "check-readme": "lerna run check-readme", "check-types": "lerna run check-types", From 45bc298e1094854ea4149e6bfb21480165c8b459 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sat, 7 Oct 2023 11:03:41 +0200 Subject: [PATCH 3/9] feat: add rated.network score to validator monitor dashboard (#6027) * Add rated.network score panel * Move rated.network panel near the top * Display rated.network effectiveness rating in % --- dashboards/lodestar_validator_monitor.json | 504 ++++++++++++--------- 1 file changed, 301 insertions(+), 203 deletions(-) diff --git a/dashboards/lodestar_validator_monitor.json b/dashboards/lodestar_validator_monitor.json index b3c3a2a67835..5bc844a639fc 100644 --- a/dashboards/lodestar_validator_monitor.json +++ b/dashboards/lodestar_validator_monitor.json @@ -89,7 +89,7 @@ "text": {}, "textMode": "auto" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -140,9 +140,10 @@ "fields": "", "values": false }, - "showUnfilled": true + "showUnfilled": true, + "valueMode": "color" }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -184,6 +185,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -251,7 +253,9 @@ }, "custom": { "align": "auto", - "displayMode": "auto", + "cellOptions": { + "type": "auto" + }, "inspect": false }, "mappings": [] @@ -266,7 +270,9 @@ }, "id": 4, "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": "", "reducer": [ "sum" @@ -276,7 +282,7 @@ "frameIndex": 0, "showHeader": true }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -384,7 +390,7 @@ "unit": "s" } }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -410,6 +416,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, + "description": "Metric based on formula used by rated.network", "fieldConfig": { "defaults": { "color": { @@ -422,21 +429,22 @@ "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", - "fillOpacity": 10, + "fillOpacity": 0, "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, - "showPoints": "never", - "spanNulls": true, + "showPoints": "auto", + "spanNulls": false, "stacking": { "group": "A", "mode": "none" @@ -446,7 +454,7 @@ } }, "mappings": [], - "unit": "none" + "unit": "percentunit" }, "overrides": [] }, @@ -456,35 +464,33 @@ "x": 12, "y": 9 }, - "id": 6, + "id": 33, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": false + "showLegend": true }, "tooltip": { - "mode": "multi", + "mode": "single", "sort": "none" } }, - "pluginVersion": "8.4.0-beta1", "targets": [ { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "exemplar": false, - "expr": "avg(\n rate(validator_monitor_prev_epoch_on_chain_balance[32m])\n)", - "hide": false, - "interval": "", - "legendFormat": "balance_delta", + "editorMode": "code", + "expr": "5/8\n*\n(\n 1 -\n sum(rate(validator_monitor_prev_epoch_on_chain_source_attester_miss_total[$rate_interval]))\n /\n sum(\n rate(validator_monitor_prev_epoch_on_chain_source_attester_miss_total[$rate_interval])\n +\n rate(validator_monitor_prev_epoch_on_chain_source_attester_hit_total[$rate_interval])\n )\n)\n*\n(\n (\n 1 -\n sum(rate(validator_monitor_prev_epoch_on_chain_head_attester_miss_total[$rate_interval]))\n /\n sum(\n rate(validator_monitor_prev_epoch_on_chain_head_attester_miss_total[$rate_interval])\n +\n rate(validator_monitor_prev_epoch_on_chain_head_attester_hit_total[$rate_interval])\n )\n ) \n + \n (\n 1 -\n sum(rate(validator_monitor_prev_epoch_on_chain_target_attester_miss_total[$rate_interval]))\n /\n sum(\n rate(validator_monitor_prev_epoch_on_chain_target_attester_miss_total[$rate_interval])\n +\n rate(validator_monitor_prev_epoch_on_chain_target_attester_hit_total[$rate_interval])\n )\n )\n +\n (\n 1\n -\n sum(rate(validator_monitor_prev_epoch_on_chain_source_attester_miss_total[$rate_interval]))\n /\n sum(\n rate(validator_monitor_prev_epoch_on_chain_source_attester_miss_total[$rate_interval])\n +\n rate(validator_monitor_prev_epoch_on_chain_source_attester_hit_total[$rate_interval])\n )\n )\n) \n*\n1/3\n*\n1/(\n sum(rate(validator_monitor_prev_epoch_on_chain_inclusion_distance_sum[$rate_interval]))\n /\n sum(rate(validator_monitor_prev_epoch_on_chain_inclusion_distance_count[$rate_interval]))\n)\n+\n3/8 * 1 - 0.17/100", + "legendFormat": "Effectiveness Rating", + "range": true, "refId": "A" } ], - "title": "balance delta prev epoch", + "title": "rated.network score", "type": "timeseries" }, { @@ -512,6 +518,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -592,6 +599,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -609,7 +617,7 @@ } }, "mappings": [], - "unit": "short" + "unit": "none" }, "overrides": [] }, @@ -619,7 +627,7 @@ "x": 12, "y": 17 }, - "id": 10, + "id": 6, "options": { "legend": { "calcs": [], @@ -640,25 +648,14 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "avg(validator_monitor_prev_epoch_on_chain_inclusion_distance)", - "interval": "", - "legendFormat": "inclusion distance", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": false, - "expr": "rate(validator_monitor_prev_epoch_on_chain_inclusion_distance_sum[$rate_interval])\n/\nrate(validator_monitor_prev_epoch_on_chain_inclusion_distance_count[$rate_interval])", + "expr": "avg(\n rate(validator_monitor_prev_epoch_on_chain_balance[32m])\n)", "hide": false, "interval": "", - "legendFormat": "inclusion distance new", - "refId": "B" + "legendFormat": "balance_delta", + "refId": "A" } ], - "title": "Avg inclusion distance", + "title": "balance delta prev epoch", "type": "timeseries" }, { @@ -686,6 +683,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 4, @@ -773,7 +771,6 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "description": "Min delay from when the validator should send an object and when it was received", "fieldConfig": { "defaults": { "color": { @@ -793,6 +790,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -810,7 +808,7 @@ } }, "mappings": [], - "unit": "s" + "unit": "short" }, "overrides": [] }, @@ -820,13 +818,13 @@ "x": 12, "y": 25 }, - "id": 18, + "id": 10, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": true + "showLegend": false }, "tooltip": { "mode": "multi", @@ -841,22 +839,10 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "sum(rate(validator_monitor_prev_epoch_attestations_min_delay_seconds_sum[$rate_interval]))\n/\nsum(rate(validator_monitor_prev_epoch_attestations_min_delay_seconds_count[$rate_interval]))", - "hide": false, - "interval": "", - "legendFormat": "attestations", - "refId": "Attestations" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": false, - "expr": "sum(rate(validator_monitor_prev_epoch_aggregates_min_delay_seconds_sum[$rate_interval]))\n/\nsum(rate(validator_monitor_prev_epoch_aggregates_min_delay_seconds_count[$rate_interval]))", + "expr": "avg(validator_monitor_prev_epoch_on_chain_inclusion_distance)", "interval": "", - "legendFormat": "aggregates", - "refId": "Aggregates" + "legendFormat": "inclusion distance", + "refId": "A" }, { "datasource": { @@ -864,14 +850,14 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "sum(rate(validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds_sum[$rate_interval]))\n/\nsum(rate(validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds_count[$rate_interval]))", + "expr": "rate(validator_monitor_prev_epoch_on_chain_inclusion_distance_sum[$rate_interval])\n/\nrate(validator_monitor_prev_epoch_on_chain_inclusion_distance_count[$rate_interval])", "hide": false, "interval": "", - "legendFormat": "", - "refId": "Blocks" + "legendFormat": "inclusion distance new", + "refId": "B" } ], - "title": "Prev epoch min delay", + "title": "Avg inclusion distance", "type": "timeseries" }, { @@ -953,7 +939,7 @@ "unit": "short" } }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "reverseYBuckets": false, "targets": [ { @@ -992,6 +978,7 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, + "description": "Min delay from when the validator should send an object and when it was received", "fieldConfig": { "defaults": { "color": { @@ -1011,6 +998,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1021,14 +1009,14 @@ "spanNulls": true, "stacking": { "group": "A", - "mode": "normal" + "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], - "unit": "percentunit" + "unit": "s" }, "overrides": [] }, @@ -1038,13 +1026,13 @@ "x": 12, "y": 33 }, - "id": 14, + "id": 18, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": false + "showLegend": true }, "tooltip": { "mode": "multi", @@ -1059,23 +1047,11 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "count(validator_monitor_prev_epoch_on_chain_inclusion_distance == 1) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", - "hide": false, - "interval": "", - "legendFormat": "1", - "refId": "D" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": false, - "expr": "count(validator_monitor_prev_epoch_on_chain_inclusion_distance == 2) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", + "expr": "sum(rate(validator_monitor_prev_epoch_attestations_min_delay_seconds_sum[$rate_interval]))\n/\nsum(rate(validator_monitor_prev_epoch_attestations_min_delay_seconds_count[$rate_interval]))", "hide": false, "interval": "", - "legendFormat": "2", - "refId": "C" + "legendFormat": "attestations", + "refId": "Attestations" }, { "datasource": { @@ -1083,11 +1059,10 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "count(5 > validator_monitor_prev_epoch_on_chain_inclusion_distance >= 3) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", - "hide": false, + "expr": "sum(rate(validator_monitor_prev_epoch_aggregates_min_delay_seconds_sum[$rate_interval]))\n/\nsum(rate(validator_monitor_prev_epoch_aggregates_min_delay_seconds_count[$rate_interval]))", "interval": "", - "legendFormat": "3-5", - "refId": "E" + "legendFormat": "aggregates", + "refId": "Aggregates" }, { "datasource": { @@ -1095,25 +1070,14 @@ "uid": "${DS_PROMETHEUS}" }, "exemplar": false, - "expr": "count(10 > validator_monitor_prev_epoch_on_chain_inclusion_distance >= 5) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", + "expr": "sum(rate(validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds_sum[$rate_interval]))\n/\nsum(rate(validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds_count[$rate_interval]))", "hide": false, "interval": "", - "legendFormat": "5-10", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "exemplar": false, - "expr": "count(validator_monitor_prev_epoch_on_chain_inclusion_distance >= 10) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", - "interval": "", - "legendFormat": "+10", - "refId": "A" + "legendFormat": "", + "refId": "Blocks" } ], - "title": "Inclusion distance distribution", + "title": "Prev epoch min delay", "type": "timeseries" }, { @@ -1195,7 +1159,7 @@ "unit": "short" } }, - "pluginVersion": "9.3.2", + "pluginVersion": "10.1.1", "reverseYBuckets": false, "targets": [ { @@ -1246,32 +1210,32 @@ "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", - "fillOpacity": 8, - "gradientMode": "opacity", + "fillOpacity": 10, + "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { - "log": 2, - "type": "log" + "type": "linear" }, "showPoints": "never", "spanNulls": true, "stacking": { "group": "A", - "mode": "none" + "mode": "normal" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], - "unit": "short" + "unit": "percentunit" }, "overrides": [] }, @@ -1281,13 +1245,13 @@ "x": 12, "y": 41 }, - "id": 20, + "id": 14, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": true + "showLegend": false }, "tooltip": { "mode": "multi", @@ -1301,30 +1265,62 @@ "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "editorMode": "code", "exemplar": false, - "expr": "validator_monitor_prev_epoch_attestations_count / validator_monitor_validators", + "expr": "count(validator_monitor_prev_epoch_on_chain_inclusion_distance == 1) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", + "hide": false, "interval": "", - "legendFormat": "attestations_sent", - "range": true, - "refId": "A" + "legendFormat": "1", + "refId": "D" }, { "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, - "editorMode": "code", "exemplar": false, - "expr": "rate(validator_monitor_prev_epoch_aggregates_count[$rate_interval]) / validator_monitor_validators", + "expr": "count(validator_monitor_prev_epoch_on_chain_inclusion_distance == 2) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", "hide": false, "interval": "", - "legendFormat": "aggregates_sent", - "range": true, - "refId": "D" + "legendFormat": "2", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": false, + "expr": "count(5 > validator_monitor_prev_epoch_on_chain_inclusion_distance >= 3) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", + "hide": false, + "interval": "", + "legendFormat": "3-5", + "refId": "E" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": false, + "expr": "count(10 > validator_monitor_prev_epoch_on_chain_inclusion_distance >= 5) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", + "hide": false, + "interval": "", + "legendFormat": "5-10", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "exemplar": false, + "expr": "count(validator_monitor_prev_epoch_on_chain_inclusion_distance >= 10) / count(validator_monitor_prev_epoch_on_chain_inclusion_distance)", + "interval": "", + "legendFormat": "+10", + "refId": "A" } ], - "title": "Attestater sent per epoch per validator", + "title": "Inclusion distance distribution", "type": "timeseries" }, { @@ -1351,6 +1347,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1422,6 +1419,188 @@ "title": "Attestation inclusions epoch per validator", "type": "timeseries" }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 8, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "log": 2, + "type": "log" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 49 + }, + "id": 20, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.4.0-beta1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": false, + "expr": "validator_monitor_prev_epoch_attestations_count / validator_monitor_validators", + "interval": "", + "legendFormat": "attestations_sent", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "exemplar": false, + "expr": "rate(validator_monitor_prev_epoch_aggregates_count[$rate_interval]) / validator_monitor_validators", + "hide": false, + "interval": "", + "legendFormat": "aggregates_sent", + "range": true, + "refId": "D" + } + ], + "title": "Attestater sent per epoch per validator", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 57 + }, + "id": 32, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "9.3.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(validator_monitor_unaggregated_attestation_submitted_sent_peers_count_bucket{le=\"0\"} [$rate_interval])\n/ on(instance)\nrate(validator_monitor_unaggregated_attestation_submitted_sent_peers_count_count [$rate_interval])", + "format": "time_series", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Unaggregated attestations submitted to zero peers", + "type": "timeseries" + }, { "datasource": { "type": "prometheus", @@ -1446,6 +1625,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -1533,7 +1713,7 @@ "h": 8, "w": 12, "x": 12, - "y": 49 + "y": 57 }, "id": 22, "options": { @@ -1600,92 +1780,10 @@ ], "title": "Block proposer balance delta", "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 57 - }, - "id": 32, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "9.3.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(validator_monitor_unaggregated_attestation_submitted_sent_peers_count_bucket{le=\"0\"} [$rate_interval])\n/ on(instance)\nrate(validator_monitor_unaggregated_attestation_submitted_sent_peers_count_count [$rate_interval])", - "format": "time_series", - "legendFormat": "__auto", - "range": true, - "refId": "A" - } - ], - "title": "Unaggregated attestations submitted to zero peers", - "type": "timeseries" } ], "refresh": "10s", - "schemaVersion": 37, + "schemaVersion": 38, "style": "dark", "tags": [ "lodestar" From e42d6cc6457051cf67ab7a3cdbfada25028d10f7 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 9 Oct 2023 19:40:43 +0200 Subject: [PATCH 4/9] fix: remove duplicate validator registration calls (#5993) --- .../src/services/prepareBeaconProposer.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/validator/src/services/prepareBeaconProposer.ts b/packages/validator/src/services/prepareBeaconProposer.ts index f2df410131ff..e474614a7a1d 100644 --- a/packages/validator/src/services/prepareBeaconProposer.ts +++ b/packages/validator/src/services/prepareBeaconProposer.ts @@ -45,17 +45,14 @@ export function pollPrepareBeaconProposer( }) ); ApiError.assert(await api.validator.prepareBeaconProposer(proposers)); + logger.debug("Registered proposers with beacon node", {epoch, count: proposers.length}); } catch (e) { - logger.error("Failed to register proposers with beacon", {epoch}, e as Error); + logger.error("Failed to register proposers with beacon node", {epoch}, e as Error); } } } clock.runEveryEpoch(prepareBeaconProposer); - // Since the registration of the validators to the BN as well as to builder (if enabled) - // is scheduled every epoch, there could be some time since the first scheduled run, - // so fire one registration right away as well - void prepareBeaconProposer(clock.getCurrentEpoch()); } /** @@ -81,7 +78,7 @@ export function pollBuilderValidatorRegistration( // registerValidator is not as time sensitive as attesting. // Poll indices first, then call api.validator.registerValidator once await validatorStore.pollValidatorIndices().catch((e: Error) => { - logger.error("Error on pollValidatorIndices for prepareBeaconProposer", {epoch}, e); + logger.error("Error on pollValidatorIndices for registerValidator", {epoch}, e); }); const pubkeyHexes = validatorStore .getAllLocalIndices() @@ -103,17 +100,13 @@ export function pollBuilderValidatorRegistration( }) ); ApiError.assert(await api.validator.registerValidator(registrations)); - logger.info("Published validator registrations to builder network", {epoch, count: registrations.length}); + logger.info("Published validator registrations to builder", {epoch, count: registrations.length}); } catch (e) { - logger.error("Failed to publish validator registrations to builder network", {epoch}, e as Error); + logger.error("Failed to publish validator registrations to builder", {epoch}, e as Error); } } } } clock.runEveryEpoch(registerValidator); - // Since the registration of the validators to the BN as well as to builder (if enabled) - // is scheduled every epoch, there could be some time since the first scheduled run, - // so fire one registration right away as well - void registerValidator(clock.getCurrentEpoch()); } From 1aa656191c84e3b55281bb8f21c9f4a529282500 Mon Sep 17 00:00:00 2001 From: Roman Dvorkin <121502696+rdvorkin@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:31:58 +0300 Subject: [PATCH 5/9] feat: support "input" param for verifiable tx (#6019) Using contract calls in web3js, the transaction data can either be filled in the "data" parameter or "input" parameter, default is "input" The current verified execution provider supports only "data" parameter, so code like this const contract = new web3.eth.Contract(balanceOfABI, tokenContract) let result = await contract.methods.balanceOf(tokenHolder).call(); doesn't work --- packages/prover/src/utils/evm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/prover/src/utils/evm.ts b/packages/prover/src/utils/evm.ts index fa5f5ec3feb2..ecebda78b8ad 100644 --- a/packages/prover/src/utils/evm.ts +++ b/packages/prover/src/utils/evm.ts @@ -166,7 +166,7 @@ export async function executeVMCall({ executionPayload: allForks.ExecutionPayload; network: NetworkName; }): Promise { - const {from, to, gas, gasPrice, maxPriorityFeePerGas, value, data} = tx; + const {from, to, gas, gasPrice, maxPriorityFeePerGas, value, data, input} = tx; const {result: block} = await rpc.request("eth_getBlockByHash", [bufferToHex(executionPayload.blockHash), true], { raiseError: true, }); @@ -181,7 +181,7 @@ export async function executeVMCall({ gasLimit: hexToBigInt(gas ?? block.gasLimit), gasPrice: hexToBigInt(gasPrice ?? maxPriorityFeePerGas ?? "0x0"), value: hexToBigInt(value ?? "0x0"), - data: data ? hexToBuffer(data) : undefined, + data: input ? hexToBuffer(input) : data ? hexToBuffer(data) : undefined, block: { header: getVMBlockHeaderFromELBlock(block, executionPayload, network), }, From 93709ffc288f13d022d077d01dd81af36fbb78a6 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Thu, 12 Oct 2023 21:18:49 +0200 Subject: [PATCH 6/9] fix: chunkIntoN to chunk correctly (#6035) * fix: fixed chunkIntoN to chunk correctly (#6018) * FIX: fixed chunkIntoN to chunk correctly chunkIntoN was chunking into N chunks, however it is used to chunk eth_getCode and eth_getProof responses into chunks of 2, so the desired action should be to chunk into chunks of length N https://github.com/ChainSafe/lodestar/blob/unstable/packages/prover/src/utils/evm.ts#L105 Because the current tests work on chunking array of length 4 into 2 the previous behavior was working and passing tests. When there are 6 requests the current behavior no longer works * Fix strings in test * Add more test cases * Update test title * Update packages/prover/test/unit/utils/conversion.test.ts Co-authored-by: Nico Flaig * Update the test description * Update the test description * Update the test description --------- Co-authored-by: Roman Dvorkin <121502696+rdvorkin@users.noreply.github.com> Co-authored-by: Nico Flaig --- packages/prover/src/utils/conversion.ts | 9 +- .../prover/test/unit/utils/conversion.test.ts | 86 +++++++++++++++++++ 2 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 packages/prover/test/unit/utils/conversion.test.ts diff --git a/packages/prover/src/utils/conversion.ts b/packages/prover/src/utils/conversion.ts index b26b1852ed74..1f143baf1bda 100644 --- a/packages/prover/src/utils/conversion.ts +++ b/packages/prover/src/utils/conversion.ts @@ -97,12 +97,11 @@ export function cleanObject | unknown[]>(obj: } /** - * Convert an array to array of chunks + * Convert an array to array of chunks of length N * @example - * chunkIntoN([1,2,3,4], 2) - * => [[1,2], [3,4]] + * chunkIntoN([1,2,3,4,5,6], 2) + * => [[1,2], [3,4], [5,6]] */ export function chunkIntoN(arr: T, n: number): T[] { - const size = Math.ceil(arr.length / n); - return Array.from({length: n}, (v, i) => arr.slice(i * size, i * size + size)) as T[]; + return Array.from({length: Math.ceil(arr.length / n)}, (_, i) => arr.slice(i * n, i * n + n)) as T[]; } diff --git a/packages/prover/test/unit/utils/conversion.test.ts b/packages/prover/test/unit/utils/conversion.test.ts new file mode 100644 index 000000000000..50ed03a89450 --- /dev/null +++ b/packages/prover/test/unit/utils/conversion.test.ts @@ -0,0 +1,86 @@ +import {expect} from "chai"; +import {chunkIntoN} from "../../../src/utils/conversion.js"; + +describe("utils/conversion", () => { + describe("chunkIntoN", () => { + const testCases = [ + { + title: "even number of chunks", + input: { + data: [1, 2, 3, 4, 5, 6], + n: 2, + }, + output: [ + [1, 2], + [3, 4], + [5, 6], + ], + }, + { + title: "even number of chunks with additional element", + input: { + data: [1, 2, 3, 4, 5, 6, 7], + n: 2, + }, + output: [[1, 2], [3, 4], [5, 6], [7]], + }, + { + title: "odd number of chunks", + input: { + data: [1, 2, 3, 4, 5, 6], + n: 3, + }, + output: [ + [1, 2, 3], + [4, 5, 6], + ], + }, + { + title: "odd number of chunks with additional element", + input: { + data: [1, 2, 3, 4, 5, 6, 7], + n: 3, + }, + output: [[1, 2, 3], [4, 5, 6], [7]], + }, + { + title: "data less than chunk size", + input: { + data: [1], + n: 3, + }, + output: [[1]], + }, + { + title: "data 1 less than chunk size", + input: { + data: [1, 2], + n: 3, + }, + output: [[1, 2]], + }, + { + title: "data 1 extra than chunk size", + input: { + data: [1, 2, 3, 4], + n: 3, + }, + output: [[1, 2, 3], [4]], + }, + ]; + + for (const {title, input, output} of testCases) { + it(`should chunkify data when ${title}`, async () => { + expect(chunkIntoN(input.data, input.n)).to.be.deep.eq(output); + }); + } + + it("should not change the order of elements", () => { + expect(chunkIntoN([6, 5, 4, 3, 2, 1], 2)).to.be.deep.eq([ + [6, 5], + [4, 3], + [2, 1], + ]); + }); + }); +}); From dd57c963c7d2d1c3ab17bc447bb7a5a30f35e798 Mon Sep 17 00:00:00 2001 From: Matthew Keil Date: Thu, 12 Oct 2023 21:27:32 +0200 Subject: [PATCH 7/9] feat(beacon-node): network worker event latency metrics (#5800) * feat(beacon-node): pass metrics to workerEvents * feat(beacon-node): add types for network worker event metrics * feat(beacon-node): add metrics for network worker events * feat(beacon-node): add metric data to network worker events * fix(beacon-node): move async iterator timestamps to correct location * fix(beacon-node): Omit unnecessary emittedAt from parameter type * feat(dashboards): add network worker thread metrics to dashboard * fix(dashboard): change metric name back to lodestar_ prefix * fix: run check-types and update missed test types * Revert "feat(beacon-node): add types for network worker event metrics" This reverts commit e8dc6d29458d5c54c02a71c01f390f34118605ab. * Revert "fix(beacon-node): move async iterator timestamps to correct location" This reverts commit 8b3f6c606e0857e94275daa25381b77c4e8c8202. * Revert "fix(beacon-node): Omit unnecessary emittedAt from parameter type" This reverts commit b7fde56b5f903cc767a84a9f5ce861d867c8b480. * Revert "feat(beacon-node): add metric data to network worker events" This reverts commit 631f57071ebf5a5595f2c0d02c8ed365825ced61. * feat(beacon-node): capture worker message in hrTime * fix(dashboards): remove re-emit panel from network worker row * fix(metrics): remove unused re-emit metrics * Revert "fix: run check-types and update missed test types" This reverts commit 525d1577baa6ddf5050fc89f19de8fcdbeca2373. * fix(beacon-node): update metric name at call site * fix(metrics): update capture to ISU units * refactor(beacon-node): move initialization out of conditional * fix: remove unused import * feat(metrics): add unit to metric name * feat(metrics): add unit to metric name * feat: add trace log statement to network worker * fix: change trace to debug log * feat(metrics): add eventName to network worker message metrics * bug(logger): check if trace is broken * feat(metrics): add worker eventDirection label * fix(metrics): use string instead of enum for eventDirection * fix(metrics): remove eventDirection label * feat(dashboards): add average panel for network worker message * fix(metrics): update naming per Nico's suggestions * refactor: remove unused logger from workerEvents.ts * fix(metrics): add network worker unit name back * fix(beacon-node): use bigint for hrtime in worker message metric * fix(dashboards): remove dashboard changes. moved to PR#5827 * fix(dashboards): remove dashboard changes. moved to PR#5827 * fix(dashboards): remove dashboard changes. moved to PR#5827 * fix: constant case for nano conversion * Revert "fix(beacon-node): use bigint for hrtime in worker message metric" This reverts commit 59f12ff89cdc1cc98c33befc1e980d777419728a. * refactor: remove Sec suffix in metric variable name * fix(dashboard): make metric name match the updates in PR --- dashboards/lodestar_networking.json | 20 +++++++++--------- .../src/metrics/metrics/lodestar.ts | 6 ++++++ .../beacon-node/src/network/core/metrics.ts | 8 +++++++ .../src/network/core/networkCoreWorker.ts | 12 ++++++----- .../network/core/networkCoreWorkerHandler.ts | 2 ++ packages/beacon-node/src/util/workerEvents.ts | 21 +++++++++++++++++++ 6 files changed, 54 insertions(+), 15 deletions(-) diff --git a/dashboards/lodestar_networking.json b/dashboards/lodestar_networking.json index 7a18f218db7b..8633faeb7668 100644 --- a/dashboards/lodestar_networking.json +++ b/dashboards/lodestar_networking.json @@ -1,12 +1,12 @@ { "__inputs": [ { - "description": "", - "label": "Prometheus", "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Prometheus", + "description": "", "pluginId": "prometheus", - "pluginName": "Prometheus", - "type": "datasource" + "pluginName": "Prometheus" } ], "annotations": { @@ -937,7 +937,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "(\n sum(rate(\n lodestar_network_worker_wire_events_on_worker_thread_latency_sum[$rate_interval]\n )) \n +\n sum(rate(\n lodestar_network_worker_wire_events_on_main_thread_latency_sum[$rate_interval]\n ))\n)\n/\n(\n sum(rate(\n lodestar_network_worker_wire_events_on_worker_thread_latency_count[$rate_interval]\n ))\n +\n sum(rate(\n lodestar_network_worker_wire_events_on_main_thread_latency_count[$rate_interval]\n ))\n)", + "expr": "(\n sum(rate(\n lodestar_network_worker_wire_events_on_worker_thread_latency_seconds_sum[$rate_interval]\n )) \n +\n sum(rate(\n lodestar_network_worker_wire_events_on_main_thread_latency_seconds_sum[$rate_interval]\n ))\n)\n/\n(\n sum(rate(\n lodestar_network_worker_wire_events_on_worker_thread_latency_seconds_count[$rate_interval]\n ))\n +\n sum(rate(\n lodestar_network_worker_wire_events_on_main_thread_latency_seconds_count[$rate_interval]\n ))\n)", "hide": false, "interval": "", "legendFormat": "Average", @@ -951,7 +951,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "avg(rate(lodestar_network_worker_wire_events_on_worker_thread_latency_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_worker_thread_latency_count[$rate_interval]))", + "expr": "avg(rate(lodestar_network_worker_wire_events_on_worker_thread_latency_seconds_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_worker_thread_latency_seconds_count[$rate_interval]))", "hide": false, "interval": "", "legendFormat": "Worker to Main", @@ -964,7 +964,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "avg(rate(lodestar_network_worker_wire_events_on_main_thread_latency_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_main_thread_latency_count[$rate_interval]))", + "expr": "avg(rate(lodestar_network_worker_wire_events_on_main_thread_latency_seconds_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_main_thread_latency_seconds_count[$rate_interval]))", "hide": false, "legendFormat": "Main to Worker", "range": true, @@ -1051,7 +1051,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "avg(rate(lodestar_network_worker_wire_events_on_main_thread_latency_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_main_thread_latency_count[$rate_interval]))", + "expr": "avg(rate(lodestar_network_worker_wire_events_on_main_thread_latency_seconds_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_main_thread_latency_seconds_count[$rate_interval]))", "hide": true, "interval": "", "legendFormat": "Average to Main", @@ -1065,7 +1065,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "rate(lodestar_network_worker_wire_events_on_main_thread_latency_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_main_thread_latency_count[$rate_interval])", + "expr": "rate(lodestar_network_worker_wire_events_on_main_thread_latency_seconds_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_main_thread_latency_seconds_count[$rate_interval])", "interval": "", "legendFormat": "{{eventName}}", "range": true, @@ -1077,7 +1077,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "rate(lodestar_network_worker_wire_events_on_worker_thread_latency_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_worker_thread_latency_count[$rate_interval])", + "expr": "rate(lodestar_network_worker_wire_events_on_worker_thread_latency_seconds_sum[$rate_interval])/rate(lodestar_network_worker_wire_events_on_worker_thread_latency_seconds_count[$rate_interval])", "hide": false, "legendFormat": "{{eventName}}", "range": true, diff --git a/packages/beacon-node/src/metrics/metrics/lodestar.ts b/packages/beacon-node/src/metrics/metrics/lodestar.ts index 8b8ce0f0c2bc..5ffae34a9eeb 100644 --- a/packages/beacon-node/src/metrics/metrics/lodestar.ts +++ b/packages/beacon-node/src/metrics/metrics/lodestar.ts @@ -121,6 +121,12 @@ export function createLodestarMetrics( help: "Current count of pending items in reqRespBridgeReqCaller data structure", }), }, + networkWorkerWireEventsOnMainThreadLatency: register.histogram<"eventName">({ + name: "lodestar_network_worker_wire_events_on_main_thread_latency_seconds", + help: "Latency in seconds to transmit network events to main thread across worker port", + labelNames: ["eventName"], + buckets: [0.001, 0.003, 0.01, 0.03, 0.1], + }), regenQueue: { length: register.gauge({ diff --git a/packages/beacon-node/src/network/core/metrics.ts b/packages/beacon-node/src/network/core/metrics.ts index 78bc88d52fe7..e5ce0bede447 100644 --- a/packages/beacon-node/src/network/core/metrics.ts +++ b/packages/beacon-node/src/network/core/metrics.ts @@ -333,6 +333,8 @@ export function createNetworkCoreMetrics(register: RegistryMetricCreator) { }; } +export type NetworkCoreWorkerMetrics = ReturnType; + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type export function getNetworkCoreWorkerMetrics(register: RegistryMetricCreator) { return { @@ -340,5 +342,11 @@ export function getNetworkCoreWorkerMetrics(register: RegistryMetricCreator) { name: "lodestar_network_worker_reqresp_bridge_caller_pending_count", help: "Current count of pending elements in respBridgeCaller", }), + networkWorkerWireEventsOnWorkerThreadLatency: register.histogram<"eventName">({ + name: "lodestar_network_worker_wire_events_on_worker_thread_latency_seconds", + help: "Latency in seconds to transmit network events to worker thread across parent port", + labelNames: ["eventName"], + buckets: [0.001, 0.003, 0.01, 0.03, 0.1], + }), }; } diff --git a/packages/beacon-node/src/network/core/networkCoreWorker.ts b/packages/beacon-node/src/network/core/networkCoreWorker.ts index a0c8ff22fe60..35303190a8f8 100644 --- a/packages/beacon-node/src/network/core/networkCoreWorker.ts +++ b/packages/beacon-node/src/network/core/networkCoreWorker.ts @@ -13,6 +13,9 @@ import {peerIdToString} from "../../util/peerId.js"; import {profileNodeJS} from "../../util/profile.js"; import {NetworkEventBus, NetworkEventData, networkEventDirection} from "../events.js"; import {wireEventsOnWorkerThread} from "../../util/workerEvents.js"; +import {getNetworkCoreWorkerMetrics} from "./metrics.js"; +import {NetworkWorkerApi, NetworkWorkerData} from "./types.js"; +import {NetworkCore} from "./networkCore.js"; import { NetworkWorkerThreadEventType, ReqRespBridgeEventBus, @@ -21,9 +24,6 @@ import { getReqRespBridgeRespEvents, reqRespBridgeEventDirection, } from "./events.js"; -import {getNetworkCoreWorkerMetrics} from "./metrics.js"; -import {NetworkCore} from "./networkCore.js"; -import {NetworkWorkerApi, NetworkWorkerData} from "./types.js"; // Cloned data from instantiation const workerData = worker.workerData as NetworkWorkerData; @@ -83,9 +83,9 @@ new AsyncIterableBridgeHandler(getReqRespBridgeReqEvents(reqRespBridgeEventBus), ); const reqRespBridgeRespCaller = new AsyncIterableBridgeCaller(getReqRespBridgeRespEvents(reqRespBridgeEventBus)); +const networkCoreWorkerMetrics = metricsRegister ? getNetworkCoreWorkerMetrics(metricsRegister) : null; // respBridgeCaller metrics -if (metricsRegister) { - const networkCoreWorkerMetrics = getNetworkCoreWorkerMetrics(metricsRegister); +if (networkCoreWorkerMetrics) { networkCoreWorkerMetrics.reqRespBridgeRespCallerPending.addCollect(() => { networkCoreWorkerMetrics.reqRespBridgeRespCallerPending.set(reqRespBridgeRespCaller.pendingCount); }); @@ -110,12 +110,14 @@ wireEventsOnWorkerThread( NetworkWorkerThreadEventType.networkEvent, events, parentPort, + networkCoreWorkerMetrics, networkEventDirection ); wireEventsOnWorkerThread( NetworkWorkerThreadEventType.reqRespBridgeEvents, reqRespBridgeEventBus, parentPort, + networkCoreWorkerMetrics, reqRespBridgeEventDirection ); diff --git a/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts b/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts index 73ca9e9c5fd0..8c944dd87d2d 100644 --- a/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts +++ b/packages/beacon-node/src/network/core/networkCoreWorkerHandler.ts @@ -75,12 +75,14 @@ export class WorkerNetworkCore implements INetworkCore { NetworkWorkerThreadEventType.networkEvent, modules.events, modules.worker as unknown as worker_threads.Worker, + modules.metrics, networkEventDirection ); wireEventsOnMainThread( NetworkWorkerThreadEventType.reqRespBridgeEvents, this.reqRespBridgeEventBus, modules.worker as unknown as worker_threads.Worker, + modules.metrics, reqRespBridgeEventDirection ); diff --git a/packages/beacon-node/src/util/workerEvents.ts b/packages/beacon-node/src/util/workerEvents.ts index cd61e6b95393..807bf7a30618 100644 --- a/packages/beacon-node/src/util/workerEvents.ts +++ b/packages/beacon-node/src/util/workerEvents.ts @@ -2,11 +2,16 @@ import {MessagePort, Worker} from "node:worker_threads"; import {Thread} from "@chainsafe/threads"; import {Logger} from "@lodestar/logger"; import {sleep} from "@lodestar/utils"; +import {Metrics} from "../metrics/metrics.js"; +import {NetworkCoreWorkerMetrics} from "../network/core/metrics.js"; import {StrictEventEmitterSingleArg} from "./strictEvents.js"; +const NANO_TO_SECOND_CONVERSION = 1e9; + export type WorkerBridgeEvent = { type: string; event: keyof EventData; + posted: [number, number]; data: EventData[keyof EventData]; }; @@ -27,6 +32,7 @@ export function wireEventsOnWorkerThread( mainEventName: string, events: StrictEventEmitterSingleArg, parentPort: MessagePort, + metrics: NetworkCoreWorkerMetrics | null, isWorkerToMain: {[K in keyof EventData]: EventDirection} ): void { // Subscribe to events from main thread @@ -37,6 +43,12 @@ export function wireEventsOnWorkerThread( // This check is not necessary but added for safety in case of improper implemented events isWorkerToMain[data.event] === EventDirection.mainToWorker ) { + const [sec, nanoSec] = process.hrtime(data.posted); + const networkWorkerLatency = sec + nanoSec / NANO_TO_SECOND_CONVERSION; + metrics?.networkWorkerWireEventsOnWorkerThreadLatency.observe( + {eventName: data.event as string}, + networkWorkerLatency + ); events.emit(data.event, data.data); } }); @@ -48,6 +60,7 @@ export function wireEventsOnWorkerThread( const workerEvent: WorkerBridgeEvent = { type: mainEventName, event: eventName, + posted: process.hrtime(), data, }; parentPort.postMessage(workerEvent); @@ -60,6 +73,7 @@ export function wireEventsOnMainThread( mainEventName: string, events: StrictEventEmitterSingleArg, worker: Pick, + metrics: Metrics | null, isWorkerToMain: {[K in keyof EventData]: EventDirection} ): void { // Subscribe to events from main thread @@ -70,6 +84,12 @@ export function wireEventsOnMainThread( // This check is not necessary but added for safety in case of improper implemented events isWorkerToMain[data.event] === EventDirection.workerToMain ) { + const [sec, nanoSec] = process.hrtime(data.posted); + const networkWorkerLatency = sec + nanoSec / NANO_TO_SECOND_CONVERSION; + metrics?.networkWorkerWireEventsOnMainThreadLatency.observe( + {eventName: data.event as string}, + networkWorkerLatency + ); events.emit(data.event, data.data); } }); @@ -81,6 +101,7 @@ export function wireEventsOnMainThread( const workerEvent: WorkerBridgeEvent = { type: mainEventName, event: eventName, + posted: process.hrtime(), data, }; worker.postMessage(workerEvent); From 48f9a08f5067e24f4ffd3741d67289c21adc4c3a Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Fri, 13 Oct 2023 03:38:19 +0200 Subject: [PATCH 8/9] fix: the unknown block sync timeout (#6031) * Fix the unknown block sync timeout * Remove unused variable * Recompute the sync check initiate condition * Move the range sync delay fix when we only have range sync enabled * chore: rename variable --------- Co-authored-by: Tuyen Nguyen --- packages/beacon-node/src/sync/sync.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/beacon-node/src/sync/sync.ts b/packages/beacon-node/src/sync/sync.ts index dac8a501cea0..9cf7ba9ff716 100644 --- a/packages/beacon-node/src/sync/sync.ts +++ b/packages/beacon-node/src/sync/sync.ts @@ -57,14 +57,30 @@ export class BeaconSync implements IBeaconSync { this.rangeSync.on(RangeSyncEvent.completedChain, this.updateSyncState); this.network.events.on(NetworkEvent.peerConnected, this.addPeer); this.network.events.on(NetworkEvent.peerDisconnected, this.removePeer); + this.chain.clock.on(ClockEvent.epoch, this.onClockEpoch); } else { // test code, this is needed for Unknown block sync sim test this.unknownBlockSync.subscribeToNetwork(); this.logger.debug("RangeSync disabled."); - } - // TODO: It's okay to start this on initial sync? - this.chain.clock.on(ClockEvent.epoch, this.onClockEpoch); + // In case node is started with `rangeSync` disabled and `unknownBlockSync` is enabled. + // If the epoch boundary happens right away the `onClockEpoch` will check for the `syncDiff` and if + // it's more than 2 epoch will disable the disabling the `unknownBlockSync` as well. + // This will result into node hanging on the head slot and not syncing any blocks. + // This was the scenario in the test case `Unknown block sync` in `packages/cli/test/sim/multi_fork.test.ts` + // So we are adding a particular delay to ensure that the `unknownBlockSync` is enabled. + const syncStartSlot = this.chain.clock.currentSlot; + // Having one epoch time for the node to connect to peers and start a syncing process + const epochCheckForSyncSlot = syncStartSlot + SLOTS_PER_EPOCH; + const initiateEpochCheckForSync = (): void => { + if (this.chain.clock.currentSlot > epochCheckForSyncSlot) { + this.logger.info("Initiating epoch check for sync progress"); + this.chain.clock.off(ClockEvent.slot, initiateEpochCheckForSync); + this.chain.clock.on(ClockEvent.epoch, this.onClockEpoch); + } + }; + this.chain.clock.on(ClockEvent.slot, initiateEpochCheckForSync); + } if (metrics) { metrics.syncStatus.addCollect(() => this.scrapeMetrics(metrics)); From c6291ada650b40051cb71ed865ba12c9d60899da Mon Sep 17 00:00:00 2001 From: tuyennhv Date: Fri, 13 Oct 2023 09:28:27 +0700 Subject: [PATCH 9/9] chore: update persistent-merkle-tree 0.6.1 (#5969) * feat: migrate @chainsafe/persistent-merkle-tree to 0.6.1 * fix: setHasher first * chore: move setHasher to applyPreset.ts * chore: fix applyPreset import --------- Co-authored-by: Cayman --- packages/api/package.json | 2 +- packages/beacon-node/package.json | 2 +- packages/cli/package.json | 1 + packages/cli/src/applyPreset.ts | 9 +++++++++ packages/cli/src/index.ts | 2 +- packages/light-client/package.json | 2 +- packages/light-client/src/utils/verifyMerkleBranch.ts | 6 +++--- packages/light-client/test/utils/utils.ts | 6 +++--- packages/prover/src/cli/applyPreset.ts | 9 +++++++++ packages/prover/src/cli/index.ts | 2 +- packages/state-transition/package.json | 2 +- yarn.lock | 7 ------- 12 files changed, 31 insertions(+), 19 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index dc4854448c45..4cddda4b4033 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -69,7 +69,7 @@ "check-readme": "typescript-docs-verifier" }, "dependencies": { - "@chainsafe/persistent-merkle-tree": "^0.5.0", + "@chainsafe/persistent-merkle-tree": "^0.6.1", "@chainsafe/ssz": "^0.13.0", "@lodestar/config": "^1.11.3", "@lodestar/params": "^1.11.3", diff --git a/packages/beacon-node/package.json b/packages/beacon-node/package.json index 7af605f6f603..71dc7ec65dea 100644 --- a/packages/beacon-node/package.json +++ b/packages/beacon-node/package.json @@ -102,7 +102,7 @@ "@chainsafe/discv5": "^5.1.0", "@chainsafe/libp2p-gossipsub": "^10.1.0", "@chainsafe/libp2p-noise": "^13.0.0", - "@chainsafe/persistent-merkle-tree": "^0.5.0", + "@chainsafe/persistent-merkle-tree": "^0.6.1", "@chainsafe/prometheus-gc-stats": "^1.0.0", "@chainsafe/ssz": "^0.13.0", "@chainsafe/threads": "^1.11.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index ab9e09e39a3c..9cec49cbf419 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -61,6 +61,7 @@ "@chainsafe/discv5": "^5.1.0", "@chainsafe/ssz": "^0.13.0", "@chainsafe/threads": "^1.11.1", + "@chainsafe/persistent-merkle-tree": "^0.6.1", "@libp2p/crypto": "^2.0.2", "@libp2p/peer-id": "^3.0.1", "@libp2p/peer-id-factory": "^3.0.2", diff --git a/packages/cli/src/applyPreset.ts b/packages/cli/src/applyPreset.ts index f0f784f8ae61..760c18dbbcd7 100644 --- a/packages/cli/src/applyPreset.ts +++ b/packages/cli/src/applyPreset.ts @@ -1,4 +1,13 @@ // MUST import this file first before anything and not import any Lodestar code. + +// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies +import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js"; +// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies +import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js"; + +// without setting this first, persistent-merkle-tree will use noble instead +setHasher(hasher); + // // ## Rationale // diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index add49804c9be..5cdccbacfeec 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -// MUST import first to apply preset from args +// MUST import first to apply preset from args and set ssz hasher import "./applyPreset.js"; import {YargsError} from "./util/index.js"; import {getLodestarCli, yarg} from "./cli.js"; diff --git a/packages/light-client/package.json b/packages/light-client/package.json index 3f10ecd67aa4..8a33f2fa862c 100644 --- a/packages/light-client/package.json +++ b/packages/light-client/package.json @@ -65,7 +65,7 @@ }, "dependencies": { "@chainsafe/bls": "7.1.1", - "@chainsafe/persistent-merkle-tree": "^0.5.0", + "@chainsafe/persistent-merkle-tree": "^0.6.1", "@chainsafe/ssz": "^0.13.0", "@lodestar/api": "^1.11.3", "@lodestar/config": "^1.11.3", diff --git a/packages/light-client/src/utils/verifyMerkleBranch.ts b/packages/light-client/src/utils/verifyMerkleBranch.ts index 7cdf673aaf87..87b1d660eb32 100644 --- a/packages/light-client/src/utils/verifyMerkleBranch.ts +++ b/packages/light-client/src/utils/verifyMerkleBranch.ts @@ -1,5 +1,5 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {hash} from "@chainsafe/persistent-merkle-tree"; +import {hasher} from "@chainsafe/persistent-merkle-tree"; export const SYNC_COMMITTEES_DEPTH = 4; export const SYNC_COMMITTEES_INDEX = 11; @@ -20,9 +20,9 @@ export function isValidMerkleBranch( let value = leaf; for (let i = 0; i < depth; i++) { if (Math.floor(index / 2 ** i) % 2) { - value = hash(proof[i], value); + value = hasher.digest64(proof[i], value); } else { - value = hash(value, proof[i]); + value = hasher.digest64(value, proof[i]); } } return byteArrayEquals(value, root); diff --git a/packages/light-client/test/utils/utils.ts b/packages/light-client/test/utils/utils.ts index c5f5b78afe42..df9bd4170dcc 100644 --- a/packages/light-client/test/utils/utils.ts +++ b/packages/light-client/test/utils/utils.ts @@ -1,6 +1,6 @@ import bls from "@chainsafe/bls/switchable"; import {PointFormat, PublicKey, SecretKey} from "@chainsafe/bls/types"; -import {hash, Tree} from "@chainsafe/persistent-merkle-tree"; +import {hasher, Tree} from "@chainsafe/persistent-merkle-tree"; import {BitArray, fromHexString} from "@chainsafe/ssz"; import {BeaconConfig} from "@lodestar/config"; import { @@ -235,9 +235,9 @@ export function computeMerkleBranch( for (let i = 0; i < depth; i++) { proof[i] = Buffer.alloc(32, i); if (Math.floor(index / 2 ** i) % 2) { - value = hash(proof[i], value); + value = hasher.digest64(proof[i], value); } else { - value = hash(value, proof[i]); + value = hasher.digest64(value, proof[i]); } } return {root: value, proof}; diff --git a/packages/prover/src/cli/applyPreset.ts b/packages/prover/src/cli/applyPreset.ts index a6a3568c5f91..158e05243ec7 100644 --- a/packages/prover/src/cli/applyPreset.ts +++ b/packages/prover/src/cli/applyPreset.ts @@ -1,4 +1,13 @@ // MUST import this file first before anything and not import any Lodestar code. + +// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies +import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js"; +// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies +import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js"; + +// without setting this first, persistent-merkle-tree will use noble instead +setHasher(hasher); + // // ## Rationale // diff --git a/packages/prover/src/cli/index.ts b/packages/prover/src/cli/index.ts index 53a32a02eb87..845831b32cb0 100644 --- a/packages/prover/src/cli/index.ts +++ b/packages/prover/src/cli/index.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -// MUST import first to apply preset from args +// MUST import first to apply preset from args and set ssz hasher import "./applyPreset.js"; import {YargsError} from "../utils/errors.js"; import {getLodestarProverCli, yarg} from "./cli.js"; diff --git a/packages/state-transition/package.json b/packages/state-transition/package.json index 269e8e129f48..ec2b7dfe0b31 100644 --- a/packages/state-transition/package.json +++ b/packages/state-transition/package.json @@ -59,7 +59,7 @@ "dependencies": { "@chainsafe/as-sha256": "^0.3.1", "@chainsafe/bls": "7.1.1", - "@chainsafe/persistent-merkle-tree": "^0.5.0", + "@chainsafe/persistent-merkle-tree": "^0.6.1", "@chainsafe/persistent-ts": "^0.19.1", "@chainsafe/ssz": "^0.13.0", "@lodestar/config": "^1.11.3", diff --git a/yarn.lock b/yarn.lock index ad25e99d2a72..22bab309ad68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -611,13 +611,6 @@ dependencies: "@chainsafe/is-ip" "^2.0.1" -"@chainsafe/persistent-merkle-tree@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.5.0.tgz#2b4a62c9489a5739dedd197250d8d2f5427e9f63" - integrity sha512-l0V1b5clxA3iwQLXP40zYjyZYospQLZXzBVIhhr9kDg/1qHZfzzHw0jj4VPBijfYCArZDlPkRi1wZaV2POKeuw== - dependencies: - "@chainsafe/as-sha256" "^0.3.1" - "@chainsafe/persistent-merkle-tree@^0.6.1": version "0.6.1" resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.6.1.tgz#37bde25cf6cbe1660ad84311aa73157dc86ec7f2"