Skip to content

Commit

Permalink
DN updates pt1. Dependency updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabi committed Nov 19, 2024
1 parent baae900 commit 961bae4
Show file tree
Hide file tree
Showing 65 changed files with 541 additions and 1,289 deletions.
531 changes: 288 additions & 243 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions _config/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ start_block_number = 6_015_486
[validator_list_updater]
history_record_depth = 10

[onekv]
[dn]
# this many most recent records will always be kept in the database for reference
candidate_history_record_count = 5
candidate_list_endpoint = "https://kusama.w3f.community/candidates"
candidate_details_endpoint = "https://kusama.w3f.community/candidate/"
nominator_list_endpoint = "https://kusama.w3f.community/nominators"
data_endpoint = "https://nodes.web3.foundation/api/cohort/1/polkadot"
refresh_seconds = 300

[report]
Expand Down
6 changes: 2 additions & 4 deletions _config/network/kusama.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ token_decimals = 12
# first block of 2021 for Kusama is 6_015_486
start_block_number = 6_015_486

[onekv]
candidate_list_endpoint = "https://kusama.w3f.community/candidates"
candidate_details_endpoint = "https://kusama.w3f.community/candidate/"
nominator_list_endpoint = "https://kusama.w3f.community/nominators"
[dn]
data_endpoint = "https://nodes.web3.foundation/api/cohort/1/kusama"

[notification_generator]
unclaimed_payout_check_delay_hours = 3
6 changes: 2 additions & 4 deletions _config/network/polkadot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ token_decimals = 10
# first block of 2021 for Polkadot is 2_700_565
start_block_number = 2_700_565

[onekv]
candidate_list_endpoint = "https://polkadot.w3f.community/candidates"
candidate_details_endpoint = "https://polkadot.w3f.community/candidate/"
nominator_list_endpoint = "https://polkadot.w3f.community/nominators"
[dn]
data_endpoint = "https://nodes.web3.foundation/api/cohort/1/polkadot"

[notification_generator]
unclaimed_payout_check_delay_hours = 9
2 changes: 1 addition & 1 deletion _docker/compose/.env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=0.20.6
VERSION=0.21.0
ENV=production
LOG_LEVEL=debug

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ DO $$ BEGIN
blocks_authored bigint,
reward_points bigint,
heartbeat_received boolean,
onekv_candidate_record_id INTEGER,
onekv_rank bigint,
onekv_location text,
onekv_is_valid boolean,
onekv_offline_since bigint
dn_node_record_id INTEGER,
dn_status text
);
END $$;

Expand Down Expand Up @@ -95,9 +92,9 @@ BEGIN
) INTO result_record.heartbeat_received;
end if;

SELECT id, rank, location, is_valid, offline_since
SELECT id, status
FROM sub_onekv_candidate C
INTO result_record.onekv_candidate_record_id, result_record.onekv_rank, result_record.onekv_location, result_record.onekv_is_valid, result_record.onekv_offline_since
INTO result_record.dn_node_record_id, result_record.dn_status
WHERE C.validator_account_id = account_id_param
ORDER BY id DESC
LIMIT 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- Add down migration script here
54 changes: 54 additions & 0 deletions _migrations/network/migrations/20241119095142_dn_update.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
-- Add up migration script here
ALTER TABLE sub_onekv_candidate DROP COLUMN kusama_account_id;
ALTER TABLE sub_onekv_candidate DROP COLUMN discovered_at;
ALTER TABLE sub_onekv_candidate DROP COLUMN inclusion;
ALTER TABLE sub_onekv_candidate DROP COLUMN commission;
ALTER TABLE sub_onekv_candidate DROP COLUMN is_active;
ALTER TABLE sub_onekv_candidate DROP COLUMN unclaimed_eras;
ALTER TABLE sub_onekv_candidate DROP COLUMN nominated_at;
ALTER TABLE sub_onekv_candidate DROP COLUMN offline_accumulated;
ALTER TABLE sub_onekv_candidate DROP COLUMN offline_since;
ALTER TABLE sub_onekv_candidate DROP COLUMN name;
ALTER TABLE sub_onekv_candidate DROP COLUMN location;
ALTER TABLE sub_onekv_candidate DROP COLUMN rank;
ALTER TABLE sub_onekv_candidate DROP COLUMN version;
ALTER TABLE sub_onekv_candidate DROP COLUMN is_valid;
ALTER TABLE sub_onekv_candidate DROP COLUMN fault_count;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_updated_at;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_total;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_aggregate;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_inclusion;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_discovered;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_nominated;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_rank;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_unclaimed;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_bonded;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_faults;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_offline;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_randomness;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_span_inclusion;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_location;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_country;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_nominator_stake;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_provider;
ALTER TABLE sub_onekv_candidate DROP COLUMN score_region;
ALTER TABLE sub_onekv_candidate DROP COLUMN created_at;

ALTER TABLE sub_onekv_candidate ADD COLUMN IF NOT EXISTS identity text NOT NULL;
ALTER TABLE sub_onekv_candidate ADD COLUMN IF NOT EXISTS status VARCHAR(256) NOT NULL;
ALTER TABLE sub_onekv_candidate ADD COLUMN IF NOT EXISTS created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now();

ALTER TABLE sub_onekv_nominator DROP COLUMN onekv_id;
ALTER TABLE sub_onekv_nominator DROP COLUMN stash_account_id;
ALTER TABLE sub_onekv_nominator DROP COLUMN proxy_account_id;
ALTER TABLE sub_onekv_nominator DROP COLUMN bonded_amount;
ALTER TABLE sub_onekv_nominator DROP COLUMN proxy_delay;
ALTER TABLE sub_onekv_nominator DROP COLUMN last_nomination_at;
ALTER TABLE sub_onekv_nominator DROP COLUMN nominator_created_at;
ALTER TABLE sub_onekv_nominator DROP COLUMN average_stake;
ALTER TABLE sub_onekv_nominator DROP COLUMN reward_destination;
ALTER TABLE sub_onekv_nominator DROP COLUMN created_at;
ALTER TABLE sub_onekv_nominator ADD COLUMN IF NOT EXISTS created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now();

DROP TABLE sub_onekv_candidate_validity;
DROP TABLE sub_onekv_nominee;
17 changes: 4 additions & 13 deletions _template/telegram/dialog/validator_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,8 @@
☠️ Slashed {{ slash_count }} times in the last 12 months{% endif %}{% else %}🙄 There is currently no active or waiting validator with address <pre>{{ condensed_address }}</pre>. Please make sure the validator still has a <pre>validate</pre> intention.{% endif %}

<strong>OpenGov</strong>
🗳 {% if missing_referendum_votes | length == 0 %}No missing votes for open referenda{% else %}Hasn't voted for {% for missing_referendum_vote in missing_referendum_votes %}<a href="https://{{ chain }}.subsquare.io/referenda/referendum/{{ missing_referendum_vote }}">#{{ missing_referendum_vote }}</a>{% if not loop.last %}, {% endif %}{% endfor %}{% endif %}{% if is_onekv %}
🗳 {% if missing_referendum_votes | length == 0 %}No missing votes for open referenda{% else %}Hasn't voted for {% for missing_referendum_vote in missing_referendum_votes %}<a href="https://{{ chain }}.subsquare.io/referenda/referendum/{{ missing_referendum_vote }}">#{{ missing_referendum_vote }}</a>{% if not loop.last %}, {% endif %}{% endfor %}{% endif %}{% if is_dn %}

<strong>Thousand Validators Info</strong>
🏷 {{ onekv_name }}
{% if onekv_offline_since %}🔴️ Offline since {{ onekv_offline_since }}{% else %}🟢️ Online{% endif %}
{% if onekv_is_valid %}✅ Valid 1KV validator{% else %}❌ Invalid 1KV validator:{% for onekv_invalidity_reason in onekv_invalidity_reasons %}
- {{ onekv_invalidity_reason }}{% endfor %}{% endif %}{% if onekv_rank %}
📈 Rank {{ onekv_rank }}{% endif %}{% if onekv_score %}
📊 Score {{ onekv_score }}{% endif %}
🆘 {% if onekv_fault_count == 0 %}No{% else %}{{ onekv_fault_count }}{% endif %} offline fault{% if onekv_fault_count != 1 %}s{% endif %} {% if onekv_nominated_at %}
💎 Last 1KV nomination {{ onekv_nominated_at }}{% endif %}{% if onekv_location %}
🌍 {{ onekv_location }}{% endif %}
📡 Discovered {{ onekv_discovered_at }}
<i>1KV data last updated {{ onekv_last_updated }}</i>{% endif %}
<strong>Decentralized Nodes Info</strong>
🏷 {{ dn_identity }}
📊 Status: {{ dn_status }}{% endif %}
2 changes: 1 addition & 1 deletion subvt-app-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-app-service"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-block-processor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-block-processor"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-config"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
9 changes: 3 additions & 6 deletions subvt-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,10 @@ pub struct ValidatorListUpdaterConfig {
pub history_record_depth: u64,
}

/// 1KV configuration - only used for Polkadot and Kusama.
#[derive(Clone, Debug, Deserialize)]
pub struct OneKVConfig {
pub struct DNConfig {
pub candidate_history_record_count: u64,
pub candidate_list_endpoint: String,
pub candidate_details_endpoint: String,
pub nominator_list_endpoint: String,
pub data_endpoint: String,
pub refresh_seconds: u64,
}

Expand Down Expand Up @@ -285,7 +282,7 @@ pub struct Config {
pub common: CommonConfig,
pub http: HTTPConfig,
pub log: LogConfig,
pub onekv: OneKVConfig,
pub dn: DNConfig,
pub app_postgres: PostgreSQLConfig,
pub network_postgres: PostgreSQLConfig,
pub redis: RedisConfig,
Expand Down
2 changes: 1 addition & 1 deletion subvt-governance/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-governance"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-kline-updater/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-kline-updater"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-logging/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-logging"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-metrics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-metrics"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-network-status-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-network-status-server"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-network-status-updater/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-network-status-updater"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-nft/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-nft"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
2 changes: 1 addition & 1 deletion subvt-notification-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subvt-notification-generator"
version = "0.20.7"
version = "0.21.0"
edition = "2021"
rust-version = "1.67.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use subvt_types::subvt::ValidatorDetails;

mod add;
mod init;
mod onekv;
mod remove;
mod unclaimed_payout;
mod update;
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 961bae4

Please sign in to comment.