Skip to content

Commit

Permalink
updates for s8
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Oct 2, 2024
1 parent 8b66dc6 commit aed75b0
Show file tree
Hide file tree
Showing 21 changed files with 245 additions and 48 deletions.
2 changes: 1 addition & 1 deletion code/scripts/align_ntx_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

coin_ranges = {}
epochs = populate_epochs()
for season in ["Season_7"]:
for season in ["Season_8"]:
for server in epochs[season]:
if server not in coin_ranges:
coin_ranges.update({
Expand Down
4 changes: 2 additions & 2 deletions code/scripts/archive_season_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from logger import logger


def archive_past_seasons(current_seasons=["Season_7"]):
def archive_past_seasons(current_seasons=["Season_8"]):
for season in SEASONS_INFO:
logger.info(season)
if season not in current_seasons:
Expand Down Expand Up @@ -46,5 +46,5 @@ def archive_past_seasons(current_seasons=["Season_7"]):


if __name__ == '__main__':
current_seasons = ["Season_7"]
current_seasons = ["Season_8"]
archive_past_seasons(current_seasons)
2 changes: 1 addition & 1 deletion code/scripts/build_prices_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger.info(e)
prices = {}

for season in ["Season_7"]:
for season in ["Season_8"]:
if season not in prices:
prices.update({season: {}})
season_start_dt = dt.utcfromtimestamp(SEASONS_INFO[season]["start_time"])
Expand Down
6 changes: 3 additions & 3 deletions code/scripts/convert_seednodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import json
from logger import logger

seednodes = {"Season_7": {}}
with open('s7_seednodes.csv', 'r') as file:
seednodes = {"Season_8": {}}
with open('s8_seednodes.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
logger.info(row)
seednodes["Season_7"].update({
seednodes["Season_8"].update({
row[0]: {
"IP": row[2],
"PeerID": row[1]
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/cron_api_populate_nn_ltc_txids.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def scan_ltc_transactions(season):

if __name__ == "__main__":

for season in ["Season_7"]:
for season in ["Season_8"]:
scan_ltc_transactions(season)

CURSOR.close()
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/cron_import_nn_ltc_txids.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

if __name__ == "__main__":

for season in ["Season_7"]:
for season in ["Season_8"]:

import_nn_ltc_txids(season)
2 changes: 1 addition & 1 deletion code/scripts/cron_import_notarised.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@print_runtime
def import_notarised():
for season in ["Season_7"]:
for season in ["Season_8"]:

season_notaries = helper.get_season_notaries(season)
ntx_tbl = lib_ntx.notarised(season)
Expand Down
3 changes: 2 additions & 1 deletion code/scripts/cron_update_mined_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def run_updates(seasons):
update_mined_count_season_table(season)

if __name__ == "__main__":
seasons = [CURRENT_SEASON]
current_season = get_season()['season']
seasons = [current_season]
if len(sys.argv) > 1:
if sys.argv[1] == "rescan":
RESCAN_SEASON = True
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/cron_update_social_coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def populate_coins_social(season):
if __name__ == "__main__":

logger.info(f"Preparing to populate [social_coins] table...")
for season in ["Season_7"]:
for season in ["Season_8"]:
generate_social_coins_template(season)
populate_coins_social(season)

Expand Down
2 changes: 1 addition & 1 deletion code/scripts/cron_update_social_notaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def remove_invalid_notaries(season):

if __name__ == "__main__":
logger.info(EXCLUDED_SEASONS)
season = "Season_7"
season = "Season_8"
logger.info(f"Preparing to populate {season} [social_notaries] table...")
populate_social_notaries(season)
remove_invalid_notaries(season)
Expand Down
16 changes: 8 additions & 8 deletions code/scripts/generate_social_notary_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from lib_validate import *
from lib_helper import get_nn_region_split

s7_socials = requests.get("https://raw.githubusercontent.com/KomodoPlatform/NotaryNodes/master/season7/elected_nn_social.json").json()
season = "Season_7"
s8_socials = requests.get("https://raw.githubusercontent.com/KomodoPlatform/NotaryNodes/master/season8/elected_nn_social.json").json()
season = "Season_8"

template = {}
for notary in NOTARY_PUBKEYS["Season_7"]["Main"]:
for notary in NOTARY_PUBKEYS["Season_8"]["Main"]:
nn, region = get_nn_region_split(notary)
if nn not in template:
template.update({
Expand All @@ -33,18 +33,18 @@
"Main": {
"KMD_address": "",
"LTC_address": "",
"pubkey": NOTARY_PUBKEYS["Season_7"]["Main"][notary]
"pubkey": NOTARY_PUBKEYS["Season_8"]["Main"][notary]
},
"Third_Party": {
"KMD_address": "",
"pubkey": NOTARY_PUBKEYS["Season_7"]["Third_Party"][notary]
"pubkey": NOTARY_PUBKEYS["Season_8"]["Third_Party"][notary]
}
}
})
if nn in s7_socials:
for k,v in s7_socials[nn].items():
if nn in s8_socials:
for k,v in s8_socials[nn].items():
if v != "" and k != "regions":
template[nn][k] = v

with open(os.path.dirname(os.path.abspath(__file__))+'/social_notaries_season_7.json', 'w+') as j:
with open(os.path.dirname(os.path.abspath(__file__))+'/social_notaries_season_8.json', 'w+') as j:
json.dump(template, j, indent = 4, sort_keys=True)
95 changes: 73 additions & 22 deletions code/scripts/lib_dpow_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,47 @@ def get_scoring_epochs_repo_data(branch='master'):
del repo_data[_season]["Servers"]["dPoW-3P"]
return repo_data

def get_season():
now = time.time()
s = "unknown"
ps = False
for _season in SEASONS_INFO:
print(f"season: {_season}")
print(f"now: {now}")
print(f"season: {_season}")
if _season in SEASONS_INFO:
print(SEASONS_INFO[_season])
if _season.find("Testnet") == -1:
if SEASONS_INFO[_season]["start_time"] < now:
print("After start time")
if SEASONS_INFO[_season]["end_time"] > now:
print("Before end time")
s = _season
elif "post_season_end_time" in SEASONS_INFO[_season]:
if SEASONS_INFO[_season]["post_season_end_time"] > now:
print("Before postseason end time")
ps = True
s = _season

r = {
"season": s,
"is_postseason": ps
}
print(r)
return r


def get_dpow_active_info(seasons):
'''Get current dpow coins from repo'''
data = requests.get(urls.get_dpow_active_coins_url()).json()["results"]
for season in seasons:
if season.find("Testnet") == -1:
start_time, end_time = get_season_start_end(season)

if NOW >= start_time and NOW <= end_time:
current_season = season
current_dpow_coins = {season: {}}

for _coin in data:
if data[_coin]["dpow"]["server"] not in current_dpow_coins[season]:
current_dpow_coins[season].update({
data[_coin]["dpow"]["server"]: []
})

current_dpow_coins[season][data[_coin]["dpow"]["server"]].append(_coin)

current_season = get_season()['season']
current_dpow_coins = {current_season: {}}
for _coin in data:
if data[_coin]["dpow"]["server"] not in current_dpow_coins[current_season]:
current_dpow_coins[current_season].update({
data[_coin]["dpow"]["server"]: []
})
current_dpow_coins[current_season][data[_coin]["dpow"]["server"]].append(_coin)
return current_season, data, current_dpow_coins


Expand Down Expand Up @@ -281,7 +302,7 @@ def get_season_server_coins(season, server):


# Things that can be ignored
RETIRED_DPOW_COINS = ["HUSH3", "GLEEC-OLD", "AXO", "BTCH", "COQUICASH", "OOT"]
RETIRED_DPOW_COINS = ["HUSH3", "AXO", "BTCH", "COQUICASH", "OOT"]
EXCLUDE_DECODE_OPRET_COINS = ['D']
EXCLUDED_SERVERS = ["Unofficial"]
EXCLUDED_SEASONS = ["Season_1", "Season_2", "Season_3", "Unofficial", "Season_4", "Season_5", "Season_5_Testnet", "VOTE2022_Testnet"]
Expand All @@ -299,7 +320,7 @@ def get_season_server_coins(season, server):
"VRSC": "~/VerusCoin/src/verusd",
"GLEEC": "~/komodo/src/komodod -ac_name=GLEEC -ac_supply=210000000 -ac_public=1 -ac_staked=100 -addnode=95.217.161.126",
"KIP0001": "~/komodo/src/komodod -ac_public=1 -ac_name=KIP0001 -ac_supply=139419284 -ac_staked=10 -addnode=178.159.2.6",
"MCL": "~/marmara/src/komodod -ac_name=MCL -ac_supply=2000000 -ac_cc=2 -addnode=5.189.149.242 -addnode=161.97.146.150 -addnode=149.202.158.145 -addressindex=1 -spentindex=1 -ac_marmara=1 -ac_staked=75 -ac_reward=3000000000 -daemon"
"MCL": "~/marmara/src/marmarad -ac_name=MCL-addnode=5.189.149.242 -addnode=161.97.146.150 -addnode=149.202.158.145 -addressindex=1 -spentindex=1 -daemon"
}

OTHER_CONF_FILE = {
Expand Down Expand Up @@ -330,7 +351,7 @@ def get_season_server_coins(season, server):
"LTC": "~/litecoin/src/litecoin-cli",
"KMD": "~/komodo/src/komodo-cli",
"MIL": "~/mil-1/src/mil-cli",
"MCL": "~/komodo/src/komodo-cli -ac_name=MCL",
"MCL": "~/komodo/src/marmara-cli",
"TOKEL": "~/komodo/src/komodo-cli -ac_name=TOKEL",
"GLEEC": "~/komodo/src/komodo-cli -ac_name=GLEEC",
"KIP0001": "~/komodo/src/komodo-cli -ac_name=KIP0001",
Expand Down Expand Up @@ -470,6 +491,27 @@ def get_season_server_coins(season, server):
"VRSC"
]
},
"Season_8": {
"LTC": ["LTC"],
"KMD": ["KMD"],
"Main": [
"CLC",
"CCL",
"DOC",
"GLEEC",
"ILN",
"KOIN",
"MARTY",
"NINJA",
"PIRATE",
"SUPERNET",
"THC"
],
"Third_Party": [
"MCL",
"TOKEL"
]
},
"VOTE2023_Testnet": {
"Main": [
"DOC",
Expand Down Expand Up @@ -526,10 +568,18 @@ def get_season_server_coins(season, server):
},
"Season_7": {
"start_block": 3484958,
"end_block": 4484958,
"end_block": 4125958,
"start_time": 1688132253,
"end_time": 1717199999,
"post_season_end_time": 1725148799,
"post_season_end_time": 1728049052,
"servers": {}
},
"Season_8": {
"start_block": 4125988,
"end_block": 8888888,
"start_time": 1728049053,
"end_time": 1999999999,
"post_season_end_time": 1999999999,
"servers": {}
},
"VOTE2022_Testnet": {
Expand Down Expand Up @@ -686,7 +736,7 @@ def get_season_server_coins(season, server):


# Set season and if postseason
POSTSEASON = False
POSTSEASON = True
for _season in SEASONS_INFO:
if _season.find("Testnet") == -1:
if SEASONS_INFO[_season]["start_time"] < NOW:
Expand All @@ -698,6 +748,7 @@ def get_season_server_coins(season, server):
SEASON = _season



logger.info(f"{int(time.time()) - NOW} sec to complete dpow const")

NEXT_SEASON_COINS = []
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def validated(self):
logger.warning(f" [notarised_tenure] Invalid server {server}")
return False

if self.season not in ['Season_5', 'Season_5_Testnet', 'Season_4', 'Season_6', 'Season_7']:
if self.season not in ['Season_5', 'Season_5_Testnet', 'Season_4', 'Season_6', 'Season_7', 'Season_8']:
logger.warning(f"[notarised_tenure] Invalid season {season}")

return False
Expand Down
Loading

0 comments on commit aed75b0

Please sign in to comment.