From 3df56aaf4c42d18c90f676e0b1148798c73ab76c Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sun, 15 Dec 2019 21:14:45 +0100
Subject: [PATCH] [ref] rename BLOCK_NEW_GENERATED_VERSION -> DUBP_NEXT_VERSION

---
 app/lib/common-libs/constants.ts                       |  3 ++-
 app/lib/rules/local_rules.ts                           |  2 +-
 app/modules/prover/lib/blockProver.ts                  |  2 +-
 test/integration/branches/branches_revert2.ts          |  4 ++--
 test/integration/certification/certification-expiry.ts |  4 ++--
 test/integration/certification/certification-replay.ts |  4 ++--
 .../fork-resolution/register-fork-blocks.ts            |  4 ++--
 test/integration/membership_chainability.ts            | 10 +++++-----
 test/integration/sandbox/expired-certifications.ts     |  4 ++--
 test/integration/sandbox/expired-identity.ts           |  4 ++--
 test/integration/sandbox/expired-membership.ts         |  4 ++--
 test/integration/sandbox/expired-transactions.ts       |  4 ++--
 test/integration/wot/wotb.ts                           |  4 ++--
 13 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/app/lib/common-libs/constants.ts b/app/lib/common-libs/constants.ts
index cf5224b66..e14647b65 100755
--- a/app/lib/common-libs/constants.ts
+++ b/app/lib/common-libs/constants.ts
@@ -103,7 +103,8 @@ export const CommonConstants = {
 
   // Version of genesis block
   BLOCK_GENESIS_VERSION: 10,
-  BLOCK_NEW_GENERATED_VERSION: 11, // Put it to 11 when ready
+  // Highest supported version of DUBP protocol (= next version of the protocol)
+  DUBP_NEXT_VERSION: 11,
   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 81a536cbc..87bcfa9fb 100644
--- a/app/lib/rules/local_rules.ts
+++ b/app/lib/rules/local_rules.ts
@@ -540,7 +540,7 @@ export const LOCAL_RULES_HELPERS = {
 
         // More than 70% of the computing network converted? Let's go to next version.
         if (Math.floor(nbNoncesWithNextVersionCode / uniqIssuersInFrame.length) > 0.6) {
-          return constants.BLOCK_NEW_GENERATED_VERSION
+          return constants.DUBP_NEXT_VERSION
         }
 
         // Otherwise, we stay on same version
diff --git a/app/modules/prover/lib/blockProver.ts b/app/modules/prover/lib/blockProver.ts
index 9bcdfe749..63e8271f7 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.BLOCK_NEW_GENERATED_VERSION === 11
+    const notifyVersionJumpReady = block.version === 10 && CommonConstants.DUBP_NEXT_VERSION === 11
 
     return (async () => {
 
diff --git a/test/integration/branches/branches_revert2.ts b/test/integration/branches/branches_revert2.ts
index 78748f5e7..e1f1010b8 100644
--- a/test/integration/branches/branches_revert2.ts
+++ b/test/integration/branches/branches_revert2.ts
@@ -43,7 +43,7 @@ describe("Revert two blocks", function() {
 
   before(async () => {
 
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
 
     s1 = NewTestingServer(
       Underscore.extend({
@@ -291,6 +291,6 @@ describe("Revert two blocks", function() {
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
   })
 });
diff --git a/test/integration/certification/certification-expiry.ts b/test/integration/certification/certification-expiry.ts
index 0ea21e806..3c24878b4 100644
--- a/test/integration/certification/certification-expiry.ts
+++ b/test/integration/certification/certification-expiry.ts
@@ -21,7 +21,7 @@ describe('Certification expiry + trimming', () => writeBasicTestWithConfAnd2User
 }, (test) => {
 
   before(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
   })
 
   const now = 1500000000
@@ -109,6 +109,6 @@ describe('Certification expiry + trimming', () => writeBasicTestWithConfAnd2User
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
   })
 }))
diff --git a/test/integration/certification/certification-replay.ts b/test/integration/certification/certification-replay.ts
index 88ddce86f..f67a69358 100644
--- a/test/integration/certification/certification-replay.ts
+++ b/test/integration/certification/certification-replay.ts
@@ -23,7 +23,7 @@ describe('Certification replay', () => writeBasicTestWithConfAnd2Users({
 }, (test) => {
 
   before(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
   })
 
   const now = 1500000000
@@ -126,6 +126,6 @@ describe('Certification replay', () => writeBasicTestWithConfAnd2Users({
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
   })
 }))
diff --git a/test/integration/fork-resolution/register-fork-blocks.ts b/test/integration/fork-resolution/register-fork-blocks.ts
index f74d1d9c1..41af69200 100644
--- a/test/integration/fork-resolution/register-fork-blocks.ts
+++ b/test/integration/fork-resolution/register-fork-blocks.ts
@@ -28,7 +28,7 @@ describe("Fork blocks", function() {
 
   before(async () => {
 
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
 
     s1 = NewTestingServer({
 
@@ -235,6 +235,6 @@ describe("Fork blocks", function() {
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
   })
 })
diff --git a/test/integration/membership_chainability.ts b/test/integration/membership_chainability.ts
index 458f30349..bf9367230 100644
--- a/test/integration/membership_chainability.ts
+++ b/test/integration/membership_chainability.ts
@@ -35,18 +35,18 @@ describe("Membership chainability", function() {
       const res1 = await simpleNodeWith2Users(conf)
       s1 = res1.s1
       cat = res1.cat
-      const nowVersion = CommonConstants.BLOCK_NEW_GENERATED_VERSION
-      CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+      const nowVersion = CommonConstants.DUBP_NEXT_VERSION
+      CommonConstants.DUBP_NEXT_VERSION = 10
       await s1.commit({ time: now })
       await s1.commit({ time: now })
       await s1.commit({ time: now, actives: [
         'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd:rppB5NEwmdMUCxw3N/QPMk+V1h2Jpn0yxTzdO2xxcNN3MACv6x8vNTChWwM6DOq+kXiQHTczFzoux+82WkMfDQ==:1-12D7B9BEBE941F6929A4A61CDC06DEEEFCB00FD1DA72E42FFF7B19A338D421E1:0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855:cat'
       ]})
-      CommonConstants.BLOCK_NEW_GENERATED_VERSION = nowVersion
+      CommonConstants.DUBP_NEXT_VERSION = nowVersion
     })
 
     before(() => {
-      CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+      CommonConstants.DUBP_NEXT_VERSION = 11
     })
 
     it('current should be the 2nd', () => s1.expect('/blockchain/current', (res:any) => {
@@ -55,7 +55,7 @@ describe("Membership chainability", function() {
     }))
 
     before(() => {
-      CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+      CommonConstants.DUBP_NEXT_VERSION = 10
     })
 
     after(async () => {
diff --git a/test/integration/sandbox/expired-certifications.ts b/test/integration/sandbox/expired-certifications.ts
index e3af0d5f5..5697fefac 100644
--- a/test/integration/sandbox/expired-certifications.ts
+++ b/test/integration/sandbox/expired-certifications.ts
@@ -24,7 +24,7 @@ describe('Expired certifications', () => writeBasicTestWithConfAnd2Users({
 }, (test) => {
 
   before(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
   })
 
   const now = 1500000000
@@ -58,6 +58,6 @@ describe('Expired certifications', () => writeBasicTestWithConfAnd2Users({
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
   })
 }))
diff --git a/test/integration/sandbox/expired-identity.ts b/test/integration/sandbox/expired-identity.ts
index 5d8af9702..9f0990bfc 100644
--- a/test/integration/sandbox/expired-identity.ts
+++ b/test/integration/sandbox/expired-identity.ts
@@ -23,7 +23,7 @@ describe('Expired identities', () => writeBasicTestWithConfAnd2Users({
 }, (test) => {
 
   before(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
   })
 
   const now = 1500000000
@@ -47,6 +47,6 @@ describe('Expired identities', () => writeBasicTestWithConfAnd2Users({
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
   })
 }))
diff --git a/test/integration/sandbox/expired-membership.ts b/test/integration/sandbox/expired-membership.ts
index b98ebe3ab..d71a74011 100644
--- a/test/integration/sandbox/expired-membership.ts
+++ b/test/integration/sandbox/expired-membership.ts
@@ -23,7 +23,7 @@ describe('Expired membership', () => writeBasicTestWithConfAnd2Users({
 }, (test) => {
 
   before(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
   })
 
   const now = 1500000000
@@ -58,6 +58,6 @@ describe('Expired membership', () => writeBasicTestWithConfAnd2Users({
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
   })
 }))
diff --git a/test/integration/sandbox/expired-transactions.ts b/test/integration/sandbox/expired-transactions.ts
index fe950d99b..2c8cc49bd 100644
--- a/test/integration/sandbox/expired-transactions.ts
+++ b/test/integration/sandbox/expired-transactions.ts
@@ -22,7 +22,7 @@ describe('Expired transactions', () => writeBasicTestWithConfAnd2Users({
   let oldTxWindowValue: number
 
   before(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+    CommonConstants.DUBP_NEXT_VERSION = 11
     oldTxWindowValue = CommonConstants.TX_WINDOW
     CommonConstants.TX_WINDOW = 2 // We need a low value to pass time bounds rules
   })
@@ -48,7 +48,7 @@ describe('Expired transactions', () => writeBasicTestWithConfAnd2Users({
   })
 
   after(() => {
-    CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+    CommonConstants.DUBP_NEXT_VERSION = 10
     CommonConstants.TX_WINDOW = oldTxWindowValue
   })
 }))
diff --git a/test/integration/wot/wotb.ts b/test/integration/wot/wotb.ts
index b9acfcb24..e72ed7cfc 100644
--- a/test/integration/wot/wotb.ts
+++ b/test/integration/wot/wotb.ts
@@ -59,7 +59,7 @@ describe("WOTB module", () => {
 
     before(async () => {
 
-      CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
+      CommonConstants.DUBP_NEXT_VERSION = 11
 
       s1 = NewTestingServer(
         Underscore.extend({
@@ -452,7 +452,7 @@ describe("WOTB module", () => {
     });
 
     after(() => {
-      CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
+      CommonConstants.DUBP_NEXT_VERSION = 10
     })
   });
 });
-- 
GitLab