Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
6959f9f1
Commit
6959f9f1
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[enh] Put constants in a ProverConstants
parent
42ca7a5a
No related branches found
No related tags found
2 merge requests
!1216
[enh] Ecomode improvements
,
!1214
Reduce cpu
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/modules/prover/lib/blockProver.ts
+2
-2
2 additions, 2 deletions
app/modules/prover/lib/blockProver.ts
app/modules/prover/lib/constants.ts
+3
-0
3 additions, 0 deletions
app/modules/prover/lib/constants.ts
with
5 additions
and
2 deletions
app/modules/prover/lib/blockProver.ts
+
2
−
2
View file @
6959f9f1
...
...
@@ -201,12 +201,12 @@ export class BlockProver {
this
.
logger
.
info
(
'
Done: #%s, %s in %ss instead of %ss (%s tests, ~%s tests/s)
'
,
block
.
number
,
proof
.
hash
,
(
duration
/
1000
).
toFixed
(
2
),
this
.
conf
.
avgGenTime
,
testsCount
,
testsPerSecond
.
toFixed
(
2
));
this
.
logger
.
info
(
'
FOUND proof-of-work with %s leading zeros followed by [0-
'
+
highMark
+
'
]!
'
,
nbZeros
);
if
(
this
.
conf
.
ecoMode
===
true
&&
this
.
conf
.
nbCores
*
testsPerSecond
>
300
)
{
if
(
this
.
conf
.
ecoMode
===
true
&&
this
.
conf
.
nbCores
*
testsPerSecond
>
ProverConstants
.
ECO_MODE_MINIMAL_TESTS_PER_SECONDS
)
{
if
(
this
.
conf
.
nbCores
>
1
)
{
this
.
logger
.
info
(
"
Reducing number of CPU cores
"
+
this
.
conf
.
nbCores
)
this
.
conf
.
nbCores
=
this
.
conf
.
nbCores
-
1
}
else
if
(
this
.
conf
.
cpu
>
0.19
){
else
if
(
this
.
conf
.
cpu
>
ProverConstants
.
ECO_MODE_MINIMAL_CPU
){
let
cpu
:
number
=
this
.
conf
.
cpu
-
0.1
this
.
logger
.
info
(
"
Slowing down the CPU to
"
+
cpu
)
this
.
changeCPU
(
cpu
)
...
...
This diff is collapsed.
Click to expand it.
app/modules/prover/lib/constants.ts
+
3
−
0
View file @
6959f9f1
...
...
@@ -11,6 +11,9 @@ export const ProverConstants = {
MIN_PEER_ID
:
1
,
MAX_PEER_ID
:
899
,
// Due to MAX_SAFE_INTEGER = 9007199254740991 (16 digits, and we use 11 digits for the nonce + 2 digits for core number => 3 digits for the peer, must be below 900)
ECO_MODE_MINIMAL_TESTS_PER_SECONDS
:
300
,
ECO_MODE_MINIMAL_CPU
:
0.19
,
NONCE_RANGE
:
1000
*
1000
*
1000
*
100
,
POW_MAXIMUM_ACCEPTABLE_HANDICAP
:
64
,
...
...
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