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
42ca7a5a
Commit
42ca7a5a
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[enh] Improve ecomode unit test + fix workers
parent
97d0de73
No related branches found
No related tags found
2 merge requests
!1216
[enh] Ecomode improvements
,
!1214
Reduce cpu
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/modules/prover/lib/powCluster.ts
+17
-20
17 additions, 20 deletions
app/modules/prover/lib/powCluster.ts
test/integration/proof-of-work.js
+11
-5
11 additions, 5 deletions
test/integration/proof-of-work.js
with
28 additions
and
25 deletions
app/modules/prover/lib/powCluster.ts
+
17
−
20
View file @
42ca7a5a
...
...
@@ -185,7 +185,6 @@ export class Master {
// Start the salves' job
this
.
slaves
.
forEach
((
s
:
any
,
index
)
=>
{
if
(
index
<
stuff
.
newPoW
.
conf
.
nbCores
)
{
s
.
worker
.
send
({
uuid
,
command
:
'
newPoW
'
,
...
...
@@ -196,8 +195,7 @@ export class Master {
highMark
:
stuff
.
newPoW
.
highMark
,
pair
:
_
.
clone
(
stuff
.
newPoW
.
pair
),
forcedTime
:
stuff
.
newPoW
.
forcedTime
,
turnDuration
:
stuff
.
newPoW
.
turnDuration
,
conf
:
{
turnDuration
:
stuff
.
newPoW
.
turnDuration
,
conf
:
{
medianTimeBlocks
:
stuff
.
newPoW
.
conf
.
medianTimeBlocks
,
avgGenTime
:
stuff
.
newPoW
.
conf
.
avgGenTime
,
cpu
:
stuff
.
newPoW
.
conf
.
cpu
,
...
...
@@ -205,7 +203,6 @@ export class Master {
}
}
})
}
})
return
await
this
.
currentPromise
...
...
This diff is collapsed.
Click to expand it.
test/integration/proof-of-work.js
+
11
−
5
View file @
42ca7a5a
...
...
@@ -36,11 +36,10 @@ const prover = new BlockProver({
const
now
=
1474382274
*
1000
;
const
MUST_START_WITH_A_ZERO
=
16
;
const
MUST_START_WITH_TWO_ZEROS
=
32
;
const
MUST_START_WITH_
THREE_ZEROS
=
58
;
const
MUST_START_WITH_
A_ZERO_AND_A_NUMBER
=
22
describe
(
"
Proof-of-work
"
,
function
()
{
this
.
timeout
(
6
*
60000
)
it
(
'
should be able to find an easy PoW
'
,
()
=>
co
(
function
*
()
{
let
block
=
yield
prover
.
prove
({
issuer
:
'
HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
'
,
...
...
@@ -53,12 +52,19 @@ describe("Proof-of-work", function() {
}));
it
(
'
should be reducing cpu when the PoW is too easy for the cpu
'
,
()
=>
co
(
function
*
()
{
prover
.
conf
.
nbCores
=
2
prover
.
conf
.
cpu
=
0.9
prover
.
conf
.
nbCores
.
should
.
equal
(
2
)
prover
.
conf
.
cpu
.
should
.
equal
(
0.9
)
for
(
let
i
=
0
;
i
<
8
;
++
i
)
{
let
block
=
yield
prover
.
prove
({
yield
prover
.
prove
({
issuer
:
'
HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
'
,
number
:
i
+
2
},
MUST_START_WITH_THREE_ZEROS
,
now
);
number
:
i
+
2
,
now
},
MUST_START_WITH_A_ZERO_AND_A_NUMBER
,
now
);
}
prover
.
conf
.
nbCores
.
should
.
equal
(
1
)
prover
.
conf
.
cpu
.
should
.
be
.
below
(
0.9
)
}));
// Too randomly successing test
// it('should be able to cancel a proof-of-work on other PoW receival', () => co(function*() {
...
...
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