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
890fd266
Commit
890fd266
authored
5 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[feat] automatic transition to dubp version 12
parent
fffa3ebc
No related branches found
No related tags found
1 merge request
!1283
Resolve "Duniter uses a buggy version of TweetNaCl"
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/common-libs/constants.ts
+2
-2
2 additions, 2 deletions
app/lib/common-libs/constants.ts
app/lib/rules/local_rules.ts
+2
-1
2 additions, 1 deletion
app/lib/rules/local_rules.ts
app/modules/prover/lib/blockProver.ts
+1
-1
1 addition, 1 deletion
app/modules/prover/lib/blockProver.ts
with
5 additions
and
4 deletions
app/lib/common-libs/constants.ts
+
2
−
2
View file @
890fd266
...
@@ -20,7 +20,7 @@ const SIGNATURE = "[A-Za-z0-9+\\/=]{87,88}"
...
@@ -20,7 +20,7 @@ const SIGNATURE = "[A-Za-z0-9+\\/=]{87,88}"
const
USER_ID
=
"
[A-Za-z0-9_-]{2,100}
"
const
USER_ID
=
"
[A-Za-z0-9_-]{2,100}
"
const
INTEGER
=
"
(0|[1-9]
\\
d{0,18})
"
const
INTEGER
=
"
(0|[1-9]
\\
d{0,18})
"
const
FINGERPRINT
=
"
[A-F0-9]{64}
"
const
FINGERPRINT
=
"
[A-F0-9]{64}
"
const
BLOCK_VERSION
=
"
(10|11)
"
const
BLOCK_VERSION
=
"
(10|11
|12
)
"
const
TX_VERSION
=
"
(10)
"
const
TX_VERSION
=
"
(10)
"
const
DIVIDEND
=
"
[1-9][0-9]{0,5}
"
const
DIVIDEND
=
"
[1-9][0-9]{0,5}
"
const
ZERO_OR_POSITIVE_INT
=
"
0|[1-9][0-9]{0,18}
"
const
ZERO_OR_POSITIVE_INT
=
"
0|[1-9][0-9]{0,18}
"
...
@@ -104,7 +104,7 @@ export const CommonConstants = {
...
@@ -104,7 +104,7 @@ export const CommonConstants = {
// Version of genesis block
// Version of genesis block
BLOCK_GENESIS_VERSION
:
10
,
BLOCK_GENESIS_VERSION
:
10
,
// Highest supported version of DUBP protocol (= next version of the protocol)
// Highest supported version of DUBP protocol (= next version of the protocol)
DUBP_NEXT_VERSION
:
1
1
,
DUBP_NEXT_VERSION
:
1
2
,
LAST_VERSION_FOR_TX
:
10
,
LAST_VERSION_FOR_TX
:
10
,
TRANSACTION_VERSION
:
10
,
TRANSACTION_VERSION
:
10
,
DOCUMENTS_VERSION
:
10
,
DOCUMENTS_VERSION
:
10
,
...
...
This diff is collapsed.
Click to expand it.
app/lib/rules/local_rules.ts
+
2
−
1
View file @
890fd266
...
@@ -544,7 +544,8 @@ export const LOCAL_RULES_HELPERS = {
...
@@ -544,7 +544,8 @@ export const LOCAL_RULES_HELPERS = {
const
nbNoncesWithNextVersionCode
=
lastNonceOfEachIssuer
.
filter
(
nonce
=>
nonce
.
substr
(
-
11
,
3
)
===
'
999
'
).
length
const
nbNoncesWithNextVersionCode
=
lastNonceOfEachIssuer
.
filter
(
nonce
=>
nonce
.
substr
(
-
11
,
3
)
===
'
999
'
).
length
// More than 70% of the computing network converted? Let's go to next version.
// More than 70% of the computing network converted? Let's go to next version.
if
(
Math
.
floor
(
nbNoncesWithNextVersionCode
/
uniqIssuersInFrame
.
length
)
>
0.6
)
{
let
propIssuersReadyToJump
=
nbNoncesWithNextVersionCode
/
uniqIssuersInFrame
.
length
;
if
(
propIssuersReadyToJump
>
0.7
)
{
return
constants
.
DUBP_NEXT_VERSION
return
constants
.
DUBP_NEXT_VERSION
}
}
...
...
This diff is collapsed.
Click to expand it.
app/modules/prover/lib/blockProver.ts
+
1
−
1
View file @
890fd266
...
@@ -163,7 +163,7 @@ export class BlockProver {
...
@@ -163,7 +163,7 @@ export class BlockProver {
const
remainder
=
difficulty
%
16
;
const
remainder
=
difficulty
%
16
;
const
nbZeros
=
(
difficulty
-
remainder
)
/
16
;
const
nbZeros
=
(
difficulty
-
remainder
)
/
16
;
const
highMark
=
CommonConstants
.
PROOF_OF_WORK
.
UPPER_BOUND
[
remainder
];
const
highMark
=
CommonConstants
.
PROOF_OF_WORK
.
UPPER_BOUND
[
remainder
];
const
notifyVersionJumpReady
=
block
.
version
===
10
&&
CommonConstants
.
DUBP_NEXT_VERSION
===
11
const
notifyVersionJumpReady
:
boolean
=
(
block
.
version
+
1
)
===
CommonConstants
.
DUBP_NEXT_VERSION
;
return
(
async
()
=>
{
return
(
async
()
=>
{
...
...
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