From 581f0781eaeaa959035780e4174b6a5b3e65bd67 Mon Sep 17 00:00:00 2001 From: derrandz Date: Wed, 23 Nov 2022 23:38:57 +0000 Subject: [PATCH] feat: add testground influxdb metric and improve dashboard charts --- build/grafana/dashboards/benchmarks.json | 756 ++++++++++++++++-- build/otel-collector/config.yml | 2 +- testkit/appkit/app.go | 11 + testkit/sync.go | 1 + tests/helpers/das-benchmarks/run_bridge.go | 26 +- tests/helpers/das-benchmarks/run_light.go | 60 +- tests/helpers/das-benchmarks/run_validator.go | 14 +- 7 files changed, 753 insertions(+), 117 deletions(-) diff --git a/build/grafana/dashboards/benchmarks.json b/build/grafana/dashboards/benchmarks.json index f3abcedd..07300e91 100644 --- a/build/grafana/dashboards/benchmarks.json +++ b/build/grafana/dashboards/benchmarks.json @@ -30,14 +30,30 @@ "panels": [ { "datasource": { - "type": "prometheus", - "uid": "lW0MKED4k" + "type": "influxdb", + "uid": "LoyIzPOVz" }, - "description": "", "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + } }, "mappings": [], "thresholds": { @@ -52,8 +68,7 @@ "value": 80 } ] - }, - "unit": "KBs" + } }, "overrides": [] }, @@ -63,40 +78,124 @@ "x": 0, "y": 0 }, - "id": 123133, + "id": 123139, "options": { + "barRadius": 0, + "barWidth": 0.97, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" }, - "showThresholdLabels": false, - "showThresholdMarkers": true + "xField": "height", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 }, - "pluginVersion": "9.2.4", "targets": [ { "datasource": { - "type": "prometheus", - "uid": "lW0MKED4k" + "type": "influxdb", + "uid": "LoyIzPOVz" }, - "editorMode": "code", - "expr": "(rate(testground_node_header_blackbox_request_duration_sum{exported_instance=\"$light_node_id\"}[$__range])/rate(testground_node_header_blackbox_request_duration_count{exported_instance=\"$light_node_id\"}[$__range]))/1000", - "legendFormat": "__auto", - "range": true, - "refId": "A" + "groupBy": [ + { + "params": [ + "5m" + ], + "type": "time" + }, + { + "params": [ + "height" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "results.celestia-001-lights-dasing-latest.das.time_to_catch_up.point", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT percentile(\"value\", 95) / 1000 FROM \"results.celestia-001-lights-dasing-latest.das.time_to_catch_up.point\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + " / 1000" + ], + "type": "math" + } + ] + ], + "tags": [] } ], - "title": "Average Header Transfer Rate (kb/s)", - "type": "gauge" + "title": "Time To Catch Up (In Test)", + "transformations": [ + { + "id": "filterByValue", + "options": { + "filters": [ + { + "config": { + "id": "isNull", + "options": {} + }, + "fieldName": "mean" + } + ], + "match": "any", + "type": "exclude" + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "height": { + "aggregations": [], + "operation": "groupby" + }, + "mean": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], + "type": "barchart" }, { "datasource": { - "type": "prometheus", - "uid": "lW0MKED4k" + "type": "influxdb", + "uid": "LoyIzPOVz" }, "fieldConfig": { "defaults": { @@ -143,7 +242,7 @@ "x": 12, "y": 0 }, - "id": 123125, + "id": 123140, "options": { "barRadius": 0, "barWidth": 0.97, @@ -161,35 +260,128 @@ "mode": "single", "sort": "none" }, + "xField": "height", "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, "targets": [ { "datasource": { - "type": "prometheus", - "uid": "lW0MKED4k" + "type": "influxdb", + "uid": "LoyIzPOVz" }, - "editorMode": "code", - "expr": "avg by (header) (testground_das_sample_time_hist_sum{exported_instance=\"$light_node_id\"})", - "legendFormat": "__auto", - "range": true, - "refId": "A" + "groupBy": [ + { + "params": [ + "5m" + ], + "type": "time" + }, + { + "params": [ + "height" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "results.celestia-001-lights-dasing-latest.validator.time_to_produce_block.point", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT percentile(\"value\", 95) / 1000 FROM \"results.celestia-001-lights-dasing-latest.das.time_to_catch_up.point\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + " / 1000" + ], + "type": "math" + } + ] + ], + "tags": [] + } + ], + "title": "Time To Produce Block (In Test)", + "transformations": [ + { + "id": "filterByValue", + "options": { + "filters": [ + { + "config": { + "id": "isNull", + "options": {} + }, + "fieldName": "mean" + } + ], + "match": "any", + "type": "exclude" + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "height": { + "aggregations": [], + "operation": "groupby" + }, + "mean": { + "aggregations": [], + "operation": "groupby" + } + } + } } ], - "title": "DASing time / height", - "transformations": [], "type": "barchart" }, { "datasource": { - "type": "prometheus", - "uid": "lW0MKED4k" + "type": "influxdb", + "uid": "LoyIzPOVz" }, "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + } }, "mappings": [], "thresholds": { @@ -204,31 +396,293 @@ "value": 80 } ] - }, - "unit": "KBs" + } }, "overrides": [] }, "gridPos": { "h": 8, - "w": 12, + "w": 24, "x": 0, "y": 8 }, - "id": 123131, + "id": 123141, "options": { + "barRadius": 0, + "barWidth": 0.97, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xField": "height", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "LoyIzPOVz" + }, + "groupBy": [ + { + "params": [ + "5m" + ], + "type": "time" + }, + { + "params": [ + "height" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } ], - "fields": "", - "values": false + "measurement": "results.celestia-001-lights-dasing-latest.bridge.time_to_sync_block.point", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT percentile(\"value\", 95) / 1000 FROM \"results.celestia-001-lights-dasing-latest.das.time_to_catch_up.point\" WHERE $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": false, + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + " / 1000" + ], + "type": "math" + } + ] + ], + "tags": [] + } + ], + "title": "Time To Sync Block (Bridge) (In Test)", + "transformations": [ + { + "id": "filterByValue", + "options": { + "filters": [ + { + "config": { + "id": "isNull", + "options": {} + }, + "fieldName": "mean" + } + ], + "match": "any", + "type": "exclude" + } }, - "showThresholdLabels": false, - "showThresholdMarkers": true + { + "id": "groupBy", + "options": { + "fields": { + "height": { + "aggregations": [], + "operation": "groupby" + }, + "mean": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "influxdb", + "uid": "LoyIzPOVz" + }, + "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": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 123136, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } }, "pluginVersion": "9.2.4", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "LoyIzPOVz" + }, + "query": "SELECT count(\"count\") FROM \"results.celestia-001-lights-dasing-latest.light-nodes-counter.counter\" WHERE (\"group_id\" = 'lights') AND $timeFilter GROUP BY time(1s), \"group_id\" fill(null)", + "rawQuery": true, + "refId": "A", + "resultFormat": "time_series" + } + ], + "title": "# of Light Nodes Alive", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "lW0MKED4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 23 + }, + "id": 123127, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, "targets": [ { "datasource": { @@ -236,14 +690,32 @@ "uid": "lW0MKED4k" }, "editorMode": "code", - "expr": "(rate(testground_node_share_blackbox_request_duration_sum{exported_instance=\"$light_node_id\"}[$__range])/rate(testground_node_share_blackbox_request_duration_count{exported_instance=\"$light_node_id\"}[$__range]))", + "expr": "(avg by (height) (testground_node_header_blackbox_block_time_sum{exported_instance=\"$light_node_id\"}))/1000", + "format": "table", "legendFormat": "__auto", "range": true, "refId": "A" } ], - "title": "Average Share Transfer Rate (kb/s)", - "type": "gauge" + "title": "Block time per Height", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "Value": { + "aggregations": [], + "operation": "groupby" + }, + "height": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], + "type": "barchart" }, { "datasource": { @@ -285,7 +757,8 @@ "value": 80 } ] - } + }, + "unit": "short" }, "overrides": [] }, @@ -293,9 +766,9 @@ "h": 8, "w": 12, "x": 12, - "y": 8 + "y": 23 }, - "id": 123127, + "id": 123137, "options": { "barRadius": 0, "barWidth": 0.97, @@ -303,11 +776,11 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom", + "placement": "right", "showLegend": true }, "orientation": "auto", - "showValue": "auto", + "showValue": "never", "stacking": "none", "tooltip": { "mode": "single", @@ -323,15 +796,164 @@ "uid": "lW0MKED4k" }, "editorMode": "code", - "expr": "(max by (height) (testground_node_header_blackbox_block_time_sum{exported_instance=\"$light_node_id\"}))/1000", + "exemplar": false, + "expr": "avg by (header) (testground_das_sample_time_hist_sum{exported_instance=\"$light_node_id\"})", + "format": "table", + "instant": true, "legendFormat": "__auto", "range": true, "refId": "A" } ], - "title": "Block time / Height", + "title": "DASing time per Height", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "Value": { + "aggregations": [], + "operation": "groupby" + }, + "header": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], "type": "barchart" }, + { + "datasource": { + "type": "prometheus", + "uid": "lW0MKED4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "KBs" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 31 + }, + "id": 123131, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "9.2.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "lW0MKED4k" + }, + "editorMode": "code", + "expr": "(rate(testground_node_share_blackbox_request_duration_sum{exported_instance=\"$light_node_id\"}[$__range])/rate(testground_node_share_blackbox_request_duration_count{exported_instance=\"$light_node_id\"}[$__range]))", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Average Share Transfer Rate (kb/s)", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "lW0MKED4k" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "KBs" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 31 + }, + "id": 123133, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "9.2.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "lW0MKED4k" + }, + "editorMode": "code", + "expr": "(rate(testground_node_header_blackbox_request_duration_sum{exported_instance=\"$light_node_id\"}[$__range])/rate(testground_node_header_blackbox_request_duration_count{exported_instance=\"$light_node_id\"}[$__range]))/1000", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Average Header Transfer Rate (kb/s)", + "type": "gauge" + }, { "datasource": { "type": "prometheus", @@ -365,7 +987,7 @@ "h": 8, "w": 12, "x": 0, - "y": 16 + "y": 39 }, "id": 123129, "options": { @@ -434,7 +1056,7 @@ "h": 8, "w": 12, "x": 12, - "y": 16 + "y": 39 }, "id": 123134, "options": { @@ -479,8 +1101,8 @@ { "current": { "selected": false, - "text": "12D3KooWBHiBbE1hWsXd9JaPE7Gy3VaAZsTJ31Wt3evjERAwHW9g", - "value": "12D3KooWBHiBbE1hWsXd9JaPE7Gy3VaAZsTJ31Wt3evjERAwHW9g" + "text": "12D3KooWSJuXtv6RA4UUScFxBJVYFfmVCd9VBCkS1iRgvzrVciL1", + "value": "12D3KooWSJuXtv6RA4UUScFxBJVYFfmVCd9VBCkS1iRgvzrVciL1" }, "datasource": { "type": "prometheus", @@ -505,7 +1127,7 @@ ] }, "time": { - "from": "now-6h", + "from": "now-15m", "to": "now" }, "timepicker": { @@ -538,6 +1160,6 @@ "timezone": "browser", "title": "Bridge Node vs Multiple Light Nodes Benchmark", "uid": "Fns8TadVz", - "version": 2, + "version": 7, "weekStart": "" } \ No newline at end of file diff --git a/build/otel-collector/config.yml b/build/otel-collector/config.yml index 54e9adba..0163899c 100644 --- a/build/otel-collector/config.yml +++ b/build/otel-collector/config.yml @@ -16,7 +16,7 @@ exporters: endpoint: "otel-collector:8889" namespace: "testground" send_timestamps: true - metric_expiration: 180m + metric_expiration: 1440m processors: batch: diff --git a/testkit/appkit/app.go b/testkit/appkit/app.go index 68029882..7c4da5d4 100644 --- a/testkit/appkit/app.go +++ b/testkit/appkit/app.go @@ -285,6 +285,17 @@ func GetLatestsBlockSize(ip net.IP) (int, error) { return resBlock.Block.Size(), nil } +func GetLatestBlockSizeAndHeight(ip net.IP) (int, uint64, error) { + uri := fmt.Sprintf("http://%s:26657/block", ip.To4().String()) + + resBlock, err := getResultBlockResponse(uri) + if err != nil { + return 0, 0, err + } + + return resBlock.Block.Size(), uint64(resBlock.Block.Height), nil +} + func updateConfig(path, key string, value interface{}) error { fh, err := os.OpenFile(path, os.O_RDWR, 0777) if err != nil { diff --git a/testkit/sync.go b/testkit/sync.go index 57255c97..56f8b4ef 100644 --- a/testkit/sync.go +++ b/testkit/sync.go @@ -52,4 +52,5 @@ var ( PastBlocksGeneratedState = sync.State("past-blocks-generated") AccountsFundedState = sync.State("accounts-funded") FinishState = sync.State("test-finished") + LightNodesStartedState = sync.State("light-nodes-started") ) diff --git a/tests/helpers/das-benchmarks/run_bridge.go b/tests/helpers/das-benchmarks/run_bridge.go index ec02acc3..c16142ac 100644 --- a/tests/helpers/das-benchmarks/run_bridge.go +++ b/tests/helpers/das-benchmarks/run_bridge.go @@ -59,19 +59,23 @@ func RunBridgeNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error { return err } - // After reaching a dedicated block-height, we can signal other node types - // to start syncing the past - eh, err := nd.HeaderServ.GetByHeight(ctx, uint64(runenv.IntParam("block-height"))) - if err != nil { - return err + for i := 0; i < runenv.IntParam("block-height"); i++ { + start := time.Now() + // After reaching a dedicated block-height, we can signal other node types + // to start syncing the past + eh, err := nd.HeaderServ.GetByHeight(ctx, uint64(i+1)) + if err != nil { + runenv.RecordFailure(err) + return err + } + runenv.R().RecordPoint(fmt.Sprintf("bridge.time_to_sync_block,height=%v", eh.RawHeader.Height), float64(time.Since(start).Milliseconds())) + runenv.RecordMessage( + "Reached Block#%d contains Hash: %s", + runenv.IntParam("block-height"), + eh.Commit.BlockID.Hash.String(), + ) } - runenv.RecordMessage( - "Reached Block#%d contains Hash: %s", - runenv.IntParam("block-height"), - eh.Commit.BlockID.Hash.String(), - ) - if nd.HeaderServ.IsSyncing() { runenv.RecordFailure(fmt.Errorf("bridge node is still syncing the past")) } diff --git a/tests/helpers/das-benchmarks/run_light.go b/tests/helpers/das-benchmarks/run_light.go index b8def433..38110de0 100644 --- a/tests/helpers/das-benchmarks/run_light.go +++ b/tests/helpers/das-benchmarks/run_light.go @@ -101,7 +101,7 @@ func RunLightNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error { return err } - runenv.RecordMessage("Starting DAS") + runenv.R().Counter("light-nodes-counter").Inc(1) // wait for the core network to reach height 1 _, err = nd.HeaderServ.GetByHeight(ctx, uint64(1)) @@ -110,52 +110,38 @@ func RunLightNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error { return err } + // wait for the daser to catch up with the current height of the core network err = nd.DASer.WaitCatchUp(ctx) if err != nil { runenv.RecordFailure(fmt.Errorf("Error while waiting for the DASer to catch up, %s", err)) return err } - // prevHead := []byte(bridgeNode.TrustedHash) + _, err = syncclient.SignalEntry(ctx, testkit.LightNodesStartedState) + if err != nil { + return err + } - for i := 0; i < runenv.IntParam("block-height"); i++ { - header, err := nd.HeaderServ.SyncerHead(ctx) + // let the chain move! + for i := 1; i < runenv.IntParam("block-height"); i++ { + start := time.Now() + nd.DASer.WaitCatchUp(ctx) // wait for the daser to catch up on every height + stats, err := nd.DASer.SamplingStats(ctx) if err != nil { - runenv.RecordFailure(fmt.Errorf("Failed to retrieve SyncerHead: %s", err)) - return err + runenv.RecordFailure(err) + } else { + runenv.R().Gauge("daser-head").Update( + float64(stats.SampledChainHead), + ) + runenv.R().RecordPoint(fmt.Sprintf("das.time_to_catch_up,height=%v", stats.SampledChainHead), float64(time.Since(start).Milliseconds())) } - // if bytes.Compare(header.Commit.BlockID.Hash, prevHead) == 0 { - // err := fmt.Errorf("Light Node Error: Block Sync Not Advancing, Failed to stay on top of the chain") - // runenv.RecordMessage(err) - // return err - // } - - // prevHead = header.Commit.BlockID.Hash - - // if nd.HeaderServ.IsSyncing() { - // err := fmt.Errorf("Light Node Error: BlockSync still in progress, Failed to stay on top of the chain") - // runenv.RecordMessage(err) - // return err - // } - - // st, err := nd.DASer.SamplingStats(ctx) - // if err != nil { - // err := fmt.Errorf("Light Node Error: Failed to retrieve sampling stats, %s", err) - // runenv.RecordMessage(err) - // return err - // } - - // // if all known headers (up to header.RawHeader.Height) are sampled - // // and all headers before CatchupHead are on going - // // we have successfully up to SampledChainHead - // if !(st.CatchUpDone && - // st.CatchupHead == uint64(header.RawHeader.Height) && - // st.SampledChainHead == uint64(header.RawHeader.Height)) { - // return fmt.Errorf("xxx") - // } - - nd.HeaderServ.GetByHeight(ctx, uint64(header.RawHeader.Height+1)) + // wait for the core network to reach height 1 + _, err = nd.HeaderServ.GetByHeight(ctx, uint64(i+1)) + if err != nil { + runenv.RecordFailure(fmt.Errorf("Error: failed to sync headers, %s", err)) + return err + } } err = nd.Stop(ctx) diff --git a/tests/helpers/das-benchmarks/run_validator.go b/tests/helpers/das-benchmarks/run_validator.go index 5de35226..2103d854 100644 --- a/tests/helpers/das-benchmarks/run_validator.go +++ b/tests/helpers/das-benchmarks/run_validator.go @@ -2,6 +2,7 @@ package dasbenchmarks import ( "context" + "fmt" "net" "time" @@ -82,7 +83,17 @@ func RunValidator(runenv *runtime.RunEnv, initCtx *run.InitContext) error { // // wait for a new block to be produced time.Sleep(1 * time.Minute) + l, err := syncclient.Barrier(ctx, testkit.LightNodesStartedState, runenv.IntParam("light")) + if err != nil { + runenv.RecordFailure(err) + } + lerr := <-l.C + if lerr != nil { + runenv.RecordFailure(lerr) + } + for i := 0; i < runenv.IntParam("submit-times"); i++ { + start := time.Now() runenv.RecordMessage("Submitting PFD with %d bytes random data", runenv.IntParam("msg-size")) err = appcmd.PayForData( appcmd.AccountAddress, @@ -95,12 +106,13 @@ func RunValidator(runenv *runtime.RunEnv, initCtx *run.InitContext) error { return err } - s, err := appkit.GetLatestsBlockSize(net.ParseIP("127.0.0.1")) + s, h, err := appkit.GetLatestBlockSizeAndHeight(net.ParseIP("127.0.0.1")) if err != nil { runenv.RecordMessage("err in last size call, %s", err.Error()) } runenv.RecordMessage("latest size on iteration %d of the block is - %d", i, s) + runenv.R().RecordPoint(fmt.Sprintf("validator.time_to_produce_block,height=%v", h), float64(time.Since(start).Milliseconds())) } time.Sleep(30 * time.Second)