From 890fd26664208e84547eb5fec2a227913f9596b1 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Fri, 20 Dec 2019 01:06:02 +0100 Subject: [PATCH] [feat] automatic transition to dubp version 12 --- app/lib/common-libs/constants.ts | 4 ++-- app/lib/rules/local_rules.ts | 3 ++- app/modules/prover/lib/blockProver.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/lib/common-libs/constants.ts b/app/lib/common-libs/constants.ts index e14647b65..13d8ed290 100755 --- a/app/lib/common-libs/constants.ts +++ b/app/lib/common-libs/constants.ts @@ -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, diff --git a/app/lib/rules/local_rules.ts b/app/lib/rules/local_rules.ts index c943fac63..ad2973053 100644 --- a/app/lib/rules/local_rules.ts +++ b/app/lib/rules/local_rules.ts @@ -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 } diff --git a/app/modules/prover/lib/blockProver.ts b/app/modules/prover/lib/blockProver.ts index 63e8271f7..9b3b39530 100644 --- a/app/modules/prover/lib/blockProver.ts +++ b/app/modules/prover/lib/blockProver.ts @@ -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 () => { -- GitLab