diff --git a/@ b/@ new file mode 100644 index 0000000..e86032c --- /dev/null +++ b/@ @@ -0,0 +1,6 @@ +Merge branch 'main' into darren/chore/minor-dashboard-improvements +# Please enter a commit message to explain why this merge is necessary, +# especially if it merges an updated upstream into a topic branch. +# +# Lines starting with '#' will be ignored, and an empty message aborts +# the commit. diff --git a/go.mod b/go.mod index b9043cc..a784388 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.24.2 require ( github.com/ethereum/go-ethereum v1.14.7 + github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/influxdata/influxdb-client-go/v2 v2.14.0 github.com/kouhin/envflag v0.0.0-20150818174321-0e9a86061649 github.com/pkg/errors v0.8.1-0.20171216070316-e881fd58d78e @@ -26,7 +27,6 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/holiman/uint256 v1.3.0 // indirect github.com/huin/goupnp v0.0.0-20171109214107-dceda08e705b // indirect github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect diff --git a/go.sum b/go.sum index fd0e1ce..88fccbc 100644 --- a/go.sum +++ b/go.sum @@ -166,8 +166,6 @@ golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/grafana/dashboards/dpos-current-validator-overview.json b/grafana/dashboards/dpos-current-validator-overview.json index bf974a2..48ed042 100644 --- a/grafana/dashboards/dpos-current-validator-overview.json +++ b/grafana/dashboards/dpos-current-validator-overview.json @@ -92,7 +92,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -137,6 +137,10 @@ "pluginVersion": "10.4.19", "targets": [ { + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\nfrom(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"status\"] == \"active\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\" or r[\"_field\"] == \"delegators_staked\")\n |> group()\n |> sum(column: \"_value\")\n |> map(fn: (r) => ({ _value: float(v: r._value) * float(v: ${vet_price})}))", "refId": "A" } @@ -398,6 +402,7 @@ "color": { "mode": "thresholds" }, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -408,7 +413,7 @@ } ] }, - "unit": "locale" + "unit": "currencyUSD" }, "overrides": [] }, @@ -442,11 +447,15 @@ "pluginVersion": "10.4.19", "targets": [ { - "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\nfrom(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"status\"] == \"active\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> sum(column: \"_value\")", + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\nfrom(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"status\"] == \"active\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> sum(column: \"_value\")\n |> map(fn: (r) => ({ r with _value: float(v: r._value) * float(v: ${vet_price})}))", "refId": "A" } ], - "title": "Validator TVL (VET)", + "title": "Validator TVL (USD)", "type": "stat" }, { @@ -520,7 +529,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -565,6 +574,10 @@ "pluginVersion": "10.4.19", "targets": [ { + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\nfrom(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"status\"] == \"active\")\n |> filter(fn: (r) => r[\"_field\"] == \"delegators_staked\")\n |> group()\n |> sum(column: \"_value\")\n |> map(fn: (r) => ({ _value: float(v: r._value) * float(v: ${vet_price})}))", "refId": "A" } @@ -582,7 +595,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -648,7 +661,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -714,7 +727,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -780,7 +793,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -846,7 +859,7 @@ "color": { "mode": "thresholds" }, - "decimals": 0, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -3243,13 +3256,13 @@ ] }, "time": { - "from": "now-3h", + "from": "now-5m", "to": "now" }, "timepicker": {}, "timezone": "browser", - "title": "DPOS - Current Validator Overview", + "title": "DPOS - Current Overview", "uid": "detluapo628zkf", - "version": 1, + "version": 9, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/dpos-single-validator.json b/grafana/dashboards/dpos-single-validator.json index fa6bb26..bc6b7c6 100644 --- a/grafana/dashboards/dpos-single-validator.json +++ b/grafana/dashboards/dpos-single-validator.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 10, + "id": 15, "links": [], "panels": [ { @@ -84,6 +84,7 @@ }, { "datasource": { + "type": "influxdb", "uid": "B87265B08D314AF" }, "fieldConfig": { @@ -91,6 +92,74 @@ "color": { "mode": "thresholds" }, + "mappings": [ + { + "options": { + "4294967295": { + "index": 0, + "text": "Not Exiting" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 4, + "x": 4, + "y": 0 + }, + "id": 18, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.19", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"exit_block\")\n |> group()\n |> last()", + "refId": "A" + } + ], + "title": "Exit Block", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "fieldConfig": { + "defaults": { "custom": { "align": "auto", "cellOptions": { @@ -109,12 +178,37 @@ ] } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "_time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "status" + }, + "properties": [ + { + "id": "displayName", + "value": "Status" + } + ] + } + ] }, "gridPos": { "h": 8, "w": 4, - "x": 4, + "x": 8, "y": 0 }, "id": 3, @@ -133,7 +227,11 @@ "pluginVersion": "10.4.19", "targets": [ { - "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"start_block\")\n |> first()\n |> map(fn: (r) => ({ _time: r._time, _value: r.status }))", + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "query": "from(bucket: \"${bucket}\")\n |> range(start: -10y)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"status_changed\")\n |> group()\n |> keep(columns: [\"_time\", \"status\"])", "refId": "A" } ], @@ -210,7 +308,7 @@ "gridPos": { "h": 8, "w": 12, - "x": 8, + "x": 12, "y": 0 }, "id": 23, @@ -246,17 +344,14 @@ "color": { "mode": "thresholds" }, - "mappings": [ - { - "options": { - "4294967295": { - "index": 0, - "text": "Not Exiting" - } - }, - "type": "value" - } - ], + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], "thresholds": { "mode": "absolute", "steps": [ @@ -267,31 +362,87 @@ ] } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "block_number" + }, + "properties": [ + { + "id": "displayName", + "value": "Block Number" + }, + { + "id": "unit", + "value": "locale" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "signer_probability" + }, + "properties": [ + { + "id": "displayName", + "value": "Block Probability %" + }, + { + "id": "unit", + "value": "percent" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "block_in_epoch" + }, + "properties": [ + { + "id": "displayName", + "value": "Block In Epoch" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "epoch" + }, + "properties": [ + { + "id": "displayName", + "value": "Epoch" + }, + { + "id": "unit", + "value": "locale" + } + ] + } + ] }, "gridPos": { "h": 8, - "w": 4, - "x": 20, - "y": 0 + "w": 12, + "x": 0, + "y": 8 }, - "id": 18, + "id": 29, "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], + "cellHeight": "sm", + "footer": { + "countRows": false, "fields": "", - "values": false + "reducer": [ + "sum" + ], + "show": false }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true + "showHeader": true }, "pluginVersion": "10.4.19", "targets": [ @@ -300,12 +451,29 @@ "type": "influxdb", "uid": "B87265B08D314AF" }, - "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"exit_block\")\n |> group()\n |> last()", + "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart)\n |> filter(fn: (r) => r[\"_measurement\"] == \"validator_overview\" and r[\"signer\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"signer_probability\" or r[\"_field\"] == \"block_number\" or r[\"_field\"] == \"epoch\" or r[\"_field\"] == \"block_in_epoch\")\n |> pivot(\n rowKey:[\"_time\"],\n columnKey: [\"_field\"],\n valueColumn: \"_value\"\n )\n |> sort(columns: [\"block_number\"], desc: true)\n |> drop(columns: [\"_start\", \"_stop\", \"chain_tag\", \"signer\"])\n |> limit(n: 1000)\n", "refId": "A" } ], - "title": "Exit Block", - "type": "stat" + "title": "Recent Blocks", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "includeByName": {}, + "indexByName": { + "_time": 0, + "block_in_epoch": 3, + "block_number": 1, + "epoch": 4, + "signer_probability": 2 + }, + "renameByName": {} + } + } + ], + "type": "table" }, { "datasource": { @@ -333,8 +501,8 @@ }, "gridPos": { "h": 8, - "w": 5, - "x": 0, + "w": 4, + "x": 12, "y": 8 }, "id": 30, @@ -395,8 +563,8 @@ }, "gridPos": { "h": 8, - "w": 5, - "x": 5, + "w": 4, + "x": 16, "y": 8 }, "id": 31, @@ -441,13 +609,6 @@ "color": { "mode": "thresholds" }, - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false - }, "mappings": [], "thresholds": { "mode": "absolute", @@ -457,116 +618,48 @@ "value": null } ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "block_number" - }, - "properties": [ - { - "id": "displayName", - "value": "Block Number" - }, - { - "id": "unit", - "value": "locale" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "signer_probability" - }, - "properties": [ - { - "id": "displayName", - "value": "Block Probability %" - }, - { - "id": "unit", - "value": "percent" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "block_in_epoch" - }, - "properties": [ - { - "id": "displayName", - "value": "Block In Epoch" - } - ] }, - { - "matcher": { - "id": "byName", - "options": "epoch" - }, - "properties": [ - { - "id": "displayName", - "value": "Epoch" - }, - { - "id": "unit", - "value": "locale" - } - ] - } - ] + "unit": "locale" + }, + "overrides": [] }, "gridPos": { "h": 8, - "w": 12, - "x": 12, + "w": 4, + "x": 20, "y": 8 }, - "id": 29, + "id": 32, "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" ], - "show": false + "fields": "", + "values": false }, - "showHeader": true + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, "pluginVersion": "10.4.19", "targets": [ { - "query": "from(bucket: \"${bucket}\")\n |> range(start: -20y)\n |> filter(fn: (r) => r[\"_measurement\"] == \"validator_overview\" and r[\"signer\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"signer_probability\" or r[\"_field\"] == \"block_number\" or r[\"_field\"] == \"epoch\" or r[\"_field\"] == \"block_in_epoch\")\n |> pivot(\n rowKey:[\"_time\"],\n columnKey: [\"_field\"],\n valueColumn: \"_value\"\n )\n |> sort(columns: [\"block_number\"], desc: true)\n |> drop(columns: [\"_start\", \"_stop\", \"chain_tag\", \"signer\"])", + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"hayabusa_gas\" and r[\"signer\"] == \"${staker}\" and r[\"_field\"] == \"validators_share\")\n |> count()\n ", "refId": "A" } ], - "title": "Recent Blocks (TODO: Why is block probability different for same epoch?)", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": {}, - "includeByName": {}, - "indexByName": { - "_time": 0, - "block_in_epoch": 3, - "block_number": 1, - "epoch": 4, - "signer_probability": 2 - }, - "renameByName": {} - } - } - ], - "type": "table" + "title": "Proposed Blocks", + "type": "stat" }, { "datasource": { @@ -776,7 +869,11 @@ "pluginVersion": "12.2.0-17027759091", "targets": [ { - "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\" or r[\"_field\"] == \"delegators_staked\")\n |> pivot(\n rowKey:[\"_time\", \"validator\"],\n columnKey: [\"_field\"],\n valueColumn: \"_value\"\n )\n |> map(fn: (r) => ({ r with _value: r.delegators_staked + r.validator_staked }))\n |> drop(columns: [\"delegators_staked\", \"validator_staked\"])", + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\" or r[\"_field\"] == \"delegators_staked\")\n |> pivot(\n rowKey:[\"_time\", \"validator\"],\n columnKey: [\"_field\"],\n valueColumn: \"_value\"\n )\n |> map(fn: (r) => ({ r with _value: r.delegators_staked + r.validator_staked }))\n |> drop(columns: [\"delegators_staked\", \"validator_staked\", \"endorsor\", \"signalled_exit\", \"staking_period_length\", \"validator\", \"chain_tag\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean)", "refId": "A" } ], @@ -990,6 +1087,10 @@ "pluginVersion": "12.2.0-17027759091", "targets": [ { + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\" and r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> keep(columns: [\"_value\", \"_time\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", "refId": "A" } @@ -1442,15 +1543,48 @@ { "color": "green", "value": null - }, - { - "color": "red", - "value": 80 } ] } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "_time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "_measurement" + }, + "properties": [ + { + "id": "displayName", + "value": "Action" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "_value" + }, + "properties": [ + { + "id": "displayName", + "value": "Value" + } + ] + } + ] }, "gridPos": { "h": 9, @@ -1469,12 +1603,17 @@ ], "show": false }, + "frameIndex": 3, "showHeader": true }, "pluginVersion": "10.4.19", "targets": [ { - "query": "from(bucket: \"${bucket}\")\n |> range(start: -20y)\n |> filter(fn: (r) => r[\"_measurement\"] == \"validation_queued\" or r[\"_measurement\"] == \"validation_withdrawn\" or r[\"_measurement\"] == \"validation_signaled_exit\" or r[\"_measurement\"] == \"stake_increased\" or r[\"_measurement\"] == \"stake_decreased\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> group()\n |> drop(columns: [\"_stop\", \"_start\"])\n |> sort(columns: [\"_time\"], desc: true)", + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "query": "from(bucket: \"${bucket}\")\n |> range(start: -20y)\n |> filter(fn: (r) => r[\"_measurement\"] == \"validation_queued\" or r[\"_measurement\"] == \"validation_withdrawn\" or r[\"_measurement\"] == \"validation_signaled_exit\" or r[\"_measurement\"] == \"stake_increased\" or r[\"_measurement\"] == \"stake_decreased\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> drop(columns: [\"_stop\", \"_start\"])\n |> map(fn: (r) => ({r with _value: string(v: r._value)}))\n |> group()\n |> sort(columns: [\"_time\"], desc: true)\n |> drop(columns: [\"_field\", \"endorsor\", \"validator\"])", "refId": "A" } ], @@ -1618,7 +1757,7 @@ "steps": [ { "color": "green", - "value": 0 + "value": null } ] } @@ -1641,7 +1780,7 @@ "steps": [ { "color": "green", - "value": 0 + "value": null } ] } @@ -1681,7 +1820,7 @@ }, "showHeader": true }, - "pluginVersion": "12.2.0-17027759091", + "pluginVersion": "10.4.19", "targets": [ { "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\ncomplete_periods = from(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"completed_periods\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\ncurrent = complete_periods._value + uint(v: 1)\n\nfrom(bucket: \"${bucket}\")\n |> range(start: -5y)\n |> filter(fn: (r) => r[\"_measurement\"] == \"delegation_added\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"stake\" or r[\"_field\"] == \"total_weight\" or r[\"_field\"] == \"multiplier\" or r[\"_field\"] == \"start_period\")\n |> pivot(\n rowKey:[\"_time\", \"delegation_id\"],\n columnKey: [\"_field\"],\n valueColumn: \"_value\"\n )\n |> filter(fn: (r) => r[\"start_period\"] > current)\n |> map(fn: (r) => ({ r with \n \"Delegation ID\": r.delegation_id,\n \"VET\": r.stake,\n \"Multiplier\": r.multiplier,\n \"total_weight\": r.total_weight,\n \"Stake USD\": float(v: r.stake) * float(v: \"${vet_price}\")\n }))\n |> keep(columns: [\"VET\", \"Delegation ID\", \"Multiplier\", \"total_weight\", \"_time\", \"Stake USD\"])\n |> sort(columns: [\"Stake USD\"], desc: true)", @@ -1732,7 +1871,7 @@ "steps": [ { "color": "green", - "value": 0 + "value": null } ] } @@ -1758,7 +1897,7 @@ }, "showHeader": true }, - "pluginVersion": "12.2.0-17027759091", + "pluginVersion": "10.4.19", "targets": [ { "query": "\nlatestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\ncomplete_periods = from(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"completed_periods\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\ncurrent = complete_periods._value + uint(v: 1)\n\nfrom(bucket: \"${bucket}\")\n |> range(start: -5y)\n |> filter(fn: (r) => r[\"_measurement\"] == \"delegation_signaled_exit\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => \n r[\"_field\"] == \"block\" or \n r[\"_field\"] == \"exit_period\" or \n r[\"_field\"] == \"multiplier\" or \n r[\"_field\"] == \"validator_staking_period\" or \n r[\"_field\"] == \"validator_start_block\" or \n r[\"_field\"] == \"total_weight\" or\n r[\"_field\"] == \"exit_block\" or\n r[\"_field\"] == \"stake\"\n )\n |> pivot(\n rowKey:[\"_time\", \"delegation_id\"],\n columnKey: [\"_field\"],\n valueColumn: \"_value\"\n )\n |> group()", @@ -1767,201 +1906,79 @@ ], "title": "Signalled Exit Delegations (TODO: Separate this by exited or exiting, based on current block and exit block)", "type": "table" - }, - { - "datasource": { - "type": "influxdb", - "uid": "B87265B08D314AF" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - } - }, - "mappings": [], - "unit": "locale" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "_value delegators_staked" - }, - "properties": [ - { - "id": "displayName", - "value": "Delegator VET" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "_value validator_staked" - }, - "properties": [ - { - "id": "displayName", - "value": "Validator VET" - } - ] - } - ] - }, - "gridPos": { - "h": 8, - "w": 5, - "x": 0, - "y": 66 - }, - "id": 32, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "sort": "desc", - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.2.0-17027759091", - "targets": [ - { - "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\nfrom(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\" or r[\"_field\"] == \"delegators_staked\")\n |> last()\n |> keep(columns: [\"_value\", \"_field\"])", - "refId": "A" - } - ], - "title": "Locked VET", - "type": "piechart" - }, - { - "datasource": { - "type": "influxdb", - "uid": "B87265B08D314AF" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - } - }, - "mappings": [], - "unit": "locale" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "_value delegators_weight" - }, - "properties": [ - { - "id": "displayName", - "value": "Delegator Weight" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "_value validator_weight" - }, - "properties": [ - { - "id": "displayName", - "value": "Validator Weight" - } - ] - } - ] - }, - "gridPos": { - "h": 8, - "w": 5, - "x": 5, - "y": 66 - }, - "id": 33, - "options": { - "legend": { - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "sort": "desc", - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.2.0-17027759091", - "targets": [ - { - "query": "latestRecord = from(bucket: \"${bucket}\")\n |> range(start: 2015-01-01T00:00:00Z, stop: 2100-01-01T00:00:00Z)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_staked\")\n |> group()\n |> last()\n |> findRecord(fn: (key) => true, idx: 0)\n\nlatestTime = latestRecord._time\n\nfrom(bucket: \"${bucket}\")\n |> range(start: latestTime)\n |> filter(fn: (r) => r[\"_measurement\"] == \"individual_validators\")\n |> filter(fn: (r) => r[\"validator\"] == \"${staker}\")\n |> filter(fn: (r) => r[\"_field\"] == \"validator_weight\" or r[\"_field\"] == \"delegators_weight\")\n |> last()\n |> keep(columns: [\"_value\", \"_field\"])", - "refId": "A" - } - ], - "title": "Weight Contribution", - "type": "piechart" } ], - "preload": false, "refresh": "", - "schemaVersion": 41, + "schemaVersion": 39, "tags": [], "templating": { "list": [ { "current": { - "text": "0x098c4257b6543edf067d221e909e9dd0ba8be964", - "value": "0x098c4257b6543edf067d221e909e9dd0ba8be964" + "selected": false, + "text": "vechain", + "value": "vechain" + }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "definition": "buckets()", + "hide": 0, + "includeAll": false, + "label": "Bucket", + "multi": false, + "name": "bucket", + "options": [], + "query": "buckets()", + "refresh": 2, + "regex": "^[^_].*", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "active", + "value": "active" + }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, + "definition": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"individual_validators\")\n |> keep(columns: [\"_time\", \"status\"])\n |> distinct(column: \"status\")\n |> rename(columns: {_value: \"address\"})\n |> sort(columns: [\"address\"])", + "hide": 0, + "includeAll": false, + "label": "Status", + "multi": false, + "name": "status", + "options": [], + "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"individual_validators\")\n |> keep(columns: [\"_time\", \"status\"])\n |> distinct(column: \"status\")\n |> rename(columns: {_value: \"address\"})\n |> sort(columns: [\"address\"])", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "0x2696d1bd5c015781f13f466c8284d5419793e473", + "value": "0x2696d1bd5c015781f13f466c8284d5419793e473" }, "datasource": { "type": "influxdb", "uid": "B87265B08D314AF" }, - "definition": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"individual_validators\")\n |> keep(columns: [\"_time\", \"validator\"])\n |> distinct(column: \"validator\")\n |> rename(columns: {_value: \"address\"})\n |> sort(columns: [\"address\"])", + "definition": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"individual_validators\")\n |> filter(fn: (r) => r[\"status\"] == \"${status}\")\n |> keep(columns: [\"_time\", \"validator\"])\n |> distinct(column: \"validator\")\n |> rename(columns: {_value: \"address\"})\n |> sort(columns: [\"address\"])", "hide": 0, "includeAll": false, "label": "staker", "multi": false, "name": "staker", "options": [], - "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"individual_validators\")\n |> keep(columns: [\"_time\", \"validator\"])\n |> distinct(column: \"validator\")\n |> rename(columns: {_value: \"address\"})\n |> sort(columns: [\"address\"])", + "query": "from(bucket: \"${bucket}\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r._measurement == \"individual_validators\")\n |> filter(fn: (r) => r[\"status\"] == \"${status}\")\n |> keep(columns: [\"_time\", \"validator\"])\n |> distinct(column: \"validator\")\n |> rename(columns: {_value: \"address\"})\n |> sort(columns: [\"address\"])", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1973,6 +1990,7 @@ "text": "0.02303", "value": "0.02303" }, + "hide": 0, "label": "VET / USD", "name": "vet_price", "options": [ @@ -1983,6 +2001,7 @@ } ], "query": "0.02303", + "skipUrlSync": false, "type": "textbox" }, { @@ -1990,6 +2009,7 @@ "text": "0.001883", "value": "0.001883" }, + "hide": 0, "label": "VTHO / USD", "name": "vtho_price", "options": [ @@ -2000,33 +2020,19 @@ } ], "query": "0.001883", - "type": "textbox" - }, - { - "datasource": { - "type": "influxdb", - "uid": "B87265B08D314AF" - }, - "definition": "buckets()", - "hide": 0, - "includeAll": false, - "label": "Bucket", - "multi": false, - "name": "bucket", - "options": [], - "query": "buckets()", - "refresh": 2, - "regex": "^[^_].*", "skipUrlSync": false, - "sort": 1, - "type": "query" + "type": "textbox" }, { "current": { - "selected": true, + "selected": false, "text": "18", "value": "18" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"epoch_length\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2047,6 +2053,10 @@ "text": "10", "value": "10" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"block_interval\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2067,6 +2077,10 @@ "text": "720", "value": "720" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"seeder_interval\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2087,6 +2101,10 @@ "text": "8640", "value": "8640" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"validator_eviction_threshold\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2107,6 +2125,10 @@ "text": "18", "value": "18" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"low_staking_period\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2127,6 +2149,10 @@ "text": "180", "value": "180" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"medium_staking_period\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2147,6 +2173,10 @@ "text": "8640", "value": "8640" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"high_staking_period\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2167,6 +2197,10 @@ "text": "720", "value": "720" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"cooldown_period\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2187,6 +2221,10 @@ "text": "18", "value": "18" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"hayabusa_tp\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2207,6 +2245,10 @@ "text": "0", "value": "0" }, + "datasource": { + "type": "influxdb", + "uid": "B87265B08D314AF" + }, "definition": "import \"influxdata/influxdb/schema\"\n\nschema.tagValues(\n bucket: \"${bucket}\",\n tag: \"hayabusa_fork_block\",\n predicate: (r) => r._measurement == \"chain_config\"\n)", "hide": 2, "includeAll": false, @@ -2224,13 +2266,13 @@ ] }, "time": { - "from": "now-1h", + "from": "now-3h", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "DPOS - Individual Stakers", - "uid": "fetli0i64zny8c", - "version": 12, + "uid": "ff189wtkoe39ca", + "version": 6, "weekStart": "" } \ No newline at end of file diff --git a/stats/pos/event_processors.go b/stats/pos/event_processors.go index 93ef53c..bfd96d5 100644 --- a/stats/pos/event_processors.go +++ b/stats/pos/event_processors.go @@ -208,7 +208,7 @@ func processStakeIncreased(rev thor.Bytes32, event *api.JSONEvent, abi abi.Event "validator": validator.String(), }, map[string]interface{}{ - "added": added.String(), + "added": vetutil.ScaleToVET(added), }, timestamp, ), nil @@ -234,7 +234,7 @@ func processStakeDecreased(rev thor.Bytes32, event *api.JSONEvent, abi abi.Event "validator": validator.String(), }, map[string]interface{}{ - "removed": removed.String(), + "removed": vetutil.ScaleToVET(removed), }, timestamp, ), nil