Skip to content
Snippets Groups Projects
Commit 890fd266 authored by Éloïs's avatar Éloïs
Browse files

[feat] automatic transition to dubp version 12

parent fffa3ebc
No related branches found
No related tags found
1 merge request!1283Resolve "Duniter uses a buggy version of TweetNaCl"
...@@ -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: 11, DUBP_NEXT_VERSION: 12,
LAST_VERSION_FOR_TX: 10, LAST_VERSION_FOR_TX: 10,
TRANSACTION_VERSION: 10, TRANSACTION_VERSION: 10,
DOCUMENTS_VERSION: 10, DOCUMENTS_VERSION: 10,
......
...@@ -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
} }
......
...@@ -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 () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment