Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
py-g1-migrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
py-g1-migrator
Commits
d8717c28
Commit
d8717c28
authored
2 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
add optionnal future timestamp start
parent
39c80e46
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/functions.py
+4
-2
4 additions, 2 deletions
lib/functions.py
lib/utility.py
+2
-4
2 additions, 4 deletions
lib/utility.py
main.py
+4
-4
4 additions, 4 deletions
main.py
with
10 additions
and
10 deletions
lib/functions.py
+
4
−
2
View file @
d8717c28
from
symbol
import
parameters
from
urllib.request
import
urlopen
from
lib.utility
import
*
from
time
import
time
def
get_wallets_data
():
...
...
@@ -28,7 +29,7 @@ def get_wallets_data():
return
wallets
def
get_identities_
bloc
(
):
def
get_identities_
and_wallets
(
start_timestamp
):
# Get wallets data
wallets
=
get_wallets_data
()
...
...
@@ -74,7 +75,8 @@ def get_identities_bloc():
if
r_username
==
None
:
continue
cert_expire_on_bloc
=
dateToBlocNumber
(
blocs
[
str
(
cert
[
'
writtenOn
'
])])
if
start_timestamp
==
''
:
start_timestamp
=
int
(
time
())
cert_expire_on_bloc
=
dateToBlocNumber
(
blocs
[
str
(
cert
[
'
writtenOn
'
])],
start_timestamp
)
if
r_username
not
in
identities
:
identities
.
update
({
r_username
:
{}})
if
'
certs
'
not
in
identities
[
r_username
]:
identities
[
r_username
].
update
({
'
certs
'
:
[]})
...
...
This diff is collapsed.
Click to expand it.
lib/utility.py
+
2
−
4
View file @
d8717c28
import
json
,
math
from
time
import
time
import
base58
from
currency_parameters
import
CERT_VALIDITY_PERIOD
from
substrateinterface
import
Keypair
,
KeypairType
currentTimestamp
=
int
(
time
())
def
v1_pubkey_to_v2_address
(
pubkey
):
pubkey_bytes
=
base58
.
b58decode
(
pubkey
)
...
...
@@ -20,8 +18,8 @@ def v1_pubkey_to_v2_address(pubkey):
# return V2 address
return
keypair
.
ss58_address
def
dateToBlocNumber
(
timestamp
):
cert_duration
=
currentT
imestamp
-
timestamp
def
dateToBlocNumber
(
timestamp
,
start_timestamp
):
cert_duration
=
int
(
start_t
imestamp
)
-
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
...
...
This diff is collapsed.
Click to expand it.
main.py
+
4
−
4
View file @
d8717c28
#!/usr/bin/env python3
import
base58
import
sys
from
lib.functions
import
*
from
currency_parameters
import
*
from
lib.get_parameters
import
*
from
lib.get_smiths_and_techs
import
*
# Get optional arguments
#
opt1 = ''
#
if len(sys.argv) > 1: opt1=sys.argv[1]
opt1
=
''
if
len
(
sys
.
argv
)
>
1
:
opt1
=
sys
.
argv
[
1
]
# Final ĞTest genesis JSON
gtest_genesis
=
{}
...
...
@@ -32,7 +32,7 @@ gtest_genesis.update({'technical_committee': technical_committee})
gtest_genesis
.
update
({
'
sudo_key
'
:
sudo_key
})
# Add identities bloc
identities_wallets
=
get_identities_
bloc
(
)
identities_wallets
=
get_identities_
and_wallets
(
opt1
)
gtest_genesis
.
update
({
'
identities
'
:
identities_wallets
[
0
]})
# Add wallets bloc
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment