Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Scheduling Scripts
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
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
xx network
Scheduling Scripts
Commits
c1a4a31e
Commit
c1a4a31e
authored
Nov 14, 2021
by
Jake Taylor
Browse files
Options
Downloads
Plain Diff
Merge branch 'hotfix/points' into 'master'
points script fixes See merge request
!5
parents
e9792f60
9c0fe7b2
No related branches found
No related tags found
1 merge request
!5
points script fixes
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
points.py
+16
-7
16 additions, 7 deletions
points.py
with
16 additions
and
7 deletions
points.py
+
16
−
7
View file @
c1a4a31e
...
...
@@ -76,7 +76,7 @@ def main():
try
:
# Get up-to-date period information from blockchain
point_info
=
poll_point_info
(
substrate
)
period
=
point_info
[
'
period
'
]
period
=
point_info
[
'
period
'
]
*
1e+6
# Wait until the next period arrives
next_period
=
last_checked_ts
+
period
...
...
@@ -187,8 +187,7 @@ def round_point_computation(point_info, round_info, active_nodes):
round_err
=
row
[
5
]
topology
=
row
[
6
]
points
=
0
raw_points
=
0
log
.
debug
(
f
"
Topology:
{
topology
}
, round_err:
{
round_err
}
"
)
if
round_err
:
# Determine negative points for failures
round_id
=
row
[
0
]
...
...
@@ -196,8 +195,12 @@ def round_point_computation(point_info, round_info, active_nodes):
log
.
debug
(
f
"
Round
{
round_id
}
: Precomp error
"
)
else
:
log
.
debug
(
f
"
Round
{
round_id
}
: Realtime error
"
)
points
=
fail_points
raw_points
=
fail_points
for
node_id
in
topology
:
# NOTE: Weirdness can result here from nodes going offline between eras. Should be reviewed.
wallet
=
node_wallets
.
get
(
bytes
(
node_id
))
if
wallet
:
wallet_points
[
wallet
]
+=
fail_points
raw_points_dict
[
wallet
]
+=
fail_points
else
:
# Handle point multipliers
# NOTE: Weirdness can result here from nodes going offline between eras. Should be reviewed.
...
...
@@ -207,8 +210,10 @@ def round_point_computation(point_info, round_info, active_nodes):
# Assign points to wallets
for
node_id
in
topology
:
if
node_multipliers
.
get
(
bytes
(
node_id
)):
node_mult
=
(
max_multiplier
+
node_multipliers
[
bytes
(
node_id
)])
/
2
mult
=
node_multipliers
.
get
(
bytes
(
node_id
))
if
mult
:
node_mult
=
(
max_multiplier
+
mult
)
/
2
log
.
debug
(
f
"
node multiplier:
{
node_mult
}
"
)
points
=
success_points
*
node_mult
# NOTE: Weirdness can result here from nodes going offline between eras. Should be reviewed.
...
...
@@ -216,6 +221,10 @@ def round_point_computation(point_info, round_info, active_nodes):
if
wallet
:
wallet_points
[
wallet
]
+=
points
raw_points_dict
[
wallet
]
+=
success_points
else
:
log
.
warning
(
f
"
no wallet found for nid
{
bytes
(
node_id
)
}
"
)
else
:
log
.
warning
(
f
"
no mult found for nid
{
bytes
(
node_id
)
}
"
)
log
.
debug
(
f
"
Wallet points:
{
wallet_points
}
"
)
return
wallet_points
,
raw_points_dict
...
...
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