Skip to content
Snippets Groups Projects
Commit c854646e authored by poka's avatar poka
Browse files

fix: remove old certs

parent fc9a8080
Branches
No related tags found
No related merge requests found
# Utility
def b_minutes(minutes): return int(minutes * 60 / 6)
def b_hours(hours): return int(b_minutes(hours) * 60)
def b_days(days): return int(b_hours(days) * 24)
def b_months(months): return int(b_days(months) * 30)
# Global parameters
FIRST_UD_REEVAL = 2629800
FIRST_UD_REEVAL = b_months(6) # 6 months
# Genesis parameters
GENESIS_CERTS_EXPIRE_ON = 15
GENESIS_CERTS_MIN_RECEIVED = 0
GENESIS_MEMBERSHIPS_EXPIRE_ON = 1051200
GENESIS_SMITH_CERTS_EXPIRE_ON = 2102400
GENESIS_MEMBERSHIPS_EXPIRE_ON = b_months(12)
GENESIS_SMITH_CERTS_EXPIRE_ON = b_months(24)
GENESIS_SMITH_CERTS_MIN_RECEIVED = 1
GENESIS_SMITH_MEMBERSHIPS_EXPIRE_ON = 1051200
GENESIS_SMITH_MEMBERSHIPS_EXPIRE_ON = b_months(12)
# Parameters
BABE_EPOCH_DURATION = 600
CERT_PERIOD = 14400
CERT_PERIOD = b_days(1) # 1 day
CERT_MAX_BY_ISSUER = 100
CERT_MIN_RECEIVED_CERT_TO_ISSUE_CERT = 5
CERT_VALIDITY_PERIOD = 10512000
IDTY_CONFIRM_PERIOD = 100800
IDTY_CREATION_PERIOD = 100800
MEMBERSHIP_PERIOD = 5256000
PENDING_MEMBERSHIP_PERIOD = 172800
UD_CREATION_PERIOD = 14400
UD_REEVAL_PERIOD = 2629800
SMITH_CERT_PERIOD = 14400
CERT_VALIDITY_PERIOD = b_months(24)
IDTY_CONFIRM_PERIOD = b_days(7)
IDTY_CREATION_PERIOD = b_days(7)
MEMBERSHIP_PERIOD = b_months(12)
PENDING_MEMBERSHIP_PERIOD = b_months(1)
UD_CREATION_PERIOD = b_days(1)
UD_REEVAL_PERIOD = b_months(6)
SMITH_CERT_PERIOD = b_days(1)
SMITH_CERT_MAX_BY_ISSUER = 15
SMITH_CERT_MIN_RECEIVED_CERT_TO_ISSUE_CERT = 3
SMITH_CERT_VALIDITY_PERIOD = 10512000
SMITH_MEMBERSHIP_PERIOD = 5256000
SMITH_PENDING_MEMBERSHIP_PERIOD = 172800
SMITHS_WOT_FIRST_CERT_ISSUABLE_ON = 14400
SMITH_CERT_VALIDITY_PERIOD = b_months(24)
SMITH_MEMBERSHIP_PERIOD = b_months(12)
SMITH_PENDING_MEMBERSHIP_PERIOD = b_months(1)
SMITHS_WOT_FIRST_CERT_ISSUABLE_ON = b_days(1)
SMITHS_WOT_MIN_CERT_FOR_MEMBERSHIP = 3
WOT_FIRST_CERT_ISSUABLE_ON = 15
WOT_FIRST_CERT_ISSUABLE_ON = b_minutes(5) # 5 minutes
WOT_MIN_CERT_FOR_CREATE_IDTY_RIGHT = 5
WOT_MIN_CERT_FOR_MEMBERSHIP = 5
#!/bin/bash
echo "Export wallets data in progress..."
yes|./dex find wallet -p balance -o json -f input/wallets.json > /dev/null && echo "Done"
yes|./dex find wallet -p balance -o json -f input/wallets.json > /dev/null && echo "Done" || exit 1
echo "Export certs data in progress..."
yes|./dex find cindex -p issued -o json -f input/certs.json > /dev/null && echo "Done"
......
......@@ -77,6 +77,7 @@ def get_identities_and_wallets(start_timestamp):
if start_timestamp == '': start_timestamp = int(time())
cert_expire_on_bloc = dateToBlocNumber(blocs[str(cert['writtenOn'])], start_timestamp)
if cert_expire_on_bloc <= 0: continue
if r_username not in identities: identities.update({r_username: {}})
if 'certs' not in identities[r_username]: identities[r_username].update({'certs': []})
......
import json, math
import base58
from currency_parameters import CERT_VALIDITY_PERIOD
from currency_parameters import *
from substrateinterface import Keypair, KeypairType
......@@ -20,22 +20,10 @@ def v1_pubkey_to_v2_address(pubkey):
def dateToBlocNumber(timestamp, start_timestamp):
cert_duration = int(start_timestamp) - timestamp
cert_duration_bloc_number = math.trunc(cert_duration / 600)
cert_expire_on_bloc = CERT_VALIDITY_PERIOD - cert_duration_bloc_number
return cert_expire_on_bloc
cert_duration_bloc_number = b_minutes(cert_duration / 60)
# print(cert_duration_bloc_number)
return CERT_VALIDITY_PERIOD - cert_duration_bloc_number
def load_json(data):
get_data = open(data)
return json.load(get_data)
# def progressbar(it, prefix="", size=60, out=sys.stdout):
# count = len(it)
# def show(j):
# x = int(size*j/count)
# print("{}[{}{}] {}/{}".format(prefix, "#"*x, "."*(size-x), j, count),
# end='\r', file=out, flush=True)
# show(0)
# for i, item in enumerate(it):
# yield item
# show(i+1)
# print("\n", flush=True, file=out)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment