Commit 890fd266 authored by Éloïs's avatar Éloïs

[feat] automatic transition to dubp version 12

parent fffa3ebc
......@@ -20,7 +20,7 @@ const SIGNATURE = "[A-Za-z0-9+\\/=]{87,88}"
const USER_ID = "[A-Za-z0-9_-]{2,100}"
const INTEGER = "(0|[1-9]\\d{0,18})"
const FINGERPRINT = "[A-F0-9]{64}"
const BLOCK_VERSION = "(10|11)"
const BLOCK_VERSION = "(10|11|12)"
const TX_VERSION = "(10)"
const DIVIDEND = "[1-9][0-9]{0,5}"
const ZERO_OR_POSITIVE_INT = "0|[1-9][0-9]{0,18}"
......@@ -104,7 +104,7 @@ export const CommonConstants = {
// Version of genesis block
BLOCK_GENESIS_VERSION: 10,
// Highest supported version of DUBP protocol (= next version of the protocol)
DUBP_NEXT_VERSION: 11,
DUBP_NEXT_VERSION: 12,
LAST_VERSION_FOR_TX: 10,
TRANSACTION_VERSION: 10,
DOCUMENTS_VERSION: 10,
......
......@@ -544,7 +544,8 @@ export const LOCAL_RULES_HELPERS = {
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.
if (Math.floor(nbNoncesWithNextVersionCode / uniqIssuersInFrame.length) > 0.6) {
let propIssuersReadyToJump = nbNoncesWithNextVersionCode / uniqIssuersInFrame.length;
if (propIssuersReadyToJump > 0.7) {
return constants.DUBP_NEXT_VERSION
}
......
......@@ -163,7 +163,7 @@ export class BlockProver {
const remainder = difficulty % 16;
const nbZeros = (difficulty - remainder) / 16;
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 () => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment